From 88f4df439231873b70352b6b4ae9fbf9cfe4c468 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 10 Dec 2025 10:03:29 +0530 Subject: [PATCH 1/4] diable v2 zeta flows --- Makefile | 1 + cmd/zetae2e/config/contracts.go | 7 +++ e2e/e2etests/legacy/test_zeta_deposit.go | 2 - e2e/e2etests/test_zeta_deposit.go | 17 ++++--- e2e/e2etests/test_zeta_deposit_and_call.go | 28 ++++++----- .../test_zeta_deposit_and_call_no_message.go | 29 +++++++----- .../test_zeta_deposit_and_call_revert.go | 18 ++++--- ..._zeta_deposit_and_call_revert_with_call.go | 31 ++++++------ .../test_zeta_deposit_revert_and_abort.go | 42 +++++++++-------- e2e/e2etests/test_zeta_withdraw.go | 9 ++-- .../test_zeta_withdraw_and_arbitrary_call.go | 21 +++++---- e2e/e2etests/test_zeta_withdraw_and_call.go | 36 +++++++------- .../test_zeta_withdraw_and_call_revert.go | 32 ++++++++----- ...zeta_withdraw_and_call_revert_with_call.go | 47 ++++++++++--------- .../test_zeta_withdraw_revert_and_abort.go | 46 ++++++++++-------- x/crosschain/keeper/cctx_gateway_zevm.go | 8 +++- x/crosschain/keeper/v2_zevm_inbound.go | 19 ++++---- x/crosschain/types/errors.go | 1 + 18 files changed, 226 insertions(+), 168 deletions(-) diff --git a/Makefile b/Makefile index 5a5785c94b..bff34d4c9d 100644 --- a/Makefile +++ b/Makefile @@ -431,6 +431,7 @@ start-connector-migration-test: zetanode-upgrade @echo "--> Starting migration test for v2 connector contracts" export LOCALNET_MODE=upgrade && \ export UPGRADE_HEIGHT=90 && \ + export USE_ZETAE2E_ANTE=true && \ export E2E_ARGS="${E2E_ARGS} --skip-regular --test-connector-migration --test-legacy" && \ cd contrib/localnet/ && $(DOCKER_COMPOSE) --profile upgrade -f docker-compose-upgrade.yml up -d diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index 4e72d60618..4a5d6ab64b 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -364,6 +364,13 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { } } + if c := conf.Contracts.ZEVM.TestDappAddr; c != "" { + r.ZevmTestDAppAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ZevmTestDappAddr: %w", err) + } + } + if c := conf.Contracts.EVM.TestDAppV2Addr; c != "" { r.TestDAppV2EVMAddr, err = c.AsEVMAddress() if err != nil { diff --git a/e2e/e2etests/legacy/test_zeta_deposit.go b/e2e/e2etests/legacy/test_zeta_deposit.go index a08877b4ea..0f6016b658 100644 --- a/e2e/e2etests/legacy/test_zeta_deposit.go +++ b/e2e/e2etests/legacy/test_zeta_deposit.go @@ -18,6 +18,4 @@ func TestZetaDeposit(r *runner.E2ERunner, args []string) { // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, hash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.CCTX(*cctx, "deposit") - - r.Logger.Print("Zeta deposit cctx: %s", cctx.Index) } diff --git a/e2e/e2etests/test_zeta_deposit.go b/e2e/e2etests/test_zeta_deposit.go index 18c24b5622..0fa6b65419 100644 --- a/e2e/e2etests/test_zeta_deposit.go +++ b/e2e/e2etests/test_zeta_deposit.go @@ -17,19 +17,22 @@ func TestZetaDeposit(r *runner.E2ERunner, args []string) { amount := utils.ParseBigInt(r, args[0]) receiverAddress := r.EVMAddress() - oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) + //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) r.ApproveZetaOnEVM(r.GatewayEVMAddr) // perform the deposit tx := r.ZETADeposit(receiverAddress, amount, gatewayevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) - // wait for the cctx to be mined + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) - require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) + //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) } diff --git a/e2e/e2etests/test_zeta_deposit_and_call.go b/e2e/e2etests/test_zeta_deposit_and_call.go index 9c2d784589..751f12651d 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call.go +++ b/e2e/e2etests/test_zeta_deposit_and_call.go @@ -24,8 +24,8 @@ func TestZetaDepositAndCall(r *runner.E2ERunner, args []string) { r.AssertTestDAppZEVMCalled(false, payload, sender, amount) - oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) + //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) // perform the deposit tx := r.ZetaDepositAndCall( @@ -36,15 +36,19 @@ func TestZetaDepositAndCall(r *runner.E2ERunner, args []string) { ) // wait for the cctx to be mined + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - - // check the payload was received on the contract - r.AssertTestDAppZEVMCalled(true, payload, sender, amount) - - // check the balance was updated - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) - require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + r.Logger.CCTX(*cctx, "zeta_deposit") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + + //// check the payload was received on the contract + //r.AssertTestDAppZEVMCalled(true, payload, sender, amount) + // + //// check the balance was updated + //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) + //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_no_message.go b/e2e/e2etests/test_zeta_deposit_and_call_no_message.go index 292222fa4d..641b7e88c4 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_no_message.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_no_message.go @@ -3,7 +3,6 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -20,8 +19,8 @@ func TestZetaDepositAndCallNoMessage(r *runner.E2ERunner, args []string) { r.ApproveZetaOnEVM(r.GatewayEVMAddr) receiverAddress := r.TestDAppV2ZEVMAddr - oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) + //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) // perform the deposit tx := r.ZetaDepositAndCall( @@ -32,17 +31,21 @@ func TestZetaDepositAndCallNoMessage(r *runner.E2ERunner, args []string) { ) // wait for the cctx to be mined + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit_and_call_no_message") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit_and_call_no_message") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + r.Logger.CCTX(*cctx, "zeta_deposit") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) // check the payload was received on the contract - messageIndex, err := r.TestDAppV2ZEVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress()) - require.NoError(r, err) - r.AssertTestDAppZEVMCalled(true, messageIndex, r.EVMAddress().Bytes(), amount) - - // check the balance was updated - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - require.NoError(r, err) - require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + //messageIndex, err := r.TestDAppV2ZEVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress()) + //require.NoError(r, err) + //r.AssertTestDAppZEVMCalled(true, messageIndex, r.EVMAddress().Bytes(), amount) + // + //// check the balance was updated + //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + //require.NoError(r, err) + //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_revert.go b/e2e/e2etests/test_zeta_deposit_and_call_revert.go index 39a759b9c2..3af5418e1d 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_revert.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_revert.go @@ -33,12 +33,16 @@ func TestZetaDepositAndCallRevert(r *runner.E2ERunner, args []string) { }) // wait for the cctx to be reverted + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - - // check the balance is more than 0 - balance, err = r.ZetaEth.BalanceOf(&bind.CallOpts{}, revertAddress) - require.NoError(r, err) - require.True(r, balance.Cmp(big.NewInt(0)) > 0) + r.Logger.CCTX(*cctx, "zeta_deposit") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + + //// check the balance is more than 0 + //balance, err = r.ZetaEth.BalanceOf(&bind.CallOpts{}, revertAddress) + //require.NoError(r, err) + //require.True(r, balance.Cmp(big.NewInt(0)) > 0) } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go index a2f1800de8..141ebc6b41 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go @@ -3,7 +3,6 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -33,18 +32,22 @@ func TestZetaDepositAndCallRevertWithCall(r *runner.E2ERunner, args []string) { }) // wait for the cctx to be reverted + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - - // check the payload was received on the contract - r.AssertTestDAppEVMCalled(true, payload, big.NewInt(0)) - - // check expected sender was used - senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( - &bind.CallOpts{}, - []byte(payload), - ) - require.NoError(r, err) - require.Equal(r, r.EVMAuth.From, senderForMsg) + r.Logger.CCTX(*cctx, "zeta_deposit") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + + //// check the payload was received on the contract + //r.AssertTestDAppEVMCalled(true, payload, big.NewInt(0)) + // + //// check expected sender was used + //senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + // &bind.CallOpts{}, + // []byte(payload), + //) + //require.NoError(r, err) + //require.Equal(r, r.EVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_zeta_deposit_revert_and_abort.go b/e2e/e2etests/test_zeta_deposit_revert_and_abort.go index 41c4b26422..f306197885 100644 --- a/e2e/e2etests/test_zeta_deposit_revert_and_abort.go +++ b/e2e/e2etests/test_zeta_deposit_revert_and_abort.go @@ -3,8 +3,6 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -21,7 +19,7 @@ func TestZetaDepositRevertAndAbort(r *runner.E2ERunner, args []string) { r.ApproveZetaOnEVM(r.GatewayEVMAddr) // deploy testabort contract - testAbortAddr, txDeploy, testAbort, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) + testAbortAddr, txDeploy, _, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) require.NoError(r, err) r.WaitForTxReceiptOnZEVM(txDeploy) @@ -45,24 +43,28 @@ func TestZetaDepositRevertAndAbort(r *runner.E2ERunner, args []string) { ) // wait for the cctx to be reverted + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + r.Logger.CCTX(*cctx, "zeta_deposit") utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - // check onAbort was called - aborted, err := testAbort.IsAborted(&bind.CallOpts{}) - require.NoError(r, err) - require.True(r, aborted) - - // Asset is empty as ZETA is the native gas token on ZEVM - emptyAddress := ethcommon.Address{} - // check abort context was passed - abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") - require.NoError(r, err) - require.EqualValues(r, emptyAddress.Hex(), abortContext.Asset.Hex()) - - // check abort contract received the tokens - balance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) - require.NoError(r, err) - require.True(r, balance.Uint64() > 0) + //// check onAbort was called + //aborted, err := testAbort.IsAborted(&bind.CallOpts{}) + //require.NoError(r, err) + //require.True(r, aborted) + // + //// Asset is empty as ZETA is the native gas token on ZEVM + //emptyAddress := ethcommon.Address{} + //// check abort context was passed + //abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") + //require.NoError(r, err) + //require.EqualValues(r, emptyAddress.Hex(), abortContext.Asset.Hex()) + // + //// check abort contract received the tokens + //balance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) + //require.NoError(r, err) + //require.True(r, balance.Uint64() > 0) } diff --git a/e2e/e2etests/test_zeta_withdraw.go b/e2e/e2etests/test_zeta_withdraw.go index 7eac243375..80e9d8a8db 100644 --- a/e2e/e2etests/test_zeta_withdraw.go +++ b/e2e/e2etests/test_zeta_withdraw.go @@ -8,7 +8,6 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) func TestZetaWithdraw(r *runner.E2ERunner, args []string) { @@ -25,7 +24,9 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { tx := r.ZETAWithdraw(r.EVMAddress(), amount, evmChainID, gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) // wait for the cctx to be mined - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + //r.Logger.CCTX(*cctx, "withdraw") + //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) } diff --git a/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go index 89fdd56f20..dda2da4e7c 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go @@ -8,23 +8,24 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) +// TestZetaWithdrawAndArbitraryCall tests that ZETA withdraw and arbitrary call through gateway +// is not supported in V2 - no CCTX should be created. func TestZetaWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) amount := utils.ParseBigInt(r, args[0]) payload := randomPayload(r) - //payload := strings.ToLower(r.ZetaEthAddr.String()) evmChainID, err := r.EVMClient.ChainID(r.Ctx) require.NoError(r, err) - r.AssertTestDAppEVMCalled(false, payload, amount) - r.ApproveETHZRC20(r.GatewayZEVMAddr) + // r.AssertTestDAppEVMCalled(false, payload, amount) + // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, @@ -34,10 +35,12 @@ func TestZetaWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, ) - // wait for the cctx to be mined - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - r.AssertTestDAppEVMCalled(true, payload, amount) + // // wait for the cctx to be mined + // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + // r.Logger.CCTX(*cctx, "withdraw") + // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + // r.AssertTestDAppEVMCalled(true, payload, amount) } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call.go b/e2e/e2etests/test_zeta_withdraw_and_call.go index 2b4bc2d705..b9ed75c4ae 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call.go @@ -4,15 +4,17 @@ import ( "math/big" "strings" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + // "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) +// TestZetaWithdrawAndCall tests that ZETA withdraw and call through gateway +// is not supported in V2 - no CCTX should be created. func TestZetaWithdrawAndCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 2) @@ -42,18 +44,20 @@ func TestZetaWithdrawAndCall(r *runner.E2ERunner, args []string) { gasLimit, ) - // wait for the cctx to be mined - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - - r.AssertTestDAppEVMCalled(true, payload, amount) - - // check expected sender was used - senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( - &bind.CallOpts{}, - []byte(payload), - ) - require.NoError(r, err) - require.Equal(r, r.ZEVMAuth.From, senderForMsg) + // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + + // // wait for the cctx to be mined + // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + // r.Logger.CCTX(*cctx, "withdraw") + // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + // r.AssertTestDAppEVMCalled(true, payload, amount) + // + // // check expected sender was used + // senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + // &bind.CallOpts{}, + // []byte(payload), + // ) + // require.NoError(r, err) + // require.Equal(r, r.ZEVMAuth.From, senderForMsg) } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call_revert.go b/e2e/e2etests/test_zeta_withdraw_and_call_revert.go index 599d083d3f..708171120d 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call_revert.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call_revert.go @@ -3,16 +3,18 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + // "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" "github.com/zeta-chain/node/testutil/sample" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) +// TestZetaWithdrawAndCallRevert tests that ZETA withdraw and call revert through gateway +// is not supported in V2 - no CCTX should be created. func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) @@ -25,9 +27,10 @@ func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { // use a random address to get the revert amount revertAddress := sample.EthAddress() - balance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, revertAddress) - require.NoError(r, err) - require.EqualValues(r, int64(0), balance.Int64()) + + // balance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, revertAddress) + // require.NoError(r, err) + // require.EqualValues(r, int64(0), balance.Int64()) // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( @@ -41,12 +44,15 @@ func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { }, ) - // wait for the cctx to be reverted - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, revertAddress, nil) - require.NoError(r, err) - require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + + // // wait for the cctx to be reverted + // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + // r.Logger.CCTX(*cctx, "withdraw") + // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + // + // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, revertAddress, nil) + // require.NoError(r, err) + // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go index a1ebbad0e5..8ad74d36cc 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go @@ -3,15 +3,17 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + // "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) +// TestZetaWithdrawAndCallRevertWithCall tests that ZETA withdraw and call revert with call through gateway +// is not supported in V2 - no CCTX should be created. func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) @@ -21,10 +23,10 @@ func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { evmChainID, err := r.EVMClient.ChainID(r.Ctx) require.NoError(r, err) - r.AssertTestDAppZEVMCalled(false, payload, nil, amount) - r.ApproveETHZRC20(r.GatewayZEVMAddr) + // r.AssertTestDAppZEVMCalled(false, payload, nil, amount) + // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, @@ -39,22 +41,25 @@ func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { }, ) - // wait for the cctx to be mined - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - r.AssertTestDAppZEVMCalled(true, payload, nil, big.NewInt(0)) - - // check expected sender was used - senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( - &bind.CallOpts{}, - []byte(payload), - ) - require.NoError(r, err) - require.Equal(r, r.ZEVMAuth.From, senderForMsg) - - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, r.TestDAppV2ZEVMAddr, nil) - require.NoError(r, err) - require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + // // wait for the cctx to be mined + // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + // r.Logger.CCTX(*cctx, "withdraw") + // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + // + // r.AssertTestDAppZEVMCalled(true, payload, nil, big.NewInt(0)) + // + // // check expected sender was used + // senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( + // &bind.CallOpts{}, + // []byte(payload), + // ) + // require.NoError(r, err) + // require.Equal(r, r.ZEVMAuth.From, senderForMsg) + // + // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, r.TestDAppV2ZEVMAddr, nil) + // require.NoError(r, err) + // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) } diff --git a/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go b/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go index 3093b5661b..21a6b4fe05 100644 --- a/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go +++ b/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go @@ -3,8 +3,8 @@ package e2etests import ( "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" + // "github.com/ethereum/go-ethereum/accounts/abi/bind" + // "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" @@ -12,9 +12,11 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" "github.com/zeta-chain/node/testutil/sample" - crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) +// TestZetaWithdrawRevertAndAbort tests that ZETA withdraw revert and abort through gateway +// is not supported in V2 - no CCTX should be created. func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { require.Len(r, args, 2) @@ -29,6 +31,7 @@ func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { // deploy testabort contract testAbortAddr, _, testAbort, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) require.NoError(r, err) + _ = testAbort // perform the withdraw tx := r.ZETAWithdrawAndCall( @@ -46,22 +49,25 @@ func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { gasLimit, ) - // wait for the cctx to be mined - cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "withdraw") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - // check onAbort was called - aborted, err := testAbort.IsAborted(&bind.CallOpts{}) - require.NoError(r, err) - require.True(r, aborted) - - // check abort context was passed - abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") - require.NoError(r, err) - require.EqualValues(r, common.Address{}.Hex(), abortContext.Asset.Hex()) - - newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) - require.NoError(r, err) - require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + // // wait for the cctx to be mined + // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + // r.Logger.CCTX(*cctx, "withdraw") + // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + // + // // check onAbort was called + // aborted, err := testAbort.IsAborted(&bind.CallOpts{}) + // require.NoError(r, err) + // require.True(r, aborted) + // + // // check abort context was passed + // abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") + // require.NoError(r, err) + // require.EqualValues(r, common.Address{}.Hex(), abortContext.Asset.Hex()) + // + // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) + // require.NoError(r, err) + // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) } diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index 67a86741a0..dc69bb52b7 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" - + "github.com/zeta-chain/node/pkg/coin" cctxerror "github.com/zeta-chain/node/pkg/errors" "github.com/zeta-chain/node/x/crosschain/types" ) @@ -44,6 +44,12 @@ func (c CCTXGatewayZEVM) InitiateOutbound( return newCCTXStatus, nil case types.InboundStatus_SUCCESS: // process the deposit normally + if config.CCTX.InboundParams.CoinType == coin.CoinType_Zeta && config.CCTX.ProtocolContractVersion == types.ProtocolContractVersion_V2 { + config.CCTX.SetAbort(types.StatusMessages{ + StatusMessage: types.ErrZetaThroughGateway.Error(), + }) + return types.CctxStatus_Aborted, nil + } tmpCtx, commit := ctx.CacheContext() isContractReverted, err := c.crosschainKeeper.HandleEVMDeposit(tmpCtx, config.CCTX) diff --git a/x/crosschain/keeper/v2_zevm_inbound.go b/x/crosschain/keeper/v2_zevm_inbound.go index 396fe4d7e5..a114eb1233 100644 --- a/x/crosschain/keeper/v2_zevm_inbound.go +++ b/x/crosschain/keeper/v2_zevm_inbound.go @@ -47,26 +47,26 @@ func (k Keeper) ProcessZEVMInboundV2( var zrc20 ethcommon.Address var value *big.Int var receiver []byte - var receiverChainID *big.Int - var callOptions gatewayzevm.CallOptions + //var receiverChainID *big.Int + //var callOptions gatewayzevm.CallOptions if withdrawalEvent != nil { zrc20 = withdrawalEvent.Zrc20 value = withdrawalEvent.Value receiver = withdrawalEvent.Receiver - receiverChainID = withdrawalEvent.ChainId - callOptions = withdrawalEvent.CallOptions + //receiverChainID = withdrawalEvent.ChainId + //callOptions = withdrawalEvent.CallOptions } else if callEvent != nil { zrc20 = callEvent.Zrc20 value = big.NewInt(0) receiver = callEvent.Receiver - callOptions = callEvent.CallOptions - receiverChainID = big.NewInt(0) // Receiver chain ID is only used for withdraws when coin type is ZETA. + //callOptions = callEvent.CallOptions + //receiverChainID = big.NewInt(0) // Receiver chain ID is only used for withdraws when coin type is ZETA. } else { zrc20 = withdrawalAndCallEvent.Zrc20 value = withdrawalAndCallEvent.Value receiver = withdrawalAndCallEvent.Receiver - receiverChainID = withdrawalAndCallEvent.ChainId - callOptions = withdrawalAndCallEvent.CallOptions + //receiverChainID = withdrawalAndCallEvent.ChainId + //callOptions = withdrawalAndCallEvent.CallOptions } wzetaContractAddress, err := k.fungibleKeeper.GetWZetaContractAddress(ctx) @@ -83,7 +83,8 @@ func (k Keeper) ProcessZEVMInboundV2( // Note: NoAssetCall is not supported for ZETA switch { case zrc20 == wzetaContractAddress: - inboundDetails, err = k.getZETAInboundDetails(ctx, receiverChainID, callOptions) + return types.ErrZetaThroughGateway + //inboundDetails, err = k.getZETAInboundDetails(ctx, receiverChainID, callOptions) default: inboundDetails, err = k.getZRC20InboundDetails(ctx, zrc20, callEvent != nil) } diff --git a/x/crosschain/types/errors.go b/x/crosschain/types/errors.go index 5e44679822..4c24c971b1 100644 --- a/x/crosschain/types/errors.go +++ b/x/crosschain/types/errors.go @@ -62,4 +62,5 @@ var ( ErrUnableToParseCCTXIndexBytes = errorsmod.Register(ModuleName, 1161, "unable to parse cctx index bytes") ErrInvalidPriorityFee = errorsmod.Register(ModuleName, 1162, "invalid priority fee") ErrInvalidWithdrawalEvent = errorsmod.Register(ModuleName, 1163, "invalid withdrawal event") + ErrZetaThroughGateway = errorsmod.Register(ModuleName, 1164, "V2 zeta deposits and withdraws through the gateway are not supported , use connector contract instead") ) From ad2b3881d3075fff1fe0206be4dc59464974599b Mon Sep 17 00:00:00 2001 From: Tanmay Date: Tue, 23 Dec 2025 17:58:53 +0530 Subject: [PATCH 2/4] add a flag to enable and disable V2 Zeta flows --- Makefile | 5 + cmd/zetae2e/local/local.go | 7 + docs/openapi/openapi.swagger.yaml | 4 + docs/spec/generated.md | 13 + e2e/e2etests/test_zeta_deposit.go | 24 +- e2e/e2etests/test_zeta_deposit_and_call.go | 36 +- .../test_zeta_deposit_and_call_no_message.go | 41 +- .../test_zeta_deposit_and_call_revert.go | 28 +- ..._zeta_deposit_and_call_revert_with_call.go | 41 +- .../test_zeta_deposit_revert_and_abort.go | 51 +- e2e/e2etests/test_zeta_withdraw.go | 16 +- .../test_zeta_withdraw_and_arbitrary_call.go | 25 +- e2e/e2etests/test_zeta_withdraw_and_call.go | 41 +- .../test_zeta_withdraw_and_call_revert.go | 34 +- ...zeta_withdraw_and_call_revert_with_call.go | 51 +- .../test_zeta_withdraw_revert_and_abort.go | 52 +- e2e/runner/setup_zetacore_configuration.go | 17 + e2e/txserver/zeta_tx_server.go | 18 + .../zetacore/observer/crosschain_flags.proto | 1 + proto/zetachain/zetacore/observer/tx.proto | 12 + testutil/keeper/mocks/crosschain/observer.go | 18 + .../zetacore/observer/crosschain_flags_pb.ts | 7 +- .../zetachain/zetacore/observer/tx_pb.ts | 49 +- x/authority/types/authorization_list.go | 1 + x/authority/types/authorization_list_test.go | 1 + x/crosschain/keeper/cctx_gateway_zevm.go | 5 +- x/crosschain/keeper/evm_hooks_test.go | 7 + x/crosschain/keeper/v2_zevm_inbound.go | 25 +- x/crosschain/types/errors.go | 6 +- x/crosschain/types/expected_keepers.go | 1 + x/observer/keeper/crosschain_flags.go | 8 + .../keeper/msg_server_update_v2_zeta_flows.go | 38 ++ .../msg_server_update_v2_zeta_flows_test.go | 133 ++++ x/observer/types/codec.go | 2 + x/observer/types/crosschain_flags.go | 1 + x/observer/types/crosschain_flags.pb.go | 100 ++- .../types/message_update_v2_zeta_flows.go | 48 ++ x/observer/types/tx.pb.go | 584 ++++++++++++++---- 38 files changed, 1196 insertions(+), 355 deletions(-) create mode 100644 x/observer/keeper/msg_server_update_v2_zeta_flows.go create mode 100644 x/observer/keeper/msg_server_update_v2_zeta_flows_test.go create mode 100644 x/observer/types/message_update_v2_zeta_flows.go diff --git a/Makefile b/Makefile index bff34d4c9d..5deba266f3 100644 --- a/Makefile +++ b/Makefile @@ -273,6 +273,11 @@ start-e2e-test: e2e-images @echo "--> Starting e2e test" cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d +start-e2e-v2ZETA-test: e2e-images + @echo "--> Starting e2e test with V2 ZETA flows enabled" + export E2E_ARGS="${E2E_ARGS} --v2-zeta-flows" && \ + cd contrib/localnet/ && $(DOCKER_COMPOSE) up -d + start-skip-consensus-overwrite-test: e2e-images @echo "--> Starting e2e test but skip overwriting the consensus timeout params on zetacore0" cd contrib/localnet/ && SKIP_CONSENSUS_VALUES_OVERWRITE=true $(DOCKER_COMPOSE) up -d diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index fcfc72819a..91f03121cf 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -61,6 +61,7 @@ const ( flagTestStaking = "test-staking" flagTestConnectorMigration = "test-connector-migration" flagAccountConfig = "account-config" // Use this flag to override the account data in base config file + flagV2ZETAFlows = "v2-zeta-flows" ) var ( @@ -109,6 +110,7 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagTestConnectorMigration, false, "set to true to run v2 connector migration tests") cmd.Flags(). String(flagAccountConfig, "", "path to the account config file to override the accounts in the base config file") + cmd.Flags().Bool(flagV2ZETAFlows, false, "set to true to enable V2 ZETA gateway flows") cmd.AddCommand(NewGetZetaclientBootstrap()) @@ -148,6 +150,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { testFilterStr = must(cmd.Flags().GetString(flagTestFilter)) testStaking = must(cmd.Flags().GetBool(flagTestStaking)) testConnectorMigration = must(cmd.Flags().GetBool(flagTestConnectorMigration)) + v2ZETAFlows = must(cmd.Flags().GetBool(flagV2ZETAFlows)) testStress = testEthStress || testSolanaStress || testSuiStress shouldSetupSolana = setupSolana || testSolana || testStress @@ -260,6 +263,10 @@ func localE2ETest(cmd *cobra.Command, _ []string) { })) } + if v2ZETAFlows { + noError(deployerRunner.EnableV2ZETAFlows()) + } + // setting up the networks if !skipSetup { logger.Print("⚙️ setting up networks") diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index e86356ce31..b232642f3c 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -55194,6 +55194,8 @@ definitions: type: boolean gasPriceIncreaseFlags: $ref: '#/definitions/zetachain.zetacore.observer.GasPriceIncreaseFlags' + isV2ZetaEnabled: + type: boolean zetachain.zetacore.observer.GasPriceIncreaseFlags: type: object properties: @@ -55274,6 +55276,8 @@ definitions: type: object zetachain.zetacore.observer.MsgUpdateOperationalFlagsResponse: type: object + zetachain.zetacore.observer.MsgUpdateV2ZetaFlowsResponse: + type: object zetachain.zetacore.observer.MsgVoteBlameResponse: type: object zetachain.zetacore.observer.MsgVoteBlockHeaderResponse: diff --git a/docs/spec/generated.md b/docs/spec/generated.md index 5c776b23d9..258a0f49b8 100644 --- a/docs/spec/generated.md +++ b/docs/spec/generated.md @@ -982,3 +982,16 @@ message MsgUpdateOperationalChainParams { } ``` +#### MsgUpdateV2ZetaFlows + +UpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. +This sets IsV2ZetaEnabled to the provided value, controlling V2 ZETA deposits and withdrawals. +The flag is updated by the policy account with the groupOperational policy type. + +```proto +message MsgUpdateV2ZetaFlows { + string creator = 1; + bool isV2ZetaEnabled = 2; +} +``` + diff --git a/e2e/e2etests/test_zeta_deposit.go b/e2e/e2etests/test_zeta_deposit.go index 0fa6b65419..1179993d67 100644 --- a/e2e/e2etests/test_zeta_deposit.go +++ b/e2e/e2etests/test_zeta_deposit.go @@ -17,22 +17,24 @@ func TestZetaDeposit(r *runner.E2ERunner, args []string) { amount := utils.ParseBigInt(r, args[0]) receiverAddress := r.EVMAddress() - //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) - r.ApproveZetaOnEVM(r.GatewayEVMAddr) // perform the deposit tx := r.ZETADeposit(receiverAddress, amount, gatewayevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) // wait for the cctx to be mined - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) - //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit should succeed + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) + require.True(r, newBalance.Cmp(oldBalance) >= 0) + } else { + // V2 ZETA flows disabled: deposit should be aborted + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_deposit_and_call.go b/e2e/e2etests/test_zeta_deposit_and_call.go index 751f12651d..917970665c 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call.go +++ b/e2e/e2etests/test_zeta_deposit_and_call.go @@ -24,8 +24,8 @@ func TestZetaDepositAndCall(r *runner.E2ERunner, args []string) { r.AssertTestDAppZEVMCalled(false, payload, sender, amount) - //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) + oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) // perform the deposit tx := r.ZetaDepositAndCall( @@ -36,19 +36,23 @@ func TestZetaDepositAndCall(r *runner.E2ERunner, args []string) { ) // wait for the cctx to be mined - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - - //// check the payload was received on the contract - //r.AssertTestDAppZEVMCalled(true, payload, sender, amount) - // - //// check the balance was updated - //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) - //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + r.Logger.CCTX(*cctx, "zeta_deposit_and_call") + + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit and call should succeed + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + + // check the payload was received on the contract + r.AssertTestDAppZEVMCalled(true, payload, sender, amount) + + // check the balance was updated + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) + require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + } else { + // V2 ZETA flows disabled: deposit should be aborted + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_no_message.go b/e2e/e2etests/test_zeta_deposit_and_call_no_message.go index 641b7e88c4..c82f56fac2 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_no_message.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_no_message.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -19,8 +20,8 @@ func TestZetaDepositAndCallNoMessage(r *runner.E2ERunner, args []string) { r.ApproveZetaOnEVM(r.GatewayEVMAddr) receiverAddress := r.TestDAppV2ZEVMAddr - //oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) + oldBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) // perform the deposit tx := r.ZetaDepositAndCall( @@ -31,21 +32,25 @@ func TestZetaDepositAndCallNoMessage(r *runner.E2ERunner, args []string) { ) // wait for the cctx to be mined - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit_and_call_no_message") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - - // check the payload was received on the contract - //messageIndex, err := r.TestDAppV2ZEVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress()) - //require.NoError(r, err) - //r.AssertTestDAppZEVMCalled(true, messageIndex, r.EVMAddress().Bytes(), amount) - // - //// check the balance was updated - //newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) - //require.NoError(r, err) - //require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + r.Logger.CCTX(*cctx, "zeta_deposit_and_call_no_message") + + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit and call should succeed + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + + // check the payload was received on the contract + messageIndex, err := r.TestDAppV2ZEVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress()) + require.NoError(r, err) + r.AssertTestDAppZEVMCalled(true, messageIndex, r.EVMAddress().Bytes(), amount) + + // check the balance was updated + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, receiverAddress, nil) + require.NoError(r, err) + require.Equal(r, new(big.Int).Add(oldBalance, amount), newBalance) + } else { + // V2 ZETA flows disabled: deposit should be aborted + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_revert.go b/e2e/e2etests/test_zeta_deposit_and_call_revert.go index 3af5418e1d..5621515279 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_revert.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_revert.go @@ -32,17 +32,21 @@ func TestZetaDepositAndCallRevert(r *runner.E2ERunner, args []string) { OnRevertGasLimit: big.NewInt(0), }) - // wait for the cctx to be reverted - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - - //// check the balance is more than 0 - //balance, err = r.ZetaEth.BalanceOf(&bind.CallOpts{}, revertAddress) - //require.NoError(r, err) - //require.True(r, balance.Cmp(big.NewInt(0)) > 0) + r.Logger.CCTX(*cctx, "zeta_deposit_and_call_revert") + + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit and call should revert + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + + // check the balance is more than 0 + balance, err = r.ZetaEth.BalanceOf(&bind.CallOpts{}, revertAddress) + require.NoError(r, err) + require.True(r, balance.Cmp(big.NewInt(0)) > 0) + } else { + // V2 ZETA flows disabled: deposit should be aborted + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go b/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go index 141ebc6b41..1b04b3654a 100644 --- a/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go +++ b/e2e/e2etests/test_zeta_deposit_and_call_revert_with_call.go @@ -3,6 +3,7 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -31,23 +32,27 @@ func TestZetaDepositAndCallRevertWithCall(r *runner.E2ERunner, args []string) { OnRevertGasLimit: big.NewInt(200000), }) - // wait for the cctx to be reverted - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit") - utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - - //// check the payload was received on the contract - //r.AssertTestDAppEVMCalled(true, payload, big.NewInt(0)) - // - //// check expected sender was used - //senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( - // &bind.CallOpts{}, - // []byte(payload), - //) - //require.NoError(r, err) - //require.Equal(r, r.EVMAuth.From, senderForMsg) + r.Logger.CCTX(*cctx, "zeta_deposit_and_call_revert_with_call") + + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit and call should revert + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + + // check the payload was received on the contract + r.AssertTestDAppEVMCalled(true, payload, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payload), + ) + require.NoError(r, err) + require.Equal(r, r.EVMAuth.From, senderForMsg) + } else { + // V2 ZETA flows disabled: deposit should be aborted + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_deposit_revert_and_abort.go b/e2e/e2etests/test_zeta_deposit_revert_and_abort.go index f306197885..b128f36888 100644 --- a/e2e/e2etests/test_zeta_deposit_revert_and_abort.go +++ b/e2e/e2etests/test_zeta_deposit_revert_and_abort.go @@ -3,6 +3,8 @@ package e2etests import ( "math/big" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayevm.sol" @@ -19,7 +21,7 @@ func TestZetaDepositRevertAndAbort(r *runner.E2ERunner, args []string) { r.ApproveZetaOnEVM(r.GatewayEVMAddr) // deploy testabort contract - testAbortAddr, txDeploy, _, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) + testAbortAddr, txDeploy, testAbort, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) require.NoError(r, err) r.WaitForTxReceiptOnZEVM(txDeploy) @@ -42,29 +44,32 @@ func TestZetaDepositRevertAndAbort(r *runner.E2ERunner, args []string) { }, ) - // wait for the cctx to be reverted - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "zeta_deposit_and_call") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) + // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - r.Logger.CCTX(*cctx, "zeta_deposit") + r.Logger.CCTX(*cctx, "zeta_deposit_revert_and_abort") utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) - //// check onAbort was called - //aborted, err := testAbort.IsAborted(&bind.CallOpts{}) - //require.NoError(r, err) - //require.True(r, aborted) - // - //// Asset is empty as ZETA is the native gas token on ZEVM - //emptyAddress := ethcommon.Address{} - //// check abort context was passed - //abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") - //require.NoError(r, err) - //require.EqualValues(r, emptyAddress.Hex(), abortContext.Asset.Hex()) - // - //// check abort contract received the tokens - //balance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) - //require.NoError(r, err) - //require.True(r, balance.Uint64() > 0) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: deposit should fail, revert should fail, then abort with onAbort called + + // check onAbort was called + aborted, err := testAbort.IsAborted(&bind.CallOpts{}) + require.NoError(r, err) + require.True(r, aborted) + + // Asset is empty as ZETA is the native gas token on ZEVM + emptyAddress := ethcommon.Address{} + // check abort context was passed + abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") + require.NoError(r, err) + require.EqualValues(r, emptyAddress.Hex(), abortContext.Asset.Hex()) + + // check abort contract received the tokens + balance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) + require.NoError(r, err) + require.True(r, balance.Uint64() > 0) + } else { + // V2 ZETA flows disabled: deposit should be aborted with ErrZetaThroughGateway + require.Equal(r, cctx.CctxStatus.StatusMessage, crosschaintypes.ErrZetaThroughGateway.Error()) + } } diff --git a/e2e/e2etests/test_zeta_withdraw.go b/e2e/e2etests/test_zeta_withdraw.go index 80e9d8a8db..0d493061b2 100644 --- a/e2e/e2etests/test_zeta_withdraw.go +++ b/e2e/e2etests/test_zeta_withdraw.go @@ -8,6 +8,7 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) func TestZetaWithdraw(r *runner.E2ERunner, args []string) { @@ -23,10 +24,13 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { // perform the withdraw tx := r.ZETAWithdraw(r.EVMAddress(), amount, evmChainID, gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}) - // wait for the cctx to be mined - //cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - //r.Logger.CCTX(*cctx, "withdraw") - //utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw should succeed + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go b/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go index dda2da4e7c..eb407ddbe5 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_arbitrary_call.go @@ -8,11 +8,10 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestZetaWithdrawAndArbitraryCall tests that ZETA withdraw and arbitrary call through gateway -// is not supported in V2 - no CCTX should be created. +// TestZetaWithdrawAndArbitraryCall tests ZETA withdraw and arbitrary call through gateway func TestZetaWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) @@ -24,7 +23,7 @@ func TestZetaWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { r.ApproveETHZRC20(r.GatewayZEVMAddr) - // r.AssertTestDAppEVMCalled(false, payload, amount) + r.AssertTestDAppEVMCalled(false, payload, amount) // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( @@ -35,12 +34,14 @@ func TestZetaWithdrawAndArbitraryCall(r *runner.E2ERunner, args []string) { gatewayzevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, ) - // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - - // // wait for the cctx to be mined - // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - // r.Logger.CCTX(*cctx, "withdraw") - // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - // r.AssertTestDAppEVMCalled(true, payload, amount) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw and arbitrary call should succeed + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw_and_arbitrary_call") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + r.AssertTestDAppEVMCalled(true, payload, amount) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call.go b/e2e/e2etests/test_zeta_withdraw_and_call.go index b9ed75c4ae..c791249c96 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call.go @@ -4,17 +4,16 @@ import ( "math/big" "strings" - // "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestZetaWithdrawAndCall tests that ZETA withdraw and call through gateway -// is not supported in V2 - no CCTX should be created. +// TestZetaWithdrawAndCall tests ZETA withdraw and call through gateway func TestZetaWithdrawAndCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 2) @@ -44,20 +43,22 @@ func TestZetaWithdrawAndCall(r *runner.E2ERunner, args []string) { gasLimit, ) - // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - - // // wait for the cctx to be mined - // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - // r.Logger.CCTX(*cctx, "withdraw") - // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - // r.AssertTestDAppEVMCalled(true, payload, amount) - // - // // check expected sender was used - // senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( - // &bind.CallOpts{}, - // []byte(payload), - // ) - // require.NoError(r, err) - // require.Equal(r, r.ZEVMAuth.From, senderForMsg) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw and call should succeed + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw_and_call") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) + r.AssertTestDAppEVMCalled(true, payload, amount) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payload), + ) + require.NoError(r, err) + require.Equal(r, r.ZEVMAuth.From, senderForMsg) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call_revert.go b/e2e/e2etests/test_zeta_withdraw_and_call_revert.go index 708171120d..8f775e1b0b 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call_revert.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call_revert.go @@ -3,18 +3,16 @@ package e2etests import ( "math/big" - // "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" "github.com/zeta-chain/node/testutil/sample" - // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestZetaWithdrawAndCallRevert tests that ZETA withdraw and call revert through gateway -// is not supported in V2 - no CCTX should be created. +// TestZetaWithdrawAndCallRevert tests ZETA withdraw and call revert through gateway func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) @@ -28,10 +26,6 @@ func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { // use a random address to get the revert amount revertAddress := sample.EthAddress() - // balance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, revertAddress) - // require.NoError(r, err) - // require.EqualValues(r, int64(0), balance.Int64()) - // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( r.TestDAppV2EVMAddr, @@ -44,15 +38,17 @@ func TestZetaWithdrawAndCallRevert(r *runner.E2ERunner, args []string) { }, ) - // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) - - // // wait for the cctx to be reverted - // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - // r.Logger.CCTX(*cctx, "withdraw") - // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - // - // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, revertAddress, nil) - // require.NoError(r, err) - // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw and call should revert + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw_and_call_revert") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) + + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, revertAddress, nil) + require.NoError(r, err) + require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go b/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go index 8ad74d36cc..2354390fca 100644 --- a/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go +++ b/e2e/e2etests/test_zeta_withdraw_and_call_revert_with_call.go @@ -3,17 +3,16 @@ package e2etests import ( "math/big" - // "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" - // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestZetaWithdrawAndCallRevertWithCall tests that ZETA withdraw and call revert with call through gateway -// is not supported in V2 - no CCTX should be created. +// TestZetaWithdrawAndCallRevertWithCall tests ZETA withdraw and call revert with call through gateway func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { require.Len(r, args, 1) @@ -25,7 +24,7 @@ func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { r.ApproveETHZRC20(r.GatewayZEVMAddr) - // r.AssertTestDAppZEVMCalled(false, payload, nil, amount) + r.AssertTestDAppZEVMCalled(false, payload, nil, amount) // perform the withdraw tx := r.ZETAWithdrawAndArbitraryCall( @@ -41,25 +40,27 @@ func TestZetaWithdrawAndCallRevertWithCall(r *runner.E2ERunner, args []string) { }, ) - // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw and call should revert with call + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw_and_call_revert_with_call") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - // // wait for the cctx to be mined - // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - // r.Logger.CCTX(*cctx, "withdraw") - // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Reverted) - // - // r.AssertTestDAppZEVMCalled(true, payload, nil, big.NewInt(0)) - // - // // check expected sender was used - // senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( - // &bind.CallOpts{}, - // []byte(payload), - // ) - // require.NoError(r, err) - // require.Equal(r, r.ZEVMAuth.From, senderForMsg) - // - // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, r.TestDAppV2ZEVMAddr, nil) - // require.NoError(r, err) - // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + r.AssertTestDAppZEVMCalled(true, payload, nil, big.NewInt(0)) + + // check expected sender was used + senderForMsg, err := r.TestDAppV2ZEVM.SenderWithMessage( + &bind.CallOpts{}, + []byte(payload), + ) + require.NoError(r, err) + require.Equal(r, r.ZEVMAuth.From, senderForMsg) + + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, r.TestDAppV2ZEVMAddr, nil) + require.NoError(r, err) + require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go b/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go index 21a6b4fe05..638215ac5f 100644 --- a/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go +++ b/e2e/e2etests/test_zeta_withdraw_revert_and_abort.go @@ -3,8 +3,8 @@ package e2etests import ( "math/big" - // "github.com/ethereum/go-ethereum/accounts/abi/bind" - // "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/gatewayzevm.sol" @@ -12,11 +12,10 @@ import ( "github.com/zeta-chain/node/e2e/runner" "github.com/zeta-chain/node/e2e/utils" "github.com/zeta-chain/node/testutil/sample" - // crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" + crosschaintypes "github.com/zeta-chain/node/x/crosschain/types" ) -// TestZetaWithdrawRevertAndAbort tests that ZETA withdraw revert and abort through gateway -// is not supported in V2 - no CCTX should be created. +// TestZetaWithdrawRevertAndAbort tests ZETA withdraw revert and abort through gateway func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { require.Len(r, args, 2) @@ -31,7 +30,6 @@ func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { // deploy testabort contract testAbortAddr, _, testAbort, err := testabort.DeployTestAbort(r.ZEVMAuth, r.ZEVMClient) require.NoError(r, err) - _ = testAbort // perform the withdraw tx := r.ZETAWithdrawAndCall( @@ -49,25 +47,27 @@ func TestZetaWithdrawRevertAndAbort(r *runner.E2ERunner, args []string) { gasLimit, ) - // ZETA withdraws through gateway are not supported in V2, verify no CCTX is created - utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + if r.IsV2ZETAEnabled() { + // V2 ZETA flows enabled: withdraw should fail, revert should fail, then abort with onAbort called + cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctx, "zeta_withdraw_revert_and_abort") + utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - // // wait for the cctx to be mined - // cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - // r.Logger.CCTX(*cctx, "withdraw") - // utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_Aborted) - // - // // check onAbort was called - // aborted, err := testAbort.IsAborted(&bind.CallOpts{}) - // require.NoError(r, err) - // require.True(r, aborted) - // - // // check abort context was passed - // abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") - // require.NoError(r, err) - // require.EqualValues(r, common.Address{}.Hex(), abortContext.Asset.Hex()) - // - // newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) - // require.NoError(r, err) - // require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + // check onAbort was called + aborted, err := testAbort.IsAborted(&bind.CallOpts{}) + require.NoError(r, err) + require.True(r, aborted) + + // check abort context was passed + abortContext, err := testAbort.GetAbortedWithMessage(&bind.CallOpts{}, "revert") + require.NoError(r, err) + require.EqualValues(r, common.Address{}.Hex(), abortContext.Asset.Hex()) + + newBalance, err := r.ZEVMClient.BalanceAt(r.Ctx, testAbortAddr, nil) + require.NoError(r, err) + require.True(r, newBalance.Cmp(big.NewInt(0)) > 0) + } else { + // V2 ZETA flows disabled: tx should revert on GatewayZEVM, no CCTX created + utils.EnsureNoCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient) + } } diff --git a/e2e/runner/setup_zetacore_configuration.go b/e2e/runner/setup_zetacore_configuration.go index 5923a6c774..83982d77e3 100644 --- a/e2e/runner/setup_zetacore_configuration.go +++ b/e2e/runner/setup_zetacore_configuration.go @@ -99,3 +99,20 @@ func (r *E2ERunner) EnableHeaderVerification(chainIDList []int64) error { return r.ZetaTxServer.EnableHeaderVerification(e2eutils.AdminPolicyName, chainIDList) } + +// EnableV2ZETAFlows enables the V2 ZETA flows flag +func (r *E2ERunner) EnableV2ZETAFlows() error { + r.Logger.Print("⚙️ enabling V2 ZETA flows") + + return r.ZetaTxServer.UpdateV2ZETAFlows(e2eutils.OperationalPolicyName, true) +} + +// IsV2ZETAEnabled returns true if V2 ZETA flows are enabled +func (r *E2ERunner) IsV2ZETAEnabled() bool { + res, err := r.ObserverClient.CrosschainFlags(r.Ctx, &observertypes.QueryGetCrosschainFlagsRequest{}) + if err != nil { + r.Logger.Print("⚠️ failed to query crosschain flags: %v", err) + return false + } + return res.CrosschainFlags.IsV2ZetaEnabled +} diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index cfda11d18c..5a02205daa 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -401,6 +401,24 @@ func (zts *ZetaTxServer) EnableHeaderVerification(account string, chainIDList [] return err } +// UpdateV2ZETAFlows updates the V2 ZETA flows flag +func (zts *ZetaTxServer) UpdateV2ZETAFlows(account string, isV2ZETAEnabled bool) error { + acc, err := zts.clientCtx.Keyring.Key(account) + if err != nil { + return err + } + addr, err := acc.GetAddress() + if err != nil { + return err + } + + _, err = zts.BroadcastTx(account, observertypes.NewMsgUpdateV2ZetaFlows( + addr.String(), + isV2ZETAEnabled, + )) + return err +} + // UpdateGatewayAddress updates the gateway address func (zts *ZetaTxServer) UpdateGatewayAddress(account, gatewayAddr string) error { // retrieve account diff --git a/proto/zetachain/zetacore/observer/crosschain_flags.proto b/proto/zetachain/zetacore/observer/crosschain_flags.proto index 749e564796..8857335cbc 100644 --- a/proto/zetachain/zetacore/observer/crosschain_flags.proto +++ b/proto/zetachain/zetacore/observer/crosschain_flags.proto @@ -29,6 +29,7 @@ message CrosschainFlags { bool isInboundEnabled = 1; bool isOutboundEnabled = 2; GasPriceIncreaseFlags gasPriceIncreaseFlags = 3; + bool isV2ZetaEnabled = 4; } message LegacyCrosschainFlags { diff --git a/proto/zetachain/zetacore/observer/tx.proto b/proto/zetachain/zetacore/observer/tx.proto index 1dc828aa7b..5269cc333b 100644 --- a/proto/zetachain/zetacore/observer/tx.proto +++ b/proto/zetachain/zetacore/observer/tx.proto @@ -41,6 +41,8 @@ service Msg { returns (MsgUpdateOperationalFlagsResponse); rpc UpdateOperationalChainParams(MsgUpdateOperationalChainParams) returns (MsgUpdateOperationalChainParamsResponse); + rpc UpdateV2ZetaFlows(MsgUpdateV2ZetaFlows) + returns (MsgUpdateV2ZetaFlowsResponse); } message MsgUpdateObserver { @@ -192,3 +194,13 @@ message MsgDisableFastConfirmation { int64 chain_id = 2; } message MsgDisableFastConfirmationResponse {} + +// MsgUpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. +// This is used to enable or disable V2 ZETA deposits and withdrawals through +// the gateway. +message MsgUpdateV2ZetaFlows { + option (cosmos.msg.v1.signer) = "creator"; + string creator = 1; + bool isV2ZetaEnabled = 2; +} +message MsgUpdateV2ZetaFlowsResponse {} diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 77e0334f9d..062d64c14e 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -698,6 +698,24 @@ func (_m *CrosschainObserverKeeper) IsInboundEnabled(ctx types.Context) bool { return r0 } +// IsV2ZetaEnabled provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) IsV2ZetaEnabled(ctx types.Context) bool { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for IsV2ZetaEnabled") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(types.Context) bool); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + // RemoveAllExistingMigrators provides a mock function with given fields: ctx func (_m *CrosschainObserverKeeper) RemoveAllExistingMigrators(ctx types.Context) { _m.Called(ctx) diff --git a/typescript/zetachain/zetacore/observer/crosschain_flags_pb.ts b/typescript/zetachain/zetacore/observer/crosschain_flags_pb.ts index 389e663424..88d36d1f16 100644 --- a/typescript/zetachain/zetacore/observer/crosschain_flags_pb.ts +++ b/typescript/zetachain/zetacore/observer/crosschain_flags_pb.ts @@ -13,7 +13,7 @@ import type { Message } from "@bufbuild/protobuf"; * Describes the file zetachain/zetacore/observer/crosschain_flags.proto. */ export const file_zetachain_zetacore_observer_crosschain_flags: GenFile = /*@__PURE__*/ - fileDesc("CjJ6ZXRhY2hhaW4vemV0YWNvcmUvb2JzZXJ2ZXIvY3Jvc3NjaGFpbl9mbGFncy5wcm90bxIbemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyIv4BChVHYXNQcmljZUluY3JlYXNlRmxhZ3MSEwoLZXBvY2hMZW5ndGgYASABKAMSOgoNcmV0cnlJbnRlcnZhbBgCIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbkIIyN4fAJjfHwESHwoXZ2FzUHJpY2VJbmNyZWFzZVBlcmNlbnQYAyABKA0SGwoTZ2FzUHJpY2VJbmNyZWFzZU1heBgEIAEoDRIXCg9tYXhQZW5kaW5nQ2N0eHMYBSABKA0SPQoQcmV0cnlJbnRlcnZhbEJUQxgGIAEoCzIZLmdvb2dsZS5wcm90b2J1Zi5EdXJhdGlvbkIIyN4fAJjfHwEimQEKD0Nyb3NzY2hhaW5GbGFncxIYChBpc0luYm91bmRFbmFibGVkGAEgASgIEhkKEWlzT3V0Ym91bmRFbmFibGVkGAIgASgIElEKFWdhc1ByaWNlSW5jcmVhc2VGbGFncxgDIAEoCzIyLnpldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlci5HYXNQcmljZUluY3JlYXNlRmxhZ3MinwEKFUxlZ2FjeUNyb3NzY2hhaW5GbGFncxIYChBpc0luYm91bmRFbmFibGVkGAEgASgIEhkKEWlzT3V0Ym91bmRFbmFibGVkGAIgASgIElEKFWdhc1ByaWNlSW5jcmVhc2VGbGFncxgDIAEoCzIyLnpldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlci5HYXNQcmljZUluY3JlYXNlRmxhZ3NC8gEKH2NvbS56ZXRhY2hhaW4uemV0YWNvcmUub2JzZXJ2ZXJCFENyb3NzY2hhaW5GbGFnc1Byb3RvUAFaK2dpdGh1Yi5jb20vemV0YS1ja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5hYmxlZBgCIAEoCBJRChVnYXNQcmljZUluY3JlYXNlRmxhZ3MYAyABKAsyMi56ZXRhY2hhaW4uemV0YWNvcmUub2JzZXJ2ZXIuR2FzUHJpY2VJbmNyZWFzZUZsYWdzQvIBCh9jb20uemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyQhRDcm9zc2NoYWluRmxhZ3NQcm90b1ABWitnaXRodWIuY29tL3pldGEtY2hhaW4vbm9kZS94L29ic2VydmVyL3R5cGVzogIDWlpPqgIbWmV0YWNoYWluLlpldGFjb3JlLk9ic2VydmVyygIbWmV0YWNoYWluXFpldGFjb3JlXE9ic2VydmVy4gInWmV0YWNoYWluXFpldGFjb3JlXE9ic2VydmVyXEdQQk1ldGFkYXRh6gIdWmV0YWNoYWluOjpaZXRhY29yZTo6T2JzZXJ2ZXJiBnByb3RvMw", [file_gogoproto_gogo, file_google_protobuf_duration]); /** * @generated from message zetachain.zetacore.observer.GasPriceIncreaseFlags @@ -83,6 +83,11 @@ export type CrosschainFlags = Message<"zetachain.zetacore.observer.CrosschainFla * @generated from field: zetachain.zetacore.observer.GasPriceIncreaseFlags gasPriceIncreaseFlags = 3; */ gasPriceIncreaseFlags?: GasPriceIncreaseFlags; + + /** + * @generated from field: bool isV2ZetaEnabled = 4; + */ + isV2ZetaEnabled: boolean; }; /** diff --git a/typescript/zetachain/zetacore/observer/tx_pb.ts b/typescript/zetachain/zetacore/observer/tx_pb.ts index 5e0dffa521..4312b8af08 100644 --- a/typescript/zetachain/zetacore/observer/tx_pb.ts +++ b/typescript/zetachain/zetacore/observer/tx_pb.ts @@ -30,7 +30,7 @@ import type { Message } from "@bufbuild/protobuf"; * Describes the file zetachain/zetacore/observer/tx.proto. */ export const file_zetachain_zetacore_observer_tx: GenFile = /*@__PURE__*/ - fileDesc("CiR6ZXRhY2hhaW4vemV0YWNvcmUvb2JzZXJ2ZXIvdHgucHJvdG8SG3pldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlciK4AQoRTXNnV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GFpblxaZXRhY29yZVxPYnNlcnZlclxHUEJNZXRhZGF0YeoCHVpldGFjaGFpbjo6WmV0YWNvcmU6Ok9ic2VydmVyYgZwcm90bzM", [file_gogoproto_gogo, file_zetachain_zetacore_observer_blame, file_zetachain_zetacore_observer_crosschain_flags, file_zetachain_zetacore_observer_observer, file_zetachain_zetacore_observer_chain_params, file_zetachain_zetacore_observer_pending_nonces, file_zetachain_zetacore_observer_tss, file_zetachain_zetacore_observer_operational, file_zetachain_zetacore_observer_confirmation_params, file_zetachain_zetacore_pkg_chains_chains, file_zetachain_zetacore_pkg_proofs_proofs, file_cosmos_msg_v1_msg]); + fileDesc("CiR6ZXRhY2hhaW4vemV0YWNvcmUvb2JzZXJ2ZXIvdHgucHJvdG8SG3pldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlciK4AQoRTXNnVXBkYXRlT2JzZXJ2ZXISDwoHY3JlYXRvchgBIAEoCRIcChRvbGRfb2JzZXJ2ZXJfYWRkcmVzcxgCIAEoCRIcChRuZXdfb2JzZXJ2ZXJfYWRkcmVzcxgDIAEoCRJICg11cGRhdGVfcmVhc29uGAQgASgOMjEuemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyLk9ic2VydmVyVXBkYXRlUmVhc29uOgyC57AqB2NyZWF0b3IiGwoZTXNnVXBkYXRlT2JzZXJ2ZXJSZXNwb25zZSKqAQoSTXNnVm90ZUJsb2NrSGVhZGVyEg8KB2NyZWF0b3IYASABKAkSEAoIY2hhaW5faWQYAiABKAMSEgoKYmxvY2tfaGFzaBgDIAEoDBIOCgZoZWlnaHQYBCABKAMSPwoGaGVhZGVyGAUgASgLMikuemV0YWNoYWluLnpldGFjb3JlLnBrZy5wcm9vZnMuSGVhZGVyRGF0YUIEyN4fADoMguewKgdjcmVhdG9yIkwKGk1zZ1ZvdGVCbG9ja0hlYWRlclJlc3BvbnNlEhYKDmJhbGxvdF9jcmVhdGVkGAEgASgIEhYKDnZvdGVfZmluYWxpemVkGAIgASgIInQ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dGlvbmFsRmxhZ3MSNi56ZXRhY2hhaW4uemV0YWNvcmUub2JzZXJ2ZXIuTXNnVXBkYXRlT3BlcmF0aW9uYWxGbGFncxo+LnpldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlci5Nc2dVcGRhdGVPcGVyYXRpb25hbEZsYWdzUmVzcG9uc2USogEKHFVwZGF0ZU9wZXJhdGlvbmFsQ2hhaW5QYXJhbXMSPC56ZXRhY2hhaW4uemV0YWNvcmUub2JzZXJ2ZXIuTXNnVXBkYXRlT3BlcmF0aW9uYWxDaGFpblBhcmFtcxpELnpldGFjaGFpbi56ZXRhY29yZS5vYnNlcnZlci5Nc2dVcGRhdGVPcGVyYXRpb25hbENoYWluUGFyYW1zUmVzcG9uc2USgQEKEVVwZGF0ZVYyWmV0YUZsb3dzEjEuemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyLk1zZ1VwZGF0ZVYyWmV0YUZsb3dzGjkuemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyLk1zZ1VwZGF0ZVYyWmV0YUZsb3dzUmVzcG9uc2UaBYDnsCoBQuUBCh9jb20uemV0YWNoYWluLnpldGFjb3JlLm9ic2VydmVyQgdUeFByb3RvUAFaK2dpdGh1Yi5jb20vemV0YS1jaGFpbi9ub2RlL3gvb2JzZXJ2ZXIvdHlwZXOiAgNaWk+qAhtaZXRhY2hhaW4uWmV0YWNvcmUuT2JzZXJ2ZXLKAhtaZXRhY2hhaW5cWmV0YWNvcmVcT2JzZXJ2ZXLiAidaZXRhY2hhaW5cWmV0YWNvcmVcT2JzZXJ2ZXJcR1BCTWV0YWRhdGHqAh1aZXRhY2hhaW46OlpldGFjb3JlOjpPYnNlcnZlcmIGcHJvdG8z", [file_gogoproto_gogo, file_zetachain_zetacore_observer_blame, file_zetachain_zetacore_observer_crosschain_flags, file_zetachain_zetacore_observer_observer, file_zetachain_zetacore_observer_chain_params, file_zetachain_zetacore_observer_pending_nonces, file_zetachain_zetacore_observer_tss, file_zetachain_zetacore_observer_operational, file_zetachain_zetacore_observer_confirmation_params, file_zetachain_zetacore_pkg_chains_chains, file_zetachain_zetacore_pkg_proofs_proofs, file_cosmos_msg_v1_msg]); /** * @generated from message zetachain.zetacore.observer.MsgUpdateObserver @@ -693,6 +693,45 @@ export type MsgDisableFastConfirmationResponse = Message<"zetachain.zetacore.obs export const MsgDisableFastConfirmationResponseSchema: GenMessage = /*@__PURE__*/ messageDesc(file_zetachain_zetacore_observer_tx, 29); +/** + * MsgUpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. + * This is used to enable or disable V2 ZETA deposits and withdrawals through + * the gateway. + * + * @generated from message zetachain.zetacore.observer.MsgUpdateV2ZetaFlows + */ +export type MsgUpdateV2ZetaFlows = Message<"zetachain.zetacore.observer.MsgUpdateV2ZetaFlows"> & { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: bool isV2ZetaEnabled = 2; + */ + isV2ZetaEnabled: boolean; +}; + +/** + * Describes the message zetachain.zetacore.observer.MsgUpdateV2ZetaFlows. + * Use `create(MsgUpdateV2ZetaFlowsSchema)` to create a new message. + */ +export const MsgUpdateV2ZetaFlowsSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_zetachain_zetacore_observer_tx, 30); + +/** + * @generated from message zetachain.zetacore.observer.MsgUpdateV2ZetaFlowsResponse + */ +export type MsgUpdateV2ZetaFlowsResponse = Message<"zetachain.zetacore.observer.MsgUpdateV2ZetaFlowsResponse"> & { +}; + +/** + * Describes the message zetachain.zetacore.observer.MsgUpdateV2ZetaFlowsResponse. + * Use `create(MsgUpdateV2ZetaFlowsResponseSchema)` to create a new message. + */ +export const MsgUpdateV2ZetaFlowsResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_zetachain_zetacore_observer_tx, 31); + /** * Msg defines the Msg service. * @@ -819,6 +858,14 @@ export const Msg: GenService<{ input: typeof MsgUpdateOperationalChainParamsSchema; output: typeof MsgUpdateOperationalChainParamsResponseSchema; }, + /** + * @generated from rpc zetachain.zetacore.observer.Msg.UpdateV2ZetaFlows + */ + updateV2ZetaFlows: { + methodKind: "unary"; + input: typeof MsgUpdateV2ZetaFlowsSchema; + output: typeof MsgUpdateV2ZetaFlowsResponseSchema; + }, }> = /*@__PURE__*/ serviceDesc(file_zetachain_zetacore_observer_tx, 0); diff --git a/x/authority/types/authorization_list.go b/x/authority/types/authorization_list.go index 29e31e4019..2086e9b7ff 100644 --- a/x/authority/types/authorization_list.go +++ b/x/authority/types/authorization_list.go @@ -22,6 +22,7 @@ var ( "/zetachain.zetacore.observer.MsgUpdateGasPriceIncreaseFlags", "/zetachain.zetacore.observer.MsgUpdateOperationalFlags", "/zetachain.zetacore.observer.MsgUpdateOperationalChainParams", + "/zetachain.zetacore.observer.MsgUpdateV2ZetaFlows", } // AdminPolicyMessages keeps track of the message URLs that can, by default, only be executed by admin policy address AdminPolicyMessages = []string{ diff --git a/x/authority/types/authorization_list_test.go b/x/authority/types/authorization_list_test.go index a5723ff543..a7f4125462 100644 --- a/x/authority/types/authorization_list_test.go +++ b/x/authority/types/authorization_list_test.go @@ -401,6 +401,7 @@ func TestDefaultAuthorizationsList(t *testing.T) { sdk.MsgTypeURL(&observertypes.MsgUpdateGasPriceIncreaseFlags{}), sdk.MsgTypeURL(&observertypes.MsgUpdateOperationalFlags{}), sdk.MsgTypeURL(&observertypes.MsgUpdateOperationalChainParams{}), + sdk.MsgTypeURL(&observertypes.MsgUpdateV2ZetaFlows{}), } // EmergencyPolicyMessageList is a list of messages that can be authorized by the emergency policy diff --git a/x/crosschain/keeper/cctx_gateway_zevm.go b/x/crosschain/keeper/cctx_gateway_zevm.go index dc69bb52b7..2fb84be5db 100644 --- a/x/crosschain/keeper/cctx_gateway_zevm.go +++ b/x/crosschain/keeper/cctx_gateway_zevm.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" + "github.com/zeta-chain/node/pkg/coin" cctxerror "github.com/zeta-chain/node/pkg/errors" "github.com/zeta-chain/node/x/crosschain/types" @@ -44,7 +45,9 @@ func (c CCTXGatewayZEVM) InitiateOutbound( return newCCTXStatus, nil case types.InboundStatus_SUCCESS: // process the deposit normally - if config.CCTX.InboundParams.CoinType == coin.CoinType_Zeta && config.CCTX.ProtocolContractVersion == types.ProtocolContractVersion_V2 { + if config.CCTX.InboundParams.CoinType == coin.CoinType_Zeta && + config.CCTX.ProtocolContractVersion == types.ProtocolContractVersion_V2 && + !c.crosschainKeeper.zetaObserverKeeper.IsV2ZetaEnabled(ctx) { config.CCTX.SetAbort(types.StatusMessages{ StatusMessage: types.ErrZetaThroughGateway.Error(), }) diff --git a/x/crosschain/keeper/evm_hooks_test.go b/x/crosschain/keeper/evm_hooks_test.go index 73e928d091..80da264317 100644 --- a/x/crosschain/keeper/evm_hooks_test.go +++ b/x/crosschain/keeper/evm_hooks_test.go @@ -89,6 +89,13 @@ func SetupStateForProcessLogsZetaWithdraw( ConnectorZevm: sample.EthAddress().String(), Gateway: gatewayFromLog, }) + + // Enable V2 ZETA flows for testing + zk.ObserverKeeper.SetCrosschainFlags(ctx, observertypes.CrosschainFlags{ + IsInboundEnabled: true, + IsOutboundEnabled: true, + IsV2ZetaEnabled: true, + }) } // SetupStateForProcessLogsZetaSent sets up additional state required for processing logs for ZetaSent events diff --git a/x/crosschain/keeper/v2_zevm_inbound.go b/x/crosschain/keeper/v2_zevm_inbound.go index a114eb1233..1643ef9db9 100644 --- a/x/crosschain/keeper/v2_zevm_inbound.go +++ b/x/crosschain/keeper/v2_zevm_inbound.go @@ -47,26 +47,18 @@ func (k Keeper) ProcessZEVMInboundV2( var zrc20 ethcommon.Address var value *big.Int var receiver []byte - //var receiverChainID *big.Int - //var callOptions gatewayzevm.CallOptions if withdrawalEvent != nil { zrc20 = withdrawalEvent.Zrc20 value = withdrawalEvent.Value receiver = withdrawalEvent.Receiver - //receiverChainID = withdrawalEvent.ChainId - //callOptions = withdrawalEvent.CallOptions } else if callEvent != nil { zrc20 = callEvent.Zrc20 value = big.NewInt(0) receiver = callEvent.Receiver - //callOptions = callEvent.CallOptions - //receiverChainID = big.NewInt(0) // Receiver chain ID is only used for withdraws when coin type is ZETA. } else { zrc20 = withdrawalAndCallEvent.Zrc20 value = withdrawalAndCallEvent.Value receiver = withdrawalAndCallEvent.Receiver - //receiverChainID = withdrawalAndCallEvent.ChainId - //callOptions = withdrawalAndCallEvent.CallOptions } wzetaContractAddress, err := k.fungibleKeeper.GetWZetaContractAddress(ctx) @@ -83,8 +75,21 @@ func (k Keeper) ProcessZEVMInboundV2( // Note: NoAssetCall is not supported for ZETA switch { case zrc20 == wzetaContractAddress: - return types.ErrZetaThroughGateway - //inboundDetails, err = k.getZETAInboundDetails(ctx, receiverChainID, callOptions) + if !k.zetaObserverKeeper.IsV2ZetaEnabled(ctx) { + return types.ErrZetaThroughGateway + } + var receiverChainID *big.Int + var callOptions gatewayzevm.CallOptions + if withdrawalEvent != nil { + receiverChainID = withdrawalEvent.ChainId + callOptions = withdrawalEvent.CallOptions + } else if withdrawalAndCallEvent != nil { + receiverChainID = withdrawalAndCallEvent.ChainId + callOptions = withdrawalAndCallEvent.CallOptions + } else { + return errorsmod.Wrap(types.ErrInvalidWithdrawalEvent, "ZETA withdrawal requires withdrawal event") + } + inboundDetails, err = k.getZETAInboundDetails(ctx, receiverChainID, callOptions) default: inboundDetails, err = k.getZRC20InboundDetails(ctx, zrc20, callEvent != nil) } diff --git a/x/crosschain/types/errors.go b/x/crosschain/types/errors.go index 4c24c971b1..0f1afab4d2 100644 --- a/x/crosschain/types/errors.go +++ b/x/crosschain/types/errors.go @@ -62,5 +62,9 @@ var ( ErrUnableToParseCCTXIndexBytes = errorsmod.Register(ModuleName, 1161, "unable to parse cctx index bytes") ErrInvalidPriorityFee = errorsmod.Register(ModuleName, 1162, "invalid priority fee") ErrInvalidWithdrawalEvent = errorsmod.Register(ModuleName, 1163, "invalid withdrawal event") - ErrZetaThroughGateway = errorsmod.Register(ModuleName, 1164, "V2 zeta deposits and withdraws through the gateway are not supported , use connector contract instead") + ErrZetaThroughGateway = errorsmod.Register( + ModuleName, + 1164, + "V2 zeta deposits and withdraws through the gateway are not supported , use connector contract instead", + ) ) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 8798c6aea4..749fbf991f 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -43,6 +43,7 @@ type ObserverKeeper interface { GetAllNodeAccount(ctx sdk.Context) (nodeAccounts []observertypes.NodeAccount) SetNodeAccount(ctx sdk.Context, nodeAccount observertypes.NodeAccount) IsInboundEnabled(ctx sdk.Context) (found bool) + IsV2ZetaEnabled(ctx sdk.Context) bool GetCrosschainFlags(ctx sdk.Context) (val observertypes.CrosschainFlags, found bool) GetKeygen(ctx sdk.Context) (val observertypes.Keygen, found bool) SetKeygen(ctx sdk.Context, keygen observertypes.Keygen) diff --git a/x/observer/keeper/crosschain_flags.go b/x/observer/keeper/crosschain_flags.go index 3f5c347fa1..bdfbe985a1 100644 --- a/x/observer/keeper/crosschain_flags.go +++ b/x/observer/keeper/crosschain_flags.go @@ -57,3 +57,11 @@ func (k Keeper) DisableInboundOnly(ctx sdk.Context) { flags.IsInboundEnabled = false k.SetCrosschainFlags(ctx, flags) } + +func (k Keeper) IsV2ZetaEnabled(ctx sdk.Context) bool { + flags, found := k.GetCrosschainFlags(ctx) + if !found { + return false + } + return flags.IsV2ZetaEnabled +} diff --git a/x/observer/keeper/msg_server_update_v2_zeta_flows.go b/x/observer/keeper/msg_server_update_v2_zeta_flows.go new file mode 100644 index 0000000000..22ee31606e --- /dev/null +++ b/x/observer/keeper/msg_server_update_v2_zeta_flows.go @@ -0,0 +1,38 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + authoritytypes "github.com/zeta-chain/node/x/authority/types" + "github.com/zeta-chain/node/x/observer/types" +) + +// UpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. +func (k msgServer) UpdateV2ZetaFlows( + goCtx context.Context, + msg *types.MsgUpdateV2ZetaFlows, +) (*types.MsgUpdateV2ZetaFlowsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + err := k.GetAuthorityKeeper().CheckAuthorization(ctx, msg) + if err != nil { + return nil, errors.Wrap(authoritytypes.ErrUnauthorized, err.Error()) + } + + // check if the value exists, + // if not, set the default value for the flags + flags, isFound := k.GetCrosschainFlags(ctx) + if !isFound { + flags = *types.DefaultCrosschainFlags() + } + + // update V2 ZETA flows flag + flags.IsV2ZetaEnabled = msg.IsV2ZetaEnabled + + k.SetCrosschainFlags(ctx, flags) + + return &types.MsgUpdateV2ZetaFlowsResponse{}, nil +} diff --git a/x/observer/keeper/msg_server_update_v2_zeta_flows_test.go b/x/observer/keeper/msg_server_update_v2_zeta_flows_test.go new file mode 100644 index 0000000000..8f0162aa8a --- /dev/null +++ b/x/observer/keeper/msg_server_update_v2_zeta_flows_test.go @@ -0,0 +1,133 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/node/testutil/keeper" + "github.com/zeta-chain/node/testutil/sample" + authoritytypes "github.com/zeta-chain/node/x/authority/types" + "github.com/zeta-chain/node/x/observer/keeper" + "github.com/zeta-chain/node/x/observer/types" +) + +func TestMsgServer_UpdateV2ZetaFlows(t *testing.T) { + t.Run("can enable V2 ZETA flows", func(t *testing.T) { + // ARRANGE + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + + admin := sample.AccAddress() + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + + msg := types.MsgUpdateV2ZetaFlows{ + Creator: admin, + IsV2ZetaEnabled: true, + } + keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) + + // ACT + _, err := srv.UpdateV2ZetaFlows(sdk.WrapSDKContext(ctx), &msg) + + // ASSERT + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsV2ZetaEnabled) + }) + + t.Run("can disable V2 ZETA flows", func(t *testing.T) { + // ARRANGE + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + + // set initial state with V2 ZETA flows enabled + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsInboundEnabled: true, + IsOutboundEnabled: true, + IsV2ZetaEnabled: true, + }) + + admin := sample.AccAddress() + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + + msg := types.MsgUpdateV2ZetaFlows{ + Creator: admin, + IsV2ZetaEnabled: false, + } + keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) + + // ACT + _, err := srv.UpdateV2ZetaFlows(sdk.WrapSDKContext(ctx), &msg) + + // ASSERT + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.False(t, flags.IsV2ZetaEnabled) + // verify other flags are preserved + require.True(t, flags.IsInboundEnabled) + require.True(t, flags.IsOutboundEnabled) + }) + + t.Run("sets default flags if not found", func(t *testing.T) { + // ARRANGE + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + + admin := sample.AccAddress() + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + + msg := types.MsgUpdateV2ZetaFlows{ + Creator: admin, + IsV2ZetaEnabled: true, + } + keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, nil) + + // ACT + _, err := srv.UpdateV2ZetaFlows(sdk.WrapSDKContext(ctx), &msg) + + // ASSERT + require.NoError(t, err) + + flags, found := k.GetCrosschainFlags(ctx) + require.True(t, found) + require.True(t, flags.IsV2ZetaEnabled) + // verify default flags are applied + defaultFlags := types.DefaultCrosschainFlags() + require.Equal(t, defaultFlags.IsInboundEnabled, flags.IsInboundEnabled) + require.Equal(t, defaultFlags.IsOutboundEnabled, flags.IsOutboundEnabled) + }) + + t.Run("cannot update V2 ZETA flows if not authorized", func(t *testing.T) { + // ARRANGE + k, ctx, _, _ := keepertest.ObserverKeeperWithMocks(t, keepertest.ObserverMockOptions{ + UseAuthorityMock: true, + }) + srv := keeper.NewMsgServerImpl(*k) + admin := sample.AccAddress() + authorityMock := keepertest.GetObserverAuthorityMock(t, k) + + msg := types.MsgUpdateV2ZetaFlows{ + Creator: admin, + IsV2ZetaEnabled: true, + } + keepertest.MockCheckAuthorization(&authorityMock.Mock, &msg, authoritytypes.ErrUnauthorized) + + // ACT + _, err := srv.UpdateV2ZetaFlows(sdk.WrapSDKContext(ctx), &msg) + + // ASSERT + require.ErrorIs(t, err, authoritytypes.ErrUnauthorized) + }) +} diff --git a/x/observer/types/codec.go b/x/observer/types/codec.go index 9c5b03ad72..d413b5c735 100644 --- a/x/observer/types/codec.go +++ b/x/observer/types/codec.go @@ -23,6 +23,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdateGasPriceIncreaseFlags{}, "observer/UpdateGasPriceIncreaseFlags", nil) cdc.RegisterConcrete(&MsgUpdateOperationalFlags{}, "observer/UpdateOperationalFlags", nil) cdc.RegisterConcrete(&MsgUpdateOperationalChainParams{}, "observer/UpdateOperationalChainParams", nil) + cdc.RegisterConcrete(&MsgUpdateV2ZetaFlows{}, "observer/UpdateV2ZetaFlows", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -42,6 +43,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUpdateGasPriceIncreaseFlags{}, &MsgUpdateOperationalFlags{}, &MsgUpdateOperationalChainParams{}, + &MsgUpdateV2ZetaFlows{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/observer/types/crosschain_flags.go b/x/observer/types/crosschain_flags.go index 7515a694bb..2b70624d4c 100644 --- a/x/observer/types/crosschain_flags.go +++ b/x/observer/types/crosschain_flags.go @@ -32,5 +32,6 @@ func DefaultCrosschainFlags() *CrosschainFlags { IsInboundEnabled: true, IsOutboundEnabled: true, GasPriceIncreaseFlags: &DefaultGasPriceIncreaseFlags, + IsV2ZetaEnabled: false, } } diff --git a/x/observer/types/crosschain_flags.pb.go b/x/observer/types/crosschain_flags.pb.go index 5d83753fbd..9815839e19 100644 --- a/x/observer/types/crosschain_flags.pb.go +++ b/x/observer/types/crosschain_flags.pb.go @@ -120,6 +120,7 @@ type CrosschainFlags struct { IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,3,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"` + IsV2ZetaEnabled bool `protobuf:"varint,4,opt,name=isV2ZetaEnabled,proto3" json:"isV2ZetaEnabled,omitempty"` } func (m *CrosschainFlags) Reset() { *m = CrosschainFlags{} } @@ -176,6 +177,13 @@ func (m *CrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags { return nil } +func (m *CrosschainFlags) GetIsV2ZetaEnabled() bool { + if m != nil { + return m.IsV2ZetaEnabled + } + return false +} + type LegacyCrosschainFlags struct { IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"` IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"` @@ -247,35 +255,36 @@ func init() { } var fileDescriptor_f617dc4ef266f323 = []byte{ - // 434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x53, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xae, 0x3b, 0x98, 0x26, 0x57, 0xd3, 0x86, 0xa1, 0x22, 0x0c, 0x29, 0xab, 0x7a, 0x8a, 0xf8, - 0x70, 0x50, 0xb8, 0x70, 0x6e, 0x19, 0x28, 0xd2, 0xd0, 0xaa, 0x88, 0x13, 0x17, 0xe4, 0x38, 0xef, - 0x9c, 0x48, 0x99, 0x5d, 0xd9, 0xce, 0x94, 0xf2, 0x2b, 0x38, 0xf2, 0x93, 0x76, 0xdc, 0x05, 0x09, - 0x09, 0x09, 0x50, 0x7b, 0xe4, 0x4f, 0xa0, 0x39, 0x74, 0xd0, 0x36, 0x20, 0xce, 0xdc, 0x9c, 0xf7, - 0x79, 0x9e, 0x3c, 0xef, 0x27, 0x8e, 0xde, 0x81, 0x65, 0x3c, 0x67, 0x85, 0x0c, 0xdd, 0x4b, 0x69, - 0x08, 0x55, 0x6a, 0x40, 0x9f, 0x83, 0x0e, 0xb9, 0x56, 0xc6, 0x38, 0xf0, 0xed, 0x69, 0xc9, 0x84, - 0xa1, 0x53, 0xad, 0xac, 0x22, 0xf7, 0xaf, 0x35, 0x74, 0xa9, 0xa1, 0x4b, 0xcd, 0xc1, 0x1d, 0xa1, - 0x84, 0x72, 0xbc, 0xf0, 0xea, 0xd5, 0x48, 0x0e, 0x7c, 0xa1, 0x94, 0x28, 0x21, 0x74, 0x5f, 0x69, - 0x75, 0x1a, 0x66, 0x95, 0x66, 0xb6, 0x50, 0xb2, 0xc1, 0x87, 0xdf, 0xbb, 0xb8, 0xff, 0x92, 0x99, - 0x89, 0x2e, 0x38, 0xc4, 0x92, 0x6b, 0x60, 0x06, 0x5e, 0x5c, 0x59, 0x92, 0x01, 0xee, 0xc1, 0x54, - 0xf1, 0xfc, 0x18, 0xa4, 0xb0, 0xb9, 0x87, 0x06, 0x28, 0xd8, 0x4a, 0x7e, 0x0f, 0x91, 0x18, 0xef, - 0x6a, 0xb0, 0x7a, 0x16,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, 0xf4, 0x7e, 0xe1, 0x77, 0x2e, - 0x17, 0x7e, 0xe7, 0xd3, 0xc2, 0xef, 0xbc, 0x79, 0x28, 0x0a, 0x9b, 0x57, 0x29, 0xe5, 0xea, 0xcc, - 0x5d, 0xf1, 0xe3, 0xe6, 0xa0, 0xa5, 0xca, 0x20, 0xac, 0x7f, 0x9d, 0xb3, 0x9d, 0x4d, 0xc1, 0xa4, - 0xdb, 0x6e, 0x57, 0x9e, 0xfe, 0x08, 0x00, 0x00, 0xff, 0xff, 0x48, 0x07, 0x8a, 0xca, 0xfa, 0x03, - 0x00, 0x00, + // 451 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x53, 0x4d, 0x6f, 0x13, 0x31, + 0x10, 0x8d, 0xd3, 0x52, 0x55, 0x8e, 0xaa, 0x16, 0x43, 0xc4, 0x52, 0xa4, 0x6d, 0x94, 0x53, 0xc4, + 0x87, 0x17, 0x2d, 0x17, 0xce, 0x09, 0x05, 0x45, 0x2a, 0x6a, 0xb4, 0x42, 0x1c, 0x7a, 0x41, 0x5e, + 0xef, 0xd4, 0x6b, 0x29, 0xb5, 0x23, 0xdb, 0x5b, 0x25, 0xfc, 0x0a, 0x8e, 0xfc, 0xa4, 0x1e, 0x7b, + 0x44, 0x42, 0x02, 0x94, 0x1c, 0xf9, 0x11, 0xa0, 0x78, 0x49, 0x20, 0xc9, 0x82, 0x38, 0xf7, 0xe6, + 0x9d, 0x37, 0x6f, 0xdf, 0xf3, 0xf3, 0x0c, 0x8e, 0xdf, 0x83, 0x63, 0x3c, 0x67, 0x52, 0x45, 0xfe, + 0xa4, 0x0d, 0x44, 0x3a, 0xb5, 0x60, 0x2e, 0xc1, 0x44, 0xdc, 0x68, 0x6b, 0x3d, 0xf8, 0xee, 0x7c, + 0xc8, 0x84, 0xa5, 0x23, 0xa3, 0x9d, 0x26, 0x0f, 0x96, 0x1c, 0xba, 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 0x9c, 0x1f, 0xe2, 0x03, 0x69, 0xfb, 0x2a, 0xd5, 0x85, 0xca, 0x8e, 0x15, 0x4b, 0x87, 0x90, + 0xf9, 0xb0, 0x77, 0x93, 0x8d, 0x3a, 0x79, 0x8c, 0x6f, 0x4b, 0x7b, 0x5a, 0xb8, 0x95, 0xe6, 0xba, + 0x6f, 0xde, 0x04, 0x48, 0x8e, 0x9b, 0xa2, 0xea, 0x69, 0x7d, 0xa4, 0x8d, 0x38, 0xa6, 0xff, 0x18, + 0x27, 0x5a, 0x39, 0x14, 0x49, 0xf5, 0x0f, 0xe7, 0x91, 0x4a, 0xfb, 0x36, 0x3e, 0x03, 0xc7, 0x16, + 0xae, 0xb6, 0xbd, 0xab, 0xf5, 0x72, 0xfb, 0x33, 0xc2, 0xcd, 0x13, 0x10, 0x8c, 0x4f, 0x6e, 0x60, + 0x0e, 0xdd, 0xe3, 0xab, 0x69, 0x88, 0xae, 0xa7, 0x21, 0xfa, 0x36, 0x0d, 0xd1, 0x87, 0x59, 0x58, + 0xbb, 0x9e, 0x85, 0xb5, 0x4f, 0xb3, 0xb0, 0x76, 0xf6, 0x48, 0x48, 0x97, 0x17, 0x29, 0xe5, 0xfa, + 0xc2, 0xef, 0xfb, 0x93, 0x72, 0xf5, 0x95, 0xce, 0x20, 0x1a, 0xff, 0x5e, 0x7c, 0x37, 0x19, 0x81, + 0x4d, 0x77, 0xfc, 0x54, 0x3d, 0xfb, 0x19, 0x00, 0x00, 0xff, 0xff, 0x82, 0x51, 0xa4, 0xf8, 0x24, + 0x04, 0x00, 0x00, } func (m *GasPriceIncreaseFlags) Marshal() (dAtA []byte, err error) { @@ -357,6 +366,16 @@ func (m *CrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.IsV2ZetaEnabled { + i-- + if m.IsV2ZetaEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if m.GasPriceIncreaseFlags != nil { { size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i]) @@ -499,6 +518,9 @@ func (m *CrosschainFlags) Size() (n int) { l = m.GasPriceIncreaseFlags.Size() n += 1 + l + sovCrosschainFlags(uint64(l)) } + if m.IsV2ZetaEnabled { + n += 2 + } return n } @@ -824,6 +846,26 @@ func (m *CrosschainFlags) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsV2ZetaEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrosschainFlags + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsV2ZetaEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipCrosschainFlags(dAtA[iNdEx:]) diff --git a/x/observer/types/message_update_v2_zeta_flows.go b/x/observer/types/message_update_v2_zeta_flows.go new file mode 100644 index 0000000000..f8b2589c04 --- /dev/null +++ b/x/observer/types/message_update_v2_zeta_flows.go @@ -0,0 +1,48 @@ +package types + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + TypeMsgUpdateV2ZetaFlows = "update_v2_zeta_flows" +) + +var _ sdk.Msg = &MsgUpdateV2ZetaFlows{} + +func NewMsgUpdateV2ZetaFlows(creator string, isV2ZetaEnabled bool) *MsgUpdateV2ZetaFlows { + return &MsgUpdateV2ZetaFlows{ + Creator: creator, + IsV2ZetaEnabled: isV2ZetaEnabled, + } +} + +func (msg *MsgUpdateV2ZetaFlows) Route() string { + return RouterKey +} + +func (msg *MsgUpdateV2ZetaFlows) Type() string { + return TypeMsgUpdateV2ZetaFlows +} + +func (msg *MsgUpdateV2ZetaFlows) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateV2ZetaFlows) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateV2ZetaFlows) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index e5cced005a..5bff7bf627 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -1573,6 +1573,97 @@ func (m *MsgDisableFastConfirmationResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDisableFastConfirmationResponse proto.InternalMessageInfo +// MsgUpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. +// This is used to enable or disable V2 ZETA deposits and withdrawals through +// the gateway. +type MsgUpdateV2ZetaFlows struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + IsV2ZetaEnabled bool `protobuf:"varint,2,opt,name=isV2ZetaEnabled,proto3" json:"isV2ZetaEnabled,omitempty"` +} + +func (m *MsgUpdateV2ZetaFlows) Reset() { *m = MsgUpdateV2ZetaFlows{} } +func (m *MsgUpdateV2ZetaFlows) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateV2ZetaFlows) ProtoMessage() {} +func (*MsgUpdateV2ZetaFlows) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{30} +} +func (m *MsgUpdateV2ZetaFlows) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateV2ZetaFlows) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateV2ZetaFlows.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateV2ZetaFlows) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateV2ZetaFlows.Merge(m, src) +} +func (m *MsgUpdateV2ZetaFlows) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateV2ZetaFlows) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateV2ZetaFlows.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateV2ZetaFlows proto.InternalMessageInfo + +func (m *MsgUpdateV2ZetaFlows) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateV2ZetaFlows) GetIsV2ZetaEnabled() bool { + if m != nil { + return m.IsV2ZetaEnabled + } + return false +} + +type MsgUpdateV2ZetaFlowsResponse struct { +} + +func (m *MsgUpdateV2ZetaFlowsResponse) Reset() { *m = MsgUpdateV2ZetaFlowsResponse{} } +func (m *MsgUpdateV2ZetaFlowsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateV2ZetaFlowsResponse) ProtoMessage() {} +func (*MsgUpdateV2ZetaFlowsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eda6e3b1d16a4021, []int{31} +} +func (m *MsgUpdateV2ZetaFlowsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateV2ZetaFlowsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateV2ZetaFlowsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateV2ZetaFlowsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateV2ZetaFlowsResponse.Merge(m, src) +} +func (m *MsgUpdateV2ZetaFlowsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateV2ZetaFlowsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateV2ZetaFlowsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateV2ZetaFlowsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateObserver)(nil), "zetachain.zetacore.observer.MsgUpdateObserver") proto.RegisterType((*MsgUpdateObserverResponse)(nil), "zetachain.zetacore.observer.MsgUpdateObserverResponse") @@ -1604,6 +1695,8 @@ func init() { proto.RegisterType((*MsgUpdateOperationalFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateOperationalFlagsResponse") proto.RegisterType((*MsgDisableFastConfirmation)(nil), "zetachain.zetacore.observer.MsgDisableFastConfirmation") proto.RegisterType((*MsgDisableFastConfirmationResponse)(nil), "zetachain.zetacore.observer.MsgDisableFastConfirmationResponse") + proto.RegisterType((*MsgUpdateV2ZetaFlows)(nil), "zetachain.zetacore.observer.MsgUpdateV2ZetaFlows") + proto.RegisterType((*MsgUpdateV2ZetaFlowsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateV2ZetaFlowsResponse") } func init() { @@ -1611,112 +1704,115 @@ func init() { } var fileDescriptor_eda6e3b1d16a4021 = []byte{ - // 1667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xdb, 0x46, - 0x16, 0x37, 0xd7, 0xdf, 0xcf, 0x96, 0x64, 0x33, 0x8e, 0x2d, 0xd3, 0x89, 0x92, 0xf5, 0x26, 0xfe, - 0x4a, 0x22, 0xc5, 0xca, 0xee, 0x66, 0x37, 0x1b, 0x64, 0x91, 0xd8, 0x89, 0xed, 0xdd, 0x38, 0x0e, - 0x28, 0x27, 0xd8, 0xcd, 0x85, 0x1d, 0x91, 0x63, 0x8a, 0x35, 0xc5, 0x11, 0x38, 0x94, 0x3f, 0x52, - 0xa0, 0x68, 0x0b, 0xf4, 0xd0, 0x5c, 0x1a, 0xa0, 0xb7, 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b, - 0x73, 0x09, 0xd9, 0xa1, 0xfc, 0x83, 0x63, 0xa7, 0x74, 0x42, 0xab, 0x84, 0x16, 0xaa, 0xd4, 0x2c, - 0xec, 0x2d, 0xfb, 0x1f, 0xc1, 0xc2, 0xec, 0xaf, 0x12, 0x8c, 0x6f, 0x52, 0xf3, 0x51, 0xcd, 0x40, - 0x1e, 0xde, 0xe2, 0x02, 0xe5, 0x2c, 0x0c, 0xea, 0x2e, 0x46, 0x1e, 0x71, 0xb3, 0xd2, 0x79, 0x69, - 0x61, 0x58, 0x0d, 0x7f, 0xca, 0x57, 0x61, 0x82, 0xd8, 0x86, 0x16, 0xa6, 0xa2, 0x21, 0xc3, 0x70, - 0x31, 0xa5, 0xd9, 0x3f, 0x31, 0x98, 0x4c, 0x6c, 0x23, 0x74, 0x72, 0x3b, 0x58, 0xf1, 0x19, 0x0e, - 0xde, 0x6f, 0x65, 0xf4, 0x06, 0x0c, 0x07, 0xef, 0xc7, 0x19, 0x8f, 0x21, 0x55, 0x67, 0x7a, 0x34, - 0x17, 0x23, 0x4a, 0x9c, 0x6c, 0xdf, 0x79, 0x69, 0x21, 0x5d, 0x5c, 0xce, 0x27, 0xd4, 0x71, 0x3e, - 0x74, 0x12, 0x64, 0xa2, 0x32, 0xa2, 0x3a, 0x5a, 0x8f, 0xfc, 0xba, 0x31, 0xfa, 0xc9, 0xdb, 0x17, - 0x4b, 0x61, 0x26, 0xb3, 0x33, 0x30, 0xdd, 0x92, 0xb8, 0x8a, 0x69, 0x8d, 0x38, 0x14, 0xcf, 0xfe, - 0x28, 0x81, 0xbc, 0x49, 0xcd, 0xc7, 0xc4, 0xc3, 0x77, 0x6c, 0xa2, 0xef, 0xae, 0x63, 0x64, 0x24, - 0xee, 0xcb, 0x34, 0x0c, 0x05, 0xd5, 0x68, 0x19, 0x6c, 0x2f, 0x7a, 0xd5, 0x41, 0xf6, 0x7b, 0xc3, - 0x90, 0xcf, 0x02, 0x94, 0x7d, 0x1f, 0x5a, 0x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x84, 0x44, 0xa1, 0xea, 0x2b, 0x09, 0x66, 0x92, - 0xae, 0xf9, 0x7f, 0x75, 0xf7, 0xb0, 0xb4, 0x25, 0x2b, 0x2b, 0xef, 0x40, 0x16, 0x0a, 0x9f, 0x4b, - 0x30, 0x79, 0xc4, 0x1d, 0xdd, 0x6d, 0xcb, 0x8e, 0xf1, 0x94, 0x5b, 0x27, 0xe3, 0x09, 0x49, 0x5f, - 0x4b, 0x70, 0x26, 0xf1, 0x3f, 0x96, 0x9b, 0xc7, 0x0e, 0x10, 0x6d, 0xc2, 0xab, 0xef, 0xc2, 0x0e, - 0x45, 0x2a, 0xfd, 0x1f, 0xbd, 0x7d, 0xb1, 0x24, 0xdd, 0xb9, 0xfb, 0xf2, 0x75, 0x4e, 0x7a, 0xf5, - 0x3a, 0x27, 0xfd, 0xf2, 0x3a, 0x27, 0x3d, 0x7f, 0x93, 0xeb, 0x79, 0xf5, 0x26, 0xd7, 0xf3, 0xd3, - 0x9b, 0x5c, 0xcf, 0x93, 0x4b, 0xa6, 0xe5, 0x55, 0xea, 0xe5, 0xbc, 0x4e, 0xaa, 0xec, 0xcf, 0xd7, - 0x2b, 0xc1, 0xff, 0xb0, 0xfe, 0xab, 0x6d, 0xe1, 0x20, 0xf2, 0xf7, 0xf1, 0x61, 0x0d, 0xd3, 0xf2, - 0x00, 0xfb, 0xab, 0xf5, 0xda, 0x6f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x76, 0x26, 0x10, 0xae, - 0x17, 0x00, 0x00, + // 1713 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x37, 0xeb, 0xef, 0x67, 0x4b, 0xb2, 0x19, 0xc7, 0x96, 0xe9, 0x8d, 0x36, 0x75, 0xb3, 0xb6, + 0xec, 0x4d, 0xa4, 0x58, 0x69, 0xbb, 0x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, 0x5f, 0xd1, 0x77, 0xf8, + 0xbf, 0xd2, 0xe1, 0x8b, 0x7e, 0xf9, 0x2c, 0xf6, 0x67, 0xfa, 0x79, 0x13, 0xd3, 0xda, 0x18, 0xfb, + 0xe3, 0xf9, 0xde, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x01, 0x3c, 0x7e, 0xbc, 0x18, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1746,6 +1842,7 @@ type MsgClient interface { UpdateGasPriceIncreaseFlags(ctx context.Context, in *MsgUpdateGasPriceIncreaseFlags, opts ...grpc.CallOption) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) UpdateOperationalFlags(ctx context.Context, in *MsgUpdateOperationalFlags, opts ...grpc.CallOption) (*MsgUpdateOperationalFlagsResponse, error) UpdateOperationalChainParams(ctx context.Context, in *MsgUpdateOperationalChainParams, opts ...grpc.CallOption) (*MsgUpdateOperationalChainParamsResponse, error) + UpdateV2ZetaFlows(ctx context.Context, in *MsgUpdateV2ZetaFlows, opts ...grpc.CallOption) (*MsgUpdateV2ZetaFlowsResponse, error) } type msgClient struct { @@ -1891,6 +1988,15 @@ func (c *msgClient) UpdateOperationalChainParams(ctx context.Context, in *MsgUpd return out, nil } +func (c *msgClient) UpdateV2ZetaFlows(ctx context.Context, in *MsgUpdateV2ZetaFlows, opts ...grpc.CallOption) (*MsgUpdateV2ZetaFlowsResponse, error) { + out := new(MsgUpdateV2ZetaFlowsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateV2ZetaFlows", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error) @@ -1908,6 +2014,7 @@ type MsgServer interface { UpdateGasPriceIncreaseFlags(context.Context, *MsgUpdateGasPriceIncreaseFlags) (*MsgUpdateGasPriceIncreaseFlagsResponse, error) UpdateOperationalFlags(context.Context, *MsgUpdateOperationalFlags) (*MsgUpdateOperationalFlagsResponse, error) UpdateOperationalChainParams(context.Context, *MsgUpdateOperationalChainParams) (*MsgUpdateOperationalChainParamsResponse, error) + UpdateV2ZetaFlows(context.Context, *MsgUpdateV2ZetaFlows) (*MsgUpdateV2ZetaFlowsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1959,6 +2066,9 @@ func (*UnimplementedMsgServer) UpdateOperationalFlags(ctx context.Context, req * func (*UnimplementedMsgServer) UpdateOperationalChainParams(ctx context.Context, req *MsgUpdateOperationalChainParams) (*MsgUpdateOperationalChainParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateOperationalChainParams not implemented") } +func (*UnimplementedMsgServer) UpdateV2ZetaFlows(ctx context.Context, req *MsgUpdateV2ZetaFlows) (*MsgUpdateV2ZetaFlowsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateV2ZetaFlows not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -2234,6 +2344,24 @@ func _Msg_UpdateOperationalChainParams_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _Msg_UpdateV2ZetaFlows_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateV2ZetaFlows) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateV2ZetaFlows(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/UpdateV2ZetaFlows", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateV2ZetaFlows(ctx, req.(*MsgUpdateV2ZetaFlows)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Msg", HandlerType: (*MsgServer)(nil), @@ -2298,6 +2426,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateOperationalChainParams", Handler: _Msg_UpdateOperationalChainParams_Handler, }, + { + MethodName: "UpdateV2ZetaFlows", + Handler: _Msg_UpdateV2ZetaFlows_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zetachain/zetacore/observer/tx.proto", @@ -3407,6 +3539,69 @@ func (m *MsgDisableFastConfirmationResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } +func (m *MsgUpdateV2ZetaFlows) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateV2ZetaFlows) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateV2ZetaFlows) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsV2ZetaEnabled { + i-- + if m.IsV2ZetaEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateV2ZetaFlowsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateV2ZetaFlowsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateV2ZetaFlowsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -3876,6 +4071,31 @@ func (m *MsgDisableFastConfirmationResponse) Size() (n int) { return n } +func (m *MsgUpdateV2ZetaFlows) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.IsV2ZetaEnabled { + n += 2 + } + return n +} + +func (m *MsgUpdateV2ZetaFlowsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -6838,6 +7058,158 @@ func (m *MsgDisableFastConfirmationResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateV2ZetaFlows) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateV2ZetaFlows: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateV2ZetaFlows: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsV2ZetaEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsV2ZetaEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateV2ZetaFlowsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateV2ZetaFlowsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateV2ZetaFlowsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From f682bcd5f302574d95dd1ada39aba03c5d7fd028 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 24 Dec 2025 11:25:52 +0530 Subject: [PATCH 3/4] add a flag to enable and disable V2 Zeta flows --- cmd/zetae2e/local/admin.go | 7 +++++-- e2e/e2etests/test_update_bytecode_connector.go | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/zetae2e/local/admin.go b/cmd/zetae2e/local/admin.go index 7924608ea5..089341a536 100644 --- a/cmd/zetae2e/local/admin.go +++ b/cmd/zetae2e/local/admin.go @@ -44,10 +44,13 @@ func adminTestRoutine( adminRunner.WaitForTxReceiptOnEVM(txERC20Send) // depositing the necessary tokens on ZetaChain to the deployer account - txZetaDeposit := adminRunner.DepositZETAToDeployer() + // only deposit ZETA if V2 ZETA flows are enabled (gateway deposits don't work otherwise) + if adminRunner.IsV2ZETAEnabled() { + txZetaDeposit := adminRunner.DepositZETAToDeployer() + adminRunner.WaitForMinedCCTX(txZetaDeposit.Hash()) + } txEtherDeposit := adminRunner.DepositEtherToDeployer() txERC20Deposit := adminRunner.DepositERC20ToDeployer() - adminRunner.WaitForMinedCCTX(txZetaDeposit.Hash()) adminRunner.WaitForMinedCCTX(txEtherDeposit) adminRunner.WaitForMinedCCTX(txERC20Deposit) diff --git a/e2e/e2etests/test_update_bytecode_connector.go b/e2e/e2etests/test_update_bytecode_connector.go index ea54ae8bcd..9eee73c47d 100644 --- a/e2e/e2etests/test_update_bytecode_connector.go +++ b/e2e/e2etests/test_update_bytecode_connector.go @@ -16,6 +16,21 @@ import ( // TestUpdateBytecodeConnector tests updating the bytecode of a connector and interact with it func TestUpdateBytecodeConnector(r *runner.E2ERunner, _ []string) { + // Skip if V2 ZETA flows are disabled. + // + // This test requires ZETA withdrawals through the GatewayZEVM contract, which only works + // when V2 ZETA flows are enabled (IsV2ZetaEnabled flag in crosschain flags). + // + // - The chain params contain a ConnectorContractAddress that observers watch for ZetaSent events + // - When testLegacy=true: LegacySetupEVM sets ConnectorContractAddress to the legacy connector (ConnectorEthAddr) V1 + // - When testLegacy=false: UpdateEVMChainParams sets ConnectorContractAddress to the V2 connector (ConnectorNativeAddr) V2 + // Admin tests do not use the flag, therefore, are using the ConnectorNative only + + if !r.IsV2ZETAEnabled() { + r.Logger.Print("⚠️ skipping TestUpdateBytecodeConnector: V2 ZETA flows are disabled") + return + } + // Can withdraw 10ZETA amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(10)) evmChainID, err := r.EVMClient.ChainID(r.Ctx) From be3fae441c9c1cbc1d262f42626b2bb88830f50f Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 24 Dec 2025 12:18:48 +0530 Subject: [PATCH 4/4] add changelog --- changelog.md | 1 + docs/spec/generated.md | 2 -- x/observer/keeper/crosschain_flags_test.go | 26 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 9d348cf693..3591905794 100644 --- a/changelog.md +++ b/changelog.md @@ -19,6 +19,7 @@ by calling `updateAdditionalActionFee` admin function. * [4211](https://github.com/zeta-chain/node/pull/4211) - provide error information in cctx when Bitcoin deposit fail * [4218](https://github.com/zeta-chain/node/pull/4218) - enable NoAssetCall from Bitcoin chain * [3834](https://github.com/zeta-chain/node/pull/3734) - refund a portion of remaining unused tokens to user +* [4486](https://github.com/zeta-chain/node/pull/4486) - add a flag to toggle V2ZETA flows on and off ### Refactor diff --git a/docs/spec/generated.md b/docs/spec/generated.md index 258a0f49b8..897074de5f 100644 --- a/docs/spec/generated.md +++ b/docs/spec/generated.md @@ -985,8 +985,6 @@ message MsgUpdateOperationalChainParams { #### MsgUpdateV2ZetaFlows UpdateV2ZetaFlows updates the V2 ZETA gateway flows flag. -This sets IsV2ZetaEnabled to the provided value, controlling V2 ZETA deposits and withdrawals. -The flag is updated by the policy account with the groupOperational policy type. ```proto message MsgUpdateV2ZetaFlows { diff --git a/x/observer/keeper/crosschain_flags_test.go b/x/observer/keeper/crosschain_flags_test.go index 4f0b605a58..ff73048086 100644 --- a/x/observer/keeper/crosschain_flags_test.go +++ b/x/observer/keeper/crosschain_flags_test.go @@ -61,6 +61,32 @@ func TestKeeper_IsOutboundEnabled(t *testing.T) { }) } +func TestKeeper_IsV2ZetaEnabled(t *testing.T) { + t.Run("should return false if flags not found", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + + enabled := k.IsV2ZetaEnabled(ctx) + require.False(t, enabled) + }) + + t.Run("should return if flags found and set", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsV2ZetaEnabled: false, + }) + enabled := k.IsV2ZetaEnabled(ctx) + require.False(t, enabled) + + k.SetCrosschainFlags(ctx, types.CrosschainFlags{ + IsV2ZetaEnabled: true, + }) + + enabled = k.IsV2ZetaEnabled(ctx) + require.True(t, enabled) + }) +} + func TestKeeper_DisableInboundOnly(t *testing.T) { k, ctx, _, _ := keepertest.ObserverKeeper(t)