Skip to content

Commit

Permalink
add custom timeout for cctx and receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jan 1, 2024
1 parent acef618 commit e981a54
Show file tree
Hide file tree
Showing 20 changed files with 136 additions and 106 deletions.
5 changes: 4 additions & 1 deletion cmd/zetae2e/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ func NewRootCmd() *cobra.Command {
Use: "zetae2e",
Short: "E2E tests CLI",
}
cmd.AddCommand(local.NewLocalCmd())
cmd.AddCommand(
NewRunCmd(),
local.NewLocalCmd(),
)

return cmd
}
10 changes: 5 additions & 5 deletions contrib/localnet/orchestrator/smoketest/runner/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (sm *SmokeTestRunner) WaitForTxReceiptOnEvm(tx *ethtypes.Transaction) {
}()
sm.Lock()

receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("tx failed")
}
Expand All @@ -42,7 +42,7 @@ func (sm *SmokeTestRunner) MintUSDTOnEvm(amountUSDT int64) {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("mint failed")
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func (sm *SmokeTestRunner) DepositERC20WithAmountAndMessage(amount *big.Int, msg
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("approve failed")
}
Expand All @@ -94,7 +94,7 @@ func (sm *SmokeTestRunner) DepositERC20WithAmountAndMessage(amount *big.Int, msg
if err != nil {
panic(err)
}
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposit failed")
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func (sm *SmokeTestRunner) DepositEther(testHeader bool) ethcommon.Hash {
}

sm.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce())
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposit failed")
}
Expand Down
4 changes: 4 additions & 0 deletions contrib/localnet/orchestrator/smoketest/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ type SmokeTestRunner struct {
SystemContractAddr ethcommon.Address
SystemContract *systemcontract.SystemContract

// config
CctxTimeout time.Duration
ReceiptTimeout time.Duration

// other
Name string
Ctx context.Context
Expand Down
16 changes: 8 additions & 8 deletions contrib/localnet/orchestrator/smoketest/runner/setup_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,22 @@ func (sm *SmokeTestRunner) SetupEVM(contractsDeployed bool) {
sm.Logger.Info("TestDApp contract address: %s, tx hash: %s", appAddr.Hex(), txApp.Hash().Hex())

// check contract deployment receipt
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txDonation, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txDonation, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("GOERLI donation tx failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txZetaEth, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txZetaEth, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("ZetaEth deployment failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txConnector, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txConnector, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("ZetaConnectorEth deployment failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txCustody, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txCustody, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("ERC20Custody deployment failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txUSDT, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txUSDT, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("USDT deployment failed")
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txApp, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txApp, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("TestDApp deployment failed")
}
Expand All @@ -162,7 +162,7 @@ func (sm *SmokeTestRunner) SetupEVM(contractsDeployed bool) {
if err != nil {
panic(err)
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txWhitelist, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txWhitelist, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("USDT whitelist failed")
}

Expand All @@ -171,7 +171,7 @@ func (sm *SmokeTestRunner) SetupEVM(contractsDeployed bool) {
if err != nil {
panic(err)
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txCustody, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, txCustody, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("USDT update TSS address failed")
}
sm.Logger.Info("TSS set receipt tx hash: %s", txCustody.Hash().Hex())
Expand Down
4 changes: 2 additions & 2 deletions contrib/localnet/orchestrator/smoketest/runner/setup_zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (sm *SmokeTestRunner) SetupZEVMSwapApp() {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("ZEVMSwapApp deployment failed")
}
Expand All @@ -134,7 +134,7 @@ func (sm *SmokeTestRunner) SetupContextApp() {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("ContextApp deployment failed")
}
Expand Down
6 changes: 3 additions & 3 deletions contrib/localnet/orchestrator/smoketest/runner/zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (sm *SmokeTestRunner) WaitForMinedCCTX(txHash ethcommon.Hash) {
}()
sm.Lock()

cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, txHash.Hex(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, txHash.Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined {
panic(fmt.Sprintf("expected cctx status to be mined; got %s, message: %s",
cctx.CctxStatus.Status.String(),
Expand Down Expand Up @@ -62,7 +62,7 @@ func (sm *SmokeTestRunner) DepositZeta() ethcommon.Hash {
panic(err)
}
sm.Logger.Info("Approve tx hash: %s", tx.Hash().Hex())
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("approve tx failed")
}
Expand All @@ -83,7 +83,7 @@ func (sm *SmokeTestRunner) DepositZeta() ethcommon.Hash {
}

sm.Logger.Info("Send tx hash: %s", tx.Hash().Hex())
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic(fmt.Sprintf("expected tx receipt status to be 1; got %d", receipt.Status))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func WithdrawBitcoin(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic(fmt.Errorf("approve receipt status is not 1"))
}
Expand All @@ -37,7 +37,7 @@ func WithdrawBitcoin(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic(fmt.Errorf("withdraw receipt status is not 1"))
}
Expand All @@ -48,7 +48,7 @@ func WithdrawBitcoin(sm *runner.SmokeTestRunner) {
panic(err)
}

cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, receipt.TxHash.Hex(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, receipt.TxHash.Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash
hash, err := chainhash.NewHashFromStr(outTxHash)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestContextUpgrade(sm *runner.SmokeTestRunner) {
}

sm.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce())
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status != 1 {
panic("tx failed")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
panic(err)
}

if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txCreatePair, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txCreatePair, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("create pair failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txUSDTApprove, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txUSDTApprove, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("usdt approve failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txBTCApprove, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txBTCApprove, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("btc approve failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txTransferETH, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txTransferETH, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("ETH ZRC20 transfer failed")
}
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txTransferBTC, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txTransferBTC, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("BTC ZRC20 transfer failed")
}

Expand All @@ -74,7 +74,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
panic(fmt.Sprintf("Error liq %s", err.Error()))
}

if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txAddLiquidity, sm.Logger); receipt.Status != 1 {
if receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, txAddLiquidity, sm.Logger, sm.ReceiptTimeout); receipt.Status != 1 {
panic("add liq receipt status is not 1")
}

Expand All @@ -93,7 +93,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
sm.Logger.Info("***** First test: USDT -> BTC")
// Should deposit USDT for swap, swap for BTC and withdraw BTC
txHash := sm.DepositERC20WithAmountAndMessage(big.NewInt(8e7), msg)
cctx1 := utils.WaitCctxMinedByInTxHash(sm.Ctx, txHash.Hex(), sm.CctxClient, sm.Logger)
cctx1 := utils.WaitCctxMinedByInTxHash(sm.Ctx, txHash.Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)

// check the cctx status
if cctx1.CctxStatus.Status != types.CctxStatus_OutboundMined {
Expand All @@ -108,7 +108,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
stop := sm.MineBlocks()

// cctx1 index acts like the inTxHash for the second cctx (the one that withdraws BTC)
cctx2 := utils.WaitCctxMinedByInTxHash(sm.Ctx, cctx1.Index, sm.CctxClient, sm.Logger)
cctx2 := utils.WaitCctxMinedByInTxHash(sm.Ctx, cctx1.Index, sm.CctxClient, sm.Logger, sm.CctxTimeout)

// check the cctx status
if cctx2.CctxStatus.Status != types.CctxStatus_OutboundMined {
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
panic(err)
}

cctx3 := utils.WaitCctxMinedByInTxHash(sm.Ctx, txID.String(), sm.CctxClient, sm.Logger)
cctx3 := utils.WaitCctxMinedByInTxHash(sm.Ctx, txID.String(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx3.CctxStatus.Status != types.CctxStatus_OutboundMined {
panic(fmt.Sprintf(
"expected outbound mined status; got %s, message: %s",
Expand All @@ -165,7 +165,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
sm.Logger.Info(" status %s", cctx3.CctxStatus.Status.String())
sm.Logger.Info(" status msg: %s", cctx3.CctxStatus.StatusMessage)

cctx4 := utils.WaitCctxMinedByInTxHash(sm.Ctx, cctx3.Index, sm.CctxClient, sm.Logger)
cctx4 := utils.WaitCctxMinedByInTxHash(sm.Ctx, cctx3.Index, sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx4.CctxStatus.Status != types.CctxStatus_OutboundMined {
panic(fmt.Sprintf(
"expected outbound mined status; got %s, message: %s",
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestCrosschainSwap(sm *runner.SmokeTestRunner) {
panic(err)
}

cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, txid.String(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, txid.String(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
sm.Logger.Info("cctx3 index %s", cctx.Index)
sm.Logger.Info(" inbound tx hash %s", cctx.InboundTxParams.InboundTxObservedHash)
sm.Logger.Info(" status %s", cctx.CctxStatus.Status.String())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func TestEtherDepositAndCall(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("tx failed")
}
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined {
panic(fmt.Sprintf("expected cctx status to be mined; got %s", cctx.CctxStatus.Status))
}
Expand Down Expand Up @@ -109,11 +109,11 @@ func TestEtherDepositAndCall(sm *runner.SmokeTestRunner) {
panic(err)
}

receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("tx failed")
}
cctx = utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
cctx = utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
panic(fmt.Sprintf("expected cctx status to be reverted; got %s", cctx.CctxStatus.Status))
}
Expand Down Expand Up @@ -164,15 +164,15 @@ func TestDepositAndCallRefund(sm *runner.SmokeTestRunner) {
panic(err)
}
sm.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce())
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
sm.Logger.Info("GOERLI tx receipt: %d", receipt.Status)
sm.Logger.Info(" tx hash: %s", receipt.TxHash.String())
sm.Logger.Info(" to: %s", signedTx.To().String())
sm.Logger.Info(" value: %d", signedTx.Value())
sm.Logger.Info(" block num: %d", receipt.BlockNumber)

func() {
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
sm.Logger.Info("cctx status message: %s", cctx.CctxStatus.StatusMessage)
revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash
sm.Logger.Info("GOERLI revert tx receipt: status %d", receipt.Status)
Expand Down Expand Up @@ -249,11 +249,11 @@ func TestDepositEtherLiquidityCap(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposit eth tx failed")
}
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
cctx := utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
panic(fmt.Sprintf("expected cctx status to be Reverted; got %s", cctx.CctxStatus.Status))
}
Expand All @@ -268,11 +268,11 @@ func TestDepositEtherLiquidityCap(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposit eth tx failed")
}
utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
expectedBalance := big.NewInt(0).Add(initialBal, big.NewInt(1e15))

bal, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress)
Expand Down Expand Up @@ -303,11 +303,11 @@ func TestDepositEtherLiquidityCap(sm *runner.SmokeTestRunner) {
if err != nil {
panic(err)
}
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, signedTx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposit eth tx failed")
}
utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger)
utils.WaitCctxMinedByInTxHash(sm.Ctx, signedTx.Hash().Hex(), sm.CctxClient, sm.Logger, sm.CctxTimeout)
expectedBalance = big.NewInt(0).Add(initialBal, big.NewInt(1e17))

bal, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestMultipleERC20Deposit(sm *runner.SmokeTestRunner) {
panic(err)
}
txhash := MultipleDeposits(sm, big.NewInt(1e9), big.NewInt(3))
cctxs := utils.WaitCctxsMinedByInTxHash(sm.Ctx, txhash.Hex(), sm.CctxClient, 3, sm.Logger)
cctxs := utils.WaitCctxsMinedByInTxHash(sm.Ctx, txhash.Hex(), sm.CctxClient, 3, sm.Logger, sm.CctxTimeout)
if len(cctxs) != 3 {
panic(fmt.Sprintf("cctxs length is not correct: %d", len(cctxs)))
}
Expand Down Expand Up @@ -51,7 +51,7 @@ func MultipleDeposits(sm *runner.SmokeTestRunner, amount, count *big.Int) ethcom
if err != nil {
panic(err)
}
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt := utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("approve failed")
}
Expand All @@ -62,7 +62,7 @@ func MultipleDeposits(sm *runner.SmokeTestRunner, amount, count *big.Int) ethcom
if err != nil {
panic(err)
}
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger)
receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.GoerliClient, tx, sm.Logger, sm.ReceiptTimeout)
if receipt.Status == 0 {
panic("deposits failed")
}
Expand Down
Loading

0 comments on commit e981a54

Please sign in to comment.