From 24c1e3fcdb4045b063a0367417b730becce202e6 Mon Sep 17 00:00:00 2001 From: lumtis Date: Fri, 6 Dec 2024 13:20:47 +0100 Subject: [PATCH] more renaming --- cmd/zetae2e/local/erc20.go | 66 -- cmd/zetae2e/local/ethereum.go | 60 -- cmd/zetae2e/local/evm.go | 135 +++ cmd/zetae2e/local/legacy.go | 167 ++++ cmd/zetae2e/local/local.go | 38 +- cmd/zetae2e/local/v2.go | 138 ---- cmd/zetae2e/local/zevm_mp.go | 65 -- e2e/e2etests/e2etests.go | 769 +++++++++--------- ..._swap.go => test_deposit_and_call_swap.go} | 0 ...erc20_deposit.go => test_erc20_deposit.go} | 0 ...call.go => test_erc20_deposit_and_call.go} | 0 ...test_erc20_deposit_and_call_no_message.go} | 0 ... => test_erc20_deposit_and_call_revert.go} | 0 ...rc20_deposit_and_call_revert_with_call.go} | 0 .../test_erc20_deposit_restricted_address.go | 2 +- ...c20_withdraw.go => test_erc20_withdraw.go} | 0 ...test_erc20_withdraw_and_arbitrary_call.go} | 0 ...all.go => test_erc20_withdraw_and_call.go} | 0 ...est_erc20_withdraw_and_call_no_message.go} | 0 ...=> test_erc20_withdraw_and_call_revert.go} | 0 ...c20_withdraw_and_call_revert_with_call.go} | 0 ..._v2_eth_deposit.go => test_eth_deposit.go} | 0 ...d_call.go => test_eth_deposit_and_call.go} | 0 ...> test_eth_deposit_and_call_no_message.go} | 0 ...go => test_eth_deposit_and_call_revert.go} | 0 ..._eth_deposit_and_call_revert_with_call.go} | 0 ...2_eth_withdraw.go => test_eth_withdraw.go} | 0 ...> test_eth_withdraw_and_arbitrary_call.go} | 0 ..._call.go => test_eth_withdraw_and_call.go} | 0 ... test_eth_withdraw_and_call_no_message.go} | 0 ...o => test_eth_withdraw_and_call_revert.go} | 0 ...eth_withdraw_and_call_revert_with_call.go} | 0 ...eth_withdraw_and_call_through_contract.go} | 0 ..._zevm_call.go => test_evm_to_zevm_call.go} | 0 ....go => test_zevm_to_evm_arbitrary_call.go} | 0 ...o_evm_call.go => test_zevm_to_evm_call.go} | 0 ...test_zevm_to_evm_call_through_contract.go} | 0 37 files changed, 699 insertions(+), 741 deletions(-) delete mode 100644 cmd/zetae2e/local/erc20.go delete mode 100644 cmd/zetae2e/local/ethereum.go create mode 100644 cmd/zetae2e/local/evm.go create mode 100644 cmd/zetae2e/local/legacy.go delete mode 100644 cmd/zetae2e/local/v2.go delete mode 100644 cmd/zetae2e/local/zevm_mp.go rename e2e/e2etests/{test_v2_deposit_and_call_swap.go => test_deposit_and_call_swap.go} (100%) rename e2e/e2etests/{test_v2_erc20_deposit.go => test_erc20_deposit.go} (100%) rename e2e/e2etests/{test_v2_erc20_deposit_and_call.go => test_erc20_deposit_and_call.go} (100%) rename e2e/e2etests/{test_v2_erc20_deposit_and_call_no_message.go => test_erc20_deposit_and_call_no_message.go} (100%) rename e2e/e2etests/{test_v2_erc20_deposit_and_call_revert.go => test_erc20_deposit_and_call_revert.go} (100%) rename e2e/e2etests/{test_v2_erc20_deposit_and_call_revert_with_call.go => test_erc20_deposit_and_call_revert_with_call.go} (100%) rename e2e/e2etests/{legacy => }/test_erc20_deposit_restricted_address.go (97%) rename e2e/e2etests/{test_v2_erc20_withdraw.go => test_erc20_withdraw.go} (100%) rename e2e/e2etests/{test_v2_erc20_withdraw_and_arbitrary_call.go => test_erc20_withdraw_and_arbitrary_call.go} (100%) rename e2e/e2etests/{test_v2_erc20_withdraw_and_call.go => test_erc20_withdraw_and_call.go} (100%) rename e2e/e2etests/{test_v2_erc20_withdraw_and_call_no_message.go => test_erc20_withdraw_and_call_no_message.go} (100%) rename e2e/e2etests/{test_v2_erc20_withdraw_and_call_revert.go => test_erc20_withdraw_and_call_revert.go} (100%) rename e2e/e2etests/{test_v2_erc20_withdraw_and_call_revert_with_call.go => test_erc20_withdraw_and_call_revert_with_call.go} (100%) rename e2e/e2etests/{test_v2_eth_deposit.go => test_eth_deposit.go} (100%) rename e2e/e2etests/{test_v2_eth_deposit_and_call.go => test_eth_deposit_and_call.go} (100%) rename e2e/e2etests/{test_v2_eth_deposit_and_call_no_message.go => test_eth_deposit_and_call_no_message.go} (100%) rename e2e/e2etests/{test_v2_eth_deposit_and_call_revert.go => test_eth_deposit_and_call_revert.go} (100%) rename e2e/e2etests/{test_v2_eth_deposit_and_call_revert_with_call.go => test_eth_deposit_and_call_revert_with_call.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw.go => test_eth_withdraw.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_arbitrary_call.go => test_eth_withdraw_and_arbitrary_call.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_call.go => test_eth_withdraw_and_call.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_call_no_message.go => test_eth_withdraw_and_call_no_message.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_call_revert.go => test_eth_withdraw_and_call_revert.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_call_revert_with_call.go => test_eth_withdraw_and_call_revert_with_call.go} (100%) rename e2e/e2etests/{test_v2_eth_withdraw_and_call_through_contract.go => test_eth_withdraw_and_call_through_contract.go} (100%) rename e2e/e2etests/{test_v2_evm_to_zevm_call.go => test_evm_to_zevm_call.go} (100%) rename e2e/e2etests/{test_v2_zevm_to_evm_arbitrary_call.go => test_zevm_to_evm_arbitrary_call.go} (100%) rename e2e/e2etests/{test_v2_zevm_to_evm_call.go => test_zevm_to_evm_call.go} (100%) rename e2e/e2etests/{test_v2_zevm_to_evm_call_through_contract.go => test_zevm_to_evm_call_through_contract.go} (100%) diff --git a/cmd/zetae2e/local/erc20.go b/cmd/zetae2e/local/erc20.go deleted file mode 100644 index 8c9ef06869..0000000000 --- a/cmd/zetae2e/local/erc20.go +++ /dev/null @@ -1,66 +0,0 @@ -package local - -import ( - "fmt" - "time" - - "github.com/fatih/color" - - "github.com/zeta-chain/node/e2e/config" - "github.com/zeta-chain/node/e2e/e2etests" - "github.com/zeta-chain/node/e2e/runner" -) - -// erc20TestRoutine runs erc20 related e2e tests -func erc20TestRoutine( - conf config.Config, - deployerRunner *runner.E2ERunner, - verbose bool, - testNames ...string, -) func() error { - return func() (err error) { - account := conf.AdditionalAccounts.UserERC20 - // initialize runner for erc20 test - erc20Runner, err := initTestRunner( - "erc20", - conf, - deployerRunner, - account, - runner.NewLogger(verbose, color.FgGreen, "erc20"), - runner.WithZetaTxServer(deployerRunner.ZetaTxServer), - ) - if err != nil { - return err - } - - erc20Runner.Logger.Print("🏃 starting erc20 tests") - startTime := time.Now() - - // funding the account - txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 10000) - erc20Runner.WaitForTxReceiptOnEvm(txERC20Send) - - // depositing the necessary tokens on ZetaChain - txEtherDeposit := erc20Runner.DepositEther() - txERC20Deposit := erc20Runner.DepositERC20() - erc20Runner.WaitForMinedCCTX(txEtherDeposit) - erc20Runner.WaitForMinedCCTX(txERC20Deposit) - - // run erc20 test - testsToRun, err := erc20Runner.GetE2ETestsToRunByName( - e2etests.AllE2ETests, - testNames..., - ) - if err != nil { - return fmt.Errorf("erc20 tests failed: %v", err) - } - - if err := erc20Runner.RunE2ETests(testsToRun); err != nil { - return fmt.Errorf("erc20 tests failed: %v", err) - } - - erc20Runner.Logger.Print("🍾 erc20 tests completed in %s", time.Since(startTime).String()) - - return err - } -} diff --git a/cmd/zetae2e/local/ethereum.go b/cmd/zetae2e/local/ethereum.go deleted file mode 100644 index 09615bcbb8..0000000000 --- a/cmd/zetae2e/local/ethereum.go +++ /dev/null @@ -1,60 +0,0 @@ -package local - -import ( - "fmt" - "time" - - "github.com/fatih/color" - - "github.com/zeta-chain/node/e2e/config" - "github.com/zeta-chain/node/e2e/e2etests" - "github.com/zeta-chain/node/e2e/runner" -) - -// ethereumTestRoutine runs Ethereum related e2e tests -func ethereumTestRoutine( - conf config.Config, - deployerRunner *runner.E2ERunner, - verbose bool, - testNames ...string, -) func() error { - return func() (err error) { - // initialize runner for ether test - ethereumRunner, err := initTestRunner( - "ether", - conf, - deployerRunner, - conf.AdditionalAccounts.UserEther, - runner.NewLogger(verbose, color.FgMagenta, "ether"), - ) - if err != nil { - return err - } - - ethereumRunner.Logger.Print("🏃 starting Ethereum tests") - startTime := time.Now() - - // depositing the necessary tokens on ZetaChain - txEtherDeposit := ethereumRunner.DepositEther() - ethereumRunner.WaitForMinedCCTX(txEtherDeposit) - - // run ethereum test - // Note: due to the extensive block generation in Ethereum localnet, block header test is run first - // to make it faster to catch up with the latest block header - testsToRun, err := ethereumRunner.GetE2ETestsToRunByName( - e2etests.AllE2ETests, - testNames..., - ) - if err != nil { - return fmt.Errorf("ethereum tests failed: %v", err) - } - - if err := ethereumRunner.RunE2ETests(testsToRun); err != nil { - return fmt.Errorf("ethereum tests failed: %v", err) - } - - ethereumRunner.Logger.Print("🍾 Ethereum tests completed in %s", time.Since(startTime).String()) - - return err - } -} diff --git a/cmd/zetae2e/local/evm.go b/cmd/zetae2e/local/evm.go new file mode 100644 index 0000000000..e937aec974 --- /dev/null +++ b/cmd/zetae2e/local/evm.go @@ -0,0 +1,135 @@ +package local + +import ( + "fmt" + "time" + + "github.com/fatih/color" + "golang.org/x/sync/errgroup" + + "github.com/zeta-chain/node/e2e/config" + "github.com/zeta-chain/node/e2e/e2etests" + "github.com/zeta-chain/node/e2e/runner" +) + +// startEVMTests starts EVM chains related tests in parallel +func startEVMTests(eg *errgroup.Group, conf config.Config, deployerRunner *runner.E2ERunner, verbose bool) { + // Test happy paths for gas token workflow + eg.Go(evmTestRoutine(conf, "eth", conf.AdditionalAccounts.UserV2Ether, color.FgHiGreen, deployerRunner, verbose, + e2etests.TestETHDepositName, + e2etests.TestETHDepositAndCallName, + e2etests.TestETHWithdrawName, + e2etests.TestETHWithdrawAndArbitraryCallName, + e2etests.TestETHWithdrawAndCallName, + e2etests.TestETHWithdrawAndCallThroughContractName, + e2etests.TestZEVMToEVMArbitraryCallName, + e2etests.TestZEVMToEVMCallName, + e2etests.TestZEVMToEVMCallThroughContractName, + e2etests.TestEVMToZEVMCallName, + e2etests.TestETHDepositAndCallNoMessageName, + e2etests.TestETHWithdrawAndCallNoMessageName, + )) + + // Test happy paths for erc20 token workflow + eg.Go(evmTestRoutine(conf, "erc20", conf.AdditionalAccounts.UserV2ERC20, color.FgHiBlue, deployerRunner, verbose, + e2etests.TestETHDepositName, // necessary to pay fees on ZEVM + e2etests.TestERC20DepositName, + e2etests.TestERC20DepositAndCallName, + e2etests.TestERC20WithdrawName, + e2etests.TestERC20WithdrawAndArbitraryCallName, + e2etests.TestERC20WithdrawAndCallName, + e2etests.TestERC20DepositAndCallNoMessageName, + e2etests.TestERC20WithdrawAndCallNoMessageName, + e2etests.TestDepositAndCallSwapName, + )) + + // Test revert cases for gas token workflow + eg.Go( + evmTestRoutine( + conf, + "eth-revert", + conf.AdditionalAccounts.UserV2EtherRevert, + color.FgHiYellow, + deployerRunner, + verbose, + e2etests.TestETHDepositName, // necessary to pay fees on ZEVM and withdraw + e2etests.TestETHDepositAndCallRevertName, + e2etests.TestETHDepositAndCallRevertWithCallName, + e2etests.TestETHWithdrawAndCallRevertName, + e2etests.TestETHWithdrawAndCallRevertWithCallName, + e2etests.TestDepositAndCallOutOfGasName, + ), + ) + + // Test revert cases for erc20 token workflow + eg.Go( + evmTestRoutine( + conf, + "erc20-revert", + conf.AdditionalAccounts.UserV2ERC20Revert, + color.FgHiRed, + deployerRunner, + verbose, + e2etests.TestETHDepositName, // necessary to pay fees on ZEVM + e2etests.TestERC20DepositName, // necessary to have assets to withdraw + e2etests.TestOperationAddLiquidityETHName, // liquidity with gas and ERC20 are necessary for reverts + e2etests.TestOperationAddLiquidityERC20Name, + e2etests.TestERC20DepositAndCallRevertName, + e2etests.TestERC20DepositAndCallRevertWithCallName, + e2etests.TestERC20WithdrawAndCallRevertName, + e2etests.TestERC20WithdrawAndCallRevertWithCallName, + ), + ) +} + +// evmTestRoutine runs EVM chain related e2e tests +func evmTestRoutine( + conf config.Config, + name string, + account config.Account, + color color.Attribute, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + name = "v2-" + name + + // initialize runner for erc20 test + v2Runner, err := initTestRunner( + name, + conf, + deployerRunner, + account, + runner.NewLogger(verbose, color, name), + runner.WithZetaTxServer(deployerRunner.ZetaTxServer), + ) + if err != nil { + return err + } + + v2Runner.Logger.Print("🏃 starting %s tests", name) + startTime := time.Now() + + // funding the account + txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 10000) + v2Runner.WaitForTxReceiptOnEvm(txERC20Send) + + // run erc20 test + testsToRun, err := v2Runner.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("%s tests failed: %v", name, err) + } + + if err := v2Runner.RunE2ETests(testsToRun); err != nil { + return fmt.Errorf("%s tests failed: %v", name, err) + } + + v2Runner.Logger.Print("🍾 %s tests completed in %s", name, time.Since(startTime).String()) + + return err + } +} diff --git a/cmd/zetae2e/local/legacy.go b/cmd/zetae2e/local/legacy.go new file mode 100644 index 0000000000..b83225ad0c --- /dev/null +++ b/cmd/zetae2e/local/legacy.go @@ -0,0 +1,167 @@ +package local + +import ( + "fmt" + "time" + + "github.com/fatih/color" + + "github.com/zeta-chain/node/e2e/config" + "github.com/zeta-chain/node/e2e/e2etests" + "github.com/zeta-chain/node/e2e/runner" +) + +// legacyERC20TestRoutine runs erc20 related e2e tests +func legacyERC20TestRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + account := conf.AdditionalAccounts.UserERC20 + // initialize runner for erc20 test + erc20Runner, err := initTestRunner( + "erc20", + conf, + deployerRunner, + account, + runner.NewLogger(verbose, color.FgGreen, "erc20"), + runner.WithZetaTxServer(deployerRunner.ZetaTxServer), + ) + if err != nil { + return err + } + + erc20Runner.Logger.Print("🏃 starting erc20 tests") + startTime := time.Now() + + // funding the account + txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 10000) + erc20Runner.WaitForTxReceiptOnEvm(txERC20Send) + + // depositing the necessary tokens on ZetaChain + txEtherDeposit := erc20Runner.DepositEther() + txERC20Deposit := erc20Runner.DepositERC20() + erc20Runner.WaitForMinedCCTX(txEtherDeposit) + erc20Runner.WaitForMinedCCTX(txERC20Deposit) + + // run erc20 test + testsToRun, err := erc20Runner.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("erc20 tests failed: %v", err) + } + + if err := erc20Runner.RunE2ETests(testsToRun); err != nil { + return fmt.Errorf("erc20 tests failed: %v", err) + } + + erc20Runner.Logger.Print("🍾 erc20 tests completed in %s", time.Since(startTime).String()) + + return err + } +} + +// legacyEthereumTestRoutine runs Ethereum related e2e tests +func legacyEthereumTestRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + // initialize runner for ether test + ethereumRunner, err := initTestRunner( + "ether", + conf, + deployerRunner, + conf.AdditionalAccounts.UserEther, + runner.NewLogger(verbose, color.FgMagenta, "ether"), + ) + if err != nil { + return err + } + + ethereumRunner.Logger.Print("🏃 starting Ethereum tests") + startTime := time.Now() + + // depositing the necessary tokens on ZetaChain + txEtherDeposit := ethereumRunner.DepositEther() + ethereumRunner.WaitForMinedCCTX(txEtherDeposit) + + // run ethereum test + // Note: due to the extensive block generation in Ethereum localnet, block header test is run first + // to make it faster to catch up with the latest block header + testsToRun, err := ethereumRunner.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("ethereum tests failed: %v", err) + } + + if err := ethereumRunner.RunE2ETests(testsToRun); err != nil { + return fmt.Errorf("ethereum tests failed: %v", err) + } + + ethereumRunner.Logger.Print("🍾 Ethereum tests completed in %s", time.Since(startTime).String()) + + return err + } +} + +// legacyZEVMMPTestRoutine runs ZEVM message passing related e2e tests +func legacyZEVMMPTestRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + account := conf.AdditionalAccounts.UserZEVMMPTest + // initialize runner for zevm mp test + zevmMPRunner, err := initTestRunner( + "zevm_mp", + conf, + deployerRunner, + account, + runner.NewLogger(verbose, color.FgHiRed, "zevm_mp"), + ) + if err != nil { + return err + } + + zevmMPRunner.Logger.Print("🏃 starting ZEVM Message Passing tests") + startTime := time.Now() + + // funding the account + txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 1000) + zevmMPRunner.WaitForTxReceiptOnEvm(txZetaSend) + + // depositing the necessary tokens on ZetaChain + txZetaDeposit := zevmMPRunner.DepositZeta() + txEtherDeposit := zevmMPRunner.DepositEther() + zevmMPRunner.WaitForMinedCCTX(txZetaDeposit) + zevmMPRunner.WaitForMinedCCTX(txEtherDeposit) + + // run zevm message passing test + testsToRun, err := zevmMPRunner.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("zevm message passing tests failed: %v", err) + } + + if err := zevmMPRunner.RunE2ETests(testsToRun); err != nil { + return fmt.Errorf("zevm message passing tests failed: %v", err) + } + + zevmMPRunner.Logger.Print("🍾 ZEVM message passing tests completed in %s", time.Since(startTime).String()) + + return err + } +} diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 73cb7de374..05bf34586d 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -284,9 +284,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { if !skipRegular { // defines all tests, if light is enabled, only the most basic tests are run and advanced are skipped erc20Tests := []string{ - e2etests.TestERC20WithdrawName, - e2etests.TestMultipleERC20WithdrawsName, - e2etests.TestERC20DepositAndCallRefundName, + e2etests.TestLegacyERC20WithdrawName, + e2etests.TestLegacyMultipleERC20WithdrawsName, + e2etests.TestLegacyERC20DepositAndCallRefundName, e2etests.TestZRC20SwapName, } erc20AdvancedTests := []string{ @@ -294,9 +294,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { } zetaTests := []string{ e2etests.TestZetaWithdrawName, - e2etests.TestMessagePassingExternalChainsName, - e2etests.TestMessagePassingRevertFailExternalChainsName, - e2etests.TestMessagePassingRevertSuccessExternalChainsName, + e2etests.TestLegacyMessagePassingExternalChainsName, + e2etests.TestLegacyMessagePassingRevertFailExternalChainsName, + e2etests.TestLegacyMessagePassingRevertSuccessExternalChainsName, } zetaAdvancedTests := []string{ e2etests.TestZetaDepositRestrictedName, @@ -305,12 +305,12 @@ func localE2ETest(cmd *cobra.Command, _ []string) { } zevmMPTests := []string{} zevmMPAdvancedTests := []string{ - e2etests.TestMessagePassingZEVMToEVMName, - e2etests.TestMessagePassingEVMtoZEVMName, - e2etests.TestMessagePassingEVMtoZEVMRevertName, - e2etests.TestMessagePassingZEVMtoEVMRevertName, - e2etests.TestMessagePassingZEVMtoEVMRevertFailName, - e2etests.TestMessagePassingEVMtoZEVMRevertFailName, + e2etests.TestLegacyMessagePassingZEVMToEVMName, + e2etests.TestLegacyMessagePassingEVMtoZEVMName, + e2etests.TestLegacyMessagePassingEVMtoZEVMRevertName, + e2etests.TestLegacyMessagePassingZEVMtoEVMRevertName, + e2etests.TestLegacyMessagePassingZEVMtoEVMRevertFailName, + e2etests.TestLegacyMessagePassingEVMtoZEVMRevertFailName, } // btc withdraw tests are those that need a Bitcoin node wallet to send UTXOs @@ -343,9 +343,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { e2etests.TestBitcoinWithdrawRestrictedName, } ethereumTests := []string{ - e2etests.TestEtherWithdrawName, - e2etests.TestEtherDepositAndCallName, - e2etests.TestEtherDepositAndCallRefundName, + e2etests.TestLegacyEtherWithdrawName, + e2etests.TestLegacyEtherDepositAndCallName, + e2etests.TestLegacyEtherDepositAndCallRefundName, } ethereumAdvancedTests := []string{ e2etests.TestEtherWithdrawRestrictedName, @@ -378,9 +378,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) { } eg.Go(statefulPrecompilesTestRoutine(conf, deployerRunner, verbose, precompiledContractTests...)) - eg.Go(erc20TestRoutine(conf, deployerRunner, verbose, erc20Tests...)) + eg.Go(legacyERC20TestRoutine(conf, deployerRunner, verbose, erc20Tests...)) eg.Go(zetaTestRoutine(conf, deployerRunner, verbose, zetaTests...)) - eg.Go(zevmMPTestRoutine(conf, deployerRunner, verbose, zevmMPTests...)) + eg.Go(legacyZEVMMPTestRoutine(conf, deployerRunner, verbose, zevmMPTests...)) runnerDeposit, runnerWithdraw := initBitcoinTestRunners( conf, deployerRunner, @@ -391,7 +391,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { ) eg.Go(runnerDeposit) eg.Go(runnerWithdraw) - eg.Go(ethereumTestRoutine(conf, deployerRunner, verbose, ethereumTests...)) + eg.Go(legacyEthereumTestRoutine(conf, deployerRunner, verbose, ethereumTests...)) } if testAdmin { @@ -468,7 +468,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { } if testV2 { - startV2Tests(&eg, conf, deployerRunner, verbose) + startEVMTests(&eg, conf, deployerRunner, verbose) } // while tests are executed, monitor blocks in parallel to check if system txs are on top and they have biggest priority diff --git a/cmd/zetae2e/local/v2.go b/cmd/zetae2e/local/v2.go deleted file mode 100644 index 88423b9742..0000000000 --- a/cmd/zetae2e/local/v2.go +++ /dev/null @@ -1,138 +0,0 @@ -package local - -import ( - "fmt" - "time" - - "github.com/fatih/color" - "golang.org/x/sync/errgroup" - - "github.com/zeta-chain/node/e2e/config" - "github.com/zeta-chain/node/e2e/e2etests" - "github.com/zeta-chain/node/e2e/runner" -) - -// startV2Tests starts v2 related tests in parallel -func startV2Tests(eg *errgroup.Group, conf config.Config, deployerRunner *runner.E2ERunner, verbose bool) { - // Test happy paths for gas token workflow - eg.Go(v2TestRoutine(conf, "eth", conf.AdditionalAccounts.UserV2Ether, color.FgHiGreen, deployerRunner, verbose, - e2etests.TestV2ETHDepositName, - e2etests.TestV2ETHDepositAndCallName, - e2etests.TestV2ETHWithdrawName, - e2etests.TestV2ETHWithdrawAndArbitraryCallName, - e2etests.TestV2ETHWithdrawAndCallName, - e2etests.TestV2ETHWithdrawAndCallThroughContractName, - e2etests.TestV2ZEVMToEVMArbitraryCallName, - e2etests.TestV2ZEVMToEVMCallName, - e2etests.TestV2ZEVMToEVMCallThroughContractName, - e2etests.TestV2EVMToZEVMCallName, - e2etests.TestV2ETHDepositAndCallNoMessageName, - e2etests.TestV2ETHWithdrawAndCallNoMessageName, - )) - - // Test happy paths for erc20 token workflow - eg.Go(v2TestRoutine(conf, "erc20", conf.AdditionalAccounts.UserV2ERC20, color.FgHiBlue, deployerRunner, verbose, - e2etests.TestV2ETHDepositName, // necessary to pay fees on ZEVM - e2etests.TestV2ERC20DepositName, - e2etests.TestV2ERC20DepositAndCallName, - e2etests.TestV2ERC20WithdrawName, - e2etests.TestV2ERC20WithdrawAndArbitraryCallName, - e2etests.TestV2ERC20WithdrawAndCallName, - e2etests.TestV2ERC20DepositAndCallNoMessageName, - e2etests.TestV2ERC20WithdrawAndCallNoMessageName, - e2etests.TestV2DepositAndCallSwapName, - )) - - // Test revert cases for gas token workflow - eg.Go( - v2TestRoutine( - conf, - "eth-revert", - conf.AdditionalAccounts.UserV2EtherRevert, - color.FgHiYellow, - deployerRunner, - verbose, - e2etests.TestV2ETHDepositName, // necessary to pay fees on ZEVM and withdraw - e2etests.TestV2ETHDepositAndCallRevertName, - e2etests.TestV2ETHDepositAndCallRevertWithCallName, - e2etests.TestV2ETHWithdrawAndCallRevertName, - e2etests.TestV2ETHWithdrawAndCallRevertWithCallName, - e2etests.TestDepositAndCallOutOfGasName, - ), - ) - - // Test revert cases for erc20 token workflow - eg.Go( - v2TestRoutine( - conf, - "erc20-revert", - conf.AdditionalAccounts.UserV2ERC20Revert, - color.FgHiRed, - deployerRunner, - verbose, - e2etests.TestV2ETHDepositName, // necessary to pay fees on ZEVM - e2etests.TestV2ERC20DepositName, // necessary to have assets to withdraw - e2etests.TestOperationAddLiquidityETHName, // liquidity with gas and ERC20 are necessary for reverts - e2etests.TestOperationAddLiquidityERC20Name, - e2etests.TestV2ERC20DepositAndCallRevertName, - e2etests.TestV2ERC20DepositAndCallRevertWithCallName, - e2etests.TestV2ERC20WithdrawAndCallRevertName, - e2etests.TestV2ERC20WithdrawAndCallRevertWithCallName, - ), - ) -} - -// v2TestRoutine runs v2 related e2e tests -// TODO: this routine will be broken down in the future and will replace most current tests -// we keep a single routine for v2 for simplicity -// https://github.com/zeta-chain/node/issues/2554 -func v2TestRoutine( - conf config.Config, - name string, - account config.Account, - color color.Attribute, - deployerRunner *runner.E2ERunner, - verbose bool, - testNames ...string, -) func() error { - return func() (err error) { - name = "v2-" + name - - // initialize runner for erc20 test - v2Runner, err := initTestRunner( - name, - conf, - deployerRunner, - account, - runner.NewLogger(verbose, color, name), - runner.WithZetaTxServer(deployerRunner.ZetaTxServer), - ) - if err != nil { - return err - } - - v2Runner.Logger.Print("🏃 starting %s tests", name) - startTime := time.Now() - - // funding the account - txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 10000) - v2Runner.WaitForTxReceiptOnEvm(txERC20Send) - - // run erc20 test - testsToRun, err := v2Runner.GetE2ETestsToRunByName( - e2etests.AllE2ETests, - testNames..., - ) - if err != nil { - return fmt.Errorf("%s tests failed: %v", name, err) - } - - if err := v2Runner.RunE2ETests(testsToRun); err != nil { - return fmt.Errorf("%s tests failed: %v", name, err) - } - - v2Runner.Logger.Print("🍾 %s tests completed in %s", name, time.Since(startTime).String()) - - return err - } -} diff --git a/cmd/zetae2e/local/zevm_mp.go b/cmd/zetae2e/local/zevm_mp.go deleted file mode 100644 index 96f1e5a0b0..0000000000 --- a/cmd/zetae2e/local/zevm_mp.go +++ /dev/null @@ -1,65 +0,0 @@ -package local - -import ( - "fmt" - "time" - - "github.com/fatih/color" - - "github.com/zeta-chain/node/e2e/config" - "github.com/zeta-chain/node/e2e/e2etests" - "github.com/zeta-chain/node/e2e/runner" -) - -// zevmMPTestRoutine runs ZEVM message passing related e2e tests -func zevmMPTestRoutine( - conf config.Config, - deployerRunner *runner.E2ERunner, - verbose bool, - testNames ...string, -) func() error { - return func() (err error) { - account := conf.AdditionalAccounts.UserZEVMMPTest - // initialize runner for zevm mp test - zevmMPRunner, err := initTestRunner( - "zevm_mp", - conf, - deployerRunner, - account, - runner.NewLogger(verbose, color.FgHiRed, "zevm_mp"), - ) - if err != nil { - return err - } - - zevmMPRunner.Logger.Print("🏃 starting ZEVM Message Passing tests") - startTime := time.Now() - - // funding the account - txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 1000) - zevmMPRunner.WaitForTxReceiptOnEvm(txZetaSend) - - // depositing the necessary tokens on ZetaChain - txZetaDeposit := zevmMPRunner.DepositZeta() - txEtherDeposit := zevmMPRunner.DepositEther() - zevmMPRunner.WaitForMinedCCTX(txZetaDeposit) - zevmMPRunner.WaitForMinedCCTX(txEtherDeposit) - - // run zevm message passing test - testsToRun, err := zevmMPRunner.GetE2ETestsToRunByName( - e2etests.AllE2ETests, - testNames..., - ) - if err != nil { - return fmt.Errorf("zevm message passing tests failed: %v", err) - } - - if err := zevmMPRunner.RunE2ETests(testsToRun); err != nil { - return fmt.Errorf("zevm message passing tests failed: %v", err) - } - - zevmMPRunner.Logger.Print("🍾 ZEVM message passing tests completed in %s", time.Since(startTime).String()) - - return err - } -} diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index b6f6682b52..f60fb60904 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -8,6 +8,41 @@ import ( // List of all e2e test names to be used in zetae2e const ( + /* + EVM chain tests + */ + TestETHDepositName = "eth_deposit" + TestETHDepositAndCallName = "eth_deposit_and_call" + TestETHDepositAndCallNoMessageName = "eth_deposit_and_call_no_message" + TestETHDepositAndCallRevertName = "eth_deposit_and_call_revert" + TestETHDepositAndCallRevertWithCallName = "eth_deposit_and_call_revert_with_call" + TestETHWithdrawName = "eth_withdraw" + TestETHWithdrawAndArbitraryCallName = "eth_withdraw_and_arbitrary_call" + TestETHWithdrawAndCallName = "eth_withdraw_and_call" + TestETHWithdrawAndCallNoMessageName = "eth_withdraw_and_call_no_message" + TestETHWithdrawAndCallThroughContractName = "eth_withdraw_and_call_through_contract" + TestETHWithdrawAndCallRevertName = "eth_withdraw_and_call_revert" + TestETHWithdrawAndCallRevertWithCallName = "eth_withdraw_and_call_revert_with_call" + TestDepositAndCallOutOfGasName = "deposit_and_call_out_of_gas" + TestERC20DepositName = "erc20_deposit" + TestERC20DepositAndCallName = "erc20_deposit_and_call" + TestERC20DepositAndCallNoMessageName = "erc20_deposit_and_call_no_message" + TestERC20DepositAndCallRevertName = "erc20_deposit_and_call_revert" + TestERC20DepositAndCallRevertWithCallName = "erc20_deposit_and_call_revert_with_call" + TestERC20WithdrawName = "erc20_withdraw" + TestERC20WithdrawAndArbitraryCallName = "erc20_withdraw_and_arbitrary_call" + TestERC20WithdrawAndCallName = "erc20_withdraw_and_call" + TestERC20WithdrawAndCallNoMessageName = "erc20_withdraw_and_call_no_message" + TestERC20WithdrawAndCallRevertName = "erc20_withdraw_and_call_revert" + TestERC20WithdrawAndCallRevertWithCallName = "erc20_withdraw_and_call_revert_with_call" + TestZEVMToEVMArbitraryCallName = "zevm_to_evm_arbitrary_call" + TestZEVMToEVMCallName = "zevm_to_evm_call" + TestZEVMToEVMCallThroughContractName = "zevm_to_evm_call_through_contract" + TestEVMToZEVMCallName = "evm_to_zevm_call" + TestDepositAndCallSwapName = "deposit_and_call_swap" + TestEtherWithdrawRestrictedName = "eth_withdraw_restricted" + TestERC20DepositRestrictedName = "erc20_deposit_restricted" // #nosec G101: Potential hardcoded credentials (gosec), not a credential + /* ZETA tests Test transfer of ZETA asset across chains @@ -18,41 +53,6 @@ const ( TestZetaWithdrawName = "zeta_withdraw" TestZetaWithdrawBTCRevertName = "zeta_withdraw_btc_revert" // #nosec G101 - not a hardcoded password - /* - Message passing tests - Test message passing across chains - */ - TestMessagePassingExternalChainsName = "message_passing_external_chains" - TestMessagePassingRevertFailExternalChainsName = "message_passing_revert_fail" - TestMessagePassingRevertSuccessExternalChainsName = "message_passing_revert_success" - TestMessagePassingEVMtoZEVMName = "message_passing_evm_to_zevm" - TestMessagePassingZEVMToEVMName = "message_passing_zevm_to_evm" - TestMessagePassingZEVMtoEVMRevertName = "message_passing_zevm_to_evm_revert" - TestMessagePassingEVMtoZEVMRevertName = "message_passing_evm_to_zevm_revert" - TestMessagePassingZEVMtoEVMRevertFailName = "message_passing_zevm_to_evm_revert_fail" - TestMessagePassingEVMtoZEVMRevertFailName = "message_passing_evm_to_zevm_revert_fail" - - /* - EVM gas tests - Test transfer of EVM gas asset across chains - */ - TestEtherDepositName = "eth_deposit" - TestEtherWithdrawName = "eth_withdraw" - TestEtherWithdrawRestrictedName = "eth_withdraw_restricted" - TestEtherDepositAndCallRefundName = "eth_deposit_and_call_refund" - TestEtherDepositAndCallName = "eth_deposit_and_call" - - /* - EVM erc20 tests - Test transfer of EVM erc20 asset across chains - */ - TestERC20WithdrawName = "erc20_withdraw" - TestERC20DepositName = "erc20_deposit" - TestMultipleERC20DepositName = "erc20_multiple_deposit" - TestMultipleERC20WithdrawsName = "erc20_multiple_withdraw" - TestERC20DepositRestrictedName = "erc20_deposit_restricted" // #nosec G101: Potential hardcoded credentials (gosec), not a credential - TestERC20DepositAndCallRefundName = "erc20_deposit_and_call_refund" - /* * Solana tests */ @@ -140,39 +140,6 @@ const ( TestMigrateTSSName = "migrate_TSS" TestSolanaWhitelistSPLName = "solana_whitelist_spl" - /* - V2 smart contract tests - */ - TestV2ETHDepositName = "v2_eth_deposit" - TestV2ETHDepositAndCallName = "v2_eth_deposit_and_call" - TestV2ETHDepositAndCallNoMessageName = "v2_eth_deposit_and_call_no_message" - TestV2ETHDepositAndCallRevertName = "v2_eth_deposit_and_call_revert" - TestV2ETHDepositAndCallRevertWithCallName = "v2_eth_deposit_and_call_revert_with_call" - TestV2ETHWithdrawName = "v2_eth_withdraw" - TestV2ETHWithdrawAndArbitraryCallName = "v2_eth_withdraw_and_arbitrary_call" - TestV2ETHWithdrawAndCallName = "v2_eth_withdraw_and_call" - TestV2ETHWithdrawAndCallNoMessageName = "v2_eth_withdraw_and_call_no_message" - TestV2ETHWithdrawAndCallThroughContractName = "v2_eth_withdraw_and_call_through_contract" - TestV2ETHWithdrawAndCallRevertName = "v2_eth_withdraw_and_call_revert" - TestV2ETHWithdrawAndCallRevertWithCallName = "v2_eth_withdraw_and_call_revert_with_call" - TestDepositAndCallOutOfGasName = "deposit_and_call_out_of_gas" - TestV2ERC20DepositName = "v2_erc20_deposit" - TestV2ERC20DepositAndCallName = "v2_erc20_deposit_and_call" - TestV2ERC20DepositAndCallNoMessageName = "v2_erc20_deposit_and_call_no_message" - TestV2ERC20DepositAndCallRevertName = "v2_erc20_deposit_and_call_revert" - TestV2ERC20DepositAndCallRevertWithCallName = "v2_erc20_deposit_and_call_revert_with_call" - TestV2ERC20WithdrawName = "v2_erc20_withdraw" - TestV2ERC20WithdrawAndArbitraryCallName = "v2_erc20_withdraw_and_arbitrary_call" - TestV2ERC20WithdrawAndCallName = "v2_erc20_withdraw_and_call" - TestV2ERC20WithdrawAndCallNoMessageName = "v2_erc20_withdraw_and_call_no_message" - TestV2ERC20WithdrawAndCallRevertName = "v2_erc20_withdraw_and_call_revert" - TestV2ERC20WithdrawAndCallRevertWithCallName = "v2_erc20_withdraw_and_call_revert_with_call" - TestV2ZEVMToEVMArbitraryCallName = "v2_zevm_to_evm_arbitrary_call" - TestV2ZEVMToEVMCallName = "v2_zevm_to_evm_call" - TestV2ZEVMToEVMCallThroughContractName = "v2_zevm_to_evm_call_through_contract" - TestV2EVMToZEVMCallName = "v2_evm_to_zevm_call" - TestV2DepositAndCallSwapName = "v2_deposit_and_call_swap" - /* Operational tests Not used to test functionalities but do various interactions with the netwoks @@ -194,223 +161,301 @@ const ( TestPrecompilesDistributeName = "precompile_contracts_distribute" TestPrecompilesDistributeNonZRC20Name = "precompile_contracts_distribute_non_zrc20" TestPrecompilesDistributeThroughContractName = "precompile_contracts_distribute_through_contract" + + /* + Legacy tests (using v1 protocol contracts) + */ + TestLegacyMessagePassingExternalChainsName = "legacy_message_passing_external_chains" + TestLegacyMessagePassingRevertFailExternalChainsName = "legacy_message_passing_revert_fail" + TestLegacyMessagePassingRevertSuccessExternalChainsName = "legacy_message_passing_revert_success" + TestLegacyMessagePassingEVMtoZEVMName = "legacy_message_passing_evm_to_zevm" + TestLegacyMessagePassingZEVMToEVMName = "legacy_message_passing_zevm_to_evm" + TestLegacyMessagePassingZEVMtoEVMRevertName = "legacy_message_passing_zevm_to_evm_revert" + TestLegacyMessagePassingEVMtoZEVMRevertName = "legacy_message_passing_evm_to_zevm_revert" + TestLegacyMessagePassingZEVMtoEVMRevertFailName = "legacy_message_passing_zevm_to_evm_revert_fail" + TestLegacyMessagePassingEVMtoZEVMRevertFailName = "legacy_message_passing_evm_to_zevm_revert_fail" + TestLegacyEtherDepositName = "legacy_eth_deposit" + TestLegacyEtherWithdrawName = "legacy_eth_withdraw" + TestLegacyEtherDepositAndCallRefundName = "legacy_eth_deposit_and_call_refund" + TestLegacyEtherDepositAndCallName = "legacy_eth_deposit_and_call" + TestLegacyERC20WithdrawName = "legacy_erc20_withdraw" + TestLegacyERC20DepositName = "legacy_erc20_deposit" + TestLegacyMultipleERC20DepositName = "legacy_erc20_multiple_deposit" + TestLegacyMultipleERC20WithdrawsName = "legacy_erc20_multiple_withdraw" + TestLegacyERC20DepositAndCallRefundName = "legacy_erc20_deposit_and_call_refund" ) // AllE2ETests is an ordered list of all e2e tests var AllE2ETests = []runner.E2ETest{ /* - ZETA tests + EVM chain tests */ runner.NewE2ETest( - TestZetaDepositName, - "deposit ZETA from Ethereum to ZEVM", + TestETHDepositName, + "deposit Ether into ZEVM", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + {Description: "amount in wei", DefaultValue: "100000000000000000000"}, }, - TestZetaDeposit, + TestV2ETHDeposit, ), runner.NewE2ETest( - TestZetaDepositNewAddressName, - "deposit ZETA from Ethereum to a new ZEVM address which does not exist yet", + TestETHDepositAndCallName, + "deposit Ether into ZEVM and call a contract", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - TestZetaDepositNewAddress, + TestV2ETHDepositAndCall, ), runner.NewE2ETest( - TestZetaDepositRestrictedName, - "deposit ZETA from Ethereum to ZEVM restricted address", + TestETHDepositAndCallNoMessageName, + "deposit Ether into ZEVM and call a contract using no message content", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - TestZetaDepositRestricted, + TestV2ETHDepositAndCallNoMessage, ), runner.NewE2ETest( - TestZetaWithdrawName, - "withdraw ZETA from ZEVM to Ethereum", + TestETHDepositAndCallRevertName, + "deposit Ether into ZEVM and call a contract that reverts", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - TestZetaWithdraw, + TestV2ETHDepositAndCallRevert, ), runner.NewE2ETest( - TestZetaWithdrawBTCRevertName, - "sending ZETA from ZEVM to Bitcoin with a message that should revert cctxs", + TestETHDepositAndCallRevertWithCallName, + "deposit Ether into ZEVM and call a contract that reverts with a onRevert call", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - TestZetaWithdrawBTCRevert, + TestV2ETHDepositAndCallRevertWithCall, ), - /* - Message passing tests - */ runner.NewE2ETest( - TestMessagePassingExternalChainsName, - "evm->evm message passing (sending ZETA only)", + TestETHWithdrawName, + "withdraw Ether from ZEVM", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingExternalChains, + TestV2ETHWithdraw, ), runner.NewE2ETest( - TestMessagePassingRevertFailExternalChainsName, - "message passing with failing revert between external EVM chains", + TestETHWithdrawAndArbitraryCallName, + "withdraw Ether from ZEVM and call a contract", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingRevertFailExternalChains, + TestV2ETHWithdrawAndArbitraryCall, ), runner.NewE2ETest( - TestMessagePassingRevertSuccessExternalChainsName, - "message passing with successful revert between external EVM chains", + TestETHWithdrawAndCallName, + "withdraw Ether from ZEVM call a contract", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingRevertSuccessExternalChains, + TestV2ETHWithdrawAndCall, ), runner.NewE2ETest( - TestMessagePassingEVMtoZEVMName, - "evm -> zevm message passing contract call ", + TestETHWithdrawAndCallNoMessageName, + "withdraw Ether from ZEVM call a contract with no message content", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000009"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingEVMtoZEVM, + TestV2ETHWithdrawAndCallNoMessage, ), runner.NewE2ETest( - TestMessagePassingZEVMToEVMName, - "zevm -> evm message passing contract call", + TestETHWithdrawAndCallThroughContractName, + "withdraw Ether from ZEVM call a contract through intermediary contract", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000007"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingZEVMtoEVM, + TestV2ETHWithdrawAndCallThroughContract, ), runner.NewE2ETest( - TestMessagePassingZEVMtoEVMRevertName, - "zevm -> evm message passing contract call reverts", + TestETHWithdrawAndCallRevertName, + "withdraw Ether from ZEVM and call a contract that reverts", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000006"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingZEVMtoEVMRevert, + TestV2ETHWithdrawAndCallRevert, ), runner.NewE2ETest( - TestMessagePassingEVMtoZEVMRevertName, - "evm -> zevm message passing and revert back to evm", + TestETHWithdrawAndCallRevertWithCallName, + "withdraw Ether from ZEVM and call a contract that reverts with a onRevert call", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - legacy.TestMessagePassingEVMtoZEVMRevert, + TestV2ETHWithdrawAndCallRevertWithCall, ), runner.NewE2ETest( - TestMessagePassingZEVMtoEVMRevertFailName, - "zevm -> evm message passing contract with failing revert", + TestDepositAndCallOutOfGasName, + "deposit Ether into ZEVM and call a contract that runs out of gas", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - legacy.TestMessagePassingZEVMtoEVMRevertFail, + TestDepositAndCallOutOfGas, ), runner.NewE2ETest( - TestMessagePassingEVMtoZEVMRevertFailName, - "evm -> zevm message passing contract with failing revert", + TestERC20DepositName, + "deposit ERC20 into ZEVM", []runner.ArgDefinition{ - {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, + {Description: "amount", DefaultValue: "100000000000000000000"}, }, - legacy.TestMessagePassingEVMtoZEVMRevertFail, + TestV2ERC20Deposit, ), - - /* - EVM gas tests - */ runner.NewE2ETest( - TestEtherDepositName, - "deposit Ether into ZEVM", + TestERC20DepositAndCallName, + "deposit ERC20 into ZEVM and call a contract", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, + {Description: "amount", DefaultValue: "100000"}, }, - legacy.TestEtherDeposit, + TestV2ERC20DepositAndCall, ), runner.NewE2ETest( - TestEtherWithdrawName, - "withdraw Ether from ZEVM", + TestERC20DepositAndCallNoMessageName, + "deposit ERC20 into ZEVM and call a contract with no message content", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, + {Description: "amount", DefaultValue: "100000"}, }, - legacy.TestEtherWithdraw, + TestV2ERC20DepositAndCallNoMessage, ), runner.NewE2ETest( - TestEtherWithdrawRestrictedName, - "withdraw Ether from ZEVM to restricted address", + TestERC20DepositAndCallRevertName, + "deposit ERC20 into ZEVM and call a contract that reverts", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, + {Description: "amount", DefaultValue: "10000000000000000000"}, }, - TestEtherWithdrawRestricted, + TestV2ERC20DepositAndCallRevert, ), runner.NewE2ETest( - TestEtherDepositAndCallRefundName, - "deposit Ether into ZEVM and call a contract that reverts; should refund", + TestERC20DepositAndCallRevertWithCallName, + "deposit ERC20 into ZEVM and call a contract that reverts with a onRevert call", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000000"}, + {Description: "amount", DefaultValue: "10000000000000000000"}, }, - legacy.TestEtherDepositAndCallRefund, + TestV2ERC20DepositAndCallRevertWithCall, ), runner.NewE2ETest( - TestEtherDepositAndCallName, - "deposit ZRC20 into ZEVM and call a contract", + TestERC20WithdrawName, + "withdraw ERC20 from ZEVM", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "1000000000000000000"}, + {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestEtherDepositAndCall, + TestV2ERC20Withdraw, ), - /* - EVM erc20 tests - */ runner.NewE2ETest( - TestERC20WithdrawName, - "withdraw ERC20 from ZEVM", + TestERC20WithdrawAndArbitraryCallName, + "withdraw ERC20 from ZEVM and arbitrary call a contract", []runner.ArgDefinition{ {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestERC20Withdraw, + TestV2ERC20WithdrawAndArbitraryCall, ), runner.NewE2ETest( - TestERC20DepositName, - "deposit ERC20 into ZEVM", + TestERC20WithdrawAndCallName, + "withdraw ERC20 from ZEVM and authenticated call a contract", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100000"}, + {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestERC20Deposit, + TestV2ERC20WithdrawAndCall, ), runner.NewE2ETest( - TestMultipleERC20DepositName, - "deposit ERC20 into ZEVM in multiple deposits", + TestERC20WithdrawAndCallNoMessageName, + "withdraw ERC20 from ZEVM and authenticated call a contract with no message", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000000000"}, - {Description: "count", DefaultValue: "3"}, + {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestMultipleERC20Deposit, + TestV2ERC20WithdrawAndCallNoMessage, ), runner.NewE2ETest( - TestMultipleERC20WithdrawsName, - "withdraw ERC20 from ZEVM in multiple withdrawals", + TestERC20WithdrawAndCallRevertName, + "withdraw ERC20 from ZEVM and call a contract that reverts", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100"}, - {Description: "count", DefaultValue: "3"}, + {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestMultipleERC20Withdraws, + TestV2ERC20WithdrawAndCallRevert, ), runner.NewE2ETest( - TestERC20DepositRestrictedName, - "deposit ERC20 into ZEVM restricted address", + TestERC20WithdrawAndCallRevertWithCallName, + "withdraw ERC20 from ZEVM and call a contract that reverts with a onRevert call", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100000"}, + {Description: "amount", DefaultValue: "1000"}, }, - legacy.TestERC20DepositRestricted, + TestV2ERC20WithdrawAndCallRevertWithCall, ), runner.NewE2ETest( - TestERC20DepositAndCallRefundName, - "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts", + TestZEVMToEVMArbitraryCallName, + "zevm -> evm call", []runner.ArgDefinition{}, - legacy.TestERC20DepositAndCallRefund, + TestV2ZEVMToEVMArbitraryCall, + ), + runner.NewE2ETest( + TestZEVMToEVMCallName, + "zevm -> evm call", + []runner.ArgDefinition{}, + TestV2ZEVMToEVMCall, + ), + runner.NewE2ETest( + TestZEVMToEVMCallThroughContractName, + "zevm -> evm call through intermediary contract", + []runner.ArgDefinition{}, + TestV2ZEVMToEVMCallThroughContract, + ), + runner.NewE2ETest( + TestEVMToZEVMCallName, + "evm -> zevm call", + []runner.ArgDefinition{}, + TestV2EVMToZEVMCall, + ), + runner.NewE2ETest( + TestDepositAndCallSwapName, + "evm -> zevm deposit and call with swap and withdraw back to evm", + []runner.ArgDefinition{}, + TestV2DepositAndCallSwap, + ), + /* + ZETA tests + */ + runner.NewE2ETest( + TestZetaDepositName, + "deposit ZETA from Ethereum to ZEVM", + []runner.ArgDefinition{ + {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + }, + TestZetaDeposit, + ), + runner.NewE2ETest( + TestZetaDepositNewAddressName, + "deposit ZETA from Ethereum to a new ZEVM address which does not exist yet", + []runner.ArgDefinition{ + {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + }, + TestZetaDepositNewAddress, + ), + runner.NewE2ETest( + TestZetaDepositRestrictedName, + "deposit ZETA from Ethereum to ZEVM restricted address", + []runner.ArgDefinition{ + {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + }, + TestZetaDepositRestricted, + ), + runner.NewE2ETest( + TestZetaWithdrawName, + "withdraw ZETA from ZEVM to Ethereum", + []runner.ArgDefinition{ + {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, + }, + TestZetaWithdraw, ), + runner.NewE2ETest( + TestZetaWithdrawBTCRevertName, + "sending ZETA from ZEVM to Bitcoin with a message that should revert cctxs", + []runner.ArgDefinition{ + {Description: "amount in azeta", DefaultValue: "1000000000000000000"}, + }, + TestZetaWithdrawBTCRevert, + ), + /* Solana tests */ @@ -840,321 +885,261 @@ var AllE2ETests = []runner.E2ETest{ []runner.ArgDefinition{}, TestMigrateERC20CustodyFunds, ), + /* - V2 smart contract tests + Special tests */ runner.NewE2ETest( - TestV2ETHDepositName, - "deposit Ether into ZEVM using V2 contract", + TestDeploy, + "deploy a contract", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000000000000000000"}, + {Description: "contract name", DefaultValue: ""}, }, - TestV2ETHDeposit, + TestDeployContract, ), runner.NewE2ETest( - TestV2ETHDepositAndCallName, - "deposit Ether into ZEVM and call a contract using V2 contract", + TestOperationAddLiquidityETHName, + "add liquidity to the ZETA/ETH pool", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, + {Description: "amountZETA", DefaultValue: "50000000000000000000"}, + {Description: "amountETH", DefaultValue: "50000000000000000000"}, }, - TestV2ETHDepositAndCall, + TestOperationAddLiquidityETH, ), runner.NewE2ETest( - TestV2ETHDepositAndCallNoMessageName, - "deposit Ether into ZEVM and call a contract using V2 contract using no message content", + TestOperationAddLiquidityERC20Name, + "add liquidity to the ZETA/ERC20 pool", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, + {Description: "amountZETA", DefaultValue: "50000000000000000000"}, + {Description: "amountERC20", DefaultValue: "50000000000000000000"}, }, - TestV2ETHDepositAndCallNoMessage, + TestOperationAddLiquidityERC20, ), + /* + Stateful precompiled contracts tests + */ runner.NewE2ETest( - TestV2ETHDepositAndCallRevertName, - "deposit Ether into ZEVM and call a contract using V2 contract that reverts", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, - }, - TestV2ETHDepositAndCallRevert, + TestPrecompilesPrototypeName, + "test stateful precompiled contracts prototype", + []runner.ArgDefinition{}, + TestPrecompilesPrototype, ), runner.NewE2ETest( - TestV2ETHDepositAndCallRevertWithCallName, - "deposit Ether into ZEVM and call a contract using V2 contract that reverts with a onRevert call", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, - }, - TestV2ETHDepositAndCallRevertWithCall, + TestPrecompilesPrototypeThroughContractName, + "test stateful precompiled contracts prototype through contract", + []runner.ArgDefinition{}, + TestPrecompilesPrototypeThroughContract, ), runner.NewE2ETest( - TestV2ETHWithdrawName, - "withdraw Ether from ZEVM using V2 contract", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, - }, - TestV2ETHWithdraw, + TestPrecompilesStakingName, + "test stateful precompiled contracts staking", + []runner.ArgDefinition{}, + TestPrecompilesStakingIsDisabled, ), runner.NewE2ETest( - TestV2ETHWithdrawAndArbitraryCallName, - "withdraw Ether from ZEVM and call a contract using V2 contract", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, - }, - TestV2ETHWithdrawAndArbitraryCall, + TestPrecompilesStakingThroughContractName, + "test stateful precompiled contracts staking through contract", + []runner.ArgDefinition{}, + TestPrecompilesStakingThroughContract, ), runner.NewE2ETest( - TestV2ETHWithdrawAndCallName, - "withdraw Ether from ZEVM call a contract using V2 contract", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, - }, - TestV2ETHWithdrawAndCall, + TestPrecompilesBankName, + "test stateful precompiled contracts bank with ZRC20 tokens", + []runner.ArgDefinition{}, + TestPrecompilesBank, ), runner.NewE2ETest( - TestV2ETHWithdrawAndCallNoMessageName, - "withdraw Ether from ZEVM call a contract using V2 contract with no message content", - []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, - }, - TestV2ETHWithdrawAndCallNoMessage, + TestPrecompilesBankFailName, + "test stateful precompiled contracts bank with non ZRC20 tokens", + []runner.ArgDefinition{}, + TestPrecompilesBankNonZRC20, + ), + runner.NewE2ETest( + TestPrecompilesBankThroughContractName, + "test stateful precompiled contracts bank through contract", + []runner.ArgDefinition{}, + TestPrecompilesBankThroughContract, + ), + runner.NewE2ETest( + TestPrecompilesDistributeName, + "test stateful precompiled contracts distribute", + []runner.ArgDefinition{}, + TestPrecompilesDistributeAndClaim, + ), + runner.NewE2ETest( + TestPrecompilesDistributeNonZRC20Name, + "test stateful precompiled contracts distribute with non ZRC20 tokens", + []runner.ArgDefinition{}, + TestPrecompilesDistributeNonZRC20, ), runner.NewE2ETest( - TestV2ETHWithdrawAndCallThroughContractName, - "withdraw Ether from ZEVM call a contract using V2 contract through intermediary contract", + TestPrecompilesDistributeThroughContractName, + "test stateful precompiled contracts distribute through contract", + []runner.ArgDefinition{}, + TestPrecompilesDistributeAndClaimThroughContract, + ), + + /* + Legacy tests + */ + runner.NewE2ETest( + TestLegacyMessagePassingExternalChainsName, + "evm->evm message passing (sending ZETA only) (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, - TestV2ETHWithdrawAndCallThroughContract, + legacy.TestMessagePassingExternalChains, ), runner.NewE2ETest( - TestV2ETHWithdrawAndCallRevertName, - "withdraw Ether from ZEVM and call a contract using V2 contract that reverts", + TestLegacyMessagePassingRevertFailExternalChainsName, + "message passing with failing revert between external EVM chains (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, - TestV2ETHWithdrawAndCallRevert, + legacy.TestMessagePassingRevertFailExternalChains, ), runner.NewE2ETest( - TestV2ETHWithdrawAndCallRevertWithCallName, - "withdraw Ether from ZEVM and call a contract using V2 contract that reverts with a onRevert call", + TestLegacyMessagePassingRevertSuccessExternalChainsName, + "message passing with successful revert between external EVM chains (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "100000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, - TestV2ETHWithdrawAndCallRevertWithCall, + legacy.TestMessagePassingRevertSuccessExternalChains, ), runner.NewE2ETest( - TestDepositAndCallOutOfGasName, - "deposit Ether into ZEVM and call a contract that runs out of gas", + TestLegacyMessagePassingEVMtoZEVMName, + "evm -> zevm message passing contract call (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount in wei", DefaultValue: "10000000000000000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000009"}, }, - TestDepositAndCallOutOfGas, + legacy.TestMessagePassingEVMtoZEVM, ), runner.NewE2ETest( - TestV2ERC20DepositName, - "deposit ERC20 into ZEVM using V2 contract", + TestLegacyMessagePassingZEVMToEVMName, + "zevm -> evm message passing contract call (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100000000000000000000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000007"}, }, - TestV2ERC20Deposit, + legacy.TestMessagePassingZEVMtoEVM, ), runner.NewE2ETest( - TestV2ERC20DepositAndCallName, - "deposit ERC20 into ZEVM and call a contract using V2 contract", + TestLegacyMessagePassingZEVMtoEVMRevertName, + "zevm -> evm message passing contract call reverts (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000006"}, }, - TestV2ERC20DepositAndCall, + legacy.TestMessagePassingZEVMtoEVMRevert, ), runner.NewE2ETest( - TestV2ERC20DepositAndCallNoMessageName, - "deposit ERC20 into ZEVM and call a contract using V2 contract with no message content", + TestLegacyMessagePassingEVMtoZEVMRevertName, + "evm -> zevm message passing and revert back to evm (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "100000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, }, - TestV2ERC20DepositAndCallNoMessage, + legacy.TestMessagePassingEVMtoZEVMRevert, ), runner.NewE2ETest( - TestV2ERC20DepositAndCallRevertName, - "deposit ERC20 into ZEVM and call a contract using V2 contract that reverts", + TestLegacyMessagePassingZEVMtoEVMRevertFailName, + "zevm -> evm message passing contract with failing revert (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "10000000000000000000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, }, - TestV2ERC20DepositAndCallRevert, + legacy.TestMessagePassingZEVMtoEVMRevertFail, ), runner.NewE2ETest( - TestV2ERC20DepositAndCallRevertWithCallName, - "deposit ERC20 into ZEVM and call a contract using V2 contract that reverts with a onRevert call", + TestLegacyMessagePassingEVMtoZEVMRevertFailName, + "evm -> zevm message passing contract with failing revert (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "10000000000000000000"}, + {Description: "amount in azeta", DefaultValue: "10000000000000000008"}, }, - TestV2ERC20DepositAndCallRevertWithCall, + legacy.TestMessagePassingEVMtoZEVMRevertFail, ), runner.NewE2ETest( - TestV2ERC20WithdrawName, - "withdraw ERC20 from ZEVM using V2 contract", + TestLegacyEtherDepositName, + "deposit Ether into ZEVM (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000"}, }, - TestV2ERC20Withdraw, + legacy.TestEtherDeposit, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndArbitraryCallName, - "withdraw ERC20 from ZEVM and arbitrary call a contract using V2 contract", + TestLegacyEtherWithdrawName, + "withdraw Ether from ZEVM (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - TestV2ERC20WithdrawAndArbitraryCall, + legacy.TestEtherWithdraw, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndCallName, - "withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract", + TestEtherWithdrawRestrictedName, + "withdraw Ether from ZEVM to restricted address (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000"}, + {Description: "amount in wei", DefaultValue: "100000"}, }, - TestV2ERC20WithdrawAndCall, + TestEtherWithdrawRestricted, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndCallNoMessageName, - "withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract with no message", + TestLegacyEtherDepositAndCallRefundName, + "deposit Ether into ZEVM and call a contract that reverts; should refund (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000"}, + {Description: "amount in wei", DefaultValue: "10000000000000000000"}, }, - TestV2ERC20WithdrawAndCallNoMessage, + legacy.TestEtherDepositAndCallRefund, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndCallRevertName, - "withdraw ERC20 from ZEVM and call a contract using V2 contract that reverts", + TestLegacyEtherDepositAndCallName, + "deposit ZRC20 into ZEVM and call a contract (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amount", DefaultValue: "1000"}, + {Description: "amount in wei", DefaultValue: "1000000000000000000"}, }, - TestV2ERC20WithdrawAndCallRevert, + legacy.TestEtherDepositAndCall, ), runner.NewE2ETest( - TestV2ERC20WithdrawAndCallRevertWithCallName, - "withdraw ERC20 from ZEVM and call a contract using V2 contract that reverts with a onRevert call", + TestLegacyERC20WithdrawName, + "withdraw ERC20 from ZEVM (v1 protocol contracts)", []runner.ArgDefinition{ {Description: "amount", DefaultValue: "1000"}, }, - TestV2ERC20WithdrawAndCallRevertWithCall, - ), - runner.NewE2ETest( - TestV2ZEVMToEVMArbitraryCallName, - "zevm -> evm call using V2 contract", - []runner.ArgDefinition{}, - TestV2ZEVMToEVMArbitraryCall, - ), - runner.NewE2ETest( - TestV2ZEVMToEVMCallName, - "zevm -> evm call using V2 contract", - []runner.ArgDefinition{}, - TestV2ZEVMToEVMCall, - ), - runner.NewE2ETest( - TestV2ZEVMToEVMCallThroughContractName, - "zevm -> evm call using V2 contract through intermediary contract", - []runner.ArgDefinition{}, - TestV2ZEVMToEVMCallThroughContract, - ), - runner.NewE2ETest( - TestV2EVMToZEVMCallName, - "evm -> zevm call using V2 contract", - []runner.ArgDefinition{}, - TestV2EVMToZEVMCall, - ), - runner.NewE2ETest( - TestV2DepositAndCallSwapName, - "evm -> zevm deposit and call with swap and withdraw back to evm", - []runner.ArgDefinition{}, - TestV2DepositAndCallSwap, + legacy.TestERC20Withdraw, ), - /* - Special tests - */ runner.NewE2ETest( - TestDeploy, - "deploy a contract", + TestLegacyERC20DepositName, + "deposit ERC20 into ZEVM (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "contract name", DefaultValue: ""}, + {Description: "amount", DefaultValue: "100000"}, }, - TestDeployContract, + legacy.TestERC20Deposit, ), runner.NewE2ETest( - TestOperationAddLiquidityETHName, - "add liquidity to the ZETA/ETH pool", + TestLegacyMultipleERC20DepositName, + "deposit ERC20 into ZEVM in multiple deposits (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amountZETA", DefaultValue: "50000000000000000000"}, - {Description: "amountETH", DefaultValue: "50000000000000000000"}, + {Description: "amount", DefaultValue: "1000000000"}, + {Description: "count", DefaultValue: "3"}, }, - TestOperationAddLiquidityETH, + legacy.TestMultipleERC20Deposit, ), runner.NewE2ETest( - TestOperationAddLiquidityERC20Name, - "add liquidity to the ZETA/ERC20 pool", + TestLegacyMultipleERC20WithdrawsName, + "withdraw ERC20 from ZEVM in multiple withdrawals (v1 protocol contracts)", []runner.ArgDefinition{ - {Description: "amountZETA", DefaultValue: "50000000000000000000"}, - {Description: "amountERC20", DefaultValue: "50000000000000000000"}, + {Description: "amount", DefaultValue: "100"}, + {Description: "count", DefaultValue: "3"}, }, - TestOperationAddLiquidityERC20, - ), - /* - Stateful precompiled contracts tests - */ - runner.NewE2ETest( - TestPrecompilesPrototypeName, - "test stateful precompiled contracts prototype", - []runner.ArgDefinition{}, - TestPrecompilesPrototype, - ), - runner.NewE2ETest( - TestPrecompilesPrototypeThroughContractName, - "test stateful precompiled contracts prototype through contract", - []runner.ArgDefinition{}, - TestPrecompilesPrototypeThroughContract, - ), - runner.NewE2ETest( - TestPrecompilesStakingName, - "test stateful precompiled contracts staking", - []runner.ArgDefinition{}, - TestPrecompilesStakingIsDisabled, - ), - runner.NewE2ETest( - TestPrecompilesStakingThroughContractName, - "test stateful precompiled contracts staking through contract", - []runner.ArgDefinition{}, - TestPrecompilesStakingThroughContract, - ), - runner.NewE2ETest( - TestPrecompilesBankName, - "test stateful precompiled contracts bank with ZRC20 tokens", - []runner.ArgDefinition{}, - TestPrecompilesBank, - ), - runner.NewE2ETest( - TestPrecompilesBankFailName, - "test stateful precompiled contracts bank with non ZRC20 tokens", - []runner.ArgDefinition{}, - TestPrecompilesBankNonZRC20, - ), - runner.NewE2ETest( - TestPrecompilesBankThroughContractName, - "test stateful precompiled contracts bank through contract", - []runner.ArgDefinition{}, - TestPrecompilesBankThroughContract, - ), - runner.NewE2ETest( - TestPrecompilesDistributeName, - "test stateful precompiled contracts distribute", - []runner.ArgDefinition{}, - TestPrecompilesDistributeAndClaim, + legacy.TestMultipleERC20Withdraws, ), runner.NewE2ETest( - TestPrecompilesDistributeNonZRC20Name, - "test stateful precompiled contracts distribute with non ZRC20 tokens", - []runner.ArgDefinition{}, - TestPrecompilesDistributeNonZRC20, + TestERC20DepositRestrictedName, + "deposit ERC20 into ZEVM restricted address (v1 protocol contracts)", + []runner.ArgDefinition{ + {Description: "amount", DefaultValue: "100000"}, + }, + TestERC20DepositRestricted, ), runner.NewE2ETest( - TestPrecompilesDistributeThroughContractName, - "test stateful precompiled contracts distribute through contract", + TestLegacyERC20DepositAndCallRefundName, + "deposit a non-gas ZRC20 into ZEVM and call a contract that reverts (v1 protocol contracts)", []runner.ArgDefinition{}, - TestPrecompilesDistributeAndClaimThroughContract, + legacy.TestERC20DepositAndCallRefund, ), } diff --git a/e2e/e2etests/test_v2_deposit_and_call_swap.go b/e2e/e2etests/test_deposit_and_call_swap.go similarity index 100% rename from e2e/e2etests/test_v2_deposit_and_call_swap.go rename to e2e/e2etests/test_deposit_and_call_swap.go diff --git a/e2e/e2etests/test_v2_erc20_deposit.go b/e2e/e2etests/test_erc20_deposit.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_deposit.go rename to e2e/e2etests/test_erc20_deposit.go diff --git a/e2e/e2etests/test_v2_erc20_deposit_and_call.go b/e2e/e2etests/test_erc20_deposit_and_call.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_deposit_and_call.go rename to e2e/e2etests/test_erc20_deposit_and_call.go diff --git a/e2e/e2etests/test_v2_erc20_deposit_and_call_no_message.go b/e2e/e2etests/test_erc20_deposit_and_call_no_message.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_deposit_and_call_no_message.go rename to e2e/e2etests/test_erc20_deposit_and_call_no_message.go diff --git a/e2e/e2etests/test_v2_erc20_deposit_and_call_revert.go b/e2e/e2etests/test_erc20_deposit_and_call_revert.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_deposit_and_call_revert.go rename to e2e/e2etests/test_erc20_deposit_and_call_revert.go diff --git a/e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_erc20_deposit_and_call_revert_with_call.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go rename to e2e/e2etests/test_erc20_deposit_and_call_revert_with_call.go diff --git a/e2e/e2etests/legacy/test_erc20_deposit_restricted_address.go b/e2e/e2etests/test_erc20_deposit_restricted_address.go similarity index 97% rename from e2e/e2etests/legacy/test_erc20_deposit_restricted_address.go rename to e2e/e2etests/test_erc20_deposit_restricted_address.go index 2a1b78c909..88e6afd7c8 100644 --- a/e2e/e2etests/legacy/test_erc20_deposit_restricted_address.go +++ b/e2e/e2etests/test_erc20_deposit_restricted_address.go @@ -1,4 +1,4 @@ -package legacy +package e2etests import ( ethcommon "github.com/ethereum/go-ethereum/common" diff --git a/e2e/e2etests/test_v2_erc20_withdraw.go b/e2e/e2etests/test_erc20_withdraw.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw.go rename to e2e/e2etests/test_erc20_withdraw.go diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_erc20_withdraw_and_arbitrary_call.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw_and_arbitrary_call.go rename to e2e/e2etests/test_erc20_withdraw_and_arbitrary_call.go diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call.go b/e2e/e2etests/test_erc20_withdraw_and_call.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw_and_call.go rename to e2e/e2etests/test_erc20_withdraw_and_call.go diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_no_message.go b/e2e/e2etests/test_erc20_withdraw_and_call_no_message.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw_and_call_no_message.go rename to e2e/e2etests/test_erc20_withdraw_and_call_no_message.go diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go b/e2e/e2etests/test_erc20_withdraw_and_call_revert.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw_and_call_revert.go rename to e2e/e2etests/test_erc20_withdraw_and_call_revert.go diff --git a/e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_erc20_withdraw_and_call_revert_with_call.go similarity index 100% rename from e2e/e2etests/test_v2_erc20_withdraw_and_call_revert_with_call.go rename to e2e/e2etests/test_erc20_withdraw_and_call_revert_with_call.go diff --git a/e2e/e2etests/test_v2_eth_deposit.go b/e2e/e2etests/test_eth_deposit.go similarity index 100% rename from e2e/e2etests/test_v2_eth_deposit.go rename to e2e/e2etests/test_eth_deposit.go diff --git a/e2e/e2etests/test_v2_eth_deposit_and_call.go b/e2e/e2etests/test_eth_deposit_and_call.go similarity index 100% rename from e2e/e2etests/test_v2_eth_deposit_and_call.go rename to e2e/e2etests/test_eth_deposit_and_call.go diff --git a/e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go b/e2e/e2etests/test_eth_deposit_and_call_no_message.go similarity index 100% rename from e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go rename to e2e/e2etests/test_eth_deposit_and_call_no_message.go diff --git a/e2e/e2etests/test_v2_eth_deposit_and_call_revert.go b/e2e/e2etests/test_eth_deposit_and_call_revert.go similarity index 100% rename from e2e/e2etests/test_v2_eth_deposit_and_call_revert.go rename to e2e/e2etests/test_eth_deposit_and_call_revert.go diff --git a/e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_eth_deposit_and_call_revert_with_call.go similarity index 100% rename from e2e/e2etests/test_v2_eth_deposit_and_call_revert_with_call.go rename to e2e/e2etests/test_eth_deposit_and_call_revert_with_call.go diff --git a/e2e/e2etests/test_v2_eth_withdraw.go b/e2e/e2etests/test_eth_withdraw.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw.go rename to e2e/e2etests/test_eth_withdraw.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_eth_withdraw_and_arbitrary_call.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_arbitrary_call.go rename to e2e/e2etests/test_eth_withdraw_and_arbitrary_call.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call.go b/e2e/e2etests/test_eth_withdraw_and_call.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_call.go rename to e2e/e2etests/test_eth_withdraw_and_call.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_no_message.go b/e2e/e2etests/test_eth_withdraw_and_call_no_message.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_call_no_message.go rename to e2e/e2etests/test_eth_withdraw_and_call_no_message.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go b/e2e/e2etests/test_eth_withdraw_and_call_revert.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_call_revert.go rename to e2e/e2etests/test_eth_withdraw_and_call_revert.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_eth_withdraw_and_call_revert_with_call.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_call_revert_with_call.go rename to e2e/e2etests/test_eth_withdraw_and_call_revert_with_call.go diff --git a/e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go b/e2e/e2etests/test_eth_withdraw_and_call_through_contract.go similarity index 100% rename from e2e/e2etests/test_v2_eth_withdraw_and_call_through_contract.go rename to e2e/e2etests/test_eth_withdraw_and_call_through_contract.go diff --git a/e2e/e2etests/test_v2_evm_to_zevm_call.go b/e2e/e2etests/test_evm_to_zevm_call.go similarity index 100% rename from e2e/e2etests/test_v2_evm_to_zevm_call.go rename to e2e/e2etests/test_evm_to_zevm_call.go diff --git a/e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go b/e2e/e2etests/test_zevm_to_evm_arbitrary_call.go similarity index 100% rename from e2e/e2etests/test_v2_zevm_to_evm_arbitrary_call.go rename to e2e/e2etests/test_zevm_to_evm_arbitrary_call.go diff --git a/e2e/e2etests/test_v2_zevm_to_evm_call.go b/e2e/e2etests/test_zevm_to_evm_call.go similarity index 100% rename from e2e/e2etests/test_v2_zevm_to_evm_call.go rename to e2e/e2etests/test_zevm_to_evm_call.go diff --git a/e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go b/e2e/e2etests/test_zevm_to_evm_call_through_contract.go similarity index 100% rename from e2e/e2etests/test_v2_zevm_to_evm_call_through_contract.go rename to e2e/e2etests/test_zevm_to_evm_call_through_contract.go