Skip to content

fix(contracts): bump instance TTL in multisig_governance - #1734

Open
Akinsuyiphilip wants to merge 1 commit into
LabsCrypt:mainfrom
Akinsuyiphilip:fix/multisig-governance-instance-ttl
Open

fix(contracts): bump instance TTL in multisig_governance#1734
Akinsuyiphilip wants to merge 1 commit into
LabsCrypt:mainfrom
Akinsuyiphilip:fix/multisig-governance-instance-ttl

Conversation

@Akinsuyiphilip

Copy link
Copy Markdown

Summary

Fixes #1593

Unlike LendingPool, LoanManager, and RemittanceNFT, GovernanceContract (contracts/multisig_governance/src/lib.rs) never invoked extend_ttl on its instance storage. If no governance proposal occurs within the ledger lifetime threshold, the contract instance storage — KEY_ADMIN, KEY_TARGET, KEY_PENDING, KEY_VERSION, KEY_PROPOSAL_COUNT, KEY_LAST_CANCELLED_AT — will expire and become archived on Stellar, permanently locking protocol governance.

Changes

  • Added INSTANCE_TTL_THRESHOLD (17_280 ledgers ≈ 24h at 5s/ledger) and INSTANCE_TTL_BUMP (518_400 ledgers ≈ 30 days) constants, matching the values used in LendingPool/LoanManager.
  • Added a bump_instance_ttl(&env) helper that calls env.storage().instance().extend_ttl().
  • Invoked Self::bump_instance_ttl(&env) at the start of every public method in GovernanceContract, including all read-only view methods, so instance storage TTL is refreshed on any interaction:
    • initialize, version, upgrade
    • propose_admin_transfer, approve_transfer, finalize_admin_transfer
    • cancel_admin_transfer, emergency_cancel_proposal, expire_proposal
    • get_current_admin, get_admin, get_target, get_pending_transfer, get_pending, has_pending_transfer, get_approval_count, get_timelock_remaining, get_proposal_count, get_signers, get_threshold, has_approved

Impact

Prevents governance contract instance storage from expiring and being archived due to inactivity, ensuring the protocol's admin/governance role remains mutable over the long term.

Testing

Change follows the exact established pattern from the other contracts. No Rust/Cargo toolchain was available in the local environment to run cargo test -p multisig_governance, so automated tests should be run in CI.

Closes #1593

GovernanceContract never invoked extend_ttl on its instance storage,
unlike LendingPool, LoanManager, and RemittanceNFT. If no governance
activity occurs within the ledger lifetime threshold, instance storage
(KEY_ADMIN, KEY_TARGET, KEY_PENDING) could expire and become archived,
locking protocol governance.

Add INSTANCE_TTL_THRESHOLD / INSTANCE_TTL_BUMP constants and a
bump_instance_ttl helper, invoked at the start of every public method,
matching the established pattern in the other contracts.

Fixes LabsCrypt#1593
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.

[Bug][Contract] multisig_governance does not extend instance storage TTL

1 participant