Add contracterror pausestate#603
Open
gloskull wants to merge 2 commits into
Open
Conversation
…iant feat(vault): add VaultError::PausedState (code 37)
Author
|
Done with this issue. |
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.
Motivation
Make pause-related rejections explicitly machine-readable by adding a dedicated PausedState error variant so callers can deterministically handle pause vs. other pause-related conditions.
Description
Add VaultError::PausedState = 37 to the Vault error enum and update the public error-code table in docs/ERROR_CODES.md.
Change the vault pause guard to return VaultError::PausedState from require_not_paused() instead of the previous generic paused handling.
Update unit tests to assert the explicit PausedState result on pause-blocked code paths (try_deposit, try_deduct, try_batch_deduct) and update test_error_codes to include the new variant and expected mapping count.
Fix a few malformed test call sites in the vault tests that prevented parsing so the updated tests compile (call-site formatting and get_revenue_pool/get_settlement call fixes).
Testing
Ran cargo fmt locally to normalize formatting (succeeded for the touched files).
Ran the contract test build cargo test -p callora-vault test_error_codes -- --nocapture and related compile attempts; the run failed due to existing unrelated workspace compile errors and duplicate/undefined symbols in other contracts (these failures are not caused by the error-variant change itself).
Updated unit tests in contracts/vault/src/test.rs and contracts/vault/src/test_error_codes.rs to assert Err(Ok(VaultError::PausedState)) for paused deposits/deducts/batch-deducts (these focused assertions are included in the PR but the full workspace test run did not complete due to unrelated compilation issues).
Closes #556