@@ -23,12 +23,23 @@ import {
23
23
} from "../../src/svm/web3-v1" ;
24
24
import { testAcrossPlusMessage } from "./utils" ;
25
25
26
- const { provider, connection, program, owner, chainId, seedBalance, initializeState } = common ;
27
- const { recipient, setCurrentTime, assertSE, assert } = common ;
26
+ const {
27
+ provider,
28
+ connection,
29
+ program,
30
+ owner,
31
+ chainId,
32
+ seedBalance,
33
+ initializeState,
34
+ recipient,
35
+ setCurrentTime,
36
+ assertSE,
37
+ assert,
38
+ } = common ;
28
39
29
40
describe ( "svm_spoke.slow_fill" , ( ) => {
30
41
anchor . setProvider ( provider ) ;
31
- const payer = ( anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ) . payer ;
42
+ const { payer } = anchor . AnchorProvider . env ( ) . wallet as anchor . Wallet ;
32
43
const relayer = Keypair . generate ( ) ;
33
44
const otherRelayer = Keypair . generate ( ) ;
34
45
const { encodedMessage, fillRemainingAccounts } = testAcrossPlusMessage ( ) ;
@@ -50,7 +61,7 @@ describe("svm_spoke.slow_fill", () => {
50
61
51
62
const initialMintAmount = 10_000_000_000 ;
52
63
53
- async function updateRelayData ( newRelayData : SlowFillLeaf [ "relayData" ] ) {
64
+ const updateRelayData = async ( newRelayData : SlowFillLeaf [ "relayData" ] ) => {
54
65
relayData = newRelayData ;
55
66
const relayHashUint8Array = calculateRelayHashUint8Array ( relayData , chainId ) ;
56
67
[ fillStatus ] = PublicKey . findProgramAddressSync ( [ Buffer . from ( "fills" ) , relayHashUint8Array ] , program . programId ) ;
@@ -69,6 +80,7 @@ describe("svm_spoke.slow_fill", () => {
69
80
} ;
70
81
fillAccounts = {
71
82
state,
83
+ delegate : getFillRelayDelegatePda ( relayHashUint8Array , new BN ( 1 ) , relayer . publicKey , program . programId ) . pda ,
72
84
signer : relayer . publicKey ,
73
85
instructionParams : program . programId ,
74
86
mint : mint ,
@@ -79,7 +91,7 @@ describe("svm_spoke.slow_fill", () => {
79
91
associatedTokenProgram : ASSOCIATED_TOKEN_PROGRAM_ID ,
80
92
systemProgram : anchor . web3 . SystemProgram . programId ,
81
93
} ;
82
- }
94
+ } ;
83
95
84
96
const relaySlowFillRootBundle = async (
85
97
slowRelayLeafRecipient = recipient ,
@@ -118,7 +130,7 @@ describe("svm_spoke.slow_fill", () => {
118
130
const leaf = slowRelayLeafs [ 0 ] ;
119
131
120
132
let stateAccountData = await program . account . state . fetch ( state ) ;
121
- const rootBundleId = stateAccountData . rootBundleId ;
133
+ const { rootBundleId } = stateAccountData ;
122
134
123
135
const rootBundleIdBuffer = Buffer . alloc ( 4 ) ;
124
136
rootBundleIdBuffer . writeUInt32LE ( rootBundleId ) ;
@@ -213,7 +225,9 @@ describe("svm_spoke.slow_fill", () => {
213
225
Object . entries ( relayData ) . forEach ( ( [ key , value ] ) => {
214
226
if ( key === "message" ) {
215
227
assertSE ( event . messageHash , hashNonEmptyMessage ( value as Buffer ) , `MessageHash should match` ) ;
216
- } else assertSE ( event [ key ] , value , `${ key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) } should match` ) ;
228
+ } else {
229
+ assertSE ( event [ key ] , value , `${ key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) } should match` ) ;
230
+ }
217
231
} ) ;
218
232
} ) ;
219
233
@@ -225,7 +239,7 @@ describe("svm_spoke.slow_fill", () => {
225
239
const approveIx = await createApproveCheckedInstruction (
226
240
fillAccounts . relayerTokenAccount ,
227
241
fillAccounts . mint ,
228
- getFillRelayDelegatePda ( relayHashUint8Array , seed , program . programId ) ,
242
+ getFillRelayDelegatePda ( relayHashUint8Array , new BN ( 1 ) , relayer . publicKey , program . programId ) . pda ,
229
243
fillAccounts . signer ,
230
244
BigInt ( relayData . outputAmount . toString ( ) ) ,
231
245
tokenDecimals
@@ -386,7 +400,9 @@ describe("svm_spoke.slow_fill", () => {
386
400
Object . entries ( relayData ) . forEach ( ( [ key , value ] ) => {
387
401
if ( key === "message" ) {
388
402
assertSE ( event . messageHash , hashNonEmptyMessage ( value as Buffer ) , `MessageHash should match` ) ;
389
- } else assertSE ( event [ key ] , value , `${ key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) } should match` ) ;
403
+ } else {
404
+ assertSE ( event [ key ] , value , `${ key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 ) } should match` ) ;
405
+ }
390
406
} ) ;
391
407
// RelayExecutionInfo should match.
392
408
assertSE ( event . relayExecutionInfo . updatedRecipient , relayData . recipient , "UpdatedRecipient should match" ) ;
0 commit comments