Skip to content

Commit f172916

Browse files
committed
fix test
1 parent bc277ed commit f172916

File tree

1 file changed

+21
-48
lines changed

1 file changed

+21
-48
lines changed

test/MultisigProposal.t.sol

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,14 @@ pragma solidity ^0.8.0;
44
import {Test} from "@forge-std/Test.sol";
55

66
import {Addresses} from "@addresses/Addresses.sol";
7-
import {MultisigProposal} from "@proposals/MultisigProposal.sol";
7+
88
import {MockMultisigProposal} from "@mocks/MockMultisigProposal.sol";
9+
import {MultisigProposal} from "@proposals/MultisigProposal.sol";
910

1011
contract MultisigProposalIntegrationTest is Test {
1112
Addresses public addresses;
1213
MultisigProposal public proposal;
1314

14-
struct Call3Value {
15-
address target;
16-
bool allowFailure;
17-
uint256 value;
18-
bytes callData;
19-
}
20-
2115
function setUp() public {
2216
uint256[] memory chainIds = new uint256[](1);
2317
chainIds[0] = 1;
@@ -36,15 +30,9 @@ contract MultisigProposalIntegrationTest is Test {
3630
}
3731

3832
function test_setUp() public view {
33+
assertEq(proposal.name(), string("OPTMISM_MULTISIG_MOCK"), "Wrong proposal name");
3934
assertEq(
40-
proposal.name(),
41-
string("OPTMISM_MULTISIG_MOCK"),
42-
"Wrong proposal name"
43-
);
44-
assertEq(
45-
proposal.description(),
46-
string("Mock proposal that upgrade the L1 NFT Bridge"),
47-
"Wrong proposal description"
35+
proposal.description(), string("Mock proposal that upgrade the L1 NFT Bridge"), "Wrong proposal description"
4836
);
4937
}
5038

@@ -53,9 +41,7 @@ contract MultisigProposalIntegrationTest is Test {
5341
proposal.deploy();
5442
vm.stopPrank();
5543

56-
assertTrue(
57-
addresses.isAddressSet("OPTIMISM_L1_NFT_BRIDGE_IMPLEMENTATION")
58-
);
44+
assertTrue(addresses.isAddressSet("OPTIMISM_L1_NFT_BRIDGE_IMPLEMENTATION"));
5945
}
6046

6147
function test_build() public {
@@ -66,19 +52,11 @@ contract MultisigProposalIntegrationTest is Test {
6652

6753
proposal.build();
6854

69-
(
70-
address[] memory targets,
71-
uint256[] memory values,
72-
bytes[] memory calldatas
73-
) = proposal.getProposalActions();
55+
(address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = proposal.getProposalActions();
7456

7557
// check that the proposal targets are correct
7658
assertEq(targets.length, 1, "Wrong targets length");
77-
assertEq(
78-
targets[0],
79-
addresses.getAddress("OPTIMISM_PROXY_ADMIN"),
80-
"Wrong target at index 0"
81-
);
59+
assertEq(targets[0], addresses.getAddress("OPTIMISM_PROXY_ADMIN"), "Wrong target at index 0");
8260

8361
// check that the proposal values are correct
8462
assertEq(values.length, 1, "Wrong values length");
@@ -108,30 +86,25 @@ contract MultisigProposalIntegrationTest is Test {
10886
function test_getCalldata() public {
10987
test_build();
11088

111-
(
112-
address[] memory targets,
113-
uint256[] memory values,
114-
bytes[] memory calldatas
115-
) = proposal.getProposalActions();
116-
117-
Call3Value[] memory calls = new Call3Value[](targets.length);
118-
119-
for (uint256 i; i < calls.length; i++) {
120-
calls[i] = Call3Value({
121-
target: targets[i],
122-
allowFailure: false,
123-
value: values[i],
124-
callData: calldatas[i]
125-
});
89+
(address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = proposal.getProposalActions();
90+
91+
bytes memory encodedTxs;
92+
93+
for (uint256 i = 0; i < targets.length; i++) {
94+
uint8 operation = 0;
95+
address to = targets[i];
96+
uint256 value = values[i];
97+
bytes memory callData = calldatas[i];
98+
99+
encodedTxs =
100+
bytes.concat(encodedTxs, abi.encodePacked(operation, to, value, uint256(callData.length), callData));
126101
}
127102

128-
bytes memory expectedData = abi.encodeWithSignature(
129-
"aggregate3Value((address,bool,uint256,bytes)[])", calls
130-
);
103+
bytes memory expectedData = abi.encodeWithSignature("multiSend(bytes)", encodedTxs);
131104

132105
bytes memory data = proposal.getCalldata();
133106

134-
assertEq(data, expectedData, "Wrong aggregate calldata");
107+
assertEq(data, expectedData, "Wrong multiSend calldata");
135108
}
136109

137110
function test_getProposalId() public {

0 commit comments

Comments
 (0)