Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Sep 20, 2024
1 parent 6b711dc commit 614df83
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 16 deletions.
5 changes: 4 additions & 1 deletion e2e/e2etests/test_v2_eth_withdraw_and_authenticated_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func TestV2ETHWithdrawAndAuthenticatedCall(r *runner.E2ERunner, args []string) {
r.AssertTestDAppEVMCalled(true, payloadMessageAuthenticatedWithdrawETH, amount)

// check expected sender was used
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(&bind.CallOpts{}, []byte(payloadMessageAuthenticatedWithdrawETH))
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(
&bind.CallOpts{},
[]byte(payloadMessageAuthenticatedWithdrawETH),
)
require.NoError(r, err)
require.Equal(r, r.ZEVMAuth.From, senderForMsg)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ func TestV2ETHWithdrawAndAuthenticatedCallThroughContract(r *runner.E2ERunner, a
require.True(r, ok, "Invalid amount specified for TestV2ETHWithdrawAndCall")

// deploy caller contract and send it gas zrc20 to pay gas fee
gatewayCallerAddr, tx, gatewayCaller, err := testgatewayzevmcaller.DeployTestGatewayZEVMCaller(r.ZEVMAuth, r.ZEVMClient, r.GatewayZEVMAddr, r.WZetaAddr)
gatewayCallerAddr, tx, gatewayCaller, err := testgatewayzevmcaller.DeployTestGatewayZEVMCaller(
r.ZEVMAuth,
r.ZEVMClient,
r.GatewayZEVMAddr,
r.WZetaAddr,
)
require.NoError(r, err)
utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)

Expand All @@ -54,7 +59,10 @@ func TestV2ETHWithdrawAndAuthenticatedCallThroughContract(r *runner.E2ERunner, a
r.AssertTestDAppEVMCalled(true, payloadMessageAuthenticatedWithdrawETHThroughContract, amount)

// check expected sender was used
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(&bind.CallOpts{}, []byte(payloadMessageAuthenticatedWithdrawETHThroughContract))
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(
&bind.CallOpts{},
[]byte(payloadMessageAuthenticatedWithdrawETHThroughContract),
)
require.NoError(r, err)
require.Equal(r, gatewayCallerAddr, senderForMsg)

Expand Down
10 changes: 7 additions & 3 deletions e2e/e2etests/test_v2_zevm_to_evm_authenticated_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ func TestV2ZEVMToEVMAuthenticatedCall(r *runner.E2ERunner, args []string) {
utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)

// perform the authenticated call
tx = r.V2ZEVMToEMVAuthenticatedCall(r.TestDAppV2EVMAddr, []byte(payloadMessageEVMAuthenticatedCall), gatewayzevm.RevertOptions{
OnRevertGasLimit: big.NewInt(0),
})
tx = r.V2ZEVMToEMVAuthenticatedCall(
r.TestDAppV2EVMAddr,
[]byte(payloadMessageEVMAuthenticatedCall),
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ func TestV2ZEVMToEVMAuthenticatedCallThroughContract(r *runner.E2ERunner, args [
r.AssertTestDAppEVMCalled(false, payloadMessageEVMAuthenticatedCallThroughContract, big.NewInt(0))

// deploy caller contract and send it gas zrc20 to pay gas fee
gatewayCallerAddr, tx, gatewayCaller, err := testgatewayzevmcaller.DeployTestGatewayZEVMCaller(r.ZEVMAuth, r.ZEVMClient, r.GatewayZEVMAddr, r.WZetaAddr)
gatewayCallerAddr, tx, gatewayCaller, err := testgatewayzevmcaller.DeployTestGatewayZEVMCaller(
r.ZEVMAuth,
r.ZEVMClient,
r.GatewayZEVMAddr,
r.WZetaAddr,
)
require.NoError(r, err)
utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)

Expand All @@ -34,9 +39,14 @@ func TestV2ZEVMToEVMAuthenticatedCallThroughContract(r *runner.E2ERunner, args [
utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)

// perform the authenticated call
tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract(gatewayCaller, r.TestDAppV2EVMAddr, []byte(payloadMessageEVMAuthenticatedCallThroughContract), testgatewayzevmcaller.RevertOptions{
OnRevertGasLimit: big.NewInt(0),
})
tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract(
gatewayCaller,
r.TestDAppV2EVMAddr,
[]byte(payloadMessageEVMAuthenticatedCallThroughContract),
testgatewayzevmcaller.RevertOptions{
OnRevertGasLimit: big.NewInt(0),
},
)
utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)
cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "call")
Expand All @@ -45,7 +55,10 @@ func TestV2ZEVMToEVMAuthenticatedCallThroughContract(r *runner.E2ERunner, args [
r.AssertTestDAppEVMCalled(true, payloadMessageEVMAuthenticatedCallThroughContract, big.NewInt(0))

// check expected sender was used
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(&bind.CallOpts{}, []byte(payloadMessageEVMAuthenticatedCallThroughContract))
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(
&bind.CallOpts{},
[]byte(payloadMessageEVMAuthenticatedCallThroughContract),
)
require.NoError(r, err)
require.Equal(r, gatewayCallerAddr, senderForMsg)

Expand All @@ -55,9 +68,14 @@ func TestV2ZEVMToEVMAuthenticatedCallThroughContract(r *runner.E2ERunner, args [
utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout)

// repeat authenticated call through contract, should revert because of wrong sender
tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract(gatewayCaller, r.TestDAppV2EVMAddr, []byte(payloadMessageEVMAuthenticatedCallThroughContract), testgatewayzevmcaller.RevertOptions{
OnRevertGasLimit: big.NewInt(0),
})
tx = r.V2ZEVMToEMVAuthenticatedCallThroughContract(
gatewayCaller,
r.TestDAppV2EVMAddr,
[]byte(payloadMessageEVMAuthenticatedCallThroughContract),
testgatewayzevmcaller.RevertOptions{
OnRevertGasLimit: big.NewInt(0),
},
)
utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout)
cctx = utils.WaitCctxMinedByInboundHash(r.Ctx, tx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout)
r.Logger.CCTX(*cctx, "call")
Expand Down
3 changes: 2 additions & 1 deletion e2e/runner/v2_zevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/require"
testgatewayzevmcaller "github.com/zeta-chain/node/pkg/contracts/testgatewayzevmcaller"
"github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol"

testgatewayzevmcaller "github.com/zeta-chain/node/pkg/contracts/testgatewayzevmcaller"
)

var gasLimit = big.NewInt(1000000)
Expand Down
6 changes: 5 additions & 1 deletion zetaclient/chains/evm/signer/v2_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import (
// function execute
// address destination,
// bytes calldata data
func (signer *Signer) signGatewayExecute(ctx context.Context, sender string, txData *OutboundData) (*ethtypes.Transaction, error) {
func (signer *Signer) signGatewayExecute(
ctx context.Context,
sender string,
txData *OutboundData,
) (*ethtypes.Transaction, error) {
gatewayABI, err := gatewayevm.GatewayEVMMetaData.GetAbi()
if err != nil {
return nil, errors.Wrap(err, "unable to get GatewayEVMMetaData ABI")
Expand Down

0 comments on commit 614df83

Please sign in to comment.