diff --git a/cmd/zetae2e/local/evm.go b/cmd/zetae2e/local/evm.go index bcb88041e8..c726faedd3 100644 --- a/cmd/zetae2e/local/evm.go +++ b/cmd/zetae2e/local/evm.go @@ -14,36 +14,36 @@ import ( // startEVMTests starts EVM chains related tests in parallel func startEVMTests(eg *errgroup.Group, conf config.Config, deployerRunner *runner.E2ERunner, verbose bool) { - // Test happy paths for gas token workflow - eg.Go(evmTestRoutine(conf, "eth", conf.AdditionalAccounts.UserEther, color.FgHiGreen, deployerRunner, verbose, - e2etests.TestETHDepositName, - e2etests.TestETHDepositAndCallName, - e2etests.TestETHWithdrawName, - e2etests.TestETHWithdrawAndArbitraryCallName, - e2etests.TestETHWithdrawAndCallName, - e2etests.TestETHWithdrawAndCallThroughContractName, - e2etests.TestZEVMToEVMArbitraryCallName, - e2etests.TestZEVMToEVMCallName, - e2etests.TestZEVMToEVMCallThroughContractName, - e2etests.TestEVMToZEVMCallName, - e2etests.TestETHDepositAndCallNoMessageName, - e2etests.TestETHWithdrawAndCallNoMessageName, - e2etests.TestEtherWithdrawRestrictedName, - )) - - // Test happy paths for erc20 token workflow - eg.Go(evmTestRoutine(conf, "erc20", conf.AdditionalAccounts.UserERC20, color.FgHiBlue, deployerRunner, verbose, - e2etests.TestETHDepositName, // necessary to pay fees on ZEVM - e2etests.TestERC20DepositName, - e2etests.TestERC20DepositAndCallName, - e2etests.TestERC20WithdrawName, - e2etests.TestERC20WithdrawAndArbitraryCallName, - e2etests.TestERC20WithdrawAndCallName, - e2etests.TestERC20DepositAndCallNoMessageName, - e2etests.TestERC20WithdrawAndCallNoMessageName, - e2etests.TestDepositAndCallSwapName, - e2etests.TestERC20DepositRestrictedName, - )) + //// Test happy paths for gas token workflow + //eg.Go(evmTestRoutine(conf, "eth", conf.AdditionalAccounts.UserEther, color.FgHiGreen, deployerRunner, verbose, + // e2etests.TestETHDepositName, + // e2etests.TestETHDepositAndCallName, + // e2etests.TestETHWithdrawName, + // e2etests.TestETHWithdrawAndArbitraryCallName, + // e2etests.TestETHWithdrawAndCallName, + // e2etests.TestETHWithdrawAndCallThroughContractName, + // e2etests.TestZEVMToEVMArbitraryCallName, + // e2etests.TestZEVMToEVMCallName, + // e2etests.TestZEVMToEVMCallThroughContractName, + // e2etests.TestEVMToZEVMCallName, + // e2etests.TestETHDepositAndCallNoMessageName, + // e2etests.TestETHWithdrawAndCallNoMessageName, + // e2etests.TestEtherWithdrawRestrictedName, + //)) + // + //// Test happy paths for erc20 token workflow + //eg.Go(evmTestRoutine(conf, "erc20", conf.AdditionalAccounts.UserERC20, color.FgHiBlue, deployerRunner, verbose, + // e2etests.TestETHDepositName, // necessary to pay fees on ZEVM + // e2etests.TestERC20DepositName, + // e2etests.TestERC20DepositAndCallName, + // e2etests.TestERC20WithdrawName, + // e2etests.TestERC20WithdrawAndArbitraryCallName, + // e2etests.TestERC20WithdrawAndCallName, + // e2etests.TestERC20DepositAndCallNoMessageName, + // e2etests.TestERC20WithdrawAndCallNoMessageName, + // e2etests.TestDepositAndCallSwapName, + // e2etests.TestERC20DepositRestrictedName, + //)) // Test revert cases for gas token workflow eg.Go( @@ -55,34 +55,34 @@ func startEVMTests(eg *errgroup.Group, conf config.Config, deployerRunner *runne deployerRunner, verbose, e2etests.TestETHDepositName, // necessary to pay fees on ZEVM and withdraw - e2etests.TestETHDepositAndCallRevertName, - e2etests.TestETHDepositAndCallRevertWithCallName, - e2etests.TestETHWithdrawAndCallRevertName, - e2etests.TestETHWithdrawAndCallRevertWithCallName, + //e2etests.TestETHDepositAndCallRevertName, + //e2etests.TestETHDepositAndCallRevertWithCallName, + //e2etests.TestETHWithdrawAndCallRevertName, + //e2etests.TestETHWithdrawAndCallRevertWithCallName, e2etests.TestETHWithdrawAndCallRevertWithWithdrawName, - e2etests.TestDepositAndCallOutOfGasName, + //e2etests.TestDepositAndCallOutOfGasName, ), ) - // Test revert cases for erc20 token workflow - eg.Go( - evmTestRoutine( - conf, - "erc20-revert", - conf.AdditionalAccounts.UserERC20Revert, - color.FgHiRed, - deployerRunner, - verbose, - e2etests.TestETHDepositName, // necessary to pay fees on ZEVM - e2etests.TestERC20DepositName, // necessary to have assets to withdraw - e2etests.TestOperationAddLiquidityETHName, // liquidity with gas and ERC20 are necessary for reverts - e2etests.TestOperationAddLiquidityERC20Name, - e2etests.TestERC20DepositAndCallRevertName, - e2etests.TestERC20DepositAndCallRevertWithCallName, - e2etests.TestERC20WithdrawAndCallRevertName, - e2etests.TestERC20WithdrawAndCallRevertWithCallName, - ), - ) + //// Test revert cases for erc20 token workflow + //eg.Go( + // evmTestRoutine( + // conf, + // "erc20-revert", + // conf.AdditionalAccounts.UserERC20Revert, + // color.FgHiRed, + // deployerRunner, + // verbose, + // e2etests.TestETHDepositName, // necessary to pay fees on ZEVM + // e2etests.TestERC20DepositName, // necessary to have assets to withdraw + // e2etests.TestOperationAddLiquidityETHName, // liquidity with gas and ERC20 are necessary for reverts + // e2etests.TestOperationAddLiquidityERC20Name, + // e2etests.TestERC20DepositAndCallRevertName, + // e2etests.TestERC20DepositAndCallRevertWithCallName, + // e2etests.TestERC20WithdrawAndCallRevertName, + // e2etests.TestERC20WithdrawAndCallRevertWithCallName, + // ), + //) } // evmTestRoutine runs EVM chain related e2e tests diff --git a/e2e/e2etests/test_eth_withdraw_and_call_revert_with_withdraw.go b/e2e/e2etests/test_eth_withdraw_and_call_revert_with_withdraw.go index 1e4f48f3d8..65815a55f9 100644 --- a/e2e/e2etests/test_eth_withdraw_and_call_revert_with_withdraw.go +++ b/e2e/e2etests/test_eth_withdraw_and_call_revert_with_withdraw.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/v2/pkg/gatewayzevm.sol" @@ -17,10 +16,6 @@ func TestETHWithdrawAndCallRevertWithWithdraw(r *runner.E2ERunner, args []string amount := utils.ParseBigInt(r, args[0]) - payload := randomPayload(r) - - r.AssertTestDAppZEVMCalled(false, payload, amount) - r.ApproveETHZRC20(r.GatewayZEVMAddr) // perform the withdraw @@ -37,17 +32,14 @@ func TestETHWithdrawAndCallRevertWithWithdraw(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") - require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctx.CctxStatus.Status) + cctxRevert := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) + r.Logger.CCTX(*cctxRevert, "withdraw") + require.Equal(r, crosschaintypes.CctxStatus_Reverted, cctxRevert.CctxStatus.Status) - r.AssertTestDAppZEVMCalled(true, payload, big.NewInt(0)) + r.Logger.Print("cctxRevert") + r.Logger.Print(cctxRevert.String()) + //cctxWithdrawFromRevert := utils.WaitCctxMinedByInboundHash(r.Ctx, cctxRevert, r.CctxClient, r.Logger, r.CctxTimeout) - // 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) + // check the cctx status + //utils.RequireCCTXStatus(r, cctxWithdrawFromRevert, crosschaintypes.CctxStatus_OutboundMined) } diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 856e3e8313..9ad11dc606 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -419,21 +419,33 @@ func (_m *CrosschainFungibleKeeper) GetUniswapV2Router02Address(ctx types.Contex } // ProcessV2RevertDeposit provides a mock function with given fields: ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage -func (_m *CrosschainFungibleKeeper) ProcessV2RevertDeposit(ctx types.Context, inboundSender string, amount *big.Int, chainID int64, coinType coin.CoinType, asset string, revertAddress common.Address, callOnRevert bool, revertMessage []byte) error { +func (_m *CrosschainFungibleKeeper) ProcessV2RevertDeposit(ctx types.Context, inboundSender string, amount *big.Int, chainID int64, coinType coin.CoinType, asset string, revertAddress common.Address, callOnRevert bool, revertMessage []byte) (*evmtypes.MsgEthereumTxResponse, error) { ret := _m.Called(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) if len(ret) == 0 { panic("no return value specified for ProcessV2RevertDeposit") } - var r0 error - if rf, ok := ret.Get(0).(func(types.Context, string, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) error); ok { + var r0 *evmtypes.MsgEthereumTxResponse + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, string, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) (*evmtypes.MsgEthereumTxResponse, error)); ok { + return rf(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) + } + if rf, ok := ret.Get(0).(func(types.Context, string, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) *evmtypes.MsgEthereumTxResponse); ok { r0 = rf(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(*evmtypes.MsgEthereumTxResponse) + } } - return r0 + if rf, ok := ret.Get(1).(func(types.Context, string, *big.Int, int64, coin.CoinType, string, common.Address, bool, []byte) error); ok { + r1 = rf(ctx, inboundSender, amount, chainID, coinType, asset, revertAddress, callOnRevert, revertMessage) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } // QueryGasLimit provides a mock function with given fields: ctx, contract