Skip to content

Add contracterror pausestate#603

Open
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-contracterror-pausestate
Open

Add contracterror pausestate#603
gloskull wants to merge 2 commits into
CalloraOrg:mainfrom
gloskull:add-contracterror-pausestate

Conversation

@gloskull

Copy link
Copy Markdown

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

@gloskull

Copy link
Copy Markdown
Author

Done with this issue.
Please merge and give and high review.
Please if there are any more tasks, assign them to me, i'd make sure to get them done quickly and submit my PR's in under 5 hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ContractError::PausedState variant

1 participant