Repository navigation
docs(agent-vault): decide and enforce non-Active agent exit paths (#865) - #896
huangji6693-max wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Hi @huangji6693-max, please merge the latest
git fetch upstream
git merge upstream/main
git pushPlease merge rather than rebase or force-push, so review history stays intact. Thanks! |
|
Thanks for the work here, @huangji6693-max, and apologies for the earlier note asking you to merge main: I should have checked eligibility first. DukaPay Wave issues are worked only after applying on the issue through the Wave and being assigned. #865 was never assigned to you, and other contributors applied first, so I'm closing this PR. If you'd like to contribute, please apply on an open Wave issue and wait for assignment before starting. Thanks for understanding. |
Closes #865
Summary
Decides, documents, and enforces which
agent_vaultexit paths remain open to non-Activeagents (Pending,Suspended,Expired, or unregistered) after the registry status gates introduced in #788 / #835:burn_float,withdraw_collateral, andsettle_netwithdelta <= 0):agent_registry::withdraw_bondexplicitly rejectsActiveagents (BondFrozen) and requires an agent to be non-Activewhile relying onagent_vaultto enforcefloat == 0before releasing USDC collateral.burn_float,withdraw_collateral, or negativesettle_netadjustments behindassert_agent_activewould strand a suspended or expired agent's float and collateral forever.withdraw_collateralremains protected by the solvency invariant (float <= (collateral - amount) * haircut_bps / 10_000) and the minimum collateral floor (collateral - amount == 0 || collateral - amount >= min_collateral).fromandtoto BeActive(transfer_float/transfer_to_agent):Self::assert_agent_active(&env, &from)?;intransfer_floatalongsideSelf::assert_agent_active(&env, &to)?;so suspended/expired agents cannot route float to peers and must unwind directly viaburn_floator operator settlement (settle_netwithdelta < 0).CONTRACTS.mdunder### Registry Status Gate & Exit Paths (Issues #788, #835, #865).contracts/agent_vault/src/test.rscovering every non-Activestatus (None/unregistered,Pending,Suspended,Expired) across all four exit paths (test_transfer_float_rejects_non_active_sender,test_settle_net_allows_non_active_negative_delta,test_burn_float_allows_non_active_agents,test_withdraw_collateral_allows_non_active_agents).Verification
CARGO_BUILD_JOBS=2 cargo test -p agent_vault— 55 passed (51 unit + 4 doc-tests)CARGO_BUILD_JOBS=2 cargo clippy -p agent_vault --all-targets -- -D warnings— 0 warningsCARGO_BUILD_JOBS=2 cargo build -p agent_vault --target wasm32v1-none --release— 40.7 KiB (< 256 KiB ceiling)