feat: complete upgrade safety gate with migration regression tests (#318) - #322
Merged
MaryammAli merged 2 commits intoJul 21, 2026
Merged
Conversation
…lockDash-Studios#318) - Add UpgradeGateEnabled master switch to storage with set/get helpers - Add check_upgrade_safety() view for pre-upgrade validation - Add get_upgrade_status() returning full UpgradeState including gate_enabled - Add set_upgrade_gate() admin entrypoint to enable/disable upgrades - Integrate gate check into start_upgrade() flow - Add UpgradeSafetyReport type with comprehensive safety breakdown - Add 8 new migration regression tests covering gate lifecycle, safety report correctness, state preservation, and migrate independence - Update documentation (IMPLEMENTATION, TEST_GUIDE, UPGRADE_SAFETY_GATE) Closes BlockDash-Studios#318
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
Completes the upgrade safety gate implementation and adds comprehensive migration regression coverage.
Changes
Contract (Issue #318):
UpgradeGateEnabledstorage key — master switch to enable/disable all upgradesset_upgrade_gate(caller, enabled)— admin function to toggle the gatecheck_upgrade_safety()— public view returningUpgradeSafetyReportwith full safety breakdownget_upgrade_status()— public view returningUpgradeStateincludinggate_enabledstart_upgrade()— blocks when gate is disabledUpgradeSafetyReporttype with fields:is_safe,gate_enabled,window_active,upgrade_in_progress,version_compatible,invariants_satisfiedUpgradeStateto includegate_enabledfieldMigration Regression Tests (12 new tests):
upgrade_safety_gate_blocks_when_gate_disabled— gate blocks upgrades when disabledupgrade_safety_gate_succeeds_when_gate_enabled— upgrades succeed when gate is enabledupgrade_safety_gate_check_upgrade_safety_reports_version— safety report correctnessupgrade_safety_gate_check_reports_unsafe_when_disabled— unsafe when gate disabledupgrade_safety_gate_check_reports_unsafe_without_window— unsafe without windowupgrade_safety_gate_check_reports_unsafe_when_in_progress— unsafe during upgradeupgrade_safety_gate_check_reports_unsafe_on_invariant_violation— unsafe on bad stateupgrade_safety_gate_get_upgrade_status_includes_gate_enabled— status includes gate fieldupgrade_safety_gate_non_admin_cannot_set_gate— admin-only enforcementupgrade_safety_gate_toggle_preserves_contract_state— regression: gate toggle preserves escrows/fees/privacyupgrade_safety_gate_full_lifecycle— end-to-end gate lifecycleupgrade_safety_gate_migrate_works_independently_of_gate— migrate() unaffected by gateDocumentation:
UPGRADE_SAFETY_GATE_IMPLEMENTATION.mdUPGRADE_SAFETY_GATE_TEST_GUIDE.mddocs/UPGRADE_SAFETY_GATE.mdTest Results
All 329 tests pass (23 upgrade safety gate tests).
Closes #318