diff --git a/changelog.md b/changelog.md index 055ada9c61..c904c5af8d 100644 --- a/changelog.md +++ b/changelog.md @@ -85,8 +85,8 @@ * [2515](https://github.com/zeta-chain/node/pull/2515) - replace chainName by chainID for ChainNonces indexing * [2541](https://github.com/zeta-chain/node/pull/2541) - deprecate ChainName field in Chain object * [2542](https://github.com/zeta-chain/node/pull/2542) - adjust permissions to be more restrictive -* [2556](https://github.com/zeta-chain/node/pull/2556) - refactor migrator length check to use consensus type * [2572](https://github.com/zeta-chain/node/pull/2572) - turn off IBC modules +* [2556](https://github.com/zeta-chain/node/pull/2556) - refactor migrator length check to use consensus type * [2568](https://github.com/zeta-chain/node/pull/2568) - improve AppContext by converging chains, chainParams, enabledChains, and additionalChains into a single zctx.Chain ### Tests diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index 4b45f41494..deb9dd112e 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -421,10 +421,10 @@ func runTSSMigration(deployerRunner *runner.E2ERunner, logger *runner.Logger, ve // Generate new TSS waitKeygenHeight(deployerRunner.Ctx, deployerRunner.CctxClient, deployerRunner.ObserverClient, logger, 0) - // migration test is a blocking thread, we cannot run other tests in parallel - // The migration test migrates funds to a new TSS and then updates the TSS address on zetacore. - // The necessary restarts are done by the zetaclient supervisor - fn := migrationTestRoutine(conf, deployerRunner, verbose, e2etests.TestMigrateTSSName) + // Run migration + // migrationRoutine runs migration e2e test , which migrates funds from the older TSS to the new one + // The zetaclient restarts required for this process are managed by the background workers in zetaclient (TSSListener) + fn := migrationRoutine(conf, deployerRunner, verbose, e2etests.TestMigrateTSSName) if err := fn(); err != nil { logger.Print("❌ %v", err) diff --git a/cmd/zetae2e/local/migration.go b/cmd/zetae2e/local/migration.go index d6fab1b709..27d9682990 100644 --- a/cmd/zetae2e/local/migration.go +++ b/cmd/zetae2e/local/migration.go @@ -11,8 +11,8 @@ import ( "github.com/zeta-chain/zetacore/e2e/runner" ) -// migrationTestRoutine runs migration related e2e tests -func migrationTestRoutine( +// migrationRoutine runs migration related e2e tests +func migrationRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index d8e7d04cbb..2cff961772 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -90,8 +90,11 @@ geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: w address=$(yq -r '.additional_accounts.user_migration.evm_address' config.yml) echo "funding migration tester address ${address} with 10000 Ether" geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 +### Run zetae2e command depending on the option passed - +# Mode migrate is used to run the e2e tests before and after the TSS migration +# It runs the e2e tests with the migrate flag which triggers a TSS migration at the end of the tests. Once the migrationis done the first e2e test is complete +# The second e2e test is run after the migration to ensure the network is still working as expected with the new tss address if [ "$LOCALNET_MODE" == "migrate" ]; then if [[ ! -f deployed.yml ]]; then zetae2e local $E2E_ARGS --setup-only --config config.yml --config-out deployed.yml --skip-header-proof @@ -104,8 +107,6 @@ if [ "$LOCALNET_MODE" == "migrate" ]; then fi echo "running e2e test before migrating TSS" - - # Use light flag to ensure tests can complete before the upgrade height zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-header-proof if [ $? -ne 0 ]; then echo "first e2e failed" @@ -116,7 +117,6 @@ if [ "$LOCALNET_MODE" == "migrate" ]; then sleep 10 zetae2e local --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof - ZETAE2E_EXIT_CODE=$? if [ $ZETAE2E_EXIT_CODE -eq 0 ]; then echo "E2E passed after migration" @@ -128,8 +128,9 @@ if [ "$LOCALNET_MODE" == "migrate" ]; then fi -### Run zetae2e command depending on the option passed - +# Mode upgrade is used to run the e2e tests before and after the upgrade +# It runs the e2e tests , waits for the upgrade height to be reached, and then runs the e2e tests again once the ungrade is done. +# The second e2e test is run after the upgrade to ensure the network is still working as expected with the new version if [ "$LOCALNET_MODE" == "upgrade" ]; then # Run the e2e tests, then restart zetaclientd at upgrade height and run the e2e tests again @@ -162,7 +163,6 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then echo "Waiting for upgrade height..." OLD_VERSION=$(get_zetacored_version) - CURRENT_HEIGHT=0 WAIT_HEIGHT=$(( UPGRADE_HEIGHT - 1 )) # wait for upgrade height @@ -209,8 +209,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then fi else - - # Run the e2e tests normally + # If no mode is passed, run the e2e tests normally echo "running e2e setup..." if [[ ! -f deployed.yml ]]; then diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index faaca5c026..61511b6ddd 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -25,8 +25,8 @@ 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 { - time.Sleep(3 * time.Second) - r.Logger.Print("ℹ️create pair error") + r.Logger.Print("ℹ️ create pair error") + time.Sleep(3 * time.Second) // wait for sometime so that the } txERC20ZRC20Approve, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) @@ -144,10 +144,8 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("memo length %d", len(memo)) amount := 0.1 - - txid := &chainhash.Hash{} utxos, err = r.ListDeployerUTXOs() - txid, err = r.SendToTSSFromDeployerWithMemo(amount, utxos[0:1], memo) + txid, err := r.SendToTSSFromDeployerWithMemo(amount, utxos[0:1], memo) require.NoError(r, err) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, txid.String(), r.CctxClient, r.Logger, r.CctxTimeout) diff --git a/e2e/e2etests/test_message_passing_external_chains_revert.go b/e2e/e2etests/test_message_passing_external_chains_revert.go index e396a7d95c..37146a4c78 100644 --- a/e2e/e2etests/test_message_passing_external_chains_revert.go +++ b/e2e/e2etests/test_message_passing_external_chains_revert.go @@ -62,11 +62,11 @@ func TestMessagePassingRevertSuccessExternalChains(r *runner.E2ERunner, args []s for _, log := range receipt.Logs { event, err := r.ConnectorEth.ParseZetaReverted(*log) if err == nil { - r.Logger.Print("ZetaReverted event: ") - r.Logger.Print(" Dest Addr: %s", ethcommon.BytesToAddress(event.DestinationAddress).Hex()) - r.Logger.Print(" Dest Chain: %d", event.DestinationChainId) - r.Logger.Print(" RemainingZetaValue: %d", event.RemainingZetaValue) - r.Logger.Print(" Message: %x", event.Message) + r.Logger.Info("ZetaReverted event: ") + r.Logger.Info(" Dest Addr: %s", ethcommon.BytesToAddress(event.DestinationAddress).Hex()) + r.Logger.Info(" Dest Chain: %d", event.DestinationChainId) + r.Logger.Info(" RemainingZetaValue: %d", event.RemainingZetaValue) + r.Logger.Info(" Message: %x", event.Message) } } diff --git a/e2e/e2etests/test_message_passing_external_chains_revert_fail.go b/e2e/e2etests/test_message_passing_external_chains_revert_fail.go index 139dee8f44..699f66b607 100644 --- a/e2e/e2etests/test_message_passing_external_chains_revert_fail.go +++ b/e2e/e2etests/test_message_passing_external_chains_revert_fail.go @@ -59,13 +59,12 @@ func TestMessagePassingRevertFailExternalChains(r *runner.E2ERunner, args []stri for _, log := range receipt.Logs { sentLog, err := r.ConnectorEth.ParseZetaSent(*log) if err == nil { - r.Logger.Print(" Dest Addr: %s", ethcommon.BytesToAddress(sentLog.DestinationAddress).Hex()) - r.Logger.Print(" Dest Chain: %d", sentLog.DestinationChainId) - r.Logger.Print(" Dest Gas: %d", sentLog.DestinationGasLimit) - r.Logger.Print(" Zeta Value: %d", sentLog.ZetaValueAndGas) + r.Logger.Info(" Dest Addr: %s", ethcommon.BytesToAddress(sentLog.DestinationAddress).Hex()) + r.Logger.Info(" Dest Chain: %d", sentLog.DestinationChainId) + r.Logger.Info(" Dest Gas: %d", sentLog.DestinationGasLimit) + r.Logger.Info(" Zeta Value: %d", sentLog.ZetaValueAndGas) } } - r.Logger.Print(" Inbound Tx Hash: %s", receipt.TxHash.String()) // expect revert tx to fail cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, receipt.TxHash.String(), r.CctxClient, r.Logger, r.CctxTimeout) receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutboundParam().Hash)) diff --git a/e2e/e2etests/test_zrc20_swap.go b/e2e/e2etests/test_zrc20_swap.go index 14febbe800..3008904306 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") } else { utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) } diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index a10dc8d68b..da3d4fc5d4 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -20,7 +20,7 @@ const ( AdminPolicyName = "admin" OperationalPolicyName = "operational" - DefaultCctxTimeout = 4 * time.Minute + DefaultCctxTimeout = 8 * time.Minute ) // WaitCctxMinedByInboundHash waits until cctx is mined; returns the cctxIndex (the last one) diff --git a/x/crosschain/keeper/outbound_tracker.go b/x/crosschain/keeper/outbound_tracker.go index fd9448db90..dbf8bf3bb5 100644 --- a/x/crosschain/keeper/outbound_tracker.go +++ b/x/crosschain/keeper/outbound_tracker.go @@ -51,7 +51,6 @@ func (k Keeper) RemoveOutboundTrackerFromStore( ) { index := getOutboundTrackerIndex(chainID, nonce) store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutboundTrackerKeyPrefix)) - fmt.Println("Removing outbound tracker ", chainID, nonce) store.Delete(types.OutboundTrackerKey( index, ))