Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): add amount args for ERC20 withdraw tests #3113

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/zetae2e/local/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func startV2Tests(eg *errgroup.Group, conf config.Config, deployerRunner *runner
e2etests.TestV2ERC20WithdrawAndArbitraryCallName,
e2etests.TestV2ERC20WithdrawAndCallName,
e2etests.TestV2ERC20DepositAndCallNoMessageName,
e2etests.TestV2ERC20WithdrawAndCallNoMessageName,
))

// Test revert cases for gas token workflow
Expand Down
8 changes: 6 additions & 2 deletions e2e/e2etests/e2etests.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,17 @@ var AllE2ETests = []runner.E2ETest{
runner.NewE2ETest(
TestV2ERC20WithdrawAndCallName,
"withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract",
[]runner.ArgDefinition{},
[]runner.ArgDefinition{
{Description: "amount", DefaultValue: "1000"},
lumtis marked this conversation as resolved.
Show resolved Hide resolved
},
TestV2ERC20WithdrawAndCall,
),
runner.NewE2ETest(
TestV2ERC20WithdrawAndCallNoMessageName,
"withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract with no message",
[]runner.ArgDefinition{},
[]runner.ArgDefinition{
{Description: "amount", DefaultValue: "1000"},
},
lumtis marked this conversation as resolved.
Show resolved Hide resolved
TestV2ERC20WithdrawAndCallNoMessage,
),
runner.NewE2ETest(
Expand Down
9 changes: 5 additions & 4 deletions e2e/e2etests/test_v2_erc20_withdraw_and_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ import (
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
)

func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, _ []string) {
func TestV2ERC20WithdrawAndCall(r *runner.E2ERunner, args []string) {
require.Len(r, args, 1)

previousGasLimit := r.ZEVMAuth.GasLimit
r.ZEVMAuth.GasLimit = 10000000
defer func() {
r.ZEVMAuth.GasLimit = previousGasLimit
}()

// called with fixed amount without arg since onCall implementation is for TestDappV2 is simple and generic
// without decoding the payload and amount handling for erc20, purpose of test is to verify correct sender and payload are used
amount := big.NewInt(10000)
amount, ok := big.NewInt(0).SetString(args[0], 10)
require.True(r, ok, "Invalid amount specified for TestV2ERC20WithdrawAndCall")
lumtis marked this conversation as resolved.
Show resolved Hide resolved

payload := randomPayload(r)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestV2ERC20WithdrawAndCallNoMessage(r *runner.E2ERunner, args []string) {
// check called
messageIndex, err := r.TestDAppV2EVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress())
require.NoError(r, err)
r.AssertTestDAppEVMCalled(true, messageIndex, amount)
r.AssertTestDAppEVMCalled(true, messageIndex, big.NewInt(0))

// check expected sender was used
senderForMsg, err := r.TestDAppV2EVM.SenderWithMessage(
Expand Down
Loading