fix: validate adapter asset observations#433
Conversation
…7a-228152a95c3b) Move adapter-reported external asset validation out of the generic kernel sync path and into the Soroban runtime policy boundary. Supply callbacks now validate the active market step against the supplied amount, refresh callbacks validate observed market principals against policy caps, and legitimate refresh decreases are allowed instead of rejected by aggregate no-decrease bounds. Stage policy principal updates before kernel sync and operation completion so failed validation or sync cannot leave in-memory policy state mutated. Remove the old aggregate sync heuristic and keep kernel SyncExternalAssets focused on op-state and total-assets consistency. Verification: cargo fmt --all; git diff --check; cargo test -p templar-soroban-runtime --features testutils complete_supply_allocation -- --nocapture; cargo test -p templar-soroban-runtime --features testutils complete_refresh -- --nocapture; cargo test -p templar-vault-kernel sync_external_assets -- --nocapture; cargo test -p templar-vault-kernel --lib -- --nocapture; cargo test -p templar-soroban-runtime --features testutils --lib -- --nocapture; cargo test -p templar-soroban-runtime --features testutils --test property_tests -- --nocapture; just -f contract/vault/soroban/justfile size-budget-check.
|
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 |
|
Superseded by #431, which consolidates the tracker-defined |
|
Closed as superseded by #431 consolidated adapter-accounting-and-blend-admin PR. |
Fixed Findings
bc013b77-b8a9-4b9a-867a-228152a95c3be16b8b3bbf6db66f1ecbb2077165c5a33043e71eRoot Cause
The Soroban runtime accepted adapter-reported external asset observations at the generic sync boundary. That made the kernel try to enforce aggregate external-asset movement without enough market-policy context: cumulative inflation could be accepted through reported market totals, while legitimate market decreases could be rejected by a broad no-decrease heuristic.
Fix Summary
SyncExternalAssetsfocused on operation-state and total-assets consistency.Verification
Passed locally on branch
audit/adapter-accounting-a033:Size gate passed: runtime deploy WASM
95801bytes <=131072bytes.This change is