Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
58308d2
feat: implement configureTimelockGuard function
maurelian Sep 8, 2025
52ade08
feat: implement clearTimelockGuard function
maurelian Sep 8, 2025
80073be
refactor: extract guard checking logic to internal helper function
maurelian Sep 8, 2025
b384a5b
feat: implement cancellationThreshold function
maurelian Sep 9, 2025
67ae93c
feat: add placeholder functions for remaining TimelockGuard functiona…
maurelian Sep 9, 2025
ff989db
Self review fixes
maurelian Sep 9, 2025
7ceb78f
Fix warnings on unimplemented functions
maurelian Sep 9, 2025
4e96f54
Fix names of test functions
maurelian Sep 9, 2025
edbc5fa
Satisfy semgrep by removing revert with string
maurelian Sep 9, 2025
41ba750
Remove arg names from unimplemented functions
maurelian Sep 9, 2025
86b557a
Snapshots
maurelian Sep 9, 2025
b88f9a8
Add interface
maurelian Sep 9, 2025
ebda4c5
Simplify cancellationThreshold() getter
maurelian Sep 10, 2025
53d9c70
Replace _getGuard with isGuardEnabled
maurelian Sep 10, 2025
f085e72
Allow a timelock delay of zero
maurelian Sep 10, 2025
0c607c1
TimelockGuard: Add scheduleTransaction()
maurelian Sep 11, 2025
f68f19b
Add todo note
maurelian Sep 11, 2025
b2611a2
Pseudocode draft of a non-nested timelock
Sep 15, 2025
1d3d11a
Remove signatures field from ExecTransactionParams
maurelian Sep 15, 2025
0f118d2
Refactor tests with improve utils (_getDummyTx, _getSignaturesForTx)
maurelian Sep 15, 2025
d38218f
Test for TransactionCancelled event
maurelian Sep 15, 2025
ec1970f
Further improve util functions
maurelian Sep 15, 2025
2f42f9b
Add approve hash test case
maurelian Sep 15, 2025
b981656
fix warnings
maurelian Sep 15, 2025
0449bca
Use correct typing for Safe addresses
maurelian Sep 15, 2025
a92bd12
Add additional scheduleTransaction tests
maurelian Sep 15, 2025
471cd83
Enable specifying which safeInstance in utility functions
maurelian Sep 15, 2025
f242c73
Change cancelTransaction to accept a tx hash
maurelian Sep 15, 2025
857887a
Add increaseCancellationThreshold to cancelTransaction
maurelian Sep 15, 2025
92b33ba
Add configured boolean to guard config
maurelian Sep 15, 2025
ed6156d
Fix signature reuse vulnerability in cancelTransaction
maurelian Sep 16, 2025
8bd999d
Move signature verification before existence check in scheduleTransac…
maurelian Sep 16, 2025
7fa271e
Remove unused console.logs
maurelian Sep 16, 2025
5f0d098
Fix increaseCancellationThreshold inputs
maurelian Sep 16, 2025
8522ae5
Separate cancellation threshold events from transaction cancellation
maurelian Sep 17, 2025
4fce42d
Remove unused _txHash argument from resetCancellation function
maurelian Sep 17, 2025
6f04021
Update ITimelockGuard to match implementation
maurelian Sep 17, 2025
158de39
Use configured flag instead of timelockDelay check in clearTimelockGuard
maurelian Sep 17, 2025
3d7d732
Add configuration check to scheduleTransaction and fix test names
maurelian Sep 17, 2025
21a8080
Implement checkTransaction
maurelian Sep 18, 2025
f4b9a4a
Add itest placeholder contract
maurelian Sep 18, 2025
6e69075
Add comment to checkAfterExecution body
maurelian Sep 18, 2025
19fdf81
pre-pr checks
maurelian Sep 18, 2025
c0eb50b
Remove GuardConfig.configured boolean field
maurelian Sep 18, 2025
2791608
Remove clearTimelockGuard
maurelian Sep 18, 2025
607b704
Add enumerableSet and get pending functionality
maurelian Sep 19, 2025
aba269e
Add getScheduledTransactions function and simple test
maurelian Sep 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions packages/contracts-bedrock/interfaces/safe/ITimelockGuard.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

library Enum {
type Operation is uint8;
}

library TimelockGuard {
struct GuardConfig {
uint256 timelockDelay;
}

struct ScheduledTransaction {
uint256 executionTime;
bool cancelled;
bool executed;
}
}

interface Interface {
struct ExecTransactionParams {
address to;
uint256 value;
bytes data;
Enum.Operation operation;
uint256 safeTxGas;
uint256 baseGas;
uint256 gasPrice;
address gasToken;
address payable refundReceiver;
}

error TimelockGuard_GuardNotConfigured();
error TimelockGuard_GuardNotEnabled();
error TimelockGuard_GuardStillEnabled();
error TimelockGuard_InvalidTimelockDelay();
error TimelockGuard_TransactionAlreadyCancelled();
error TimelockGuard_TransactionAlreadyScheduled();
error TimelockGuard_TransactionNotScheduled();

event CancellationThresholdUpdated(address indexed safe, uint256 oldThreshold, uint256 newThreshold);
event GuardConfigured(address indexed safe, uint256 timelockDelay);
event TransactionCancelled(address indexed safe, bytes32 indexed txId);
event TransactionScheduled(address indexed safe, bytes32 indexed txId, uint256 when);

function blockingThreshold(address) external pure returns (uint256);
function cancelTransaction(address _safe, bytes32 _txHash, uint256 _nonce, bytes memory _signatures) external;
function cancellationThreshold(address _safe) external view returns (uint256);
function checkAfterExecution(bytes32, bool) external;
function checkPendingTransactions(address) external pure returns (bytes32[] memory);
function checkTransaction(
address,
uint256 _value,
bytes memory,
Enum.Operation,
uint256,
uint256,
uint256,
address,
address payable,
bytes memory,
address
) external;
function configureTimelockGuard(uint256 _timelockDelay) external;
function getScheduledTransaction(address _safe, bytes32 _txHash)
external
view
returns (TimelockGuard.ScheduledTransaction memory);
function safeConfigs(address) external view returns (uint256 timelockDelay);
function scheduleTransaction(
address _safe,
uint256 _nonce,
ExecTransactionParams memory _params,
bytes memory _signatures
) external;
function version() external view returns (string memory);
function viewTimelockGuardConfiguration(address _safe) external view returns (TimelockGuard.GuardConfig memory);
}
Loading