fix: cap governance timelocks#436
Draft
carrion256 wants to merge 2 commits into
Draft
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
0358c07 to
f9d5fb0
Compare
Collaborator
Author
|
@coderabbitai review |
Contributor
✅ Actions performedReview triggered.
|
f9d5fb0 to
7bf07e8
Compare
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 governance timelock-model findings in
governance-control-plane:890b1bbf-ea61-47f3-ac17-383678f0d713:TimelockConfigcould be raised tou64::MAXimmediately, making later reductions practically unrecoverable.98dbd8f7-6f6b-4096-b917-c01f9fd68e35:load_timelockslazily materializedDataKey::Timelocksfrom the legacy scalar fallback during getter/view-style paths.This PR keeps the timelock-model fixes consolidated in the existing governance timelock PR: it caps Soroban governance timelocks at 30 days, matching the NEAR vault governance upper bound, and makes legacy/fallback timelock reads side-effect-free while preserving explicit
SetTimelockwrite behavior.Changes
MAX_TIMELOCK_NS = u64::MAXwith30 * DAY_NS.submit_set_timelock(..., TimelockKind::TimelockConfig, u64::MAX)returnsGovernanceError::TimelockOutOfBoundsand leaves the currentTimelockConfigplus pending queue unchanged.load_timelocksreturnTimelocks::from_default(default_ns)without writingDataKey::Timelockswhen only the legacyDataKey::TimelockNsscalar exists.timelock_nsandtimelocksgetters do not materialize missingTimelocksstorage.Verification
Folded A-092 commit:
0358c07b9340ad820092dc8918a79238b8a241ec.cargo test -p templar-soroban-governance timelock_config_rejects_u64_max_without_mutating_state -- --nocapturecargo test -p templar-soroban-governance timelock_getters_do_not_materialize_missing_timelocks_storage -- --nocapturecargo test -p templar-soroban-governance -- --nocapture(31 passed)git diff --check origin/audit/governance-a040..HEADjust -f contract/vault/soroban/justfile size-budget-checkRED evidence recorded locally before fixes:
left: Ok(1), provingu64::MAXwas accepted immediately.timelock_nswroteDataKey::Timelocksstorage while reading from fallback state.Runtime deploy WASM size from current folded branch size gate:
93961bytes /91.76 KiB131072bytes /128 KiBThis change is