Skip to content

Commit 37d078c

Browse files
authored
chore: Create shared evm module (#4690)
1 parent ab43e6f commit 37d078c

File tree

41 files changed

+276
-44
lines changed

Some content is hidden

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

41 files changed

+276
-44
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
* @ava-labs/platform-avalanchego
99
/graft/coreth @ava-labs/platform-evm
10+
/graft/evm @ava-labs/platform-evm
1011
/graft/subnet-evm @ava-labs/platform-evm

.github/workflows/evm-ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: EVM Shared
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
merge_group:
8+
types: [checks_requested]
9+
10+
jobs:
11+
lint_test:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ./graft/evm
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: ./.github/actions/setup-go-for-project
20+
- name: Run all lint checks
21+
run: ../../scripts/run_task.sh lint-all-ci
22+
- name: Check go.mod and go.sum are up-to-date
23+
run: ../../scripts/run_task.sh check-go-mod-tidy
24+
25+
unit_test:
26+
name: Unit Tests (${{ matrix.os }})
27+
runs-on: ${{ matrix.os }}
28+
defaults:
29+
run:
30+
working-directory: ./graft/evm
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
os: [macos-latest, ubuntu-22.04, ubuntu-latest]
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: ./.github/actions/setup-go-for-project
38+
- run: ../../scripts/run_task.sh build-test
39+
- run: ../../scripts/run_task.sh coverage

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ COPY go.mod .
1313
COPY go.sum .
1414
COPY graft/coreth ./graft/coreth
1515
COPY graft/subnet-evm ./graft/subnet-evm
16+
COPY graft/evm ./graft/evm
1617
RUN go mod download
1718

1819
# Copy the code into the container

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ require (
8787
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
8888
)
8989

90+
require github.com/ava-labs/avalanchego/graft/evm v0.0.0-00010101000000-000000000000 // indirect
91+
9092
require (
9193
github.com/Microsoft/go-winio v0.6.1 // indirect
9294
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
@@ -209,3 +211,5 @@ tool (
209211
replace github.com/ava-labs/avalanchego/graft/coreth => ./graft/coreth
210212

211213
replace github.com/ava-labs/avalanchego/graft/subnet-evm => ./graft/subnet-evm
214+
215+
replace github.com/ava-labs/avalanchego/graft/evm => ./graft/evm

graft/coreth/Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ tasks:
7070

7171
lint:
7272
desc: Run golangci-lint and check for allowed Ethereum imports in Go code
73-
cmd: ../evm-shared/scripts/lint.sh
73+
cmd: ../evm/scripts/lint.sh
7474

7575
lint-all:
7676
desc: Runs all lint checks in parallel
@@ -92,7 +92,7 @@ tasks:
9292

9393
lint-fix:
9494
desc: Run golangci-lint with auto-fix where possible
95-
cmd: ../evm-shared/scripts/lint_fix.sh
95+
cmd: ../evm/scripts/lint_fix.sh
9696

9797
shellcheck:
9898
desc: Run shellcheck static analysis on all shell scripts with version management

graft/coreth/ethclient/simulated/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"time"
3434

3535
"github.com/ava-labs/avalanchego/graft/coreth/consensus/dummy"
36-
"github.com/ava-labs/avalanchego/graft/coreth/constants"
3736
"github.com/ava-labs/avalanchego/graft/coreth/core"
3837
"github.com/ava-labs/avalanchego/graft/coreth/eth"
3938
"github.com/ava-labs/avalanchego/graft/coreth/eth/ethconfig"
@@ -42,6 +41,7 @@ import (
4241
"github.com/ava-labs/avalanchego/graft/coreth/node"
4342
"github.com/ava-labs/avalanchego/graft/coreth/params"
4443
"github.com/ava-labs/avalanchego/graft/coreth/rpc"
44+
"github.com/ava-labs/avalanchego/graft/evm/constants"
4545
"github.com/ava-labs/avalanchego/utils/timer/mockable"
4646
ethereum "github.com/ava-labs/libevm"
4747
"github.com/ava-labs/libevm/common"

graft/coreth/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ go 1.24.9
1010
require (
1111
github.com/VictoriaMetrics/fastcache v1.12.1
1212
github.com/ava-labs/avalanchego v1.14.1-0.20251120155522-df4a8e531761
13+
github.com/ava-labs/avalanchego/graft/evm v0.0.0-00010101000000-000000000000
1314
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.16
1415
github.com/ava-labs/libevm v1.13.15-0.20251016142715-1bccf4f2ddb2
1516
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
@@ -184,3 +185,5 @@ tool (
184185
)
185186

186187
replace github.com/ava-labs/avalanchego => ../../
188+
189+
replace github.com/ava-labs/avalanchego/graft/evm => ../evm

graft/coreth/plugin/evm/vm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/ava-labs/avalanchego/database"
4444
"github.com/ava-labs/avalanchego/database/versiondb"
4545
"github.com/ava-labs/avalanchego/graft/coreth/consensus/dummy"
46-
"github.com/ava-labs/avalanchego/graft/coreth/constants"
4746
"github.com/ava-labs/avalanchego/graft/coreth/core"
4847
"github.com/ava-labs/avalanchego/graft/coreth/core/txpool"
4948
"github.com/ava-labs/avalanchego/graft/coreth/eth"
@@ -65,6 +64,7 @@ import (
6564
"github.com/ava-labs/avalanchego/graft/coreth/sync/handlers"
6665
"github.com/ava-labs/avalanchego/graft/coreth/triedb/hashdb"
6766
"github.com/ava-labs/avalanchego/graft/coreth/warp"
67+
"github.com/ava-labs/avalanchego/graft/evm/constants"
6868
"github.com/ava-labs/avalanchego/ids"
6969
"github.com/ava-labs/avalanchego/network/p2p"
7070
"github.com/ava-labs/avalanchego/network/p2p/acp118"

graft/coreth/plugin/evm/vm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/ava-labs/avalanchego/database"
2929
"github.com/ava-labs/avalanchego/database/memdb"
3030
"github.com/ava-labs/avalanchego/graft/coreth/consensus/dummy"
31-
"github.com/ava-labs/avalanchego/graft/coreth/constants"
3231
"github.com/ava-labs/avalanchego/graft/coreth/core"
3332
"github.com/ava-labs/avalanchego/graft/coreth/eth"
3433
"github.com/ava-labs/avalanchego/graft/coreth/miner"
@@ -45,6 +44,7 @@ import (
4544
"github.com/ava-labs/avalanchego/graft/coreth/rpc"
4645
"github.com/ava-labs/avalanchego/graft/coreth/utils"
4746
"github.com/ava-labs/avalanchego/graft/coreth/utils/utilstest"
47+
"github.com/ava-labs/avalanchego/graft/evm/constants"
4848
"github.com/ava-labs/avalanchego/ids"
4949
"github.com/ava-labs/avalanchego/snow/snowtest"
5050
"github.com/ava-labs/avalanchego/upgrade"

graft/coreth/plugin/evm/vmtest/test_syncervm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
"github.com/ava-labs/avalanchego/database/prefixdb"
2525
"github.com/ava-labs/avalanchego/graft/coreth/consensus/dummy"
26-
"github.com/ava-labs/avalanchego/graft/coreth/constants"
2726
"github.com/ava-labs/avalanchego/graft/coreth/core"
2827
"github.com/ava-labs/avalanchego/graft/coreth/core/coretest"
2928
"github.com/ava-labs/avalanchego/graft/coreth/params/paramstest"
@@ -32,6 +31,7 @@ import (
3231
"github.com/ava-labs/avalanchego/graft/coreth/plugin/evm/vmsync"
3332
"github.com/ava-labs/avalanchego/graft/coreth/sync/statesync/statesynctest"
3433
"github.com/ava-labs/avalanchego/graft/coreth/utils/utilstest"
34+
"github.com/ava-labs/avalanchego/graft/evm/constants"
3535
"github.com/ava-labs/avalanchego/ids"
3636
"github.com/ava-labs/avalanchego/snow"
3737
"github.com/ava-labs/avalanchego/snow/engine/enginetest"

0 commit comments

Comments
 (0)