From 37e79d4bc376e4ae53f629f1159475a7748e6064 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 25 Feb 2025 10:30:33 -0500 Subject: [PATCH 01/20] Log SuggestGasPrice during test runs --- tests/fixture/e2e/helpers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/fixture/e2e/helpers.go b/tests/fixture/e2e/helpers.go index 1b6367c6eed4..9b7f6c45522e 100644 --- a/tests/fixture/e2e/helpers.go +++ b/tests/fixture/e2e/helpers.go @@ -192,6 +192,11 @@ func SendEthTransaction(tc tests.TestContext, ethClient ethclient.Client, signed func SuggestGasPrice(tc tests.TestContext, ethClient ethclient.Client) *big.Int { gasPrice, err := ethClient.SuggestGasPrice(tc.DefaultContext()) require.NoError(tc, err) + + tc.Log().Info("suggested gas price", + zap.Stringer("price", gasPrice), + ) + // Double the suggested gas price to maximize the chances of // acceptance. Maybe this can be revisited pending resolution of // https://github.com/ava-labs/coreth/issues/314. From 1015b2dde87e464f79c7573aade7b95b86b8a3ba Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 20:46:08 -0500 Subject: [PATCH 02/20] rewrite dynamic_fees test --- go.mod | 2 +- go.sum | 4 +- tests/e2e/c/consume_gas.go | 14 ++++++ tests/e2e/c/consume_gas.sol | 9 ++++ tests/e2e/c/dynamic_fees.go | 77 +++++++++++++++++++----------- tests/e2e/c/hashing.sol | 15 ------ tests/e2e/c/hashing_contract.go | 11 ----- tests/e2e/c/interchain_workflow.go | 3 +- tests/fixture/e2e/helpers.go | 7 ++- 9 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 tests/e2e/c/consume_gas.go create mode 100644 tests/e2e/c/consume_gas.sol delete mode 100644 tests/e2e/c/hashing.sol delete mode 100644 tests/e2e/c/hashing_contract.go diff --git a/go.mod b/go.mod index e12e9b2c286c..f9c2759ed62b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/DataDog/zstd v1.5.2 github.com/NYTimes/gziphandler v1.1.1 github.com/antithesishq/antithesis-sdk-go v0.3.8 - github.com/ava-labs/coreth v0.14.1-rc.1.0.20250219185827-6a9db205a450 + github.com/ava-labs/coreth v0.14.1-acp-176.0 github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 diff --git a/go.sum b/go.sum index f9928533c5bb..c76d3d8ad8c4 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/coreth v0.14.1-rc.1.0.20250219185827-6a9db205a450 h1:xSoL6plkPrb2w21v4JRnQg3BIJSg2svBHXyil09RMAg= -github.com/ava-labs/coreth v0.14.1-rc.1.0.20250219185827-6a9db205a450/go.mod h1:AEQcF8MWrKH0sS114wEZlkSfeGF5F66xTbQYqqimNLI= +github.com/ava-labs/coreth v0.14.1-acp-176.0 h1:VczY4/UNcayESdade0PvW0nmt7966wKwWYAaYaURF0s= +github.com/ava-labs/coreth v0.14.1-acp-176.0/go.mod h1:AEQcF8MWrKH0sS114wEZlkSfeGF5F66xTbQYqqimNLI= github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 h1:EL66gtXOAwR/4KYBjOV03LTWgkEXvLePribLlJNu4g0= github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60/go.mod h1:/7qKobTfbzBu7eSTVaXMTr56yTYk4j2Px6/8G+idxHo= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= diff --git a/tests/e2e/c/consume_gas.go b/tests/e2e/c/consume_gas.go new file mode 100644 index 000000000000..fbe5bfc13d2a --- /dev/null +++ b/tests/e2e/c/consume_gas.go @@ -0,0 +1,14 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package c + +const ( + // consumeGasCompiledContract is the compiled bytecode of the contract + // defined in consume_gas.sol. + consumeGasCompiledContract = "6080604052348015600f57600080fd5b5060788061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063c040622614602d575b600080fd5b60336035565b005b5b6001156040576036565b56fea264697066735822122070cfeeb0992270b4ff725a1264654534853d25ea6bb28c85d986beccfdbc997164736f6c63430008060033" + // consumeGasABIJson is the ABI of the contract defined in consume_gas.sol. + consumeGasABIJson = `[{"inputs":[],"name":"run","outputs":[],"stateMutability":"nonpayable","type":"function"}]` + // consumeGasFunction is the name of the function to call to consume gas. + consumeGasFunction = "run" +) diff --git a/tests/e2e/c/consume_gas.sol b/tests/e2e/c/consume_gas.sol new file mode 100644 index 000000000000..66e6bc11e2c3 --- /dev/null +++ b/tests/e2e/c/consume_gas.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity = 0.8.6; + +contract ConsumeGas { + function run() public { + while (true){} + } +} diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index effb012ef5d8..3dff4969ed91 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -9,6 +9,7 @@ import ( "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/params" + "github.com/ava-labs/coreth/plugin/evm/upgrade/cortina" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/onsi/ginkgo/v2" @@ -19,19 +20,27 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" ) -// This test uses the compiled bin for `hashing.sol` as -// well as its ABI contained in `hashing_contract.go`. +// This test uses the compiled bytecode for `consume_gas.sol` as well as its ABI +// contained in `consume_gas.go`. var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { tc := e2e.NewTestContext() require := require.New(tc) - // Need a gas limit much larger than the standard 21_000 to enable - // the contract to induce a gas price increase - const largeGasLimit = uint64(8_000_000) - - // TODO(marun) What is the significance of this value? - gasTip := big.NewInt(1000 * params.GWei) + const ( + // gasLimit is the maximum amount of gas that can be used in a block. + gasLimit = cortina.GasLimit // acp176.MinMaxCapacity + // maxFeePerGas is the maximum fee that transactions issued by this test + // will be willing to pay. + maxFeePerGas = 1000 * params.GWei + // minFeePerGas is the minimum fee that transactions issued by this test + // will pay. + minFeePerGas = 1 * params.Wei + ) + var ( + gasFeeCap = big.NewInt(maxFeePerGas) + gasTipCap = big.NewInt(minFeePerGas) + ) ginkgo.It("should ensure that the gas price is affected by load", func() { tc.By("creating a new private network to ensure isolation from other tests") @@ -73,18 +82,21 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // Create transaction nonce, err := ethClient.AcceptedNonceAt(tc.DefaultContext(), ethAddress) require.NoError(err) - compiledContract := common.Hex2Bytes(hashingCompiledContract) - tx := types.NewTx(&types.LegacyTx{ - Nonce: nonce, - GasPrice: gasTip, - Gas: largeGasLimit, - Value: common.Big0, - Data: compiledContract, + compiledContract := common.Hex2Bytes(consumeGasCompiledContract) + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: cChainID, + Nonce: nonce, + GasTipCap: gasTipCap, + GasFeeCap: gasFeeCap, + Gas: gasLimit, + To: nil, // contract creation + Data: compiledContract, }) // Send the transaction and wait for acceptance signedTx := sign(tx) receipt := e2e.SendEthTransaction(tc, ethClient, signedTx) + require.Equal(types.ReceiptStatusSuccessful, receipt.Status) contractAddress = receipt.ContractAddress }) @@ -92,25 +104,30 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { var gasPrice *big.Int tc.By("calling the expensive contract repeatedly until a gas price increase is detected", func() { // Evaluate the bytes representation of the contract - hashingABI, err := abi.JSON(strings.NewReader(hashingABIJson)) + hashingABI, err := abi.JSON(strings.NewReader(consumeGasABIJson)) require.NoError(err) - contractData, err := hashingABI.Pack("hashIt") + contractData, err := hashingABI.Pack(consumeGasFunction) require.NoError(err) var initialGasPrice *big.Int tc.Eventually(func() bool { // Check the gas price - var err error gasPrice, err = ethClient.SuggestGasPrice(tc.DefaultContext()) require.NoError(err) + + // If this is the first iteration, record the initial gas price. if initialGasPrice == nil { initialGasPrice = gasPrice tc.Log().Info("initial gas price", - zap.Uint64("price", initialGasPrice.Uint64()), + zap.Stringer("price", initialGasPrice), ) - } else if gasPrice.Cmp(initialGasPrice) > 0 { + } + + // If the gas price has increased, stop the loop. + if gasPrice.Cmp(initialGasPrice) > 0 { tc.Log().Info("gas price has increased", - zap.Uint64("price", gasPrice.Uint64()), + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("newPrice", gasPrice), ) return true } @@ -118,13 +135,14 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // Create the transaction nonce, err := ethClient.AcceptedNonceAt(tc.DefaultContext(), ethAddress) require.NoError(err) - tx := types.NewTx(&types.LegacyTx{ - Nonce: nonce, - GasPrice: gasTip, - Gas: largeGasLimit, - To: &contractAddress, - Value: common.Big0, - Data: contractData, + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: cChainID, + Nonce: nonce, + GasTipCap: gasTipCap, + GasFeeCap: gasFeeCap, + Gas: gasLimit, + To: &contractAddress, + Data: contractData, }) // Send the transaction and wait for acceptance @@ -145,7 +163,8 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { return initialGasPrice.Cmp(gasPrice) > 0 }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price decrease before timeout") tc.Log().Info("gas price has decreased", - zap.Uint64("price", gasPrice.Uint64()), + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("newPrice", gasPrice), ) }) diff --git a/tests/e2e/c/hashing.sol b/tests/e2e/c/hashing.sol deleted file mode 100644 index 0457ac428e01..000000000000 --- a/tests/e2e/c/hashing.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity = 0.8.6; - -contract ConsumeGas { - - bytes hashVar = bytes("This is the hashing text for the test"); - - function hashIt() public { - for (uint i=0; i<3700; i++) { - ripemd160(hashVar); - } - } - -} diff --git a/tests/e2e/c/hashing_contract.go b/tests/e2e/c/hashing_contract.go deleted file mode 100644 index 7bf1db76c7cf..000000000000 --- a/tests/e2e/c/hashing_contract.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -// AUTOMATICALLY GENERATED. DO NOT EDIT! -// Generated from hashing.sol by compile-contract.sh -package c - -const ( - hashingCompiledContract = "60806040526040518060600160405280602581526020016103ba6025913960009080519060200190610032929190610045565b5034801561003f57600080fd5b50610149565b828054610051906100e8565b90600052602060002090601f01602090048101928261007357600085556100ba565b82601f1061008c57805160ff19168380011785556100ba565b828001600101855582156100ba579182015b828111156100b957825182559160200191906001019061009e565b5b5090506100c791906100cb565b5090565b5b808211156100e45760008160009055506001016100cc565b5090565b6000600282049050600182168061010057607f821691505b602082108114156101145761011361011a565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b610262806101586000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80636f37ecea14610030575b600080fd5b61003861003a565b005b60005b610e7481101561009057600360006040516100589190610112565b602060405180830381855afa158015610075573d6000803e3d6000fd5b5050506040515150808061008890610185565b91505061003d565b50565b600081546100a081610153565b6100aa818661013e565b945060018216600081146100c557600181146100d657610109565b60ff19831686528186019350610109565b6100df85610129565b60005b83811015610101578154818901526001820191506020810190506100e2565b838801955050505b50505092915050565b600061011e8284610093565b915081905092915050565b60008190508160005260206000209050919050565b600081905092915050565b6000819050919050565b6000600282049050600182168061016b57607f821691505b6020821081141561017f5761017e6101fd565b5b50919050565b600061019082610149565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156101c3576101c26101ce565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fdfea2646970667358221220cc5de5cd3c7aa5bda60e63e0f3156691253f7a78191eb336ec6699b38a8a777c64736f6c6343000806003354686973206973207468652068617368696e67207465787420666f72207468652074657374" - hashingABIJson = `[{"inputs":[],"name":"hashIt","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -) diff --git a/tests/e2e/c/interchain_workflow.go b/tests/e2e/c/interchain_workflow.go index 791d73888f3e..3ae333e21aac 100644 --- a/tests/e2e/c/interchain_workflow.go +++ b/tests/e2e/c/interchain_workflow.go @@ -64,7 +64,8 @@ var _ = e2e.DescribeCChain("[Interchain Workflow]", func() { signedTx, err := types.SignTx(tx, signer, senderKey.ToECDSA()) require.NoError(err) - _ = e2e.SendEthTransaction(tc, ethClient, signedTx) + receipt := e2e.SendEthTransaction(tc, ethClient, signedTx) + require.Equal(types.ReceiptStatusSuccessful, receipt.Status) tc.By("waiting for the C-Chain recipient address to have received the sent funds") tc.Eventually(func() bool { diff --git a/tests/fixture/e2e/helpers.go b/tests/fixture/e2e/helpers.go index 9b7f6c45522e..16952634a780 100644 --- a/tests/fixture/e2e/helpers.go +++ b/tests/fixture/e2e/helpers.go @@ -183,7 +183,12 @@ func SendEthTransaction(tc tests.TestContext, ethClient ethclient.Client, signed return true }, DefaultTimeout, DefaultPollingInterval, "failed to see transaction acceptance before timeout") - require.Equal(types.ReceiptStatusSuccessful, receipt.Status) + tc.Log().Info("eth transaction accepted", + zap.Stringer("txID", txID), + zap.Uint64("gasUsed", receipt.GasUsed), + zap.Stringer("gasPrice", receipt.EffectiveGasPrice), + zap.Stringer("blockNumber", receipt.BlockNumber), + ) return receipt } From 7becdbda1b2ab25798e366270c381d350841d435 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 20:56:16 -0500 Subject: [PATCH 03/20] nit --- tests/e2e/c/dynamic_fees.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 3dff4969ed91..4fdd3f3556c3 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -69,7 +69,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { tc.By("initializing a transaction signer") cChainID, err := ethClient.ChainID(tc.DefaultContext()) require.NoError(err) - signer := types.NewEIP155Signer(cChainID) + signer := types.NewLondonSigner(cChainID) ecdsaKey := key.ToECDSA() sign := func(tx *types.Transaction) *types.Transaction { signedTx, err := types.SignTx(tx, signer, ecdsaKey) From 88a128091cea29599f4c5c0349cfbdeed90d7473 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 21:38:56 -0500 Subject: [PATCH 04/20] Do not trust the API --- tests/e2e/c/dynamic_fees.go | 114 ++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 44 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 4fdd3f3556c3..a911cbdbc3f4 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -36,6 +36,13 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // minFeePerGas is the minimum fee that transactions issued by this test // will pay. minFeePerGas = 1 * params.Wei + + // expectedGasPriceIncreaseNumerator/expectedGasPriceIncreaseDenominator + // is the multiplier that the gas price is attempted to reach. So if the + // initial gas price is 5 GWei, the test will attempt to increase the + // gas price to 6 GWei. + expectedGasPriceIncreaseNumerator = 6 + expectedGasPriceIncreaseDenominator = 5 ) var ( gasFeeCap = big.NewInt(maxFeePerGas) @@ -101,37 +108,46 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { contractAddress = receipt.ContractAddress }) - var gasPrice *big.Int - tc.By("calling the expensive contract repeatedly until a gas price increase is detected", func() { + latest, err := ethClient.HeaderByNumber(tc.DefaultContext(), nil) + require.NoError(err) + + initialGasPrice := latest.BaseFee + targetGasPrice := new(big.Int).Set(initialGasPrice) + targetGasPrice.Mul(targetGasPrice, big.NewInt(expectedGasPriceIncreaseNumerator)) + targetGasPrice.Div(targetGasPrice, big.NewInt(expectedGasPriceIncreaseDenominator)) + tc.Log().Info("initializing gas prices", + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("targetPrice", targetGasPrice), + ) + + tc.By("calling the contract repeatedly until a gas price increase is detected", func() { // Evaluate the bytes representation of the contract hashingABI, err := abi.JSON(strings.NewReader(consumeGasABIJson)) require.NoError(err) contractData, err := hashingABI.Pack(consumeGasFunction) require.NoError(err) - var initialGasPrice *big.Int tc.Eventually(func() bool { // Check the gas price - gasPrice, err = ethClient.SuggestGasPrice(tc.DefaultContext()) + latest, err := ethClient.HeaderByNumber(tc.DefaultContext(), nil) require.NoError(err) - // If this is the first iteration, record the initial gas price. - if initialGasPrice == nil { - initialGasPrice = gasPrice - tc.Log().Info("initial gas price", - zap.Stringer("price", initialGasPrice), - ) - } - // If the gas price has increased, stop the loop. - if gasPrice.Cmp(initialGasPrice) > 0 { + if latest.BaseFee.Cmp(targetGasPrice) > 0 { tc.Log().Info("gas price has increased", zap.Stringer("initialPrice", initialGasPrice), - zap.Stringer("newPrice", gasPrice), + zap.Stringer("targetPrice", targetGasPrice), + zap.Stringer("newPrice", latest.BaseFee), ) return true } + tc.Log().Info("gas price hasn't sufficiently increased", + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("newPrice", latest.BaseFee), + zap.Stringer("targetPrice", targetGasPrice), + ) + // Create the transaction nonce, err := ethClient.AcceptedNonceAt(tc.DefaultContext(), ethAddress) require.NoError(err) @@ -154,41 +170,51 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price increase before timeout") }) - tc.By("waiting for the gas price to decrease...", func() { - initialGasPrice := gasPrice + // Create a recipient address + var ( + recipientKey = e2e.NewPrivateKey(tc) + recipientEthAddress = recipientKey.EthAddress() + ) + tc.By("calling the contract repeatedly until a gas price decrease is detected", func() { tc.Eventually(func() bool { - var err error - gasPrice, err = ethClient.SuggestGasPrice(tc.DefaultContext()) + // Check the gas price + latest, err := ethClient.HeaderByNumber(tc.DefaultContext(), nil) require.NoError(err) - return initialGasPrice.Cmp(gasPrice) > 0 - }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price decrease before timeout") - tc.Log().Info("gas price has decreased", - zap.Stringer("initialPrice", initialGasPrice), - zap.Stringer("newPrice", gasPrice), - ) - }) - tc.By("sending funds at the current gas price", func() { - // Create a recipient address - var ( - recipientKey = e2e.NewPrivateKey(tc) - recipientEthAddress = recipientKey.EthAddress() - ) + // If the gas price has decreased, stop the loop. + if initialGasPrice.Cmp(latest.BaseFee) >= 0 { + tc.Log().Info("gas price has increased", + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("newPrice", latest.BaseFee), + ) + return true + } - // Create transaction - nonce, err := ethClient.AcceptedNonceAt(tc.DefaultContext(), ethAddress) - require.NoError(err) - tx := types.NewTx(&types.LegacyTx{ - Nonce: nonce, - GasPrice: gasPrice, - Gas: e2e.DefaultGasLimit, - To: &recipientEthAddress, - Value: common.Big0, - }) + tc.Log().Info("gas price hasn't sufficiently decreased", + zap.Stringer("initialPrice", initialGasPrice), + zap.Stringer("newPrice", latest.BaseFee), + ) - // Send the transaction and wait for acceptance - signedTx := sign(tx) - _ = e2e.SendEthTransaction(tc, ethClient, signedTx) + // Create the transaction + nonce, err := ethClient.AcceptedNonceAt(tc.DefaultContext(), ethAddress) + require.NoError(err) + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: cChainID, + Nonce: nonce, + GasTipCap: gasTipCap, + GasFeeCap: gasFeeCap, + Gas: e2e.DefaultGasLimit, + To: &recipientEthAddress, + }) + + // Send the transaction and wait for acceptance + signedTx := sign(tx) + receipt := e2e.SendEthTransaction(tc, ethClient, signedTx) + require.Equal(types.ReceiptStatusSuccessful, receipt.Status) + + // The gas price will be checked at the start of the next iteration + return false + }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price increase before timeout") }) _ = e2e.CheckBootstrapIsPossible(tc, privateNetwork) From 5a7e0442025f8ca6f7a013fccec2183088bdec20 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:08:40 -0500 Subject: [PATCH 05/20] fix copy paste --- tests/e2e/c/dynamic_fees.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index a911cbdbc3f4..8399ef791898 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -183,7 +183,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // If the gas price has decreased, stop the loop. if initialGasPrice.Cmp(latest.BaseFee) >= 0 { - tc.Log().Info("gas price has increased", + tc.Log().Info("gas price has decreased", zap.Stringer("initialPrice", initialGasPrice), zap.Stringer("newPrice", latest.BaseFee), ) @@ -214,7 +214,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // The gas price will be checked at the start of the next iteration return false - }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price increase before timeout") + }, e2e.DefaultTimeout, e2e.DefaultPollingInterval, "failed to see gas price decrease before timeout") }) _ = e2e.CheckBootstrapIsPossible(tc, privateNetwork) From 3b4be16ce65073f54f24c82e31c3b69d7a8f2c00 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:11:02 -0500 Subject: [PATCH 06/20] wip --- .github/workflows/ci.yml | 25 ++++- tests/e2e/e2e_test.go | 27 ++++- tests/e2e/etna/suites.go | 38 +++++++ tests/e2e/p/elastic_subnets.go | 196 +++++++++++++++++++++++++++++++++ tests/e2e/p/l1.go | 12 ++ tests/fixture/e2e/flags.go | 11 ++ 6 files changed, 305 insertions(+), 4 deletions(-) create mode 100644 tests/e2e/etna/suites.go create mode 100644 tests/e2e/p/elastic_subnets.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d0f6eaa9044..d3d0baa9f544 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: fuzz_test shell: bash run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds - e2e: + e2e_pre_etna: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -72,7 +72,28 @@ jobs: uses: ./.github/actions/upload-tmpnet-artifact if: always() with: - name: e2e-tmpnet-data + name: e2e-pre-etna-tmpnet-data + e2e_post_etna: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-go-for-project + - name: Build AvalancheGo Binary + shell: bash + run: ./scripts/build.sh -r + - name: Run e2e tests + uses: ./.github/actions/run-monitored-tmpnet-cmd + with: + run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown --activate-etna + prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }} + prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} + loki_id: ${{ secrets.LOKI_ID || '' }} + loki_password: ${{ secrets.LOKI_PASSWORD || '' }} + - name: Upload tmpnet network dir + uses: ./.github/actions/upload-tmpnet-artifact + if: always() + with: + name: e2e-post-etna-tmpnet-data e2e_existing_network: runs-on: ubuntu-latest steps: diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 192c5594737f..ce6b01529d79 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -4,21 +4,27 @@ package e2e_test import ( + "encoding/base64" + "encoding/json" "testing" "github.com/onsi/ginkgo/v2" + "github.com/stretchr/testify/require" // ensure test packages are scanned by ginkgo _ "github.com/ava-labs/avalanchego/tests/e2e/banff" _ "github.com/ava-labs/avalanchego/tests/e2e/c" + _ "github.com/ava-labs/avalanchego/tests/e2e/etna" _ "github.com/ava-labs/avalanchego/tests/e2e/faultinjection" _ "github.com/ava-labs/avalanchego/tests/e2e/p" _ "github.com/ava-labs/avalanchego/tests/e2e/x" _ "github.com/ava-labs/avalanchego/tests/e2e/x/transfer" + "github.com/ava-labs/avalanchego/config" "github.com/ava-labs/avalanchego/tests/e2e/vms" "github.com/ava-labs/avalanchego/tests/fixture/e2e" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" + "github.com/ava-labs/avalanchego/upgrade" ) func TestE2E(t *testing.T) { @@ -34,13 +40,30 @@ func init() { var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { // Run only once in the first ginkgo process + tc := e2e.NewEventHandlerTestContext() + nodes := tmpnet.NewNodesOrPanic(flagVars.NodeCount()) subnets := vms.XSVMSubnetsOrPanic(nodes...) + + upgrades := upgrade.Default + if flagVars.ActivateFortuna() { + upgrades.EtnaTime = upgrade.InitiallyActiveTime + } else { + upgrades.EtnaTime = upgrade.UnscheduledActivationTime + } + + upgradeJSON, err := json.Marshal(upgrades) + require.NoError(tc, err) + + upgradeBase64 := base64.StdEncoding.EncodeToString(upgradeJSON) return e2e.NewTestEnvironment( - e2e.NewEventHandlerTestContext(), + tc, flagVars, &tmpnet.Network{ - Owner: "avalanchego-e2e", + Owner: "avalanchego-e2e", + DefaultFlags: tmpnet.FlagsMap{ + config.UpgradeFileContentKey: upgradeBase64, + }, Nodes: nodes, Subnets: subnets, }, diff --git a/tests/e2e/etna/suites.go b/tests/e2e/etna/suites.go new file mode 100644 index 000000000000..fb033726d6ce --- /dev/null +++ b/tests/e2e/etna/suites.go @@ -0,0 +1,38 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// Implements tests for the etna network upgrade. +package etna + +import ( + "time" + + "github.com/onsi/ginkgo/v2" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + + "github.com/ava-labs/avalanchego/api/info" + "github.com/ava-labs/avalanchego/tests/fixture/e2e" +) + +var _ = ginkgo.Describe("[Etna]", func() { + tc := e2e.NewTestContext() + require := require.New(tc) + + ginkgo.It("can detect if Etna is activated", + func() { + env := e2e.GetEnv(tc) + infoClient := info.NewClient(env.GetRandomNodeURI().URI) + + tc.By("get upgrade config") + upgrades, err := infoClient.Upgrades(tc.DefaultContext()) + require.NoError(err) + + now := time.Now() + tc.Log().Info("detected if Etna is activated", + zap.Time("now", now), + zap.Time("etnaTime", upgrades.EtnaTime), + zap.Bool("isEtnaActivated", upgrades.IsEtnaActivated(now)), + ) + }) +}) diff --git a/tests/e2e/p/elastic_subnets.go b/tests/e2e/p/elastic_subnets.go new file mode 100644 index 000000000000..ed5a228cdd2a --- /dev/null +++ b/tests/e2e/p/elastic_subnets.go @@ -0,0 +1,196 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package p + +import ( + "fmt" + "time" + + "github.com/onsi/ginkgo/v2" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/avalanchego/api/info" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/tests/fixture/e2e" + "github.com/ava-labs/avalanchego/utils/constants" + "github.com/ava-labs/avalanchego/utils/units" + "github.com/ava-labs/avalanchego/vms/components/avax" + "github.com/ava-labs/avalanchego/vms/components/verify" + "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/reward" + "github.com/ava-labs/avalanchego/vms/platformvm/signer" + "github.com/ava-labs/avalanchego/vms/platformvm/txs" + "github.com/ava-labs/avalanchego/vms/secp256k1fx" +) + +var _ = e2e.DescribePChain("[Elastic Subnets]", func() { + tc := e2e.NewTestContext() + require := require.New(tc) + + ginkgo.It("subnets operations", + func() { + env := e2e.GetEnv(tc) + + nodeURI := env.GetRandomNodeURI() + + infoClient := info.NewClient(nodeURI.URI) + + tc.By("get upgrade config") + upgrades, err := infoClient.Upgrades(tc.DefaultContext()) + require.NoError(err) + + now := time.Now() + if upgrades.IsEtnaActivated(now) { + ginkgo.Skip("Etna is activated. Elastic Subnets are disabled post-Etna, skipping test.") + } + + keychain := env.NewKeychain() + baseWallet := e2e.NewWallet(tc, keychain, nodeURI) + + pWallet := baseWallet.P() + xWallet := baseWallet.X() + xBuilder := xWallet.Builder() + xContext := xBuilder.Context() + xChainID := xContext.BlockchainID + + var validatorID ids.NodeID + tc.By("retrieving the node ID of a primary network validator", func() { + pChainClient := platformvm.NewClient(nodeURI.URI) + validatorIDs, err := pChainClient.SampleValidators(tc.DefaultContext(), constants.PrimaryNetworkID, 1) + require.NoError(err) + validatorID = validatorIDs[0] + }) + + owner := &secp256k1fx.OutputOwners{ + Threshold: 1, + Addrs: []ids.ShortID{ + keychain.Keys[0].Address(), + }, + } + + var subnetID ids.ID + tc.By("create a permissioned subnet", func() { + subnetTx, err := pWallet.IssueCreateSubnetTx( + owner, + tc.WithDefaultContext(), + ) + require.NoError(err) + subnetID = subnetTx.ID() + require.NotEqual(subnetID, constants.PrimaryNetworkID) + }) + + validatorWeight := units.Avax + initialSupply := 2 * validatorWeight + maxSupply := 2 * initialSupply + + var subnetAssetID ids.ID + tc.By("create a custom asset for the permissionless subnet", func() { + subnetAssetTx, err := xWallet.IssueCreateAssetTx( + "RnM", + "RNM", + 9, + map[uint32][]verify.State{ + 0: { + &secp256k1fx.TransferOutput{ + Amt: maxSupply, + OutputOwners: *owner, + }, + }, + }, + tc.WithDefaultContext(), + ) + require.NoError(err) + subnetAssetID = subnetAssetTx.ID() + }) + + tc.By(fmt.Sprintf("Send %d of asset %s to the P-chain", maxSupply, subnetAssetID), func() { + _, err := xWallet.IssueExportTx( + constants.PlatformChainID, + []*avax.TransferableOutput{ + { + Asset: avax.Asset{ + ID: subnetAssetID, + }, + Out: &secp256k1fx.TransferOutput{ + Amt: maxSupply, + OutputOwners: *owner, + }, + }, + }, + tc.WithDefaultContext(), + ) + require.NoError(err) + }) + + tc.By(fmt.Sprintf("Import the %d of asset %s from the X-chain into the P-chain", maxSupply, subnetAssetID), func() { + _, err := pWallet.IssueImportTx( + xChainID, + owner, + tc.WithDefaultContext(), + ) + require.NoError(err) + }) + + tc.By("make subnet permissionless", func() { + _, err := pWallet.IssueTransformSubnetTx( + subnetID, + subnetAssetID, + initialSupply, + maxSupply, + reward.PercentDenominator, + reward.PercentDenominator, + 1, + maxSupply, + time.Second, + 365*24*time.Hour, + 0, + 1, + 5, + .80*reward.PercentDenominator, + tc.WithDefaultContext(), + ) + require.NoError(err) + }) + + endTime := time.Now().Add(time.Minute) + tc.By("add permissionless validator", func() { + _, err := pWallet.IssueAddPermissionlessValidatorTx( + &txs.SubnetValidator{ + Validator: txs.Validator{ + NodeID: validatorID, + End: uint64(endTime.Unix()), + Wght: validatorWeight, + }, + Subnet: subnetID, + }, + &signer.Empty{}, + subnetAssetID, + &secp256k1fx.OutputOwners{}, + &secp256k1fx.OutputOwners{}, + reward.PercentDenominator, + tc.WithDefaultContext(), + ) + require.NoError(err) + }) + + tc.By("add permissionless delegator", func() { + _, err := pWallet.IssueAddPermissionlessDelegatorTx( + &txs.SubnetValidator{ + Validator: txs.Validator{ + NodeID: validatorID, + End: uint64(endTime.Unix()), + Wght: validatorWeight, + }, + Subnet: subnetID, + }, + subnetAssetID, + &secp256k1fx.OutputOwners{}, + tc.WithDefaultContext(), + ) + require.NoError(err) + }) + + _ = e2e.CheckBootstrapIsPossible(tc, env.GetNetwork()) + }) +}) diff --git a/tests/e2e/p/l1.go b/tests/e2e/p/l1.go index 449fe2fd0d9c..0c34f129d8eb 100644 --- a/tests/e2e/p/l1.go +++ b/tests/e2e/p/l1.go @@ -16,6 +16,7 @@ import ( "go.uber.org/zap" "google.golang.org/protobuf/proto" + "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/config" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/network/peer" @@ -70,6 +71,17 @@ var _ = e2e.DescribePChain("[L1]", func() { env := e2e.GetEnv(tc) nodeURI := env.GetRandomNodeURI() + tc.By("verifying Etna is activated", func() { + infoClient := info.NewClient(nodeURI.URI) + upgrades, err := infoClient.Upgrades(tc.DefaultContext()) + require.NoError(err) + + now := time.Now() + if !upgrades.IsEtnaActivated(now) { + ginkgo.Skip("Etna is not activated. L1s are enabled post-Etna, skipping test.") + } + }) + tc.By("loading the wallet") var ( keychain = env.NewKeychain() diff --git a/tests/fixture/e2e/flags.go b/tests/fixture/e2e/flags.go index 629db51ce6f0..219e194dcb70 100644 --- a/tests/fixture/e2e/flags.go +++ b/tests/fixture/e2e/flags.go @@ -27,6 +27,7 @@ type FlagVars struct { stopNetwork bool restartNetwork bool nodeCount int + activateFortuna bool } func (v *FlagVars) AvalancheGoExecPath() (string, error) { @@ -94,6 +95,10 @@ func (v *FlagVars) NodeCount() int { return v.nodeCount } +func (v *FlagVars) ActivateFortuna() bool { + return v.activateFortuna +} + func GetEnvWithDefault(envVar, defaultVal string) string { val := os.Getenv(envVar) if len(val) == 0 { @@ -164,6 +169,12 @@ func RegisterFlags() *FlagVars { tmpnet.DefaultNodeCount, "number of nodes the network should initially consist of", ) + flag.BoolVar( + &vars.activateFortuna, + "activate-fortuna", + false, + "[optional] activate the fortuna upgrade", + ) return &vars } From 94ff15eef31b8d8f583e3bb78f3422e95227a650 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:12:00 -0500 Subject: [PATCH 07/20] wip --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3d0baa9f544..c928067e1c3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: fuzz_test shell: bash run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds - e2e_pre_etna: + e2e_pre_fortuna: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -73,7 +73,7 @@ jobs: if: always() with: name: e2e-pre-etna-tmpnet-data - e2e_post_etna: + e2e_post_fortuna: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -84,7 +84,7 @@ jobs: - name: Run e2e tests uses: ./.github/actions/run-monitored-tmpnet-cmd with: - run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown --activate-etna + run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown --activate-fortuna prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }} prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} loki_id: ${{ secrets.LOKI_ID || '' }} From 7cf4478b582ebbb3d0d8a4ef9af172633399c008 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:12:22 -0500 Subject: [PATCH 08/20] wip --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c928067e1c3c..dbd8f0911494 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: uses: ./.github/actions/upload-tmpnet-artifact if: always() with: - name: e2e-pre-etna-tmpnet-data + name: e2e-pre-fortuna-tmpnet-data e2e_post_fortuna: runs-on: ubuntu-latest steps: @@ -93,7 +93,7 @@ jobs: uses: ./.github/actions/upload-tmpnet-artifact if: always() with: - name: e2e-post-etna-tmpnet-data + name: e2e-post-fortuna-tmpnet-data e2e_existing_network: runs-on: ubuntu-latest steps: From 8a429c985c2d7c0cf499f134f0cea685948f52fc Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:13:34 -0500 Subject: [PATCH 09/20] wip --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbd8f0911494..9c98a4766ea6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,11 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-go-for-project + - uses: cachix/install-nix-action@v30 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + # TODO(marun) Maybe figure out how to use `nix build` somehow i.e. make the default shell double as the default package + - run: nix develop --command echo "dependencies installed" - name: Build AvalancheGo Binary shell: bash run: ./scripts/build.sh -r @@ -85,9 +90,10 @@ jobs: uses: ./.github/actions/run-monitored-tmpnet-cmd with: run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown --activate-fortuna - prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }} + filter_by_owner: avalanchego-e2e + prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }} prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }} - loki_id: ${{ secrets.LOKI_ID || '' }} + loki_username: ${{ secrets.LOKI_ID || '' }} loki_password: ${{ secrets.LOKI_PASSWORD || '' }} - name: Upload tmpnet network dir uses: ./.github/actions/upload-tmpnet-artifact From 229c2652e94aa51607e26c15be8d9fcd99353e78 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:16:57 -0500 Subject: [PATCH 10/20] wip --- tests/e2e/e2e_test.go | 5 +- tests/e2e/etna/suites.go | 38 ------- tests/e2e/p/elastic_subnets.go | 196 --------------------------------- tests/e2e/p/l1.go | 12 -- 4 files changed, 2 insertions(+), 249 deletions(-) delete mode 100644 tests/e2e/etna/suites.go delete mode 100644 tests/e2e/p/elastic_subnets.go diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index ce6b01529d79..cde19be85c1d 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -14,7 +14,6 @@ import ( // ensure test packages are scanned by ginkgo _ "github.com/ava-labs/avalanchego/tests/e2e/banff" _ "github.com/ava-labs/avalanchego/tests/e2e/c" - _ "github.com/ava-labs/avalanchego/tests/e2e/etna" _ "github.com/ava-labs/avalanchego/tests/e2e/faultinjection" _ "github.com/ava-labs/avalanchego/tests/e2e/p" _ "github.com/ava-labs/avalanchego/tests/e2e/x" @@ -47,9 +46,9 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { upgrades := upgrade.Default if flagVars.ActivateFortuna() { - upgrades.EtnaTime = upgrade.InitiallyActiveTime + upgrades.FUpgradeTime = upgrade.InitiallyActiveTime } else { - upgrades.EtnaTime = upgrade.UnscheduledActivationTime + upgrades.FUpgradeTime = upgrade.UnscheduledActivationTime } upgradeJSON, err := json.Marshal(upgrades) diff --git a/tests/e2e/etna/suites.go b/tests/e2e/etna/suites.go deleted file mode 100644 index fb033726d6ce..000000000000 --- a/tests/e2e/etna/suites.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -// Implements tests for the etna network upgrade. -package etna - -import ( - "time" - - "github.com/onsi/ginkgo/v2" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - - "github.com/ava-labs/avalanchego/api/info" - "github.com/ava-labs/avalanchego/tests/fixture/e2e" -) - -var _ = ginkgo.Describe("[Etna]", func() { - tc := e2e.NewTestContext() - require := require.New(tc) - - ginkgo.It("can detect if Etna is activated", - func() { - env := e2e.GetEnv(tc) - infoClient := info.NewClient(env.GetRandomNodeURI().URI) - - tc.By("get upgrade config") - upgrades, err := infoClient.Upgrades(tc.DefaultContext()) - require.NoError(err) - - now := time.Now() - tc.Log().Info("detected if Etna is activated", - zap.Time("now", now), - zap.Time("etnaTime", upgrades.EtnaTime), - zap.Bool("isEtnaActivated", upgrades.IsEtnaActivated(now)), - ) - }) -}) diff --git a/tests/e2e/p/elastic_subnets.go b/tests/e2e/p/elastic_subnets.go deleted file mode 100644 index ed5a228cdd2a..000000000000 --- a/tests/e2e/p/elastic_subnets.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package p - -import ( - "fmt" - "time" - - "github.com/onsi/ginkgo/v2" - "github.com/stretchr/testify/require" - - "github.com/ava-labs/avalanchego/api/info" - "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/tests/fixture/e2e" - "github.com/ava-labs/avalanchego/utils/constants" - "github.com/ava-labs/avalanchego/utils/units" - "github.com/ava-labs/avalanchego/vms/components/avax" - "github.com/ava-labs/avalanchego/vms/components/verify" - "github.com/ava-labs/avalanchego/vms/platformvm" - "github.com/ava-labs/avalanchego/vms/platformvm/reward" - "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" - "github.com/ava-labs/avalanchego/vms/secp256k1fx" -) - -var _ = e2e.DescribePChain("[Elastic Subnets]", func() { - tc := e2e.NewTestContext() - require := require.New(tc) - - ginkgo.It("subnets operations", - func() { - env := e2e.GetEnv(tc) - - nodeURI := env.GetRandomNodeURI() - - infoClient := info.NewClient(nodeURI.URI) - - tc.By("get upgrade config") - upgrades, err := infoClient.Upgrades(tc.DefaultContext()) - require.NoError(err) - - now := time.Now() - if upgrades.IsEtnaActivated(now) { - ginkgo.Skip("Etna is activated. Elastic Subnets are disabled post-Etna, skipping test.") - } - - keychain := env.NewKeychain() - baseWallet := e2e.NewWallet(tc, keychain, nodeURI) - - pWallet := baseWallet.P() - xWallet := baseWallet.X() - xBuilder := xWallet.Builder() - xContext := xBuilder.Context() - xChainID := xContext.BlockchainID - - var validatorID ids.NodeID - tc.By("retrieving the node ID of a primary network validator", func() { - pChainClient := platformvm.NewClient(nodeURI.URI) - validatorIDs, err := pChainClient.SampleValidators(tc.DefaultContext(), constants.PrimaryNetworkID, 1) - require.NoError(err) - validatorID = validatorIDs[0] - }) - - owner := &secp256k1fx.OutputOwners{ - Threshold: 1, - Addrs: []ids.ShortID{ - keychain.Keys[0].Address(), - }, - } - - var subnetID ids.ID - tc.By("create a permissioned subnet", func() { - subnetTx, err := pWallet.IssueCreateSubnetTx( - owner, - tc.WithDefaultContext(), - ) - require.NoError(err) - subnetID = subnetTx.ID() - require.NotEqual(subnetID, constants.PrimaryNetworkID) - }) - - validatorWeight := units.Avax - initialSupply := 2 * validatorWeight - maxSupply := 2 * initialSupply - - var subnetAssetID ids.ID - tc.By("create a custom asset for the permissionless subnet", func() { - subnetAssetTx, err := xWallet.IssueCreateAssetTx( - "RnM", - "RNM", - 9, - map[uint32][]verify.State{ - 0: { - &secp256k1fx.TransferOutput{ - Amt: maxSupply, - OutputOwners: *owner, - }, - }, - }, - tc.WithDefaultContext(), - ) - require.NoError(err) - subnetAssetID = subnetAssetTx.ID() - }) - - tc.By(fmt.Sprintf("Send %d of asset %s to the P-chain", maxSupply, subnetAssetID), func() { - _, err := xWallet.IssueExportTx( - constants.PlatformChainID, - []*avax.TransferableOutput{ - { - Asset: avax.Asset{ - ID: subnetAssetID, - }, - Out: &secp256k1fx.TransferOutput{ - Amt: maxSupply, - OutputOwners: *owner, - }, - }, - }, - tc.WithDefaultContext(), - ) - require.NoError(err) - }) - - tc.By(fmt.Sprintf("Import the %d of asset %s from the X-chain into the P-chain", maxSupply, subnetAssetID), func() { - _, err := pWallet.IssueImportTx( - xChainID, - owner, - tc.WithDefaultContext(), - ) - require.NoError(err) - }) - - tc.By("make subnet permissionless", func() { - _, err := pWallet.IssueTransformSubnetTx( - subnetID, - subnetAssetID, - initialSupply, - maxSupply, - reward.PercentDenominator, - reward.PercentDenominator, - 1, - maxSupply, - time.Second, - 365*24*time.Hour, - 0, - 1, - 5, - .80*reward.PercentDenominator, - tc.WithDefaultContext(), - ) - require.NoError(err) - }) - - endTime := time.Now().Add(time.Minute) - tc.By("add permissionless validator", func() { - _, err := pWallet.IssueAddPermissionlessValidatorTx( - &txs.SubnetValidator{ - Validator: txs.Validator{ - NodeID: validatorID, - End: uint64(endTime.Unix()), - Wght: validatorWeight, - }, - Subnet: subnetID, - }, - &signer.Empty{}, - subnetAssetID, - &secp256k1fx.OutputOwners{}, - &secp256k1fx.OutputOwners{}, - reward.PercentDenominator, - tc.WithDefaultContext(), - ) - require.NoError(err) - }) - - tc.By("add permissionless delegator", func() { - _, err := pWallet.IssueAddPermissionlessDelegatorTx( - &txs.SubnetValidator{ - Validator: txs.Validator{ - NodeID: validatorID, - End: uint64(endTime.Unix()), - Wght: validatorWeight, - }, - Subnet: subnetID, - }, - subnetAssetID, - &secp256k1fx.OutputOwners{}, - tc.WithDefaultContext(), - ) - require.NoError(err) - }) - - _ = e2e.CheckBootstrapIsPossible(tc, env.GetNetwork()) - }) -}) diff --git a/tests/e2e/p/l1.go b/tests/e2e/p/l1.go index 0c34f129d8eb..449fe2fd0d9c 100644 --- a/tests/e2e/p/l1.go +++ b/tests/e2e/p/l1.go @@ -16,7 +16,6 @@ import ( "go.uber.org/zap" "google.golang.org/protobuf/proto" - "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/config" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/network/peer" @@ -71,17 +70,6 @@ var _ = e2e.DescribePChain("[L1]", func() { env := e2e.GetEnv(tc) nodeURI := env.GetRandomNodeURI() - tc.By("verifying Etna is activated", func() { - infoClient := info.NewClient(nodeURI.URI) - upgrades, err := infoClient.Upgrades(tc.DefaultContext()) - require.NoError(err) - - now := time.Now() - if !upgrades.IsEtnaActivated(now) { - ginkgo.Skip("Etna is not activated. L1s are enabled post-Etna, skipping test.") - } - }) - tc.By("loading the wallet") var ( keychain = env.NewKeychain() From a611d2228bf707f3ba54cb72d65d311f48988721 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:23:17 -0500 Subject: [PATCH 11/20] set gas limit based on upgrade --- tests/e2e/c/dynamic_fees.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 8399ef791898..ed0d2a5ce119 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -6,9 +6,11 @@ package c import ( "math/big" "strings" + "time" "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/params" + "github.com/ava-labs/coreth/plugin/evm/upgrade/acp176" "github.com/ava-labs/coreth/plugin/evm/upgrade/cortina" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -16,6 +18,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" + "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/tests/fixture/e2e" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" ) @@ -28,8 +31,6 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { require := require.New(tc) const ( - // gasLimit is the maximum amount of gas that can be used in a block. - gasLimit = cortina.GasLimit // acp176.MinMaxCapacity // maxFeePerGas is the maximum fee that transactions issued by this test // will be willing to pay. maxFeePerGas = 1000 * params.GWei @@ -84,6 +85,24 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { return signedTx } + // gasLimit is the maximum amount of gas that can be used in a block. + var gasLimit uint64 + tc.By("verifying Fortuna is activated", func() { + infoClient := info.NewClient(nodeURI.URI) + upgrades, err := infoClient.Upgrades(tc.DefaultContext()) + require.NoError(err) + + now := time.Now() + if upgrades.IsFUpgradeActivated(now) { + gasLimit = acp176.MinMaxCapacity + } else { + gasLimit = cortina.GasLimit + } + }) + tc.Log().Info("set gas limit", + zap.Uint64("gasLimit", gasLimit), + ) + var contractAddress common.Address tc.By("deploying an expensive contract", func() { // Create transaction From 3f127cd9f5c0d3b941d2d19f5ee1b306b1f38d43 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 22:25:27 -0500 Subject: [PATCH 12/20] reduce diff --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c98a4766ea6..c56675e3a7e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: fuzz_test shell: bash run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds - e2e_pre_fortuna: + e2e: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -72,7 +72,7 @@ jobs: uses: ./.github/actions/upload-tmpnet-artifact if: always() with: - name: e2e-pre-fortuna-tmpnet-data + name: e2e-tmpnet-data e2e_post_fortuna: runs-on: ubuntu-latest steps: From 8ed81358e5d158593062ff75595af304fba48846 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 23:10:43 -0500 Subject: [PATCH 13/20] fix e2e --- tests/e2e/c/dynamic_fees.go | 7 ++++++- tests/e2e/e2e_test.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index ed0d2a5ce119..21c921641fdc 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -52,8 +52,13 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { ginkgo.It("should ensure that the gas price is affected by load", func() { tc.By("creating a new private network to ensure isolation from other tests") + env := e2e.GetEnv(tc) + publicNetwork := env.GetNetwork() + privateNetwork := tmpnet.NewDefaultNetwork("avalanchego-e2e-dynamic-fees") - e2e.GetEnv(tc).StartPrivateNetwork(privateNetwork) + privateNetwork.DefaultFlags = tmpnet.FlagsMap{} + privateNetwork.DefaultFlags.SetDefaults(publicNetwork.DefaultFlags) + env.StartPrivateNetwork(privateNetwork) // Avoid emitting a spec-scoped metrics link for the shared // network since the link emitted by the start of the private diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index cde19be85c1d..393c453ada9a 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -10,6 +10,7 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/stretchr/testify/require" + "go.uber.org/zap" // ensure test packages are scanned by ginkgo _ "github.com/ava-labs/avalanchego/tests/e2e/banff" @@ -50,6 +51,9 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { } else { upgrades.FUpgradeTime = upgrade.UnscheduledActivationTime } + tc.Log().Info("setting upgrades", + zap.Reflect("upgrades", upgrades), + ) upgradeJSON, err := json.Marshal(upgrades) require.NoError(tc, err) From 0ae624b0d49d0035dd22e0c0c87c65ed5011d6d4 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Wed, 26 Feb 2025 23:15:31 -0500 Subject: [PATCH 14/20] nit --- tests/e2e/c/dynamic_fees.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 21c921641fdc..c4d026f01040 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -144,7 +144,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { zap.Stringer("targetPrice", targetGasPrice), ) - tc.By("calling the contract repeatedly until a gas price increase is detected", func() { + tc.By("calling the contract repeatedly until a sufficient gas price increase is detected", func() { // Evaluate the bytes representation of the contract hashingABI, err := abi.JSON(strings.NewReader(consumeGasABIJson)) require.NoError(err) @@ -199,7 +199,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { recipientKey = e2e.NewPrivateKey(tc) recipientEthAddress = recipientKey.EthAddress() ) - tc.By("calling the contract repeatedly until a gas price decrease is detected", func() { + tc.By("calling the contract repeatedly until a sufficient gas price decrease is detected", func() { tc.Eventually(func() bool { // Check the gas price latest, err := ethClient.HeaderByNumber(tc.DefaultContext(), nil) From 668bd4e0fbe8c052c2f04535ed565cb07314a320 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Thu, 27 Feb 2025 00:39:30 -0500 Subject: [PATCH 15/20] nit --- tests/e2e/c/dynamic_fees.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index c4d026f01040..945e835f6fd0 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -32,7 +32,8 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { const ( // maxFeePerGas is the maximum fee that transactions issued by this test - // will be willing to pay. + // will be willing to pay. The actual value doesn't really matter, it + // just needs to be higher than the `targetGasPrice` calculated below. maxFeePerGas = 1000 * params.GWei // minFeePerGas is the minimum fee that transactions issued by this test // will pay. From ca9aceedadadca103ce8ed006c7a5ee13a6295d3 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Fri, 28 Feb 2025 19:13:19 -0500 Subject: [PATCH 16/20] nit --- tests/e2e/c/dynamic_fees.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index 945e835f6fd0..f2346a03fa6c 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -93,7 +93,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // gasLimit is the maximum amount of gas that can be used in a block. var gasLimit uint64 - tc.By("verifying Fortuna is activated", func() { + tc.By("checking if Fortuna is activated", func() { infoClient := info.NewClient(nodeURI.URI) upgrades, err := infoClient.Upgrades(tc.DefaultContext()) require.NoError(err) From 2ed1ec2ef3c0170879f661e6527d20b2ed29b400 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Fri, 28 Feb 2025 19:14:18 -0500 Subject: [PATCH 17/20] update coreth --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f9c2759ed62b..72d1a961dbfe 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/DataDog/zstd v1.5.2 github.com/NYTimes/gziphandler v1.1.1 github.com/antithesishq/antithesis-sdk-go v0.3.8 - github.com/ava-labs/coreth v0.14.1-acp-176.0 + github.com/ava-labs/coreth v0.14.1-acp-176.1 github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 diff --git a/go.sum b/go.sum index c76d3d8ad8c4..a64fdad0e328 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/coreth v0.14.1-acp-176.0 h1:VczY4/UNcayESdade0PvW0nmt7966wKwWYAaYaURF0s= -github.com/ava-labs/coreth v0.14.1-acp-176.0/go.mod h1:AEQcF8MWrKH0sS114wEZlkSfeGF5F66xTbQYqqimNLI= +github.com/ava-labs/coreth v0.14.1-acp-176.1 h1:44iXYYeLR4LzTM+5DB7ohGqysDiTFPIvxiuFY9vZJAI= +github.com/ava-labs/coreth v0.14.1-acp-176.1/go.mod h1:AEQcF8MWrKH0sS114wEZlkSfeGF5F66xTbQYqqimNLI= github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 h1:EL66gtXOAwR/4KYBjOV03LTWgkEXvLePribLlJNu4g0= github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60/go.mod h1:/7qKobTfbzBu7eSTVaXMTr56yTYk4j2Px6/8G+idxHo= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= From 5e6bc5ff98f40453c1dd4f9dadc1584ed4e2995c Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Fri, 28 Feb 2025 19:32:56 -0500 Subject: [PATCH 18/20] Fix rounding in test --- tests/e2e/c/dynamic_fees.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index f2346a03fa6c..c7da774d5868 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -47,6 +47,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { expectedGasPriceIncreaseDenominator = 5 ) var ( + bigExpectedGasPriceIncreaseNumerator = big.NewInt(expectedGasPriceIncreaseNumerator) + bigExpectedGasPriceIncreaseDenominator = big.NewInt(expectedGasPriceIncreaseDenominator) + bigExpectedGasPriceIncreaseDenominatorMinus1 = big.NewInt(expectedGasPriceIncreaseDenominator - 1) + gasFeeCap = big.NewInt(maxFeePerGas) gasTipCap = big.NewInt(minFeePerGas) ) @@ -138,8 +142,10 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { initialGasPrice := latest.BaseFee targetGasPrice := new(big.Int).Set(initialGasPrice) - targetGasPrice.Mul(targetGasPrice, big.NewInt(expectedGasPriceIncreaseNumerator)) - targetGasPrice.Div(targetGasPrice, big.NewInt(expectedGasPriceIncreaseDenominator)) + targetGasPrice.Mul(targetGasPrice, bigExpectedGasPriceIncreaseNumerator) + targetGasPrice.Add(targetGasPrice, bigExpectedGasPriceIncreaseDenominatorMinus1) + targetGasPrice.Div(targetGasPrice, bigExpectedGasPriceIncreaseDenominator) + tc.Log().Info("initializing gas prices", zap.Stringer("initialPrice", initialGasPrice), zap.Stringer("targetPrice", targetGasPrice), @@ -158,7 +164,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { require.NoError(err) // If the gas price has increased, stop the loop. - if latest.BaseFee.Cmp(targetGasPrice) > 0 { + if latest.BaseFee.Cmp(targetGasPrice) >= 0 { tc.Log().Info("gas price has increased", zap.Stringer("initialPrice", initialGasPrice), zap.Stringer("targetPrice", targetGasPrice), @@ -207,7 +213,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { require.NoError(err) // If the gas price has decreased, stop the loop. - if initialGasPrice.Cmp(latest.BaseFee) >= 0 { + if latest.BaseFee.Cmp(initialGasPrice) <= 0 { tc.Log().Info("gas price has decreased", zap.Stringer("initialPrice", initialGasPrice), zap.Stringer("newPrice", latest.BaseFee), From 0ceba597343fc29946e15dbe22b9a933ad13fc33 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Sat, 1 Mar 2025 15:58:26 -0500 Subject: [PATCH 19/20] address nits --- tests/e2e/c/dynamic_fees.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/c/dynamic_fees.go b/tests/e2e/c/dynamic_fees.go index c7da774d5868..20daf62e9c04 100644 --- a/tests/e2e/c/dynamic_fees.go +++ b/tests/e2e/c/dynamic_fees.go @@ -36,7 +36,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { // just needs to be higher than the `targetGasPrice` calculated below. maxFeePerGas = 1000 * params.GWei // minFeePerGas is the minimum fee that transactions issued by this test - // will pay. + // will pay. The mempool enforces that this value is non-zero. minFeePerGas = 1 * params.Wei // expectedGasPriceIncreaseNumerator/expectedGasPriceIncreaseDenominator @@ -61,6 +61,8 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { publicNetwork := env.GetNetwork() privateNetwork := tmpnet.NewDefaultNetwork("avalanchego-e2e-dynamic-fees") + // Copy over the defaults from the normal test suite to include settings + // like the upgrade config. privateNetwork.DefaultFlags = tmpnet.FlagsMap{} privateNetwork.DefaultFlags.SetDefaults(publicNetwork.DefaultFlags) env.StartPrivateNetwork(privateNetwork) @@ -206,7 +208,7 @@ var _ = e2e.DescribeCChain("[Dynamic Fees]", func() { recipientKey = e2e.NewPrivateKey(tc) recipientEthAddress = recipientKey.EthAddress() ) - tc.By("calling the contract repeatedly until a sufficient gas price decrease is detected", func() { + tc.By("sending small transactions until a sufficient gas price decrease is detected", func() { tc.Eventually(func() bool { // Check the gas price latest, err := ethClient.HeaderByNumber(tc.DefaultContext(), nil) From ef9ed1db5e491a887023a54b0710f1cbefb30439 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Sat, 1 Mar 2025 22:30:43 -0500 Subject: [PATCH 20/20] nit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d3fa78d8606..52a8e04ad861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,7 +78,7 @@ jobs: with: run: ./scripts/tests.e2e.sh --activate-fortuna run_env: E2E_SERIAL=1 - artifact_prefix: e2e + artifact_prefix: e2e-post-fortuna filter_by_owner: avalanchego-e2e prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }} prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}