Summary
apps/docs/architecture/vault-contract.md's error code table (around lines 140-150) lists error codes 1 through 9 but is missing AdapterSwapUnsafe = 10, defined in packages/contracts/vault/src/lib.rs and actively enforced in set_adapter (rejects the call while the vault still has shares outstanding, tested by set_adapter_fails_with_shares_outstanding). The doc's set_adapter section also currently describes migrating funds out first as only the caller's responsibility, without mentioning that the contract itself now rejects an unsafe swap.
Motivation
This doc is the reference for anyone integrating against the vault (off-chain indexers, other contributors writing adapters, or a future reviewer trying to understand set_adapter's safety guarantees). A missing error variant means someone reading the docs alone would not know this failure mode exists or what triggers it.
Proposed Solution
- Add
AdapterSwapUnsafe = 10 to the error code table, with a short description matching the enum's doc comment in vault/src/lib.rs ("set_adapter was called while the vault still has shares outstanding").
- Update the
set_adapter section to note that the contract enforces this itself, not just documents it as caller responsibility.
Scope
| Field |
Value |
| Area |
Docs |
| Protocol affected |
None |
| Network |
N/A |
| Breaking change? |
No |
Alternatives Considered
Leaving the table as-is: rejected, since it's a factual gap against the shipped contract, not a stylistic choice.
Acceptance Criteria
Additional Context
Verified against packages/contracts/vault/src/lib.rs (enum definition, set_adapter implementation, and the set_adapter_fails_with_shares_outstanding test).
Summary
apps/docs/architecture/vault-contract.md's error code table (around lines 140-150) lists error codes 1 through 9 but is missingAdapterSwapUnsafe = 10, defined inpackages/contracts/vault/src/lib.rsand actively enforced inset_adapter(rejects the call while the vault still has shares outstanding, tested byset_adapter_fails_with_shares_outstanding). The doc'sset_adaptersection also currently describes migrating funds out first as only the caller's responsibility, without mentioning that the contract itself now rejects an unsafe swap.Motivation
This doc is the reference for anyone integrating against the vault (off-chain indexers, other contributors writing adapters, or a future reviewer trying to understand
set_adapter's safety guarantees). A missing error variant means someone reading the docs alone would not know this failure mode exists or what triggers it.Proposed Solution
AdapterSwapUnsafe = 10to the error code table, with a short description matching the enum's doc comment invault/src/lib.rs("set_adapterwas called while the vault still has shares outstanding").set_adaptersection to note that the contract enforces this itself, not just documents it as caller responsibility.Scope
Alternatives Considered
Leaving the table as-is: rejected, since it's a factual gap against the shipped contract, not a stylistic choice.
Acceptance Criteria
AdapterSwapUnsafe = 10with an accurate descriptionset_adaptersection mentions the contract-level enforcement, not just caller responsibilityAdditional Context
Verified against
packages/contracts/vault/src/lib.rs(enum definition,set_adapterimplementation, and theset_adapter_fails_with_shares_outstandingtest).