From 2174a7fb3c4b0448e8abab2915c341f34efcaf56 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 17:17:00 -0500 Subject: [PATCH 01/12] stop e2e test from erroring out if uniswap pair already exists --- e2e/e2etests/test_v2_deposit_and_call_swap.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/e2e/e2etests/test_v2_deposit_and_call_swap.go b/e2e/e2etests/test_v2_deposit_and_call_swap.go index ed71ed3c53..f1c84fb561 100644 --- a/e2e/e2etests/test_v2_deposit_and_call_swap.go +++ b/e2e/e2etests/test_v2_deposit_and_call_swap.go @@ -20,8 +20,11 @@ import ( func TestV2DepositAndCallSwap(r *runner.E2ERunner, _ []string) { // create tokens pair (erc20 and eth) tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) - require.NoError(r, err) - utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + if err != nil { + r.Logger.Print("ℹ️ create pair error", err.Error()) + } else { + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + } // approve router to spend tokens being swapped tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) From ffc9b1945e2312c6d1e26b12d4ea9fdd7b209e54 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 17:24:42 -0500 Subject: [PATCH 02/12] print error for pair exists revert --- e2e/e2etests/test_crosschain_swap.go | 2 +- e2e/e2etests/test_v2_deposit_and_call_swap.go | 2 +- e2e/e2etests/test_zrc20_swap.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index 813f2d76ed..b8ec437972 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -25,7 +25,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { // if the tx fails due to already initialized, it will be ignored _, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.BTCZRC20Addr) if err != nil { - r.Logger.Print("ℹ️ create pair error") + r.Logger.Print("ℹ️ create pair error %s", err.Error()) } txERC20ZRC20Approve, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) diff --git a/e2e/e2etests/test_v2_deposit_and_call_swap.go b/e2e/e2etests/test_v2_deposit_and_call_swap.go index f1c84fb561..fb0aafed4b 100644 --- a/e2e/e2etests/test_v2_deposit_and_call_swap.go +++ b/e2e/e2etests/test_v2_deposit_and_call_swap.go @@ -21,7 +21,7 @@ func TestV2DepositAndCallSwap(r *runner.E2ERunner, _ []string) { // create tokens pair (erc20 and eth) tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) if err != nil { - r.Logger.Print("ℹ️ create pair error", err.Error()) + r.Logger.Print("ℹ️ create pair error %s", err.Error()) } else { utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) } diff --git a/e2e/e2etests/test_zrc20_swap.go b/e2e/e2etests/test_zrc20_swap.go index 72819aabf8..dcf1a312c2 100644 --- a/e2e/e2etests/test_zrc20_swap.go +++ b/e2e/e2etests/test_zrc20_swap.go @@ -19,7 +19,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { // if the tx fails due to already initialized, it will be ignored tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) if err != nil { - r.Logger.Print("ℹ️ create pair error") + r.Logger.Print("ℹ️ create pair error %s", err.Error()) } else { utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) } From ae784d82d65ae9c0478058c3f8a667cfd7936461 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 19:51:54 -0500 Subject: [PATCH 03/12] match pending revert for v21 dtc dust amount withdraw --- ...tcoin_deposit_and_call_revert_with_dust.go | 11 +++++-- e2e/utils/zetacore.go | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go index cc5f5451dc..432b20c4d6 100644 --- a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go +++ b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go @@ -47,7 +47,12 @@ func TestBitcoinDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) // ASSERT // Now we want to make sure the cctx is aborted with expected error message - cctx := utils.WaitCctxAbortedByInboundHash(r.Ctx, r, txHash.String(), r.CctxClient) - require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) - require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) + + // cctx status would be pending revert if using v21 or before + cctx := utils.WaitCctxByStatusList(r.Ctx, r, txHash.String(), r.CctxClient, []crosschaintypes.CctxStatus{crosschaintypes.CctxStatus_Aborted, crosschaintypes.CctxStatus_PendingRevert}) + + if cctx.CctxStatus.Status == crosschaintypes.CctxStatus_Aborted { + require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) + require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) + } } diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index 34e53e61b0..b004148917 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -194,6 +194,22 @@ func MatchStatus(s crosschaintypes.CctxStatus) WaitOpts { }) } +// MatchStatusList is the WaitOpts that matches CCTX with the given status. +// It returns as soon as any of the status is matched. +func MatchStatusList(s []crosschaintypes.CctxStatus) WaitOpts { + return Matches(func(tx crosschaintypes.CrossChainTx) bool { + if tx.CctxStatus == nil { + return false + } + for _, s := range s { + if tx.CctxStatus.Status == s { + return true + } + } + return false + }) +} + // MatchReverted is the WaitOpts that matches reverted CCTX. func MatchReverted() WaitOpts { return Matches(func(tx crosschaintypes.CrossChainTx) bool { @@ -227,6 +243,20 @@ func WaitCctxRevertedByInboundHash( return cctxs[0] } +// WaitCctxByStatusList waits until cctx is in one of the given statuses. +func WaitCctxByStatusList( + ctx context.Context, + t require.TestingT, + hash string, + c CCTXClient, + status []crosschaintypes.CctxStatus, +) crosschaintypes.CrossChainTx { + cctx := WaitCctxByInboundHash(ctx, t, hash, c, MatchStatusList(status)) + require.Len(t, cctx, 1) + + return cctx[0] +} + // WaitCctxAbortedByInboundHash waits until cctx is aborted by inbound hash. func WaitCctxAbortedByInboundHash( ctx context.Context, From 86efefc38bd738545faff4f05e0e7523a488c5eb Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 22:14:29 -0500 Subject: [PATCH 04/12] remove dust withdraw from v21 previous version tests --- cmd/zetae2e/local/local.go | 93 ++++++++++--------- .../localnet/orchestrator/start-zetae2e.sh | 2 +- ...tcoin_deposit_and_call_revert_with_dust.go | 9 +- e2e/utils/zetacore.go | 14 --- 4 files changed, 54 insertions(+), 64 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index a752c0e388..28bd3c607b 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -25,28 +25,29 @@ import ( ) const ( - flagContractsDeployed = "deployed" - flagWaitForHeight = "wait-for" - FlagConfigFile = "config" - flagConfigOut = "config-out" - flagVerbose = "verbose" - flagTestAdmin = "test-admin" - flagTestPerformance = "test-performance" - flagTestCustom = "test-custom" - flagTestSolana = "test-solana" - flagTestTON = "test-ton" - flagSkipRegular = "skip-regular" - flagLight = "light" - flagSetupOnly = "setup-only" - flagSkipSetup = "skip-setup" - flagTestTSSMigration = "test-tss-migration" - flagSkipBitcoinSetup = "skip-bitcoin-setup" - flagSkipHeaderProof = "skip-header-proof" - flagTestV2 = "test-v2" - flagTestV2Migration = "test-v2-migration" - flagSkipTrackerCheck = "skip-tracker-check" - flagSkipPrecompiles = "skip-precompiles" - flagUpgradeContracts = "upgrade-contracts" + flagContractsDeployed = "deployed" + flagWaitForHeight = "wait-for" + FlagConfigFile = "config" + flagConfigOut = "config-out" + flagVerbose = "verbose" + flagTestAdmin = "test-admin" + flagTestPerformance = "test-performance" + flagTestCustom = "test-custom" + flagTestSolana = "test-solana" + flagTestTON = "test-ton" + flagSkipRegular = "skip-regular" + flagLight = "light" + flagSetupOnly = "setup-only" + flagSkipSetup = "skip-setup" + flagTestTSSMigration = "test-tss-migration" + flagSkipBitcoinSetup = "skip-bitcoin-setup" + flagSkipHeaderProof = "skip-header-proof" + flagTestV2 = "test-v2" + flagTestV2Migration = "test-v2-migration" + flagSkipTrackerCheck = "skip-tracker-check" + flagSkipPrecompiles = "skip-precompiles" + flagUpgradeContracts = "upgrade-contracts" + flagSkipBitcoinDustWithdraw = "skip-bitcoin-dust-withdraw" ) var ( @@ -86,6 +87,7 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagSkipPrecompiles, false, "set to true to skip stateful precompiled contracts test") cmd.Flags(). Bool(flagUpgradeContracts, false, "set to true to upgrade Gateways and ERC20Custody contracts during setup for ZEVM and EVM") + cmd.Flags().Bool(flagSkipBitcoinDustWithdraw, false, "set to true to skip tests that withdraw dust amount from Bitcoin") return cmd } @@ -95,27 +97,28 @@ func NewLocalCmd() *cobra.Command { func localE2ETest(cmd *cobra.Command, _ []string) { // fetch flags var ( - waitForHeight = must(cmd.Flags().GetInt64(flagWaitForHeight)) - contractsDeployed = must(cmd.Flags().GetBool(flagContractsDeployed)) - verbose = must(cmd.Flags().GetBool(flagVerbose)) - configOut = must(cmd.Flags().GetString(flagConfigOut)) - testAdmin = must(cmd.Flags().GetBool(flagTestAdmin)) - testPerformance = must(cmd.Flags().GetBool(flagTestPerformance)) - testCustom = must(cmd.Flags().GetBool(flagTestCustom)) - testSolana = must(cmd.Flags().GetBool(flagTestSolana)) - testTON = must(cmd.Flags().GetBool(flagTestTON)) - skipRegular = must(cmd.Flags().GetBool(flagSkipRegular)) - light = must(cmd.Flags().GetBool(flagLight)) - setupOnly = must(cmd.Flags().GetBool(flagSetupOnly)) - skipSetup = must(cmd.Flags().GetBool(flagSkipSetup)) - skipBitcoinSetup = must(cmd.Flags().GetBool(flagSkipBitcoinSetup)) - skipHeaderProof = must(cmd.Flags().GetBool(flagSkipHeaderProof)) - skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck)) - testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration)) - testV2 = must(cmd.Flags().GetBool(flagTestV2)) - testV2Migration = must(cmd.Flags().GetBool(flagTestV2Migration)) - skipPrecompiles = must(cmd.Flags().GetBool(flagSkipPrecompiles)) - upgradeContracts = must(cmd.Flags().GetBool(flagUpgradeContracts)) + waitForHeight = must(cmd.Flags().GetInt64(flagWaitForHeight)) + contractsDeployed = must(cmd.Flags().GetBool(flagContractsDeployed)) + verbose = must(cmd.Flags().GetBool(flagVerbose)) + configOut = must(cmd.Flags().GetString(flagConfigOut)) + testAdmin = must(cmd.Flags().GetBool(flagTestAdmin)) + testPerformance = must(cmd.Flags().GetBool(flagTestPerformance)) + testCustom = must(cmd.Flags().GetBool(flagTestCustom)) + testSolana = must(cmd.Flags().GetBool(flagTestSolana)) + testTON = must(cmd.Flags().GetBool(flagTestTON)) + skipRegular = must(cmd.Flags().GetBool(flagSkipRegular)) + light = must(cmd.Flags().GetBool(flagLight)) + setupOnly = must(cmd.Flags().GetBool(flagSetupOnly)) + skipSetup = must(cmd.Flags().GetBool(flagSkipSetup)) + skipBitcoinSetup = must(cmd.Flags().GetBool(flagSkipBitcoinSetup)) + skipHeaderProof = must(cmd.Flags().GetBool(flagSkipHeaderProof)) + skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck)) + testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration)) + testV2 = must(cmd.Flags().GetBool(flagTestV2)) + testV2Migration = must(cmd.Flags().GetBool(flagTestV2Migration)) + skipPrecompiles = must(cmd.Flags().GetBool(flagSkipPrecompiles)) + upgradeContracts = must(cmd.Flags().GetBool(flagUpgradeContracts)) + skipBitcoinDustWithdraw = must(cmd.Flags().GetBool(flagSkipBitcoinDustWithdraw)) ) logger := runner.NewLogger(verbose, color.FgWhite, "setup") @@ -323,7 +326,6 @@ func localE2ETest(cmd *cobra.Command, _ []string) { e2etests.TestBitcoinDepositName, e2etests.TestBitcoinDepositAndCallName, e2etests.TestBitcoinDepositAndCallRevertName, - e2etests.TestBitcoinDepositAndCallRevertWithDustName, e2etests.TestBitcoinStdMemoDepositName, e2etests.TestBitcoinStdMemoDepositAndCallName, e2etests.TestBitcoinStdMemoDepositAndCallRevertName, @@ -331,6 +333,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { e2etests.TestBitcoinStdMemoInscribedDepositAndCallName, e2etests.TestCrosschainSwapName, } + if !skipBitcoinDustWithdraw { + bitcoinDepositTests = append(bitcoinDepositTests, e2etests.TestBitcoinDepositAndCallRevertWithDustName) + } bitcoinWithdrawTests := []string{ e2etests.TestBitcoinWithdrawSegWitName, e2etests.TestBitcoinWithdrawInvalidAddressName, diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 5d8c9c5586..71c3e29a60 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -222,7 +222,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then echo "running E2E command to setup the networks and populate the state..." # Use light flag to ensure tests can complete before the upgrade height - zetae2e local $E2E_ARGS --skip-setup --config "$deployed_config_path" --light --skip-precompiles ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config "$deployed_config_path" --light --skip-precompiles --skip-bitcoin-dust-withdraw ${COMMON_ARGS} if [ $? -ne 0 ]; then echo "first e2e failed" exit 1 diff --git a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go index 432b20c4d6..e2a3040446 100644 --- a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go +++ b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go @@ -49,10 +49,9 @@ func TestBitcoinDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) // Now we want to make sure the cctx is aborted with expected error message // cctx status would be pending revert if using v21 or before - cctx := utils.WaitCctxByStatusList(r.Ctx, r, txHash.String(), r.CctxClient, []crosschaintypes.CctxStatus{crosschaintypes.CctxStatus_Aborted, crosschaintypes.CctxStatus_PendingRevert}) + cctx := utils.WaitCctxAbortedByInboundHash(r.Ctx, r, txHash.String(), r.CctxClient) + + require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) + require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) - if cctx.CctxStatus.Status == crosschaintypes.CctxStatus_Aborted { - require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) - require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) - } } diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index b004148917..b4206383be 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -243,20 +243,6 @@ func WaitCctxRevertedByInboundHash( return cctxs[0] } -// WaitCctxByStatusList waits until cctx is in one of the given statuses. -func WaitCctxByStatusList( - ctx context.Context, - t require.TestingT, - hash string, - c CCTXClient, - status []crosschaintypes.CctxStatus, -) crosschaintypes.CrossChainTx { - cctx := WaitCctxByInboundHash(ctx, t, hash, c, MatchStatusList(status)) - require.Len(t, cctx, 1) - - return cctx[0] -} - // WaitCctxAbortedByInboundHash waits until cctx is aborted by inbound hash. func WaitCctxAbortedByInboundHash( ctx context.Context, From b214466f8c4953acd427937a0cbaf2c86156c16e Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 22:40:27 -0500 Subject: [PATCH 05/12] remove dust withdraw from v21 previous version tests --- e2e/utils/zetacore.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index b4206383be..34e53e61b0 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -194,22 +194,6 @@ func MatchStatus(s crosschaintypes.CctxStatus) WaitOpts { }) } -// MatchStatusList is the WaitOpts that matches CCTX with the given status. -// It returns as soon as any of the status is matched. -func MatchStatusList(s []crosschaintypes.CctxStatus) WaitOpts { - return Matches(func(tx crosschaintypes.CrossChainTx) bool { - if tx.CctxStatus == nil { - return false - } - for _, s := range s { - if tx.CctxStatus.Status == s { - return true - } - } - return false - }) -} - // MatchReverted is the WaitOpts that matches reverted CCTX. func MatchReverted() WaitOpts { return Matches(func(tx crosschaintypes.CrossChainTx) bool { From 7e7bd9605d4cdfa1282626ba65c4f5629b6979f4 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 22:42:13 -0500 Subject: [PATCH 06/12] add comment for v23 --- contrib/localnet/orchestrator/start-zetae2e.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 71c3e29a60..f4ef0e814f 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -222,6 +222,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then echo "running E2E command to setup the networks and populate the state..." # Use light flag to ensure tests can complete before the upgrade height + # skip-bitcoin-dust-withdraw flag can be removed after v23 is released zetae2e local $E2E_ARGS --skip-setup --config "$deployed_config_path" --light --skip-precompiles --skip-bitcoin-dust-withdraw ${COMMON_ARGS} if [ $? -ne 0 ]; then echo "first e2e failed" From a0afb1e7fedbce8f13fb730dd9562ead99380e83 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 21 Nov 2024 22:58:13 -0500 Subject: [PATCH 07/12] adjust code format --- e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go index e2a3040446..9e3606759b 100644 --- a/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go +++ b/e2e/e2etests/test_bitcoin_deposit_and_call_revert_with_dust.go @@ -53,5 +53,4 @@ func TestBitcoinDepositAndCallRevertWithDust(r *runner.E2ERunner, args []string) require.True(r, cctx.GetCurrentOutboundParam().Amount.Uint64() < constant.BTCWithdrawalDustAmount) require.True(r, strings.Contains(cctx.CctxStatus.ErrorMessage, crosschaintypes.ErrInvalidWithdrawalAmount.Error())) - } From bcbf0961f07410cfe50b5dc66b3837016329dce9 Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 22 Nov 2024 09:30:50 +0100 Subject: [PATCH 08/12] make generate --- cmd/zetae2e/local/local.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 28bd3c607b..a09fb512d1 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -87,7 +87,8 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagSkipPrecompiles, false, "set to true to skip stateful precompiled contracts test") cmd.Flags(). Bool(flagUpgradeContracts, false, "set to true to upgrade Gateways and ERC20Custody contracts during setup for ZEVM and EVM") - cmd.Flags().Bool(flagSkipBitcoinDustWithdraw, false, "set to true to skip tests that withdraw dust amount from Bitcoin") + cmd.Flags(). + Bool(flagSkipBitcoinDustWithdraw, false, "set to true to skip tests that withdraw dust amount from Bitcoin") return cmd } From 304fec006abf4a1ca5598307db8ebb49bcac700e Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 22 Nov 2024 10:02:14 +0100 Subject: [PATCH 09/12] revert skip btc dust --- cmd/zetae2e/local/local.go | 50 +++++++++---------- .../localnet/orchestrator/start-zetae2e.sh | 2 +- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index a09fb512d1..bafb5ac9df 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -87,8 +87,6 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagSkipPrecompiles, false, "set to true to skip stateful precompiled contracts test") cmd.Flags(). Bool(flagUpgradeContracts, false, "set to true to upgrade Gateways and ERC20Custody contracts during setup for ZEVM and EVM") - cmd.Flags(). - Bool(flagSkipBitcoinDustWithdraw, false, "set to true to skip tests that withdraw dust amount from Bitcoin") return cmd } @@ -98,28 +96,27 @@ func NewLocalCmd() *cobra.Command { func localE2ETest(cmd *cobra.Command, _ []string) { // fetch flags var ( - waitForHeight = must(cmd.Flags().GetInt64(flagWaitForHeight)) - contractsDeployed = must(cmd.Flags().GetBool(flagContractsDeployed)) - verbose = must(cmd.Flags().GetBool(flagVerbose)) - configOut = must(cmd.Flags().GetString(flagConfigOut)) - testAdmin = must(cmd.Flags().GetBool(flagTestAdmin)) - testPerformance = must(cmd.Flags().GetBool(flagTestPerformance)) - testCustom = must(cmd.Flags().GetBool(flagTestCustom)) - testSolana = must(cmd.Flags().GetBool(flagTestSolana)) - testTON = must(cmd.Flags().GetBool(flagTestTON)) - skipRegular = must(cmd.Flags().GetBool(flagSkipRegular)) - light = must(cmd.Flags().GetBool(flagLight)) - setupOnly = must(cmd.Flags().GetBool(flagSetupOnly)) - skipSetup = must(cmd.Flags().GetBool(flagSkipSetup)) - skipBitcoinSetup = must(cmd.Flags().GetBool(flagSkipBitcoinSetup)) - skipHeaderProof = must(cmd.Flags().GetBool(flagSkipHeaderProof)) - skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck)) - testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration)) - testV2 = must(cmd.Flags().GetBool(flagTestV2)) - testV2Migration = must(cmd.Flags().GetBool(flagTestV2Migration)) - skipPrecompiles = must(cmd.Flags().GetBool(flagSkipPrecompiles)) - upgradeContracts = must(cmd.Flags().GetBool(flagUpgradeContracts)) - skipBitcoinDustWithdraw = must(cmd.Flags().GetBool(flagSkipBitcoinDustWithdraw)) + waitForHeight = must(cmd.Flags().GetInt64(flagWaitForHeight)) + contractsDeployed = must(cmd.Flags().GetBool(flagContractsDeployed)) + verbose = must(cmd.Flags().GetBool(flagVerbose)) + configOut = must(cmd.Flags().GetString(flagConfigOut)) + testAdmin = must(cmd.Flags().GetBool(flagTestAdmin)) + testPerformance = must(cmd.Flags().GetBool(flagTestPerformance)) + testCustom = must(cmd.Flags().GetBool(flagTestCustom)) + testSolana = must(cmd.Flags().GetBool(flagTestSolana)) + testTON = must(cmd.Flags().GetBool(flagTestTON)) + skipRegular = must(cmd.Flags().GetBool(flagSkipRegular)) + light = must(cmd.Flags().GetBool(flagLight)) + setupOnly = must(cmd.Flags().GetBool(flagSetupOnly)) + skipSetup = must(cmd.Flags().GetBool(flagSkipSetup)) + skipBitcoinSetup = must(cmd.Flags().GetBool(flagSkipBitcoinSetup)) + skipHeaderProof = must(cmd.Flags().GetBool(flagSkipHeaderProof)) + skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck)) + testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration)) + testV2 = must(cmd.Flags().GetBool(flagTestV2)) + testV2Migration = must(cmd.Flags().GetBool(flagTestV2Migration)) + skipPrecompiles = must(cmd.Flags().GetBool(flagSkipPrecompiles)) + upgradeContracts = must(cmd.Flags().GetBool(flagUpgradeContracts)) ) logger := runner.NewLogger(verbose, color.FgWhite, "setup") @@ -334,8 +331,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) { e2etests.TestBitcoinStdMemoInscribedDepositAndCallName, e2etests.TestCrosschainSwapName, } - if !skipBitcoinDustWithdraw { - bitcoinDepositTests = append(bitcoinDepositTests, e2etests.TestBitcoinDepositAndCallRevertWithDustName) + bitcoinDepositTestsAdvanced := []string{ + e2etests.TestBitcoinDepositAndCallRevertWithDustName, } bitcoinWithdrawTests := []string{ e2etests.TestBitcoinWithdrawSegWitName, @@ -381,6 +378,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { erc20Tests = append(erc20Tests, erc20AdvancedTests...) zetaTests = append(zetaTests, zetaAdvancedTests...) zevmMPTests = append(zevmMPTests, zevmMPAdvancedTests...) + bitcoinDepositTests = append(bitcoinDepositTests, bitcoinDepositTestsAdvanced...) bitcoinWithdrawTests = append(bitcoinWithdrawTests, bitcoinWithdrawTestsAdvanced...) ethereumTests = append(ethereumTests, ethereumAdvancedTests...) } diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index f4ef0e814f..c9c3d26c55 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -223,7 +223,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then # Use light flag to ensure tests can complete before the upgrade height # skip-bitcoin-dust-withdraw flag can be removed after v23 is released - zetae2e local $E2E_ARGS --skip-setup --config "$deployed_config_path" --light --skip-precompiles --skip-bitcoin-dust-withdraw ${COMMON_ARGS} + zetae2e local $E2E_ARGS --skip-setup --config "$deployed_config_path" --light --skip-precompiles ${COMMON_ARGS} if [ $? -ne 0 ]; then echo "first e2e failed" exit 1 From 2ef3732439b7294ff3700a0094f10802e312fde7 Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 22 Nov 2024 10:03:20 +0100 Subject: [PATCH 10/12] remove flag name --- cmd/zetae2e/local/local.go | 45 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index bafb5ac9df..6851b29704 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -25,29 +25,28 @@ import ( ) const ( - flagContractsDeployed = "deployed" - flagWaitForHeight = "wait-for" - FlagConfigFile = "config" - flagConfigOut = "config-out" - flagVerbose = "verbose" - flagTestAdmin = "test-admin" - flagTestPerformance = "test-performance" - flagTestCustom = "test-custom" - flagTestSolana = "test-solana" - flagTestTON = "test-ton" - flagSkipRegular = "skip-regular" - flagLight = "light" - flagSetupOnly = "setup-only" - flagSkipSetup = "skip-setup" - flagTestTSSMigration = "test-tss-migration" - flagSkipBitcoinSetup = "skip-bitcoin-setup" - flagSkipHeaderProof = "skip-header-proof" - flagTestV2 = "test-v2" - flagTestV2Migration = "test-v2-migration" - flagSkipTrackerCheck = "skip-tracker-check" - flagSkipPrecompiles = "skip-precompiles" - flagUpgradeContracts = "upgrade-contracts" - flagSkipBitcoinDustWithdraw = "skip-bitcoin-dust-withdraw" + flagContractsDeployed = "deployed" + flagWaitForHeight = "wait-for" + FlagConfigFile = "config" + flagConfigOut = "config-out" + flagVerbose = "verbose" + flagTestAdmin = "test-admin" + flagTestPerformance = "test-performance" + flagTestCustom = "test-custom" + flagTestSolana = "test-solana" + flagTestTON = "test-ton" + flagSkipRegular = "skip-regular" + flagLight = "light" + flagSetupOnly = "setup-only" + flagSkipSetup = "skip-setup" + flagTestTSSMigration = "test-tss-migration" + flagSkipBitcoinSetup = "skip-bitcoin-setup" + flagSkipHeaderProof = "skip-header-proof" + flagTestV2 = "test-v2" + flagTestV2Migration = "test-v2-migration" + flagSkipTrackerCheck = "skip-tracker-check" + flagSkipPrecompiles = "skip-precompiles" + flagUpgradeContracts = "upgrade-contracts" ) var ( From 4bc9c9837b81d79e6d0b2de3a90190d7797584df Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 22 Nov 2024 10:18:59 +0100 Subject: [PATCH 11/12] newline --- cmd/zetae2e/local/local.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 6851b29704..7deebe10a8 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -121,6 +121,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { logger := runner.NewLogger(verbose, color.FgWhite, "setup") testStartTime := time.Now() + logger.Print("starting E2E tests") if testAdmin { From d9f7092ba0638a713cad66ac155d6d2f9c947e8b Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 22 Nov 2024 10:25:17 +0100 Subject: [PATCH 12/12] lint --- cmd/zetae2e/local/local.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 7deebe10a8..fa190a07a7 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -121,7 +121,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { logger := runner.NewLogger(verbose, color.FgWhite, "setup") testStartTime := time.Now() - + logger.Print("starting E2E tests") if testAdmin {