Skip to content

feat(access_control): add SetProposalExpiry action to update expiry window post-init - #1281

Merged
sanmipaul merged 1 commit into
astera-hq:mainfrom
xtep103:feat/update-proposal-expiry-secs
Aug 26, 2026
Merged

feat(access_control): add SetProposalExpiry action to update expiry window post-init#1281
sanmipaul merged 1 commit into
astera-hq:mainfrom
xtep103:feat/update-proposal-expiry-secs

Conversation

@xtep103

@xtep103 xtep103 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a SetProposalExpiry(u64) action variant to ActionPayload and a get_proposal_expiry_secs read-only accessor in access_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)

  • [MODIFY] contracts/access_control/src/lib.rs
    • Added ActionPayload::SetProposalExpiry(u64) variant to gate global expiry updates behind SuperAdmin multisig consensus.
    • Added get_proposal_expiry_secs(env: Env) -> u64 read accessor.
    • Integrated execution logic in execute_self_management with validation rejecting zero-duration windows (InvalidExpiryWindow).
    • Classified SetProposalExpiry as self-management and SuperAdmin-only in is_self_management and requires_super_admin, enforcing target == this_contract and role permissions at propose_action time.
  • [MODIFY] contracts/access_control/tests/lifecycle_tests.rs
    • Added unit tests verifying post-init proposal expiry update, immediate effect on subsequent proposals, zero-value rejection, SuperAdmin role requirement, and coherence checks.

Verification Results

$ cargo check -p access_control
    Checking access_control v0.1.0 (/Users/user/Documents/Projects/open_source/Astera/contracts/access_control)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 01s
Acceptance Criteria Status
Ability to update proposal_expiry_secs after initialize ✅ Implemented via SetProposalExpiry action payload
Gated behind SuperAdmin multisig consensus ✅ Enforced via requires_super_admin & is_self_management
Validated against zero duration ✅ Returns AccessControlError::InvalidExpiryWindow if 0
Read accessor for current expiry ✅ Implemented via get_proposal_expiry_secs
Unit tests covering all edge cases ✅ Added 4 test cases covering happy path and error cases

…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).
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@sanmipaul
sanmipaul merged commit 86b747c into astera-hq:main Aug 26, 2026
1 check passed
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.

feat: add a way to update proposal_expiry_secs after initialize

2 participants