Skip to content

Commit cec4f2e

Browse files
committed
Add additional isOperationReady check in TimelockController
1 parent 52188a2 commit cec4f2e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 4.3.1
4+
5+
* `TimelockController`: Add additional isOperationReady check.
6+
37
## 4.3.0 (2021-08-17)
48

59
* `ERC2771Context`: use private variable from storage to store the forwarder address. Fixes issues where `_msgSender()` was not callable from constructors. ([#2754](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2754))
@@ -95,6 +99,10 @@ Make sure you're using git or another version control system to be able to recov
9599

96100
Some further changes have been done between the different beta iterations. Transitions made during this period are configured in the `migrate-imports` script. Consequently, you can upgrade from any previous 4.0-beta.x version using the same script as described in the *How to upgrade from 3.x* section.
97101

102+
## 3.4.2
103+
104+
* `TimelockController`: Add additional isOperationReady check.
105+
98106
## 3.4.1 (2021-03-03)
99107

100108
* `ERC721`: made `_approve` an internal function (was private).

contracts/governance/TimelockController.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ contract TimelockController is AccessControl {
268268
bytes32 salt
269269
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
270270
bytes32 id = hashOperation(target, value, data, predecessor, salt);
271-
_beforeCall(predecessor);
271+
_beforeCall(id, predecessor);
272272
_call(id, 0, target, value, data);
273273
_afterCall(id);
274274
}
@@ -293,7 +293,7 @@ contract TimelockController is AccessControl {
293293
require(targets.length == datas.length, "TimelockController: length mismatch");
294294

295295
bytes32 id = hashOperationBatch(targets, values, datas, predecessor, salt);
296-
_beforeCall(predecessor);
296+
_beforeCall(id, predecessor);
297297
for (uint256 i = 0; i < targets.length; ++i) {
298298
_call(id, i, targets[i], values[i], datas[i]);
299299
}
@@ -303,7 +303,8 @@ contract TimelockController is AccessControl {
303303
/**
304304
* @dev Checks before execution of an operation's calls.
305305
*/
306-
function _beforeCall(bytes32 predecessor) private view {
306+
function _beforeCall(bytes32 id, bytes32 predecessor) private view {
307+
require(isOperationReady(id), "TimelockController: operation is not ready");
307308
require(predecessor == bytes32(0) || isOperationDone(predecessor), "TimelockController: missing dependency");
308309
}
309310

0 commit comments

Comments
 (0)