Skip to content

chore: centralize and document timelock delay bounds in types module - #1400

Open
ayomhide2-web wants to merge 1 commit into
JSE-ORG:mainfrom
ayomhide2-web:chore/centralize-timelock-delay-constants
Open

ayomhide2-web wants to merge 1 commit into
JSE-ORG:mainfrom
ayomhide2-web:chore/centralize-timelock-delay-constants

Conversation

@ayomhide2-web

Copy link
Copy Markdown

Summary

Centralizes timelock delay constants in types.rs and updates validation to enforce configurable minimum and maximum delay limits.

Changes Made

  • Added MIN_TIMELOCK_DELAY set to 3,600 seconds (1 hour).
  • Added MAX_TIMELOCK_DELAY set to 604,800 seconds (7 days).
  • Added DEFAULT_TIMELOCK_DELAY set to 86,400 seconds (24 hours).
  • Updated admin.rs::set_timelock_delay to validate delays against the centralized limits.
  • Ensured out-of-range values return ContractError::InvalidTimelockDelay.
  • Added tests covering minimum and maximum delay boundaries, including invalid values outside the allowed range.

Testing

  • cargo test --lib test_admin
  • make clippy
  • Verified minimum and maximum boundary values are accepted.
  • Verified out-of-range values are rejected.
  • Checked code formatting.

Scope

No changes to the existing timelock security mechanism beyond centralizing constants and enforcing consistent validation limits.

Closes #1248

Move the admin timelock delay constants next to the DataKey that stores
them and re-export them from admin.rs so existing imports keep working.
Add a test covering the inclusive MIN..=MAX boundary and the values just
outside it, which must return InvalidTimelockDelay.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
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.

Migrate Hardcoded Timelock Delay to Configurable Dynamic Range Limits

2 participants