Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
hpmaxi
marked this pull request as ready for review
October 19, 2026 23:36
luchobonatti
approved these changes
Oct 23, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #324
The vault, the share token, the oracle and the compliance contract checked most preconditions inline, often halfway down a function, so a reader had to read the whole body to learn when a call is refused. A few vault totals still used plain addition or saturating subtraction, and the oracle read its configuration with a bare
unwrap.Now each precondition is a function in the contract's
guardsmodule, named for the condition it checks. Each entrypoint calls its guards first, in the same order as before, and then does its work, so every refused call fails with the same error. The remaining totals use checked math with named errors, and a missing oracle configuration fails withNotInitialized.Changes
refuse_*,require_*andcheck_*helpers are guards now; the lock policy still decides a holder's standing, and the guards call itAmountTooLargeinstead of overflowingAccountingMismatchinstead of saturating, and deposited capital fails on overflowAccountingMismatchif they would go below zeroNotInitializedinstead of trappingholderinstead ofcontrollerDeviations
finish_setupcheck that setup is open before the hand-over check, as the vault does. Every state fails with the same error as before.Acceptance criteria
if … { panic_with_error!(…) }precondition leftAmountTooLargeorAccountingMismatchinstead of overflowing or saturatingTest plan
Automated tests
cargo test --locked: 661 passed (426 vault, 96 oracle, 75 token, 33 compliance, 6 identity verifier, 19 timelock, 6 storage). The 583 tests at the base pass unchanged; four of them are renamed.cargo clippy --locked --all-targets -- -D warningson the eight crates, and on the vault with--features short_wind_down: clean.cargo test -p async-vault -p nav-oracle --features upgrade_wasm with_wasm, after the builds indocs/TESTING.md) pass against the new token and oracle builds.Manual verification
docker run --rm -d -p 8000:8000 --name stellar-local stellar/quickstart --local --enable core,rpc.stellar contract build, thenCARGO_TARGET_DIR=target/short-wind-down stellar contract build --package async-vault --features short_wind_down.npm run build:clients, thenHARNESS_NETWORK=local npm run deploy -w scripts/harness.test:happy-path,test:guardsandtest:wind-downwithnpm run <script> -w scripts/harness.Breaking changes
Fresh deployments only.
nav_oracle: a new error,NotInitialized = 3026, for a missing configuration. A constructed oracle always has one, so no call reaches it today.async_vault: on states no valid call sequence reaches, a few totals now fail withAmountTooLargeorAccountingMismatchwhere they trapped, returned a saturated value or produced a negative payout.No entrypoint, argument, event or other error changes. The console needs no change.
Checklist
Screenshots
None.