Skip to content

fix(multisig): fix #10 by adding instance storage TTL extensions#40

Merged
ogazboiz merged 3 commits into
LabsCrypt:mainfrom
Dopezapha:fix/multisig-governance-archival
Jun 21, 2026
Merged

fix(multisig): fix #10 by adding instance storage TTL extensions#40
ogazboiz merged 3 commits into
LabsCrypt:mainfrom
Dopezapha:fix/multisig-governance-archival

Conversation

@Dopezapha

Copy link
Copy Markdown
Contributor

Closes #10

PR Description

This PR resolves issue #10 by extending the Time-To-Live (TTL) of the instance storage in the multisig_governance contract.

Previously, the contract stored the pending proposal under instance storage (KEY_PENDING) but did not extend its TTL. In Soroban, instance storage can be archived by the host if it is not accessed or bumped within its lifetime. For long-lived governance proposals waiting on the 7-day proposal TTL plus the timelock window, this could result in proposal data becoming archived, preventing finalization or approvals.

To address this, I added an INSTANCE_TTL_THRESHOLD of 17,280 ledgers (~1 day) and an INSTANCE_TTL_BUMP of 518,400 ledgers (~30 days). We introduced a bump_instance_ttl helper function that extends the instance storage TTL. This function is called on all entrypoints (both write operations like propose, approve, and finalize, and read-only views) to keep the contract state and proposal data active.

Changes Made

  • Added INSTANCE_TTL_THRESHOLD and INSTANCE_TTL_BUMP constants to multisig_governance/src/lib.rs.
  • Implemented the bump_instance_ttl helper function in multisig_governance/src/lib.rs.
  • Integrated the TTL bump helper into all entrypoints and getter methods in multisig_governance/src/lib.rs.
  • Added a unit test test_proposal_ttl_extension_keeps_proposal_active_and_finalizable in multisig_governance/src/test.rs to verify that advancing sequence numbers across the timelock keeps the proposal finalizable.

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a correct, well-scoped fix, nice work. the bump_instance_ttl helper is called on every write and read path and in read_admin, the constants are sane (threshold ~1 day, bump ~30 days, comfortably above the 7-day proposal lifetime + 1-day timelock), the extend_ttl(threshold, bump_to) signature is right, the new ttl-extension test passes and all 35 multisig tests pass, clippy clean.

one thing blocks CI: cargo fmt --check fails on multisig_governance/src/lib.rs:131 (rustfmt collapses the aligned padding before the // ~30 days comment), and fmt is the very first CI step so it hard-fails there. just run cargo fmt and commit:
cargo fmt && git commit -am "style: rustfmt"

heads up, since this is your first PR here the CI run is gated and shows "no checks reported" until a maintainer approves it. i'll approve the run so you get the signal, but it'll fail on that fmt line until you push the fix above. once fmt is clean it should go green and i'll merge.

if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@Dopezapha

Dopezapha commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@ogazboiz I have made the simple correction. I ran cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test and cargo build --all-targets and everything passed. Kindly review once again.

@Dopezapha Dopezapha requested a review from ogazboiz June 21, 2026 10:44

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the quick turnaround, the rustfmt fix is in and CI is now green (fmt + clippy + tests + wasm all pass). re-confirming the fix itself from the last round: bump_instance_ttl is called on every write and read path and in read_admin, the constants comfortably exceed the max proposal lifetime (7-day PROPOSAL_TTL_SECONDS + 24h delay), the extend_ttl signature is right, and the new test that advances ledgers across the timelock window and finalizes proves the proposal survives archival. that covers all of issue #10's acceptance criteria.

merging. nice work on this one.

if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@ogazboiz ogazboiz merged commit f2a06a1 into LabsCrypt:main Jun 21, 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.

[Contracts] Multisig governance proposal state lives in instance storage and can be archived, stranding in-flight transfers

2 participants