-
Notifications
You must be signed in to change notification settings - Fork 3.9k
TimelockGuard add basic configuration functionality #17401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| struct GuardConfig { | ||
| uint256 timelockDelay; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this single value into a struct is unnecessary, but claude did it (presumably following the example of ModuleConfig in LivenessModule2, and it felt kind of nice to namespace it so that you can use GuardConfig.timelockDelay.
I'm not opposed to getting rid of the struct though, open to opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to keep it. I also like the namespace.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #17401 +/- ##
===========================================
- Coverage 95.92% 95.83% -0.09%
===========================================
Files 112 113 +1
Lines 5127 5162 +35
===========================================
+ Hits 4918 4947 +29
- Misses 209 215 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
0b47817 to
bc7f865
Compare
- Add configureTimelockGuard function to allow Safes to set timelock delays - Validate timelock delay between 1 second and 1 year - Check that guard is properly enabled on calling Safe using getStorageAt() - Store configuration per Safe with GuardConfigured event emission - Add comprehensive test suite covering all spec requirements - Implement IGuard interface for Safe compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add clearTimelockGuard function to allow Safes to clear timelock configuration - Validate that guard is disabled before allowing configuration clearing - Check that Safe was previously configured before clearing - Delete configuration data and emit GuardCleared event - Add comprehensive test suite covering all spec requirements - Add new errors: TimelockGuard_GuardNotConfigured, TimelockGuard_GuardStillEnabled 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add internal _getGuard() helper to centralize guard address retrieval - Update configureTimelockGuard and clearTimelockGuard to use helper - Reduces code duplication and improves maintainability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add cancellationThreshold function to return current threshold for a Safe - Return 0 if guard not enabled or not configured - Initialize to 1 when Safe configures guard - Clear threshold when Safe clears guard configuration - Add comprehensive test suite covering all spec requirements - Function never reverts as per spec requirements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…lity - Add scheduleTransaction placeholder (Function 4) - Add checkPendingTransactions placeholder (Function 6) - Add rejectTransaction placeholder (Function 7) - Add rejectTransactionWithSignature placeholder (Function 8) - Add cancelTransaction placeholder (Function 9) - Update checkTransaction placeholder (Function 5) - All placeholders have proper signatures and documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
bc7f865 to
f085e72
Compare
| /// @dev MUST return 0 if the contract is not enabled as a guard for the safe | ||
| /// @param _safe The Safe address to query | ||
| /// @return The current cancellation threshold | ||
| function cancellationThreshold(address _safe) public view returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function return parameter lacks proper documentation. According to Solidity documentation standards, function return parameters should be documented with @return comments in NatSpec format. The return parameter should include a description explaining what the cancellationThreshold_ value represents.
| function cancellationThreshold(address _safe) public view returns (uint256) { | |
| /** | |
| * @notice Returns the cancellation threshold for a given safe | |
| * @param _safe The address of the safe | |
| * @return The number of confirmations required to cancel a transaction | |
| */ | |
| function cancellationThreshold(address _safe) public view returns (uint256) { |
Spotted by Diamond (based on custom rule: Custom rules)
Is this helpful? React 👍 or 👎 to let us know.
|
Replaced by #17465 |

Description
This is the first PR in a forthcoming stack (expect 1 or 2 more PRs), which establishes the outline of the TimelockGuard contract.
It fully implements and tests the following functions of the TimelockGuard listed in the specs:
viewTimelockGuardConfigurationconfigureTimelockGuardclearTimelockGuardcancellationThresholdIt also includes empty placeholders for the following functions:
scheduleTransactioncheckTransactioncheckPendingTransactionsrejectTransactionrejectTransactionWithSignaturecancelTransactionThis PR does not combine the TimelockGuard and LivenessModule2, that is done in #17402.