Skip to content

Commit cc26765

Browse files
committed
feat: return proposalId and verify
1 parent 1f1314e commit cc26765

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

contracts/pods/PodExecutor.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract PodExecutor is CoreRef {
2020
bytes calldata data,
2121
bytes32 predecessor,
2222
bytes32 salt
23-
) public payable whenNotPaused {
23+
) public payable whenNotPaused returns (bytes32) {
2424
bytes32 proposalId = TimelockController(payable(timelock)).hashOperation(
2525
target,
2626
value,
@@ -30,6 +30,7 @@ contract PodExecutor is CoreRef {
3030
);
3131
TimelockController(payable(timelock)).execute(target, value, data, predecessor, salt);
3232
emit ExecuteTransaction(timelock, proposalId);
33+
return proposalId;
3334
}
3435

3536
/// @notice Execute a transaction which contains a set of actions which were batch scheduled on a timelock
@@ -40,7 +41,7 @@ contract PodExecutor is CoreRef {
4041
bytes[] calldata payloads,
4142
bytes32 predecessor,
4243
bytes32 salt
43-
) external payable whenNotPaused {
44+
) external payable whenNotPaused returns (bytes32) {
4445
bytes32 proposalId = TimelockController(payable(timelock)).hashOperationBatch(
4546
targets,
4647
values,
@@ -50,5 +51,6 @@ contract PodExecutor is CoreRef {
5051
);
5152
TimelockController(payable(timelock)).executeBatch(targets, values, payloads, predecessor, salt);
5253
emit ExecuteTransaction(timelock, proposalId);
54+
return proposalId;
5355
}
5456
}

contracts/test/integration/governance/PodOperation.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ contract PodOperationIntegrationTest is DSTest {
127127
values[1] = 0;
128128

129129
bytes32 predecessor = bytes32(0);
130-
bytes32 salt = bytes32(1);
130+
bytes32 salt = bytes32(uint256(1));
131131

132132
vm.prank(safe);
133133
timelockContract.scheduleBatch(targets, values, payloads, predecessor, salt, podConfig.minDelay);

contracts/test/unit/governance/PodExecutor.t.sol

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function dummyBatchProposals(address[] memory ethReceivers, uint256[] memory amo
3333
payloads[1] = abi.encodePacked(bytes4(keccak256(bytes("transfer(uint256)"))), amounts[1]);
3434

3535
bytes32 predecessor = bytes32(0);
36-
bytes32 salt = bytes32(0);
36+
bytes32 salt = bytes32(uint256(1));
3737
uint256 delay = 1;
3838
return (targets, values, payloads, predecessor, salt, delay);
3939
}
@@ -142,10 +142,8 @@ contract PodExecutorTest is DSTest {
142142
assertGt(timelock.getTimestamp(proposalId), 0);
143143

144144
// 3. Execute proposal through PodExecutor
145-
podExecutor.execute(address(timelock), target, value, payload, predecessor, salt);
146-
147-
// TODO: Verify proposalId is emitted in the event as expected
148-
// TODO: (maybe) Verify CallExecuted event is emitted
145+
bytes32 executedProposalId = podExecutor.execute(address(timelock), target, value, payload, predecessor, salt);
146+
assertEq(executedProposalId, proposalId);
149147

150148
// Verfiy state
151149
assertTrue(timelock.isOperation(proposalId));
@@ -200,10 +198,15 @@ contract PodExecutorTest is DSTest {
200198
assertGt(timelock.getTimestamp(proposalId), 0);
201199

202200
// 3. Execute proposal through PodExecutor
203-
podExecutor.executeBatch(address(timelock), targets, values, payloads, predecessor, salt);
204-
205-
// TODO: Verify proposalId is emitted in the event as expected
206-
// TODO: (maybe) Verify CallExecuted event is emitted
201+
bytes32 executedProposalId = podExecutor.executeBatch(
202+
address(timelock),
203+
targets,
204+
values,
205+
payloads,
206+
predecessor,
207+
salt
208+
);
209+
assertEq(executedProposalId, proposalId);
207210

208211
// Verfiy state
209212
assertTrue(timelock.isOperation(proposalId));

test/integration/tests/podExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const dummyBatchProposal = (dai: ERC20, receiverA: string, receiverB: string, am
3333
};
3434
};
3535

36-
describe('Tribal Council', function () {
36+
describe('Pod executor', function () {
3737
let contracts: NamedContracts;
3838
let contractAddresses: NamedAddresses;
3939
let e2eCoord: TestEndtoEndCoordinator;

0 commit comments

Comments
 (0)