Repository navigation
docs(agent-vault): decide and enforce non-Active agent exit paths (#865) - #896
Open
huangji6693-max wants to merge 1 commit into
Open
huangji6693-max wants to merge 1 commit into
huangji6693-max wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
5 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)