Fix storage versioning, TTL, and Soroban caps#430
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
32aae49 to
fee307b
Compare
fee307b to
edb4fd9
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…#FIND-036 #FIND-029 #FIND-033 #FIND-034 #FIND-035 Nexus 49a0ad1a-499b-4ace-b7b4-ceaca30a5cf3 Nexus 53cec8fe-3e21-4a50-83e2-67717301b300 Nexus 3966d571-d2e2-43ba-aff1-def6813725e5 Nexus e1461d5a-d2e4-4808-993f-f82d403aad43 Nexus 69a8fd3b-1e78-41e0-811c-9b25bfcb906a Nexus e7868ba6-70e0-4082-b2a9-5518e5180d4f Nexus be1dbcdd-98f0-4b20-bc58-3cd9ae684e6e Nexus 66b6e854-524e-4047-8c9d-503e06c8e470) Trace: 4440115
…e2-43ba-aff1-def6813725e5) Trace: fcab9d3
…d1a-499b-4ace-b7b4-ceaca30a5cf3 Nexus a21aac55-d33b-4841-8427-a0466ac23fe7) Trace: fee307b
edb4fd9 to
0daab1a
Compare
…exus f37692f9-99d1-466c-afdd-076b14f35bbb Nexus afb88ec4-85a4-487b-890c-63e360bff8f6) Harden versioned storage decoders so malformed length prefixes cannot drive oversized Vec preallocation before the remaining byte budget is validated. Also removes the unused Env parameter from AddressMap::new and updates callers/tests. Verification: cargo fmt --all; CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=/data/tmp/contracts-storage-a067-target cargo test -p templar-soroban-runtime storage_codec_rejects_malformed -- --nocapture; CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=/data/tmp/contracts-storage-a067-target cargo test -p templar-soroban-runtime test_address_map -- --nocapture; git diff --check.
Summary
Fixes the storage-versioning-ttl audit cluster:
wqpageentries, so the queue can use kernelMAX_PENDING = 1024without exceeding Soroban 64 KiB per-entry limits. The header records pending count, and page reconstruction validates page IDs, ID ranges, sorted uniqueness, count parity, and kernel queue invariants.migrate()validates and rewrites current-version storage before clearing the migration gate.Tests
CARGO_TARGET_DIR=/data/projects/templar/contracts/.shared-target/storage-versioning-ttl cargo fmt --allgit diff --checkCARGO_TARGET_DIR=/data/projects/templar/contracts/.shared-target/storage-versioning-ttl cargo test -p templar-soroban-runtime storage_tests -- --nocapture(47 passed)CARGO_TARGET_DIR=/data/projects/templar/contracts/.shared-target/storage-versioning-ttl cargo test -p templar-soroban-runtime -- --nocapture(111 unit + 1 blend_e2e + 1 e2e_serialization + 52 integration + 23 property passed)CARGO_TARGET_DIR=/data/projects/templar/contracts/.shared-target/storage-versioning-ttl just -f contract/vault/soroban/justfile size-budget-check(deploy wasm 102162 bytes)Halborn Finding IDs
Included for Halborn SSC GitHub remediation detection:
49a0ad1a-499b-4ace-b7b4-ceaca30a5cf3— Withdraw queue effective cap is about 580, not 1024, due Soroban storage entry size53cec8fe-3e21-4a50-83e2-67717301b300— Permissionless TTL extension path does not refresh address-book entries3966d571-d2e2-43ba-aff1-def6813725e5— State blobs have no schema version andmigrate()does not migrate theme1461d5a-d2e4-4808-993f-f82d403aad43—cancel_migration()clears the migration flag but cannot roll back the already-swapped WASM69a8fd3b-1e78-41e0-811c-9b25bfcb906a—deserialize_fees_specaccepts a 113-byte blob with no-growth tag and silently discards 16 trailing bytese7868ba6-70e0-4082-b2a9-5518e5180d4f— Policy and restrictions decoders accept trailing bytes, unlike state and command codecsbe1dbcdd-98f0-4b20-bc58-3cd9ae684e6e— Withdraw queue deserialization does not validate queue invariants or sorted pending-withdrawal IDs66b6e854-524e-4047-8c9d-503e06c8e470—compose_policy_statesilently constructs default values for missing storage partsa21aac55-d33b-4841-8427-a0466ac23fe7— Restrictions blob can exceed the Soroban entry-size limit with large blacklist or whitelist sets0f081249-4cb8-4fbf-bcfe-929d02852e8d—load_vault_bootstraprunsmigrate_legacy_pausedon every contract callThis change is