Skip to content

Conversation

@maurelian
Copy link
Contributor

@maurelian maurelian commented Sep 9, 2025

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:

  • viewTimelockGuardConfiguration
  • configureTimelockGuard
  • clearTimelockGuard
  • cancellationThreshold

It also includes empty placeholders for the following functions:

  • scheduleTransaction
  • checkTransaction
  • checkPendingTransactions
  • rejectTransaction
  • rejectTransactionWithSignature
  • cancelTransaction

This PR does not combine the TimelockGuard and LivenessModule2, that is done in #17402.

Copy link
Contributor Author

maurelian commented Sep 9, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment on lines +19 to +21
struct GuardConfig {
uint256 timelockDelay;
}
Copy link
Contributor Author

@maurelian maurelian Sep 9, 2025

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.

Copy link
Contributor

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
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 82.85714% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.83%. Comparing base (b7c9755) to head (f085e72).
⚠️ Report is 12 commits behind head on develop.

Files with missing lines Patch % Lines
...kages/contracts-bedrock/src/safe/TimelockGuard.sol 82.85% 6 Missing ⚠️
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     
Flag Coverage Δ
contracts-bedrock-tests 95.83% <82.85%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...kages/contracts-bedrock/src/safe/TimelockGuard.sol 82.85% <82.85%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maurelian maurelian changed the title feat: implement configureTimelockGuard function TimelockGuard add basic configuration functionality Sep 9, 2025
@maurelian maurelian changed the base branch from jb/liveness-module to develop September 11, 2025 16:08
maurelian and others added 15 commits September 11, 2025 15:43
- 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]>
@maurelian maurelian mentioned this pull request Sep 11, 2025
@maurelian maurelian marked this pull request as ready for review September 11, 2025 19:49
@maurelian maurelian requested a review from a team as a code owner September 11, 2025 19:49
@maurelian maurelian requested a review from tynes September 11, 2025 19:49
/// @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) {
Copy link
Contributor

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.

Suggested change
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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@maurelian maurelian closed this Sep 15, 2025
@maurelian
Copy link
Contributor Author

Replaced by #17465

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.

3 participants