feat(contracts): pausable, batch ops, fuzz tests, upgrade harness#741
Open
Simcrypt wants to merge 1 commit into
Open
feat(contracts): pausable, batch ops, fuzz tests, upgrade harness#741Simcrypt wants to merge 1 commit into
Simcrypt wants to merge 1 commit into
Conversation
…ainTease#662-BrainTease#665) BrainTease#663 – Pausable / Emergency-Stop - Add pause/unpause/is_paused to MarketContract and RegistryContract - Guard all mutating functions with require_not_paused - Emit paused/unpaused events; only admin can toggle - Tests: pause blocks mutations, non-admin rejected, resume works BrainTease#662 – Batch Operations & Gas Optimisation - MarketContract: batch_settle_escrows, batch_refund_escrows (single auth check + sequential storage writes vs N round-trips) - RegistryContract: batch_register_users (single list write), batch_set_verification_levels - Tests cover batch edge cases and auth BrainTease#664 – Property-Based & Fuzz Testing - contracts/market/src/fuzz_tests.rs: proptest invariants for fee math (fee+net=amount, fee≤amount, net≥0, overflow safety, batch summation) - contracts/registry/src/fuzz_tests.rs: proptest invariants for level filtering, pagination bounds, skill expiry, deduplication - Add proptest = "1.4" dev-dep to market and registry Cargo.toml BrainTease#665 – Contract Upgrade Test Harness - contracts/shared/src/upgrade_tests.rs: 12 tests covering schedule, cancel, timelock enforcement, unauthorised-upgrade rejection, state preservation, storage-layout migration scenario, history - Wire upgrade_tests module into shared/src/lib.rs - Document harness in docs/smart-contract-upgrade-guide.md
|
@Simcrypt Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Resolves #662, #663, #664, #665.
#663 – Pausable / Emergency-Stop
pause/unpause/is_pausedadded toMarketContractandRegistryContractrequire_not_pausedpaused/unpausedevents emitted; only admin can toggle#662 – Batch Operations & Gas Optimisation
batch_settle_escrows+batch_refund_escrows— single auth check, sequential storage writes reduce round-trips vs N individual callsbatch_register_users(one list read + one write vs N),batch_set_verification_levels#664 – Property-Based & Fuzz Testing
contracts/market/src/fuzz_tests.rs: proptest invariants —fee + net = amount,fee ≤ amount,net ≥ 0, overflow safety, batch fee summationcontracts/registry/src/fuzz_tests.rs: proptest invariants — level filter monotonicity, pagination bounds, skill expiry logic, deduplicationproptest = "1.4"added to market and registryCargo.tomldev-dependencies#[cfg(test)] mod fuzz_testsin each contract'slib.rs#665 – Contract Upgrade Test Harness
contracts/shared/src/upgrade_tests.rs: 12 tests covering:upgrade()by non-admin rejecteddocs/smart-contract-upgrade-guide.mdupdated with harness section, test table, flow diagram, and run instructionsFiles changed
contracts/market/src/lib.rscontracts/market/src/fuzz_tests.rscontracts/market/Cargo.tomlcontracts/registry/src/lib.rscontracts/registry/src/test.rscontracts/registry/src/fuzz_tests.rscontracts/registry/Cargo.tomlcontracts/shared/src/lib.rscontracts/shared/src/upgrade_tests.rsdocs/smart-contract-upgrade-guide.mdCloses #662
Closes #663
Closes #664
Closes #665