11import { expect } from "chai" ;
22import { ethers } from "ethers" ;
33import {
4- EvmTokenRouter ,
54 EvmMatchingEngine ,
6- errorDecoder ,
7- OrderResponse ,
5+ EvmTokenRouter ,
86 MessageDecoder ,
7+ OrderResponse ,
8+ errorDecoder ,
99} from "../src" ;
10- import { IERC20__factory } from "../src/types" ;
1110import {
1211 ChainType ,
13- parseLiquidityLayerEnvFile ,
1412 CircleAttester ,
1513 GuardianNetwork ,
1614 LOCALHOSTS ,
@@ -20,21 +18,18 @@ import {
2018 ValidNetwork ,
2119 WALLET_PRIVATE_KEYS ,
2220 burnAllUsdc ,
23- mineWait ,
2421 mine ,
25- mintNativeUsdc ,
2622 mineToGracePeriod ,
2723 mineToPenaltyPeriod ,
24+ mineWait ,
25+ mintNativeUsdc ,
26+ parseLiquidityLayerEnvFile ,
2827 tryNativeToUint8Array ,
2928} from "../src/testing" ;
29+ import { IERC20__factory } from "../src/types" ;
3030
3131import { 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" ;
3833import "@wormhole-foundation/sdk-evm" ;
3934
4035// 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
11631158 ) ;
11641159 } ) ;
11651160 } ) ;
1166-
11671161 describe ( `No Auction - Deadline Exceeded` , ( ) => {
11681162 before ( `From Network -- Mint USDC` , async ( ) => {
11691163 if ( fromEnv . chainId == MATCHING_ENGINE_CHAIN ) {
@@ -1283,15 +1277,14 @@ describe("Fast Market Order Business Logic -- CCTP to CCTP", function (this: Moc
12831277 await mintNativeUsdc ( usdc , await initialBidder . getAddress ( ) , initialDeposit ) ;
12841278 await usdc . approve ( engine . address , initialDeposit ) ;
12851279
1280+ await mine ( engineProvider ) ;
1281+ await sleep ( 1 ) ;
1282+
12861283 let failedGracefully = false ;
12871284 const receipt = await engine
12881285 . connect ( initialBidder . provider ! )
12891286 . 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 ) )
12951288 . catch ( ( err ) => {
12961289 const error = errorDecoder ( err ) ;
12971290 if ( error . selector == "ErrDeadlineExceeded" ) {
@@ -1319,14 +1312,14 @@ describe("Fast Market Order Business Logic -- CCTP to CCTP", function (this: Moc
13191312 const usdc = IERC20__factory . connect ( engineEnv . tokenAddress , engineProvider ) ;
13201313 const feeRecipientBefore = await usdc . balanceOf ( engineEnv . feeRecipient ! ) ;
13211314
1322- await sleep ( 1 ) ;
1323-
13241315 const receipt = await engine
13251316 . connect ( initialBidder . provider ! )
13261317 . executeSlowOrderAndRedeem ( fastVaa , params )
13271318 . 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 ) ;
13301323 } )
13311324 . then ( ( tx ) => mineWait ( engineProvider , tx ) )
13321325 . catch ( ( err ) => {
0 commit comments