From 7c4bebe80d93b1474ca1913ddd24694e9de9c1d1 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Thu, 29 Feb 2024 23:55:02 -0600 Subject: [PATCH] removed unnecessary tests and made bitcoin withdrawal to restricted address a separate test --- cmd/zetae2e/local/bitcoin.go | 2 +- cmd/zetae2e/local/erc20.go | 1 - cmd/zetae2e/local/ethereum.go | 1 - e2e/e2etests/e2etests.go | 6 ++++++ e2e/e2etests/test_bitcoin_withdraw.go | 14 ++++++++------ 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cmd/zetae2e/local/bitcoin.go b/cmd/zetae2e/local/bitcoin.go index f82963285a..f5606eba20 100644 --- a/cmd/zetae2e/local/bitcoin.go +++ b/cmd/zetae2e/local/bitcoin.go @@ -66,8 +66,8 @@ func bitcoinTestRoutine( // to make it faster to catch up with the latest block header if err := bitcoinRunner.RunE2ETestsFromNames( e2etests.AllE2ETests, - e2etests.TestBitcoinDepositName, e2etests.TestBitcoinWithdrawName, + e2etests.TestBitcoinWithdrawRestrictedName, e2etests.TestZetaWithdrawBTCRevertName, e2etests.TestCrosschainSwapName, ); err != nil { diff --git a/cmd/zetae2e/local/erc20.go b/cmd/zetae2e/local/erc20.go index 2ae8041a67..c3dbc3f354 100644 --- a/cmd/zetae2e/local/erc20.go +++ b/cmd/zetae2e/local/erc20.go @@ -62,7 +62,6 @@ func erc20TestRoutine( // run erc20 test if err := erc20Runner.RunE2ETestsFromNames( e2etests.AllE2ETests, - e2etests.TestERC20DepositName, e2etests.TestERC20WithdrawName, e2etests.TestMultipleWithdrawsName, e2etests.TestERC20DepositAndCallRefundName, diff --git a/cmd/zetae2e/local/ethereum.go b/cmd/zetae2e/local/ethereum.go index e153fe90fa..eb615a315a 100644 --- a/cmd/zetae2e/local/ethereum.go +++ b/cmd/zetae2e/local/ethereum.go @@ -55,7 +55,6 @@ func ethereumTestRoutine( // to make it faster to catch up with the latest block header if err := ethereumRunner.RunE2ETestsFromNames( e2etests.AllE2ETests, - e2etests.TestEtherDepositName, e2etests.TestEtherWithdrawName, e2etests.TestEtherWithdrawRestrictedName, e2etests.TestContextUpgradeName, diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index dd68abdc29..6d9492bcba 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -16,6 +16,7 @@ const ( TestMessagePassingName = "message_passing" TestZRC20SwapName = "zrc20_swap" TestBitcoinWithdrawName = "bitcoin_withdraw" + TestBitcoinWithdrawRestrictedName = "bitcoin_withdraw_restricted" TestCrosschainSwapName = "crosschain_swap" TestMessagePassingRevertFailName = "message_passing_revert_fail" TestMessagePassingRevertSuccessName = "message_passing_revert_success" @@ -99,6 +100,11 @@ var AllE2ETests = []runner.E2ETest{ "withdraw BTC from ZEVM", TestBitcoinWithdraw, }, + { + TestBitcoinWithdrawRestrictedName, + "withdraw Bitcoin from ZEVM to restricted address", + TestBitcoinWithdrawRestricted, + }, { TestCrosschainSwapName, "testing Bitcoin ERC20 cross-chain swap", diff --git a/e2e/e2etests/test_bitcoin_withdraw.go b/e2e/e2etests/test_bitcoin_withdraw.go index 065adf63d8..6f302c1acf 100644 --- a/e2e/e2etests/test_bitcoin_withdraw.go +++ b/e2e/e2etests/test_bitcoin_withdraw.go @@ -14,17 +14,13 @@ import ( ) func TestBitcoinWithdraw(r *runner.E2ERunner) { - // start mining blocks - stop := r.MineBlocks() - // withdraw 0.01 BTC from ZRC20 to BTC address WithdrawBitcoin(r) +} +func TestBitcoinWithdrawRestricted(r *runner.E2ERunner) { // withdraw 0.01 BTC from ZRC20 to BTC restricted address WithdrawBitcoinRestricted(r) - - // stop mining - stop <- struct{}{} } func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) *btcjson.TxRawResult { @@ -38,6 +34,9 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) panic(fmt.Errorf("approve receipt status is not 1")) } + // mine blocks + stop := r.MineBlocks() + // withdraw 'amount' of BTC from ZRC20 to BTC address tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte(to.EncodeAddress()), amount) if err != nil { @@ -79,6 +78,9 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) r.Logger.Info(" ScriptPubKey: %s", txOut.ScriptPubKey.Hex) } + // stop mining + stop <- struct{}{} + return rawTx }