feat(access_control): add SetProposalExpiry action to update expiry window post-init - #1281
Merged
sanmipaul merged 1 commit intoAug 26, 2026
Merged
Conversation
…indow post-init Closes astera-hq#1136 proposal_expiry_secs was set once at initialize() with no on-chain path to change it afterwards. A badly-chosen initial window (too wide or too narrow) was permanently locked in, forcing a full contract redeployment to fix. This commit adds a SetProposalExpiry(u64) variant to ActionPayload that: * Routes through the normal propose → approve → execute lifecycle, so updating the window requires the same SuperAdmin M-of-N consensus as AddSigner / SetThreshold. * Is classified as a self-management action (must be proposed with target == this_contract) and as SuperAdmin-only — both enforced at propose_action time via the existing is_self_management and requires_super_admin checks. * Rejects a zero value at execute time (same invariant as initialize). * Takes effect immediately: proposals created after execution use the new window for their expires_at computation. A new get_proposal_expiry_secs() read accessor is also added so frontends/SDKs can inspect the current window without proposing. Four new lifecycle tests cover the happy path, the zero-value guard, the SuperAdmin-only enforcement, and the coherence enforcement (external target must be rejected).
|
@xtep103 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.
Overview
Adds a
SetProposalExpiry(u64)action variant toActionPayloadand aget_proposal_expiry_secsread-only accessor inaccess_control, allowing the proposal expiry window to be safely updated post-initialization through the standard SuperAdmin multisig proposal lifecycle.Related Issue
Closes #1136
Changes
Access Control (
contracts/access_control)contracts/access_control/src/lib.rsActionPayload::SetProposalExpiry(u64)variant to gate global expiry updates behind SuperAdmin multisig consensus.get_proposal_expiry_secs(env: Env) -> u64read accessor.execute_self_managementwith validation rejecting zero-duration windows (InvalidExpiryWindow).SetProposalExpiryas self-management and SuperAdmin-only inis_self_managementandrequires_super_admin, enforcingtarget == this_contractand role permissions atpropose_actiontime.contracts/access_control/tests/lifecycle_tests.rsVerification Results
proposal_expiry_secsafterinitializeSetProposalExpiryaction payloadrequires_super_admin&is_self_managementAccessControlError::InvalidExpiryWindowif 0get_proposal_expiry_secs