Skip to content

Commit a611d22

Browse files
set gas limit based on upgrade
1 parent 229c265 commit a611d22

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/e2e/c/dynamic_fees.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ package c
66
import (
77
"math/big"
88
"strings"
9+
"time"
910

1011
"github.com/ava-labs/coreth/core/types"
1112
"github.com/ava-labs/coreth/params"
13+
"github.com/ava-labs/coreth/plugin/evm/upgrade/acp176"
1214
"github.com/ava-labs/coreth/plugin/evm/upgrade/cortina"
1315
"github.com/ethereum/go-ethereum/accounts/abi"
1416
"github.com/ethereum/go-ethereum/common"
1517
"github.com/onsi/ginkgo/v2"
1618
"github.com/stretchr/testify/require"
1719
"go.uber.org/zap"
1820

21+
"github.com/ava-labs/avalanchego/api/info"
1922
"github.com/ava-labs/avalanchego/tests/fixture/e2e"
2023
"github.com/ava-labs/avalanchego/tests/fixture/tmpnet"
2124
)
@@ -28,8 +31,6 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
2831
require := require.New(tc)
2932

3033
const (
31-
// gasLimit is the maximum amount of gas that can be used in a block.
32-
gasLimit = cortina.GasLimit // acp176.MinMaxCapacity
3334
// maxFeePerGas is the maximum fee that transactions issued by this test
3435
// will be willing to pay.
3536
maxFeePerGas = 1000 * params.GWei
@@ -84,6 +85,24 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() {
8485
return signedTx
8586
}
8687

88+
// gasLimit is the maximum amount of gas that can be used in a block.
89+
var gasLimit uint64
90+
tc.By("verifying Fortuna is activated", func() {
91+
infoClient := info.NewClient(nodeURI.URI)
92+
upgrades, err := infoClient.Upgrades(tc.DefaultContext())
93+
require.NoError(err)
94+
95+
now := time.Now()
96+
if upgrades.IsFUpgradeActivated(now) {
97+
gasLimit = acp176.MinMaxCapacity
98+
} else {
99+
gasLimit = cortina.GasLimit
100+
}
101+
})
102+
tc.Log().Info("set gas limit",
103+
zap.Uint64("gasLimit", gasLimit),
104+
)
105+
87106
var contractAddress common.Address
88107
tc.By("deploying an expensive contract", func() {
89108
// Create transaction

0 commit comments

Comments
 (0)