1
1
import { expect } from "chai" ;
2
2
import { ethers } from "ethers" ;
3
3
import {
4
- EvmTokenRouter ,
5
4
EvmMatchingEngine ,
6
- errorDecoder ,
7
- OrderResponse ,
5
+ EvmTokenRouter ,
8
6
MessageDecoder ,
7
+ OrderResponse ,
8
+ errorDecoder ,
9
9
} from "../src" ;
10
- import { IERC20__factory } from "../src/types" ;
11
10
import {
12
11
ChainType ,
13
- parseLiquidityLayerEnvFile ,
14
12
CircleAttester ,
15
13
GuardianNetwork ,
16
14
LOCALHOSTS ,
@@ -20,21 +18,18 @@ import {
20
18
ValidNetwork ,
21
19
WALLET_PRIVATE_KEYS ,
22
20
burnAllUsdc ,
23
- mineWait ,
24
21
mine ,
25
- mintNativeUsdc ,
26
22
mineToGracePeriod ,
27
23
mineToPenaltyPeriod ,
24
+ mineWait ,
25
+ mintNativeUsdc ,
26
+ parseLiquidityLayerEnvFile ,
28
27
tryNativeToUint8Array ,
29
28
} from "../src/testing" ;
29
+ import { IERC20__factory } from "../src/types" ;
30
30
31
31
import { toChainId } from "@wormhole-foundation/sdk-base" ;
32
- import {
33
- deserialize ,
34
- keccak256 ,
35
- serializePayload ,
36
- toUniversal ,
37
- } from "@wormhole-foundation/sdk-definitions" ;
32
+ import { deserialize , keccak256 , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
38
33
import "@wormhole-foundation/sdk-evm" ;
39
34
40
35
// Cannot send a fast market order from the matching engine chain.
@@ -1163,7 +1158,6 @@ describe("Fast Market Order Business Logic -- CCTP to CCTP", function (this: Moc
1163
1158
) ;
1164
1159
} ) ;
1165
1160
} ) ;
1166
-
1167
1161
describe ( `No Auction - Deadline Exceeded` , ( ) => {
1168
1162
before ( `From Network -- Mint USDC` , async ( ) => {
1169
1163
if ( fromEnv . chainId == MATCHING_ENGINE_CHAIN ) {
@@ -1283,15 +1277,14 @@ describe("Fast Market Order Business Logic -- CCTP to CCTP", function (this: Moc
1283
1277
await mintNativeUsdc ( usdc , await initialBidder . getAddress ( ) , initialDeposit ) ;
1284
1278
await usdc . approve ( engine . address , initialDeposit ) ;
1285
1279
1280
+ await mine ( engineProvider ) ;
1281
+ await sleep ( 1 ) ;
1282
+
1286
1283
let failedGracefully = false ;
1287
1284
const receipt = await engine
1288
1285
. connect ( initialBidder . provider ! )
1289
1286
. placeInitialBid ( fastVaa , fastOrder . maxFee )
1290
- . then ( async ( txReq ) => {
1291
- txReq . nonce = await initialBidder . getNonce ( "pending" ) ;
1292
- return initialBidder . sendTransaction ( txReq ) ;
1293
- } )
1294
- . then ( ( tx ) => mineWait ( engineProvider , tx ) )
1287
+ . then ( async ( txReq ) => await initialBidder . sendTransaction ( txReq ) )
1295
1288
. catch ( ( err ) => {
1296
1289
const error = errorDecoder ( err ) ;
1297
1290
if ( error . selector == "ErrDeadlineExceeded" ) {
@@ -1319,14 +1312,14 @@ describe("Fast Market Order Business Logic -- CCTP to CCTP", function (this: Moc
1319
1312
const usdc = IERC20__factory . connect ( engineEnv . tokenAddress , engineProvider ) ;
1320
1313
const feeRecipientBefore = await usdc . balanceOf ( engineEnv . feeRecipient ! ) ;
1321
1314
1322
- await sleep ( 1 ) ;
1323
-
1324
1315
const receipt = await engine
1325
1316
. connect ( initialBidder . provider ! )
1326
1317
. executeSlowOrderAndRedeem ( fastVaa , params )
1327
1318
. then ( async ( txReq ) => {
1328
- //txReq.nonce = await initialBidder.getNonce("pending");
1329
- return initialBidder . sendTransaction ( txReq ) ;
1319
+ txReq . nonce = await initialBidder . getNonce ( ) ;
1320
+ // use `signer` here since the NonceManager fudges up nonce
1321
+ // because of the prior test's failed transaction
1322
+ return await initialBidder . signer . sendTransaction ( txReq ) ;
1330
1323
} )
1331
1324
. then ( ( tx ) => mineWait ( engineProvider , tx ) )
1332
1325
. catch ( ( err ) => {
0 commit comments