diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index 561a8eb6f0..b18ca9922b 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -96,6 +96,7 @@ func ExportContractsFromRunner(r *runner.E2ERunner, conf config.Config) config.C conf.Contracts.EVM.ConnectorEthAddr = r.ConnectorEthAddr.Hex() conf.Contracts.EVM.CustodyAddr = r.ERC20CustodyAddr.Hex() conf.Contracts.EVM.ERC20 = r.ERC20Addr.Hex() + conf.Contracts.EVM.TestDappAddr = r.EvmTestDAppAddr.Hex() conf.Contracts.ZEVM.SystemContractAddr = r.SystemContractAddr.Hex() conf.Contracts.ZEVM.ETHZRC20Addr = r.ETHZRC20Addr.Hex() @@ -107,7 +108,7 @@ func ExportContractsFromRunner(r *runner.E2ERunner, conf config.Config) config.C conf.Contracts.ZEVM.WZetaAddr = r.WZetaAddr.Hex() conf.Contracts.ZEVM.ZEVMSwapAppAddr = r.ZEVMSwapAppAddr.Hex() conf.Contracts.ZEVM.ContextAppAddr = r.ContextAppAddr.Hex() - conf.Contracts.ZEVM.TestDappAddr = r.EvmTestDAppAddr.Hex() + conf.Contracts.ZEVM.TestDappAddr = r.ZevmTestDAppAddr.Hex() return conf } diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index 317054af19..a47b39ef4e 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -180,7 +180,13 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { } if c := conf.Contracts.ZEVM.TestDappAddr; c != "" { if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid TestDappAddr: %s", c) + return fmt.Errorf("invalid ZevmTestDappAddr: %s", c) + } + r.ZevmTestDAppAddr = ethcommon.HexToAddress(c) + } + if c := conf.Contracts.EVM.TestDappAddr; c != "" { + if !ethcommon.IsHexAddress(c) { + return fmt.Errorf("invalid EvmTestDappAddr: %s", c) } r.EvmTestDAppAddr = ethcommon.HexToAddress(c) } diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index e2c9f07f14..ead84ee4d1 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -79,24 +79,29 @@ if [ "$OPTION" == "upgrade" ]; then # Fetch the height of the upgrade, default is 225, if arg3 is passed, use that value UPGRADE_HEIGHT=${3:-225} - # Run zetae2e, if the upgrade height is lower than 100, we use the setup-only flag - if [ "$UPGRADE_HEIGHT" -lt 100 ]; then - echo "running E2E command to setup the networks..." + if [[ ! -f deployed.yml ]]; then zetae2e "$ZETAE2E_CMD" --setup-only --config-out deployed.yml --skip-header-proof + if [ $? -ne 0 ]; then + echo "e2e setup failed" + exit 1 + fi else + echo "skipping e2e setup because it has already been completed" + fi + + # Run zetae2e, if the upgrade height is greater than 100 to populate the state + if [ "$UPGRADE_HEIGHT" -gt 100 ]; 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 "$ZETAE2E_CMD" --config-out deployed.yml --light --skip-header-proof - fi - ZETAE2E_EXIT_CODE=$? - - if [ $ZETAE2E_EXIT_CODE -ne 0 ]; then - echo "E2E setup failed" - exit 1 + zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --light --skip-header-proof + if [ $? -ne 0 ]; then + echo "first e2e failed" + exit 1 + fi fi - echo "E2E setup passed, waiting for upgrade height..." + echo "Waiting for upgrade height..." OLD_VERSION=$(get_zetacored_version) @@ -148,10 +153,21 @@ if [ "$OPTION" == "upgrade" ]; then else # Run the e2e tests normally + echo "running e2e setup..." + + if [[ ! -f deployed.yml ]]; then + zetae2e "$ZETAE2E_CMD" --setup-only --config-out deployed.yml + if [ $? -ne 0 ]; then + echo "e2e setup failed" + exit 1 + fi + else + echo "skipping e2e setup because it has already been completed" + fi echo "running e2e tests..." - eval "zetae2e $ZETAE2E_CMD" + zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml ZETAE2E_EXIT_CODE=$? # if e2e passed, exit with 0, otherwise exit with 1 diff --git a/e2e/config/config.go b/e2e/config/config.go index 6f33da7104..450b02c5a3 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -54,6 +54,7 @@ type EVM struct { ConnectorEthAddr string `yaml:"connector_eth"` CustodyAddr string `yaml:"custody"` ERC20 string `yaml:"erc20"` + TestDappAddr string `yaml:"test_dapp"` } // ZEVM contains the addresses of predeployed contracts on the zEVM chain