fix(contracts): bump instance TTL in multisig_governance - #1734
Open
Akinsuyiphilip wants to merge 1 commit into
Open
fix(contracts): bump instance TTL in multisig_governance#1734Akinsuyiphilip wants to merge 1 commit into
Akinsuyiphilip wants to merge 1 commit into
Conversation
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
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
Fixes #1593
Unlike
LendingPool,LoanManager, andRemittanceNFT,GovernanceContract(contracts/multisig_governance/src/lib.rs) never invokedextend_ttlon 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
INSTANCE_TTL_THRESHOLD(17_280 ledgers ≈ 24h at 5s/ledger) andINSTANCE_TTL_BUMP(518_400 ledgers ≈ 30 days) constants, matching the values used inLendingPool/LoanManager.bump_instance_ttl(&env)helper that callsenv.storage().instance().extend_ttl().Self::bump_instance_ttl(&env)at the start of every public method inGovernanceContract, including all read-only view methods, so instance storage TTL is refreshed on any interaction:initialize,version,upgradepropose_admin_transfer,approve_transfer,finalize_admin_transfercancel_admin_transfer,emergency_cancel_proposal,expire_proposalget_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_approvedImpact
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