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

Update avago 1.11.10 rc0 #1241

Merged
merged 18 commits into from
Jul 26, 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
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ run:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# Include non-test files tagged as test-only.
# Context: https://github.com/ava-labs/avalanchego/pull/3173
build-tags:
- test

linters:
disable-all: true
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ func golangBindings(t *testing.T, overload bool) {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "-v", "-count", "1")
cmd := exec.Command(gocmd, "test", "-tags", "test", "-v", "-count", "1")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/precompilebind/precompile_bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ func TestPrecompileBind(t *testing.T) {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "./...", "-v", "-count", "1")
cmd := exec.Command(gocmd, "test", "-tags", "test", "./...", "-v", "-count", "1")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func runCmd(ctx *cli.Context) error {
initialGas = genesisConfig.GasLimit
}
} else {
genesisConfig.Config = params.TestSubnetEVMConfig
genesisConfig.Config = params.TestSubnetEVMChainConfig
}

db := rawdb.NewMemoryDatabase()
Expand Down
2 changes: 2 additions & 0 deletions commontype/test_fee_config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package commontype

import "math/big"
Expand Down
1 change: 1 addition & 0 deletions compatibility.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rpcChainVMProtocolVersion": {
"v0.6.8": 36,
"v0.6.7": 35,
"v0.6.6": 35,
"v0.6.5": 35,
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ func TestTxLookupSkipIndexingBlockChain(t *testing.T) {
func TestCreateThenDeletePreByzantium(t *testing.T) {
// We want to use pre-byzantium rules where we have intermediate state roots
// between transactions.
config := *params.TestPreSubnetEVMConfig
config := *params.TestPreSubnetEVMChainConfig
config.ByzantiumBlock = nil
config.ConstantinopleBlock = nil
config.PetersburgBlock = nil
Expand Down
2 changes: 1 addition & 1 deletion core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestSetupGenesis(t *testing.T) {
}

func testSetupGenesis(t *testing.T, scheme string) {
preSubnetConfig := *params.TestPreSubnetEVMConfig
preSubnetConfig := *params.TestPreSubnetEVMChainConfig
preSubnetConfig.SubnetEVMTimestamp = utils.NewUint64(100)
var (
customghash = common.HexToHash("0x4a12fe7bf8d40d152d7e9de22337b115186a4662aa3a97217b36146202bbfc66")
Expand Down
2 changes: 2 additions & 0 deletions core/state/test_statedb.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package state

import (
Expand Down
2 changes: 2 additions & 0 deletions core/test_blockchain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// (c) 2020-2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package core

import (
Expand Down
4 changes: 2 additions & 2 deletions core/vm/gas_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ func TestCreateGas(t *testing.T) {
config.ExtraEips = []int{3860}
}

// Note: we use TestSubnetEVMConfig instead of AllEthashProtocolChanges (upstream)
// Note: we use TestSubnetEVMChainConfig instead of AllEthashProtocolChanges (upstream)
// because it is the last fork before the activation of EIP-3860
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.TestSubnetEVMConfig, config)
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.TestSubnetEVMChainConfig, config)
var startGas = uint64(testGas)
ret, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, startGas, new(big.Int))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions eth/tracers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestTraceCall(t *testing.T) {
// Initialize test accounts
accounts := newAccounts(3)
genesis := &core.Genesis{
Config: params.TestSubnetEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Config: params.TestSubnetEVMChainConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Alloc: core.GenesisAlloc{
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
Expand Down Expand Up @@ -590,7 +590,7 @@ func TestTracingWithOverrides(t *testing.T) {
accounts := newAccounts(3)
storageAccount := common.Address{0x13, 37}
genesis := &core.Genesis{
Config: params.TestSubnetEVMConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Config: params.TestSubnetEVMChainConfig, // TODO: go-ethereum has not enabled Shanghai yet, so we use SubnetEVM here so tests pass.
Alloc: core.GenesisAlloc{
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
Expand Down
2 changes: 1 addition & 1 deletion eth/tracers/internal/tracetest/calltrace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func TestInternals(t *testing.T) {
}, false, rawdb.HashScheme)
defer triedb.Close()

evm := vm.NewEVM(context, txContext, statedb, params.TestPreSubnetEVMConfig, vm.Config{Tracer: tc.tracer})
evm := vm.NewEVM(context, txContext, statedb, params.TestPreSubnetEVMChainConfig, vm.Config{Tracer: tc.tracer})
msg := &core.Message{
To: &to,
From: origin,
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21.12

require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/ava-labs/avalanchego v1.11.9
github.com/ava-labs/avalanchego v1.11.10
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down Expand Up @@ -54,7 +54,7 @@ require (
require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ava-labs/coreth v0.13.6-rc.1 // indirect
github.com/ava-labs/coreth v0.13.7 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.11.9 h1:hPmnPADhyl/cOp6WNJKfJNW8zA644RioIMcAXSXG3TA=
github.com/ava-labs/avalanchego v1.11.9/go.mod h1:1dpLzXIVhAmJeRpl59l5GgcCEO9bDdF6Y6qRDTo0QGY=
github.com/ava-labs/coreth v0.13.6-rc.1 h1:gRXRokmu0WOlPqyx+mTLWB655e8/w++u6qFcq9Mo7qA=
github.com/ava-labs/coreth v0.13.6-rc.1/go.mod h1:vm9T8qzP7RLo/jR2MKkliPfaiGgWeEpu/PG6fvvPmog=
github.com/ava-labs/avalanchego v1.11.10 h1:QujciF5OEp5FwAoe/RciFF/i47rxU5rkEr6fVuUBS1Q=
github.com/ava-labs/avalanchego v1.11.10/go.mod h1:POgZPryqe80OeHCDNrXrPOKoFre736iFuMgmUBeKaLc=
github.com/ava-labs/coreth v0.13.7 h1:k8T9u/ROifl8f7oXjHRc1KvSISRl9txvy7gGVmHEz6g=
github.com/ava-labs/coreth v0.13.7/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
2 changes: 2 additions & 0 deletions internal/blocktest/test_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
// standalone go program. It provides an API that mirrors the standard library
// testing API.

//go:build test

package blocktest

import (
Expand Down
2 changes: 2 additions & 0 deletions internal/cmdtest/test_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build test

package cmdtest

import (
Expand Down
4 changes: 2 additions & 2 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ func TestRPCMarshalBlock(t *testing.T) {
}

for i, tc := range testSuite {
resp := RPCMarshalBlock(block, tc.inclTx, tc.fullTx, params.TestSubnetEVMConfig)
resp := RPCMarshalBlock(block, tc.inclTx, tc.fullTx, params.TestSubnetEVMChainConfig)
out, err := json.Marshal(resp)
if err != nil {
t.Errorf("test %d: json marshal error: %v", i, err)
Expand All @@ -1160,7 +1160,7 @@ func TestRPCGetBlockOrHeader(t *testing.T) {
acc1Addr = crypto.PubkeyToAddress(acc1Key.PublicKey)
acc2Addr = crypto.PubkeyToAddress(acc2Key.PublicKey)
genesis = &core.Genesis{
Config: params.TestSubnetEVMConfig,
Config: params.TestSubnetEVMChainConfig,
Alloc: core.GenesisAlloc{
acc1Addr: {Balance: big.NewInt(params.Ether)},
acc2Addr: {Balance: big.NewInt(params.Ether)},
Expand Down
69 changes: 63 additions & 6 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"errors"
"fmt"
"math/big"
"time"

"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/version"
Expand Down Expand Up @@ -70,6 +71,8 @@ var (
MaxBlockGasCost: big.NewInt(1_000_000),
BlockGasCostStep: big.NewInt(200_000),
}

InactiveUpgradeTime = time.Date(10000, time.December, 1, 0, 0, 0, 0, time.UTC)
)

var (
Expand Down Expand Up @@ -113,7 +116,30 @@ var (
UpgradeConfig: UpgradeConfig{},
}

TestSubnetEVMConfig = &ChainConfig{
TestPreSubnetEVMChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{utils.TestSnowContext()},
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
AllowFeeRecipients: false,
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: NetworkUpgrades{
SubnetEVMTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
DurangoTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
EUpgradeTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}

TestSubnetEVMChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{utils.TestSnowContext()},
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
Expand All @@ -129,12 +155,14 @@ var (
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: NetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
DurangoTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
EUpgradeTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}

TestPreSubnetEVMConfig = &ChainConfig{
TestDurangoChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{utils.TestSnowContext()},
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
Expand All @@ -148,9 +176,36 @@ var (
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: NetworkUpgrades{},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
NetworkUpgrades: NetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
DurangoTimestamp: utils.NewUint64(0),
EUpgradeTimestamp: utils.TimeToNewUint64(InactiveUpgradeTime),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}

TestEUpgradeChainConfig = &ChainConfig{
AvalancheContext: AvalancheContext{utils.TestSnowContext()},
ChainID: big.NewInt(1),
FeeConfig: DefaultFeeConfig,
AllowFeeRecipients: false,
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
NetworkUpgrades: NetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
DurangoTimestamp: utils.NewUint64(0),
EUpgradeTimestamp: utils.NewUint64(0),
},
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
}

TestRules = TestChainConfig.Rules(new(big.Int), 0)
Expand Down Expand Up @@ -498,10 +553,12 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, height *big.Int, time
if isForkBlockIncompatible(c.MuirGlacierBlock, newcfg.MuirGlacierBlock, height) {
return newBlockCompatError("Muir Glacier fork block", c.MuirGlacierBlock, newcfg.MuirGlacierBlock)
}

if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, time) {
return newTimestampCompatError("Cancun fork block timestamp", c.CancunTime, c.CancunTime)
}
if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, time) {
return newTimestampCompatError("Verkle fork block timestamp", c.VerkleTime, newcfg.VerkleTime)
}

// Check avalanche network upgrades
if err := c.CheckNetworkUpgradesCompatible(&newcfg.NetworkUpgrades, time); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,25 @@ func TestCheckCompatible(t *testing.T) {
},
{
stored: TestChainConfig,
new: TestPreSubnetEVMConfig,
new: TestPreSubnetEVMChainConfig,
headBlock: 0,
headTimestamp: 0,
wantErr: &ConfigCompatError{
What: "SubnetEVM fork block timestamp",
StoredTime: utils.NewUint64(0),
NewTime: nil,
NewTime: TestPreSubnetEVMChainConfig.NetworkUpgrades.SubnetEVMTimestamp,
darioush marked this conversation as resolved.
Show resolved Hide resolved
RewindToTime: 0,
},
},
{
stored: TestChainConfig,
new: TestPreSubnetEVMConfig,
new: TestPreSubnetEVMChainConfig,
headBlock: 10,
headTimestamp: 100,
wantErr: &ConfigCompatError{
What: "SubnetEVM fork block timestamp",
StoredTime: utils.NewUint64(0),
NewTime: nil,
NewTime: TestPreSubnetEVMChainConfig.NetworkUpgrades.SubnetEVMTimestamp,
RewindToTime: 0,
},
},
Expand Down
14 changes: 9 additions & 5 deletions peer/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import (
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/subnet-evm/plugin/evm/message"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ava-labs/subnet-evm/plugin/evm/message"

"github.com/ava-labs/avalanchego/codec"
"github.com/ava-labs/avalanchego/codec/linearcodec"
"github.com/ava-labs/avalanchego/ids"
Expand Down Expand Up @@ -509,9 +510,12 @@ func TestHandleInvalidMessages(t *testing.T) {

nodeID := ids.GenerateTestNodeID()
requestID := uint32(1)
sender := testAppSender{}

p2pNetwork, err := p2p.NewNetwork(logging.NoLog{}, nil, prometheus.NewRegistry(), "")
sender := &common.SenderTest{
SendAppErrorF: func(context.Context, ids.NodeID, uint32, int32, string) error {
return nil
},
}
p2pNetwork, err := p2p.NewNetwork(logging.NoLog{}, sender, prometheus.NewRegistry(), "")
require.NoError(t, err)
clientNetwork := NewNetwork(p2pNetwork, sender, codecManager, crossChainCodecManager, ids.EmptyNodeID, 1, 1)
clientNetwork.SetGossipHandler(message.NoopMempoolGossipHandler{})
Expand Down Expand Up @@ -1051,7 +1055,7 @@ func (t *testSDKHandler) AppGossip(ctx context.Context, nodeID ids.NodeID, gossi
panic("implement me")
}

func (t *testSDKHandler) AppRequest(ctx context.Context, nodeID ids.NodeID, deadline time.Time, requestBytes []byte) ([]byte, error) {
func (t *testSDKHandler) AppRequest(ctx context.Context, nodeID ids.NodeID, deadline time.Time, requestBytes []byte) ([]byte, *common.AppError) {
t.appRequested = true
return nil, nil
}
Expand Down
Loading
Loading