-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Compose TimelockGuard and LivenessModule2 into a single contract #17402
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
Co-authored-by: almanax-ai[bot] <174396398+almanax-ai[bot]@users.noreply.github.com>
* Slightly simplified code --------- Co-authored-by: alcueca <[email protected]>
- 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]>
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
c9d5e95 to
e7f2f6a
Compare
e7f2f6a to
0057dd7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## jm/timelock #17402 +/- ##
================================================
+ Coverage 78.34% 89.69% +11.34%
================================================
Files 163 110 -53
Lines 9706 5034 -4672
================================================
- Hits 7604 4515 -3089
+ Misses 1956 519 -1437
+ Partials 146 0 -146
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Also makes the parent contracts abstract in order to prevent deploying them individually. The benefit of this approach is that it ensures the logic is available in both contracts, while ensuring that their state and logic are kept separate thus reducing the complexity and review effort.
0057dd7 to
b62ec78
Compare
| /// @dev This contract can be enabled simultaneously as both a module and a guard on a Safe: | ||
| /// - As a module: provides liveness challenge functionality to prevent multisig deadlock | ||
| /// - As a guard: provides timelock functionality for transaction delays and cancellation | ||
| contract SafeExtensions is LivenessModule2, TimelockGuard { |
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 liked SaferSafes as the name for the contract :)
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.
It gives a bit more information about what the contract is about, and it is memorable.
|
The problem here is that the LivenessModule needs to know the This is inconsistently explained in the specs, let's continue the conversation there. |
0b47817 to
bc7f865
Compare
|
Closing this for now. Will revisit the problem of composition after both modules are complete. |
|
My comment just above is resolved. It's better to not couple the LivenessModule and TimelockGuard features, and make sure that |

Description
TimelockGuardandLivenessModule2are inherited into a single contract. The primary purpose of which is to avoid the need to deploy and manage two different contracts.Also makes the parent contracts abstract in order to prevent deploying
them individually.
Since their functionality is otherwise distinct, the child contract contains none of its own logic. The benefit of this approach is that it ensures the logic is available
in both contracts, while ensuring that their state and logic are kept
separate thus reducing the complexity and review effort.
Tests are kept separate for the same reason.