diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index b54a39f08a..726c877428 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: "~1.21.11" + go-version: "~1.21.12" check-latest: true - run: go mod download shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd7b22373c..e7592da21f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "~1.21.11" + go-version: "~1.21.12" check-latest: true - name: Set up arm64 cross compiler run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 11e298ac3a..c030d97b93 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: pull_request: env: - min_go_version: "~1.21.11" + min_go_version: "~1.21.12" grafana_url: https://grafana-experimental.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?orgId=1&refresh=10s&var-filter=is_ephemeral_node%7C%3D%7Cfalse&var-filter=gh_repo%7C%3D%7Cava-labs%2Fsubnet-evm&var-filter=gh_run_id%7C%3D%7C${{ github.run_id }}&var-filter=gh_run_attempt%7C%3D%7C${{ github.run_attempt }} jobs: diff --git a/Dockerfile b/Dockerfile index 9bfe7620fc..521fa08b67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG AVALANCHE_VERSION # ============= Compilation Stage ================ -FROM golang:1.21.11-bullseye AS builder +FROM golang:1.21.12-bullseye AS builder WORKDIR /build diff --git a/README.md b/README.md index 7c68a7c74b..b5d411ef0a 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,11 @@ The Subnet EVM runs in a separate process from the main AvalancheGo process and [v0.6.0] AvalancheGo@v1.11.0-v1.11.1 (Protocol Version: 33) [v0.6.1] AvalancheGo@v1.11.0-v1.11.1 (Protocol Version: 33) [v0.6.2] AvalancheGo@v1.11.2 (Protocol Version: 34) -[v0.6.3] AvalancheGo@v1.11.3-v1.11.7 (Protocol Version: 35) -[v0.6.4] AvalancheGo@v1.11.3-v1.11.7 (Protocol Version: 35) -[v0.6.5] AvalancheGo@v1.11.3-v1.11.7 (Protocol Version: 35) -[v0.6.6] AvalancheGo@v1.11.3-v1.11.7 (Protocol Version: 35) +[v0.6.3] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35) +[v0.6.4] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35) +[v0.6.5] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35) +[v0.6.6] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35) +[v0.6.7] AvalancheGo@v1.11.3-v1.11.9 (Protocol Version: 35) ``` ## API @@ -102,7 +103,7 @@ To support these changes, there have been a number of changes to the SubnetEVM b ### Clone Subnet-evm -First install Go 1.21.11 or later. Follow the instructions [here](https://go.dev/doc/install). You can verify by running `go version`. +First install Go 1.21.12 or later. Follow the instructions [here](https://go.dev/doc/install). You can verify by running `go version`. Set `$GOPATH` environment variable properly for Go to look for Go Workspaces. Please read [this](https://go.dev/doc/code) for details. You can verify by running `echo $GOPATH`. diff --git a/compatibility.json b/compatibility.json index bb2b95c039..f41504576a 100644 --- a/compatibility.json +++ b/compatibility.json @@ -1,5 +1,6 @@ { "rpcChainVMProtocolVersion": { + "v0.6.7": 35, "v0.6.6": 35, "v0.6.5": 35, "v0.6.4": 35, diff --git a/go.mod b/go.mod index 3f232cacf0..79ecd16526 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/ava-labs/subnet-evm -go 1.21.11 +go 1.21.12 require ( github.com/VictoriaMetrics/fastcache v1.12.1 - github.com/ava-labs/avalanchego v1.11.7 + github.com/ava-labs/avalanchego v1.11.9 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 @@ -47,14 +47,14 @@ require ( golang.org/x/sys v0.18.0 golang.org/x/text v0.14.0 golang.org/x/time v0.3.0 - google.golang.org/protobuf v1.33.0 + google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.13.5-rc.0 // indirect + github.com/ava-labs/coreth v0.13.6-rc.1 // 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 @@ -80,7 +80,7 @@ require ( github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect diff --git a/go.sum b/go.sum index 30889c4fde..34af23567f 100644 --- a/go.sum +++ b/go.sum @@ -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.7 h1:BemCJEa6+f79fzRLdR0+iJAA3v9shOyhVniAKuibFyk= -github.com/ava-labs/avalanchego v1.11.7/go.mod h1:aPYTETkM0KjtC7vFwPO6S8z2L0QTKaXjVUi98pTdNO4= -github.com/ava-labs/coreth v0.13.5-rc.0 h1:PJQbR9o2RrW3j9ba4r1glXnmM2PNAP3xR569+gMcBd0= -github.com/ava-labs/coreth v0.13.5-rc.0/go.mod h1:cm5c12xo5NiTgtbmeduv8i2nYdzgkczz9Wm3yiwwTRU= +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/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= @@ -258,8 +258,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -993,8 +993,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/plugin/evm/version.go b/plugin/evm/version.go index cea2ceae2f..96b23ba730 100644 --- a/plugin/evm/version.go +++ b/plugin/evm/version.go @@ -11,7 +11,7 @@ var ( // GitCommit is set by the build script GitCommit string // Version is the version of Subnet EVM - Version string = "v0.6.6" + Version string = "v0.6.7" ) func init() { diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 1c480b497b..386c0eb7cf 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -937,20 +937,21 @@ func (vm *VM) VerifyHeightIndex(context.Context) error { return nil } -// GetBlockAtHeight returns the canonical block at [blkHeight]. -// If [blkHeight] is less than the height of the last accepted block, this will return -// the block accepted at that height. Otherwise, it may return a blkID that has not yet -// been accepted. -// Note: the engine assumes that if a block is not found at [blkHeight], then -// [database.ErrNotFound] will be returned. This indicates that the VM has state synced -// and does not have all historical blocks available. -func (vm *VM) GetBlockIDAtHeight(_ context.Context, blkHeight uint64) (ids.ID, error) { - ethBlock := vm.blockChain.GetBlockByNumber(blkHeight) - if ethBlock == nil { +// GetBlockAtHeight returns the canonical block at [height]. +// Note: the engine assumes that if a block is not found at [height], then +// [database.ErrNotFound] will be returned. This indicates that the VM has state +// synced and does not have all historical blocks available. +func (vm *VM) GetBlockIDAtHeight(_ context.Context, height uint64) (ids.ID, error) { + lastAcceptedBlock := vm.LastAcceptedBlock() + if lastAcceptedBlock.Height() < height { return ids.ID{}, database.ErrNotFound } - return ids.ID(ethBlock.Hash()), nil + hash := vm.blockChain.GetCanonicalHash(height) + if hash == (common.Hash{}) { + return ids.ID{}, database.ErrNotFound + } + return ids.ID(hash), nil } func (vm *VM) Version(context.Context) (string, error) { diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index f45af64c27..90d5fa087f 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -1004,6 +1004,10 @@ func TestNonCanonicalAccept(t *testing.T) { t.Fatalf("Expected status of built block to be %s, but found %s", choices.Processing, status) } + if _, err := vm1.GetBlockIDAtHeight(context.Background(), vm1BlkA.Height()); err != database.ErrNotFound { + t.Fatalf("Expected unaccepted block not to be indexed by height, but found %s", err) + } + if err := vm1.SetPreference(context.Background(), vm1BlkA.ID()); err != nil { t.Fatal(err) } @@ -1018,6 +1022,9 @@ func TestNonCanonicalAccept(t *testing.T) { if status := vm2BlkA.Status(); status != choices.Processing { t.Fatalf("Expected status of block on VM2 to be %s, but found %s", choices.Processing, status) } + if _, err := vm2.GetBlockIDAtHeight(context.Background(), vm2BlkA.Height()); err != database.ErrNotFound { + t.Fatalf("Expected unaccepted block not to be indexed by height, but found %s", err) + } if err := vm2.SetPreference(context.Background(), vm2BlkA.ID()); err != nil { t.Fatal(err) } @@ -1025,9 +1032,19 @@ func TestNonCanonicalAccept(t *testing.T) { if err := vm1BlkA.Accept(context.Background()); err != nil { t.Fatalf("VM1 failed to accept block: %s", err) } + if blkID, err := vm1.GetBlockIDAtHeight(context.Background(), vm1BlkA.Height()); err != nil { + t.Fatalf("Height lookuped failed on accepted block: %s", err) + } else if blkID != vm1BlkA.ID() { + t.Fatalf("Expected accepted block to be indexed by height, but found %s", blkID) + } if err := vm2BlkA.Accept(context.Background()); err != nil { t.Fatalf("VM2 failed to accept block: %s", err) } + if blkID, err := vm2.GetBlockIDAtHeight(context.Background(), vm2BlkA.Height()); err != nil { + t.Fatalf("Height lookuped failed on accepted block: %s", err) + } else if blkID != vm2BlkA.ID() { + t.Fatalf("Expected accepted block to be indexed by height, but found %s", blkID) + } newHead := <-newTxPoolHeadChan1 if newHead.Head.Hash() != common.Hash(vm1BlkA.ID()) { @@ -1075,6 +1092,10 @@ func TestNonCanonicalAccept(t *testing.T) { t.Fatalf("Expected status of built block to be %s, but found %s", choices.Processing, status) } + if _, err := vm1.GetBlockIDAtHeight(context.Background(), vm1BlkB.Height()); err != database.ErrNotFound { + t.Fatalf("Expected unaccepted block not to be indexed by height, but found %s", err) + } + if err := vm1.SetPreference(context.Background(), vm1BlkB.ID()); err != nil { t.Fatal(err) } @@ -1107,10 +1128,20 @@ func TestNonCanonicalAccept(t *testing.T) { t.Fatalf("Block failed verification on VM1: %s", err) } + if _, err := vm1.GetBlockIDAtHeight(context.Background(), vm1BlkC.Height()); err != database.ErrNotFound { + t.Fatalf("Expected unaccepted block not to be indexed by height, but found %s", err) + } + if err := vm1BlkC.Accept(context.Background()); err != nil { t.Fatalf("VM1 failed to accept block: %s", err) } + if blkID, err := vm1.GetBlockIDAtHeight(context.Background(), vm1BlkC.Height()); err != nil { + t.Fatalf("Height lookuped failed on accepted block: %s", err) + } else if blkID != vm1BlkC.ID() { + t.Fatalf("Expected accepted block to be indexed by height, but found %s", blkID) + } + blkCHash := vm1BlkC.(*chain.BlockWrapper).Block.(*Block).ethBlock.Hash() if b := vm1.blockChain.GetBlockByNumber(blkBHeight); b.Hash() != blkCHash { t.Fatalf("expected block at %d to have hash %s but got %s", blkBHeight, blkCHash.Hex(), b.Hash().Hex()) diff --git a/scripts/versions.sh b/scripts/versions.sh index 289da977fe..3a2bc556ed 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -4,8 +4,8 @@ # shellcheck disable=SC2034 # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.7'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.9'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'} # This won't be used, but it's here to make code syncs easier -LATEST_CORETH_VERSION='0.13.4' +LATEST_CORETH_VERSION='7684836'