Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 4b8f1dc

Browse files
Darioush JalaliARR4Nmichaelkaplan13ceyonurrichardpringle
authored
libevm phase 2: Use libevm statedb from upstream (#1421)
Co-authored-by: Arran Schlosberg <[email protected]> Co-authored-by: Darioush Jalali <[email protected]> Co-authored-by: Michael Kaplan <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: Richard Pringle <[email protected]> Co-authored-by: Quentin McGaw <[email protected]> Co-authored-by: Meaghan FitzGerald <[email protected]> Co-authored-by: Quentin McGaw <[email protected]> Co-authored-by: mountcount <[email protected]> Co-authored-by: chuangjinglu <[email protected]> Co-authored-by: guqicun <[email protected]> Co-authored-by: Dmytrol <[email protected]> fix problematic const name and some typos in comment (#1400) fix some function names in interface comment (#1397) close database on shutdown (#1403) fix some function names in comment (#1405) Fix Typos in Documentation (#1404) fix test generator (#724)
1 parent 8e744a9 commit 4b8f1dc

File tree

518 files changed

+4145
-18468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

518 files changed

+4145
-18468
lines changed

.github/CONTRIBUTING.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,40 @@ guidelines:
2727
- Commit messages should be prefixed with the package(s) they modify.
2828
- E.g. "eth, rpc: make trace configs optional"
2929

30+
### Mocks
31+
32+
Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code.
33+
34+
- To **re-generate all mocks**, use the command below from the root of the project:
35+
36+
```sh
37+
go generate -run "go.uber.org/mock/mockgen" ./...
38+
```
39+
40+
- To **add** an interface that needs a corresponding mock generated:
41+
- if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
42+
- modify its `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or
43+
- add another `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface according to specific mock generation settings
44+
- if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
45+
46+
```go
47+
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
48+
// See the file LICENSE for licensing terms.
49+
50+
package mypackage
51+
52+
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
53+
```
54+
55+
Notes:
56+
1. Ideally generate all mocks to `mocks_test.go` for the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces.
57+
1. Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare.
58+
- To **remove** an interface from having a corresponding mock generated:
59+
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
60+
1. If the `//go:generate` mockgen command line:
61+
- generates a mock file for multiple interfaces, remove your interface from the line
62+
- generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
63+
3064
## Documentation guidelines
3165

3266
- Code should be well commented, so it is easier to read and maintain.
@@ -35,7 +69,7 @@ guidelines:
3569
[commentary](https://go.dev/doc/effective_go#commentary) guidelines.
3670
- Changes with user facing impact (e.g., addition or modification of flags and
3771
options) should be accompanied by a link to a pull request to the [avalanche-docs](https://github.com/ava-labs/avalanche-docs)
38-
repository. [example](https://github.com/ava-labs/avalanche-docs/pull/1119/files).
72+
repository. [example](https://github.com/ava-labs/avalanche-docs/pull/1119/files).
3973
- Changes that modify a package significantly or add new features should
4074
either update the existing or include a new `README.md` file in that package.
4175

.github/workflows/bench.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
- uses: actions/setup-go@v4
1313
with:
1414
go-version: "~1.22.8"
15-
check-latest: true
1615
- run: go mod download
1716
shell: bash
1817
- run: ./scripts/build_bench_precompiles.sh

.github/workflows/check-clean-branch.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/publish_docker.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ on:
1717

1818
jobs:
1919
publish_docker_image:
20-
name: Publish Docker Image
21-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-latest
2221
steps:
2322
- uses: actions/checkout@v4
24-
- name: Publish image to Dockerhub
23+
- uses: docker/setup-qemu-action@v3
24+
- uses: docker/setup-buildx-action@v3
25+
- name: Build and publish images to DockerHub
2526
env:
2627
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
2728
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
2829
DOCKER_REPO: "avaplatform/subnet-evm"
29-
run: .github/workflows/publish_docker_image.sh ${{ inputs.vm_id }}
30+
VM_ID: ${{ inputs.vm_id }}
31+
PUBLISH: 1
32+
PLATFORMS: "linux/amd64,linux/arm64"
33+
run: scripts/build_docker_image.sh

.github/workflows/publish_docker_image.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag:
7-
description: "Tag to include in artifact name"
7+
description: "Tag to checkout & release"
88
required: true
99
push:
1010
tags:
@@ -20,11 +20,11 @@ jobs:
2020
with:
2121
fetch-depth: 0
2222
path: subnet-evm
23+
ref: ${{ github.event.inputs.tag }}
2324
- name: Set up Go
2425
uses: actions/setup-go@v5
2526
with:
2627
go-version: "~1.22.8"
27-
check-latest: true
2828
- name: Set up arm64 cross compiler
2929
run: |
3030
sudo apt-get -y update

.github/workflows/tests.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ jobs:
1717
runs-on: ubuntu-20.04
1818
steps:
1919
- uses: actions/checkout@v4
20-
- run: ./scripts/lint_allowed_geth_imports.sh
20+
- run: ./scripts/lint_allowed_eth_imports.sh
2121
shell: bash
2222
- uses: actions/setup-go@v5
2323
with:
2424
go-version: ${{ env.min_go_version }}
25-
check-latest: true
2625
- name: golangci-lint
2726
uses: golangci/golangci-lint-action@v3
2827
with:
@@ -36,6 +35,10 @@ jobs:
3635
- name: Run actionlint
3736
shell: bash
3837
run: scripts/actionlint.sh
38+
- name: go mod tidy
39+
run: |
40+
go mod tidy
41+
git diff --exit-code
3942
4043
unit_test:
4144
name: Golang Unit Tests (${{ matrix.os }})
@@ -49,13 +52,19 @@ jobs:
4952
- uses: actions/setup-go@v5
5053
with:
5154
go-version: ${{ env.min_go_version }}
52-
check-latest: true
5355
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
5456
shell: bash
5557
if: matrix.os == 'windows-latest'
5658
run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV"
5759
- run: go mod download
5860
shell: bash
61+
- name: Mocks are up to date
62+
shell: bash
63+
run: |
64+
grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm
65+
go generate -run "go.uber.org/mock/mockgen" ./...
66+
git add --intent-to-add --all
67+
git diff --exit-code
5968
- run: ./scripts/build.sh
6069
shell: bash
6170
- run: ./scripts/build_test.sh
@@ -77,7 +86,6 @@ jobs:
7786
uses: actions/setup-go@v5
7887
with:
7988
go-version: ${{ env.min_go_version }}
80-
check-latest: true
8189
- name: Use Node.js
8290
uses: actions/setup-node@v4
8391
with:
@@ -119,7 +127,6 @@ jobs:
119127
uses: actions/setup-go@v5
120128
with:
121129
go-version: ${{ env.min_go_version }}
122-
check-latest: true
123130
- name: Use Node.js
124131
uses: actions/setup-node@v4
125132
with:
@@ -140,7 +147,7 @@ jobs:
140147
shell: bash
141148
run: ./scripts/build.sh
142149
- name: Run Warp E2E Tests
143-
uses: ava-labs/avalanchego/.github/actions/[email protected].11-monitoring-url
150+
uses: ava-labs/avalanchego/.github/actions/[email protected].13
144151
with:
145152
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_warp.sh
146153
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
@@ -164,15 +171,14 @@ jobs:
164171
uses: actions/setup-go@v5
165172
with:
166173
go-version: ${{ env.min_go_version }}
167-
check-latest: true
168174
- name: Install AvalancheGo Release
169175
shell: bash
170176
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
171177
- name: Build Subnet-EVM Plugin Binary
172178
shell: bash
173179
run: ./scripts/build.sh
174180
- name: Run E2E Load Tests
175-
uses: ava-labs/avalanchego/.github/actions/[email protected].11-monitoring-url
181+
uses: ava-labs/avalanchego/.github/actions/[email protected].13
176182
with:
177183
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/run_ginkgo_load.sh
178184
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
@@ -184,19 +190,6 @@ jobs:
184190
if: always()
185191
with:
186192
name: load-tmpnet-data
187-
mock_gen:
188-
name: MockGen Check
189-
runs-on: ubuntu-latest
190-
steps:
191-
- uses: actions/checkout@v4
192-
- uses: actions/setup-go@v4
193-
with:
194-
go-version: ${{ env.min_go_version }}
195-
check-latest: true
196-
- shell: bash
197-
run: scripts/mock.gen.sh
198-
- shell: bash
199-
run: .github/workflows/check-clean-branch.sh
200193
test_build_image:
201194
name: Image build
202195
runs-on: ubuntu-latest
@@ -213,7 +206,6 @@ jobs:
213206
- uses: actions/setup-go@v5
214207
with:
215208
go-version: ${{ env.min_go_version }}
216-
check-latest: true
217209
- name: Install AvalancheGo Release
218210
shell: bash
219211
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ builds:
1818
overrides:
1919
- goos: linux
2020
goarch: arm64
21+
goarm64: v8.0
2122
env:
2223
- CC=aarch64-linux-gnu-gcc
2324
- goos: darwin
2425
goarch: arm64
26+
goarm64: v8.0
2527
env:
2628
- CC=oa64-clang
2729
- goos: darwin

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ The Subnet EVM runs in a separate process from the main AvalancheGo process and
3030
[v0.6.9] [email protected] (Protocol Version: 37)
3131
[v0.6.10] [email protected] (Protocol Version: 37)
3232
[v0.6.11] [email protected] (Protocol Version: 37)
33+
[v0.6.12] [email protected]/v1.12.0 (Protocol Version: 38)
34+
[v0.7.0] [email protected] (Protocol Version: 38)
35+
[v0.7.1] [email protected] (Protocol Version: 38)
3336
```
3437

3538
## API

RELEASES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## Pending Release
44

5+
* Refactored trie_prefetcher.go to be structurally similar to upstream.
6+
7+
## [v0.7.0](https://github.com/ava-labs/subnet-evm/releases/tag/v0.7.0)
8+
9+
### Updates
10+
11+
- Changed default write option from `Sync` to `NoSync` in PebbleDB
12+
13+
### Fixes
14+
15+
- Fixed database close on shutdown
16+
517
## [v0.6.11](https://github.com/ava-labs/subnet-evm/releases/tag/v0.6.11)
618

719
This release focuses on Standalone DB and database configs.

0 commit comments

Comments
 (0)