Skip to content

Commit

Permalink
update cctx timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Aug 8, 2024
1 parent 028bf50 commit e964cee
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 34 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/zetae2e/local/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 8 additions & 9 deletions contrib/localnet/orchestrator/start-zetae2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions e2e/e2etests/test_crosschain_swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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()

Check failure on line 147 in e2e/e2etests/test_crosschain_swap.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to err (ineffassign)
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)
Expand Down
10 changes: 5 additions & 5 deletions e2e/e2etests/test_message_passing_external_chains_revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_zrc20_swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/zetacore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/keeper/outbound_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))
Expand Down

0 comments on commit e964cee

Please sign in to comment.