fix: cap governance timelocks#436
Conversation
|
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
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
f9d5fb0 to
7bf07e8
Compare
|
fixed on #457 |
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