From c9805b6fa5ffa248379fca73d1cf352c22b9ca31 Mon Sep 17 00:00:00 2001 From: lumtis Date: Mon, 22 Jul 2024 14:10:35 +0200 Subject: [PATCH] tentative fix test --- e2e/e2etests/test_eth_withdraw.go | 5 ++++- e2e/e2etests/test_eth_withdraw_restricted_address.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e/e2etests/test_eth_withdraw.go b/e2e/e2etests/test_eth_withdraw.go index d875ff9fbd..d5ad7b4416 100644 --- a/e2e/e2etests/test_eth_withdraw.go +++ b/e2e/e2etests/test_eth_withdraw.go @@ -17,8 +17,11 @@ func TestEtherWithdraw(r *runner.E2ERunner, args []string) { withdrawalAmount, ok := new(big.Int).SetString(args[0], 10) require.True(r, ok, "Invalid withdrawal amount specified for TestEtherWithdraw.") + // add one unit to the withdrawal amount to account for the approval because withdrawal fees are automatically deducted + approvalAmount := new(big.Int).Add(withdrawalAmount, big.NewInt(1e18)) + // approve - tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, withdrawalAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvalAmount) require.NoError(r, err) r.Logger.EVMTransaction(*tx, "approve") diff --git a/e2e/e2etests/test_eth_withdraw_restricted_address.go b/e2e/e2etests/test_eth_withdraw_restricted_address.go index 42aab00976..6cfbf18062 100644 --- a/e2e/e2etests/test_eth_withdraw_restricted_address.go +++ b/e2e/e2etests/test_eth_withdraw_restricted_address.go @@ -19,8 +19,11 @@ func TestEtherWithdrawRestricted(r *runner.E2ERunner, args []string) { withdrawalAmount, ok := new(big.Int).SetString(args[0], 10) require.True(r, ok) + // add one unit to the withdrawal amount to account for the approval because withdrawal fees are automatically deducted + approvalAmount := new(big.Int).Add(withdrawalAmount, big.NewInt(1e18)) + // approve - tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, withdrawalAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvalAmount) require.NoError(r, err) r.Logger.EVMTransaction(*tx, "approve")