1
1
// SPDX-License-Identifier: Apache 2
2
2
3
- pragma solidity ^ 0.8.12 ;
3
+ pragma solidity ^ 0.8.0 ;
4
4
5
5
import "forge-std/Test.sol " ;
6
6
import "@pythnetwork/entropy-sdk-solidity/EntropyStructs.sol " ;
@@ -61,7 +61,11 @@ contract ExecutorTest is Test, WormholeTestUtils {
61
61
62
62
uint32 c = callable.fooCount ();
63
63
assertEq (callable.lastCaller (), address (bytes20 (0 )));
64
- testExecute (address (callable), abi.encodeCall (ICallable.foo, ()), 1 );
64
+ testExecute (
65
+ address (callable),
66
+ abi.encodeWithSelector (ICallable.foo.selector ),
67
+ 1
68
+ );
65
69
assertEq (callable.fooCount (), c + 1 );
66
70
assertEq (callable.lastCaller (), address (executor));
67
71
// Sanity check to make sure the check above is meaningful.
@@ -75,7 +79,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
75
79
assertEq (callable.lastCaller (), address (bytes20 (0 )));
76
80
testExecute (
77
81
address (callable),
78
- abi.encodeCall (ICallable.fooWithArgs, ( 17 ) ),
82
+ abi.encodeWithSelector (ICallable.fooWithArgs. selector , 17 ),
79
83
1
80
84
);
81
85
assertEq (callable.fooCount (), c + 17 );
@@ -86,7 +90,11 @@ contract ExecutorTest is Test, WormholeTestUtils {
86
90
87
91
function testCallerAddress () public {
88
92
uint32 c = callable.fooCount ();
89
- testExecute (address (callable), abi.encodeCall (ICallable.foo, ()), 1 );
93
+ testExecute (
94
+ address (callable),
95
+ abi.encodeWithSelector (ICallable.foo.selector ),
96
+ 1
97
+ );
90
98
assertEq (callable.fooCount (), c + 1 );
91
99
}
92
100
@@ -107,7 +115,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
107
115
CHAIN_ID,
108
116
address (executor),
109
117
address (callable),
110
- abi.encodeCall (ICallable.foo, () )
118
+ abi.encodeWithSelector (ICallable.foo. selector )
111
119
);
112
120
113
121
bytes memory vaa = forgeVaa (
@@ -134,7 +142,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
134
142
CHAIN_ID,
135
143
address (executor),
136
144
address (callable),
137
- abi.encodeCall (ICallable.foo, () )
145
+ abi.encodeWithSelector (ICallable.foo. selector )
138
146
);
139
147
140
148
bytes memory vaa = generateVaa (
@@ -158,7 +166,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
158
166
CHAIN_ID,
159
167
address (executor),
160
168
address (callable),
161
- abi.encodeCall (ICallable.foo, () )
169
+ abi.encodeWithSelector (ICallable.foo. selector )
162
170
);
163
171
164
172
bytes memory vaa = generateVaa (
@@ -175,7 +183,11 @@ contract ExecutorTest is Test, WormholeTestUtils {
175
183
}
176
184
177
185
function testOutOfOrder () public {
178
- testExecute (address (callable), abi.encodeCall (ICallable.foo, ()), 3 );
186
+ testExecute (
187
+ address (callable),
188
+ abi.encodeWithSelector (ICallable.foo.selector ),
189
+ 3
190
+ );
179
191
180
192
bytes memory payload = abi.encodePacked (
181
193
uint32 (0x5054474d ),
@@ -184,7 +196,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
184
196
CHAIN_ID,
185
197
address (executor),
186
198
address (callable),
187
- abi.encodeCall (ICallable.foo, () )
199
+ abi.encodeWithSelector (ICallable.foo. selector )
188
200
);
189
201
190
202
bytes memory vaa = generateVaa (
@@ -200,7 +212,11 @@ contract ExecutorTest is Test, WormholeTestUtils {
200
212
executor.execute (vaa);
201
213
202
214
callable.reset ();
203
- testExecute (address (callable), abi.encodeCall (ICallable.foo, ()), 4 );
215
+ testExecute (
216
+ address (callable),
217
+ abi.encodeWithSelector (ICallable.foo.selector ),
218
+ 4
219
+ );
204
220
assertEq (callable.fooCount (), 1 );
205
221
}
206
222
@@ -212,7 +228,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
212
228
CHAIN_ID,
213
229
address (executor),
214
230
address (callable),
215
- abi.encodeCall (ICallable.foo, () )
231
+ abi.encodeWithSelector (ICallable.foo. selector )
216
232
);
217
233
218
234
bytes memory shortPayload = BytesLib.slice (
@@ -241,7 +257,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
241
257
uint16 (3 ),
242
258
address (executor),
243
259
address (callable),
244
- abi.encodeCall (ICallable.foo, () )
260
+ abi.encodeWithSelector (ICallable.foo. selector )
245
261
);
246
262
247
263
bytes memory vaa = generateVaa (
@@ -265,7 +281,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
265
281
CHAIN_ID,
266
282
address (0x1 ),
267
283
address (callable),
268
- abi.encodeCall (ICallable.foo, () )
284
+ abi.encodeWithSelector (ICallable.foo. selector )
269
285
);
270
286
271
287
bytes memory vaa = generateVaa (
@@ -289,7 +305,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
289
305
CHAIN_ID,
290
306
address (executor),
291
307
address (callable),
292
- abi.encodeCall (ICallable.foo, () )
308
+ abi.encodeWithSelector (ICallable.foo. selector )
293
309
);
294
310
295
311
bytes memory vaa = generateVaa (
@@ -313,7 +329,7 @@ contract ExecutorTest is Test, WormholeTestUtils {
313
329
CHAIN_ID,
314
330
address (executor),
315
331
address (callable),
316
- abi.encodeCall (ICallable.reverts, () )
332
+ abi.encodeWithSelector (ICallable.reverts. selector )
317
333
);
318
334
319
335
bytes memory vaa = generateVaa (
0 commit comments