From da6f9e38b4ae5384fcbb3dd25e8fe13f314993d8 Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Sat, 20 Jan 2024 11:46:13 -0800 Subject: [PATCH] test(`e2e`): add chain header tests back and fix admin tests (#1577) * add header test back * fix admin tests * update changelogs --- changelog.md | 9 ++++++--- cmd/zetae2e/local/admin.go | 2 +- cmd/zetae2e/local/bitcoin.go | 2 +- cmd/zetae2e/local/ethereum.go | 2 +- cmd/zetae2e/local/local.go | 6 +++++- .../smoketest/smoketests/test_pause_zrc20.go | 12 ++++++------ 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index 26932679a2..01b77c5681 100644 --- a/changelog.md +++ b/changelog.md @@ -2,9 +2,9 @@ ## Unreleased -### Chores +### Tests -* [1585](https://github.com/zeta-chain/node/pull/1585) - Updated release instructions +* [1577](https://github.com/zeta-chain/node/pull/1577) - add chain header tests in E2E tests and fix admin tests ### Features @@ -13,8 +13,11 @@ * [1535](https://github.com/zeta-chain/node/issues/1535) - Avoid voting on wrong ballots due to false blockNumber in EVM tx receipt * [1588](https://github.com/zeta-chain/node/pull/1588) - fix chain params comparison logic -## Version: v12.0.0 +### Chores + +* [1585](https://github.com/zeta-chain/node/pull/1585) - Updated release instructions +## Version: v12.0.0 ### Breaking Changes diff --git a/cmd/zetae2e/local/admin.go b/cmd/zetae2e/local/admin.go index 01e5d3ae8f..34900fbaf4 100644 --- a/cmd/zetae2e/local/admin.go +++ b/cmd/zetae2e/local/admin.go @@ -66,7 +66,7 @@ func adminTestRoutine( smoketests.TestUpdateBytecodeName, smoketests.TestDepositEtherLiquidityCapName, ); err != nil { - return fmt.Errorf("admim tests failed: %v", err) + return fmt.Errorf("admin tests failed: %v", err) } adminRunner.Logger.Print("🍾 admin tests completed in %s", time.Since(startTime).String()) diff --git a/cmd/zetae2e/local/bitcoin.go b/cmd/zetae2e/local/bitcoin.go index a27d619138..eaf700465e 100644 --- a/cmd/zetae2e/local/bitcoin.go +++ b/cmd/zetae2e/local/bitcoin.go @@ -59,7 +59,7 @@ func bitcoinTestRoutine( bitcoinRunner.WaitForMinedCCTX(txERC20Deposit) bitcoinRunner.SetupBitcoinAccount(initBitcoinNetwork) - bitcoinRunner.DepositBTC(false) + bitcoinRunner.DepositBTC(true) // run bitcoin test // Note: due to the extensive block generation in Bitcoin localnet, block header test is run first diff --git a/cmd/zetae2e/local/ethereum.go b/cmd/zetae2e/local/ethereum.go index 74a57a6470..90d6a35dfb 100644 --- a/cmd/zetae2e/local/ethereum.go +++ b/cmd/zetae2e/local/ethereum.go @@ -47,7 +47,7 @@ func ethereumTestRoutine( startTime := time.Now() // depositing the necessary tokens on ZetaChain - txEtherDeposit := ethereumRunner.DepositEther(false) + txEtherDeposit := ethereumRunner.DepositEther(true) ethereumRunner.WaitForMinedCCTX(txEtherDeposit) // run ethereum test diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index f1a723f26e..b31c6869d4 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -135,7 +135,11 @@ func localE2ETest(cmd *cobra.Command, _ []string) { } testStartTime := time.Now() - logger.Print("starting tests") + logger.Print("starting E2E tests") + + if testAdmin { + logger.Print("⚠️ admin tests enabled") + } // start timer go func() { diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go index 5b6a9700b1..f3579990f2 100644 --- a/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go @@ -28,7 +28,7 @@ func TestPauseZRC20(sm *runner.SmokeTestRunner) { if receipt.Status == 0 { panic("Vault approval should succeed") } - tx, err = sm.BTCZRC20.Approve(sm.ZevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err = sm.USDTZRC20.Approve(sm.ZevmAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } @@ -93,23 +93,23 @@ func TestPauseZRC20(sm *runner.SmokeTestRunner) { } sm.Logger.Info("Operations all failed") - // Check we can still interact with BTC ZRC20 + // Check we can still interact with USDT ZRC20 sm.Logger.Info("Check other ZRC20 can still be operated") - tx, err = sm.BTCZRC20.Transfer(sm.ZevmAuth, sample.EthAddress(), big.NewInt(1e3)) + tx, err = sm.USDTZRC20.Transfer(sm.ZevmAuth, sample.EthAddress(), big.NewInt(1e3)) if err != nil { panic(err) } receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout) if receipt.Status == 0 { - panic("BTC transfer should succeed") + panic("USDT transfer should succeed") } - tx, err = vaultContract.Deposit(sm.ZevmAuth, sm.BTCZRC20Addr, big.NewInt(1e3)) + tx, err = vaultContract.Deposit(sm.ZevmAuth, sm.USDTZRC20Addr, big.NewInt(1e3)) if err != nil { panic(err) } receipt = utils.MustWaitForTxReceipt(sm.Ctx, sm.ZevmClient, tx, sm.Logger, sm.ReceiptTimeout) if receipt.Status == 0 { - panic("BTC vault deposit should succeed") + panic("USDT vault deposit should succeed") } // Check deposit revert when paused