Conversation
|
Additional changes in commit Rust (Program): Tests: While running some tests caught a regression on the SDK that i created in the last PR so here's the SDK changes: |
7f201ae to
976c890
Compare
- Regenerated SDK using solita to include missing `program` account parameter - Updated incrementAccountIndex instruction calls in test files - Fixed 12 out of 15 failing tests (from 0xbbd AccountNotEnoughKeys error) - Remaining 3 failures are unrelated to SDK issue The `program` account was added in commit c0ed7ef for event logging but the SDK wasn't regenerated, causing tests to fail with error 0xbbd (AccountNotEnoughKeys - instruction received 2 accounts instead of 3). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements vault index restriction to control which sub-accounts (vaults) can be used for transactions.
Overview
increment_account_indexinstructionProgram Changes
New Instruction:
increment_account_index• Increments
account_utilizationfield by 1, unlocking the next vault index• Callable by any signer with
Initiate,Vote, orExecutepermission• Cannot exceed index 250 (because that's for reserved account)
New Errors:
•
AccountIndexLocked- when trying to use a vault index that hasn't been unlocked•
MaxAccountIndexReached- when trying to increment beyond 250Validation Enforcement:
•
transaction_create.rs- validates account index when creating async transactions•
transaction_execute_sync.rs- validates for Settings-based sync transactions•
transaction_execute_sync_legacy.rs- validates for legacy sync transactionsConstants (in
state/settings.rs):• FREE_ACCOUNT_MAX_INDEX = 250
• RESERVED_ACCOUNT_START = 251
Tests
8 new tests:
incrementAccountIndex.ts:• Increment successfully (0→1)
• Increment multiple times (0→3)
• Non-signer cannot increment
• Proposer/Voter/Executor can increment (permission tests)
• Cannot increment beyond max index 250
transactionSynchronous.ts:• Sync transaction with locked index fails
• Reserved index (251) bypasses validation
transactionCreateFromBuffer.ts:• Creating transaction with locked index fails