9
9
10
10
agbinary "github.com/gagliardetto/binary"
11
11
solanago "github.com/gagliardetto/solana-go"
12
+ chainsel "github.com/smartcontractkit/chain-selectors"
12
13
"github.com/stretchr/testify/mock"
13
14
14
15
ccipcommon "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/common"
@@ -179,7 +180,13 @@ func TestExecutePluginCodecV1(t *testing.T) {
179
180
"accountIsWritableBitmap" : uint64 (2 ),
180
181
"TokenReceiver" : [32 ]byte (solanago .MustPublicKeyFromBase58 ("42Gia5bGsh8R2S44e37t9fsucap1qsgjr6GjBmWotgdF" ).Bytes ()),
181
182
}, nil ).Maybe ()
182
- cd := NewExecutePluginCodecV1 (ccipcommon .NewExtraDataCodec (mockExtraDataCodec , mockExtraDataCodec ))
183
+ registeredMockExtraDataCodecMap := map [string ]ccipcommon.SourceChainExtraDataCodec {
184
+ chainsel .FamilyEVM : mockExtraDataCodec ,
185
+ chainsel .FamilySolana : mockExtraDataCodec ,
186
+ }
187
+
188
+ edc := ccipcommon .ExtraDataCodec (registeredMockExtraDataCodecMap )
189
+ cd := NewExecutePluginCodecV1 (edc )
183
190
184
191
for _ , tc := range testCases {
185
192
t .Run (tc .name , func (t * testing.T ) {
@@ -219,6 +226,11 @@ func Test_DecodingExecuteReport(t *testing.T) {
219
226
"ComputeUnits" : uint32 (1000 ),
220
227
"accountIsWritableBitmap" : uint64 (2 ),
221
228
}, nil )
229
+ registeredMockExtraDataCodecMap := map [string ]ccipcommon.SourceChainExtraDataCodec {
230
+ chainsel .FamilyEVM : mockExtraDataCodec ,
231
+ chainsel .FamilySolana : mockExtraDataCodec ,
232
+ }
233
+
222
234
t .Run ("decode on-chain execute report" , func (t * testing.T ) {
223
235
chainSel := cciptypes .ChainSelector (rand .Uint64 ())
224
236
@@ -257,7 +269,8 @@ func Test_DecodingExecuteReport(t *testing.T) {
257
269
err = onChainReport .MarshalWithEncoder (encoder )
258
270
require .NoError (t , err )
259
271
260
- executeCodec := NewExecutePluginCodecV1 (ccipcommon .NewExtraDataCodec (mockExtraDataCodec , mockExtraDataCodec ))
272
+ edc := ccipcommon .ExtraDataCodec (registeredMockExtraDataCodecMap )
273
+ executeCodec := NewExecutePluginCodecV1 (edc )
261
274
decode , err := executeCodec .Decode (testutils .Context (t ), buf .Bytes ())
262
275
require .NoError (t , err )
263
276
@@ -273,7 +286,8 @@ func Test_DecodingExecuteReport(t *testing.T) {
273
286
274
287
t .Run ("decode Borsh encoded execute report" , func (t * testing.T ) {
275
288
ocrReport := randomExecuteReport (t , 124615329519749607 )
276
- cd := NewExecutePluginCodecV1 (ccipcommon .NewExtraDataCodec (mockExtraDataCodec , mockExtraDataCodec ))
289
+ edc := ccipcommon .ExtraDataCodec (registeredMockExtraDataCodecMap )
290
+ cd := NewExecutePluginCodecV1 (edc )
277
291
encodedReport , err := cd .Encode (testutils .Context (t ), ocrReport )
278
292
require .NoError (t , err )
279
293
0 commit comments