Labels: contract security feature 200pts
Background:
Spending limits reset periodically. If an admin can silently reset limits early, they could bypass budget controls. Every limit reset must be auditable and tamper-evident.
Problem:
Spending limit resets happen implicitly when Temporary storage expires. There is no log of resets. An early manual reset by an admin is indistinguishable from normal TTL expiry.
What "Done" Looks Like:
- Every spending limit reset (whether TTL-natural or manual) writes an entry to the audit log
manual_reset_spending_limit(token: Address, period: SpendingPeriod) requires 2-of-N signer approval (mini-proposal)
SpendingLimitResetRecord: { ledger: u32, token: Address, period: SpendingPeriod, trigger: ResetTrigger, authorized_by: Vec<Address> }
ResetTrigger::Natural (TTL expiry detected) vs ResetTrigger::Manual(reason: Symbol)
- Reset records stored in Persistent storage (never auto-evict)
- Tests: natural reset logging, manual reset with approval, unauthorized manual reset rejection
Key Files:
contracts/vault/src/lib.rs
contracts/vault/src/storage.rs
contracts/vault/src/types.rs
contracts/vault/src/test_audit.rs
PR Must Include:
SpendingLimitResetRecord type
- Manual reset mini-proposal flow
- Audit logging on all reset paths
- 7+ tests
Labels:
contractsecurityfeature200ptsBackground:
Spending limits reset periodically. If an admin can silently reset limits early, they could bypass budget controls. Every limit reset must be auditable and tamper-evident.
Problem:
Spending limit resets happen implicitly when Temporary storage expires. There is no log of resets. An early manual reset by an admin is indistinguishable from normal TTL expiry.
What "Done" Looks Like:
manual_reset_spending_limit(token: Address, period: SpendingPeriod)requires 2-of-N signer approval (mini-proposal)SpendingLimitResetRecord:{ ledger: u32, token: Address, period: SpendingPeriod, trigger: ResetTrigger, authorized_by: Vec<Address> }ResetTrigger::Natural(TTL expiry detected) vsResetTrigger::Manual(reason: Symbol)Key Files:
contracts/vault/src/lib.rscontracts/vault/src/storage.rscontracts/vault/src/types.rscontracts/vault/src/test_audit.rsPR Must Include:
SpendingLimitResetRecordtype