Skip to content

Commit

Permalink
add UpdateGasPriceIncreaseFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jul 12, 2024
1 parent a7b4ec8 commit 8728a08
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
}
if testAdmin {
eg.Go(adminTestRoutine(conf, deployerRunner, verbose,
//e2etests.TestRateLimiterName,
//e2etests.TestPauseZRC20Name,
//e2etests.TestUpdateBytecodeZRC20Name,
//e2etests.TestUpdateBytecodeConnectorName,
//e2etests.TestDepositEtherLiquidityCapName,
e2etests.TestRateLimiterName,
e2etests.TestPauseZRC20Name,
e2etests.TestUpdateBytecodeZRC20Name,
e2etests.TestUpdateBytecodeConnectorName,
e2etests.TestDepositEtherLiquidityCapName,
e2etests.TestAdminTransactionsName,

// TestMigrateChainSupportName tests EVM chain migration. Currently this test doesn't work with Anvil because pre-EIP1559 txs are not supported
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/e2etests.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ var AllE2ETests = []runner.E2ETest{
),
runner.NewE2ETest(
TestAdminTransactionsName,
"test admin critical admin transactions that have not been tested by any other test",
"test admin critical admin transactions",
[]runner.ArgDefinition{},
TestAdminTransactions,
),
Expand Down
13 changes: 13 additions & 0 deletions e2e/e2etests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package e2etests
import (
"math/big"
"strconv"
"time"

"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/chaincfg/chainhash"
Expand All @@ -16,6 +17,18 @@ import (
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)

func WaitForNBlock(r *runner.E2ERunner, n int64) {
height, err := r.CctxClient.LastZetaHeight(r.Ctx, &crosschaintypes.QueryLastZetaHeightRequest{})
require.NoError(r, err)
for {
heightNew, err := r.CctxClient.LastZetaHeight(r.Ctx, &crosschaintypes.QueryLastZetaHeightRequest{})
require.NoError(r, err)
if heightNew.Height+n >= height.Height {
break
}
time.Sleep(4 * time.Second)
}
}
func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) *btcjson.TxRawResult {
tx, err := r.BTCZRC20.Approve(
r.ZEVMAuth,
Expand Down
9 changes: 3 additions & 6 deletions e2e/e2etests/test_admin_transactions.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package e2etests

import (
"time"

"github.com/stretchr/testify/require"
"github.com/zeta-chain/zetacore/e2e/runner"
"github.com/zeta-chain/zetacore/e2e/utils"
Expand All @@ -13,13 +11,12 @@ import (
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)

func TestAdminTransactions(r *runner.E2ERunner, args []string) {
func TestAdminTransactions(r *runner.E2ERunner, _ []string) {
TestAddToInboundTracker(r)
TestUpdateGasPriceIncreaseFlags(r)
}

func TestUpdateGasPriceIncreaseFlags(r *runner.E2ERunner) {

defaultFlags := observertypes.DefaultGasPriceIncreaseFlags
msgGasPriceFlags := observertypes.NewMsgUpdateGasPriceIncreaseFlags(
r.ZetaTxServer.MustGetAccountAddressFromName(utils.OperationalPolicyName),
Expand All @@ -39,7 +36,7 @@ func TestUpdateGasPriceIncreaseFlags(r *runner.E2ERunner) {
_, err = r.ZetaTxServer.BroadcastTx(utils.OperationalPolicyName, msgGasPriceFlags)
require.NoError(r, err)

time.Sleep(8 * time.Second)
WaitForNBlock(r, 1)

flags, err := r.ObserverClient.CrosschainFlags(r.Ctx, &observertypes.QueryGetCrosschainFlagsRequest{})
require.NoError(r, err)
Expand Down Expand Up @@ -69,7 +66,7 @@ func TestAddToInboundTracker(r *runner.E2ERunner) {
_, err = r.ZetaTxServer.BroadcastTx(utils.EmergencyPolicyName, msgBtc)
require.NoError(r, err)

time.Sleep(8 * time.Second)
WaitForNBlock(r, 1)

tracker, err := r.CctxClient.InboundTracker(r.Ctx, &crosschaintypes.QueryInboundTrackerRequest{
ChainID: msgEth.ChainId,
Expand Down
4 changes: 2 additions & 2 deletions e2e/e2etests/test_rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func TestRateLimiter(r *runner.E2ERunner, _ []string) {
// https://github.com/zeta-chain/node/issues/2090
r.Logger.Print("rate limiter enabled")
require.NoError(r, createAndWaitWithdraws(r, withdrawTypeZETA, zetaAmount))
require.NoError(r, createAndWaitWithdraws(r, withdrawTypeZETA, ethAmount))
require.NoError(r, createAndWaitWithdraws(r, withdrawTypeZETA, erc20Amount))
require.NoError(r, createAndWaitWithdraws(r, withdrawTypeETH, ethAmount))
require.NoError(r, createAndWaitWithdraws(r, withdrawTypeERC20, erc20Amount))

// Disable rate limiter
r.Logger.Info("disabling rate limiter")
Expand Down

0 comments on commit 8728a08

Please sign in to comment.