test(treasury): add asset registration and validation test suite - #310
Open
Francis6-git wants to merge 2 commits into
Open
test(treasury): add asset registration and validation test suite#310Francis6-git wants to merge 2 commits into
Francis6-git wants to merge 2 commits into
Conversation
Contributor
|
@Francis6-git kindly fix CI |
Contributor
Author
Please check again |
|
@Francis6-git this PR currently has merge conflicts. Please resolve the conflicts before it can be merged automatically. |
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
Added focused integration test coverage for treasury asset registration and lifecycle management in
payment_executor. While allowlist behavior was already present in the implementation, this change introduces dedicated tests for registration, metadata/status updates, asset disablement, default-deny enforcement, and audit event emissions.Additionally, updates
docs/treasury.mdto formally document the asset lifecycle, state event contract, and privacy guidelines.Changes Made
Treasury Asset Lifecycle Tests
Added comprehensive integration tests in
contracts/payment_executor/tests/treasury_authorization_tests.rs:test_treasury_asset_registration_defaults_to_supported_token_onlytest_treasury_asset_registration_can_be_updated_and_disabledset_asset_allowed(asset, true)and asserts it transitions to an allowed state.set_asset_allowed(asset, false).test_treasury_asset_registration_emits_state_eventTreasuryAssetAllowedUpdated.Existing test
test_unsupported_asset_rejectioncontinues to pass, ensuring payment execution aborts withAsset not allowedwhen targeted assets are disabled.Documentation
Updated
docs/treasury.mdwith:TreasuryAssetAllowedUpdatedevent contract.Behavior Covered
The contract enforces the following asset state machine:
TreasuryAssetAllowedUpdatedevent.Privacy & Security Considerations
All added test cases utilize mock generated addresses (
Address::generate(&env)). In accordance with protocol guidelines, no employee identities, salaries, payment allocations, commitments, or zero-knowledge proof data are included in event assertions or documentation examples.Verification & QA
Ran formatting and static analysis checks:
Executed the targeted integration test suite:
cargo test -p payment_executor --test treasury_authorization_testsCloses #267