Skip to content

Commit 9e1464a

Browse files
atharrva01adecaro
authored andcommitted
feat(evm): Besu test network and the fungible suite running on it (#2159)
Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
1 parent 7c6a095 commit 9e1464a

82 files changed

Lines changed: 7090 additions & 406 deletions

Some content is hidden

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

.github/workflows/nightly-fuzz.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,52 @@ jobs:
102102
- name: fabtoken-owner-verifier
103103
pkg: ./token/core/fabtoken/v1/driver
104104
func: FuzzOwnerVerifierNoPanic
105+
# The evm driver is its own Go module, so its targets run from that module's root rather
106+
# than the repository root. `dir` defaults to "." for every entry above.
107+
- name: evm-recover-endorsement-signature
108+
dir: ./x/token/services/network/evm
109+
pkg: ./eip712
110+
func: FuzzRecoverAddress
111+
- name: evm-signer-from-bytes
112+
dir: ./x/token/services/network/evm
113+
pkg: ./eip712
114+
func: FuzzNewSignerFromBytes
115+
- name: evm-envelope-from-bytes
116+
dir: ./x/token/services/network/evm
117+
pkg: .
118+
func: FuzzEnvelopeFromBytes
119+
- name: evm-compute-anchor
120+
dir: ./x/token/services/network/evm
121+
pkg: .
122+
func: FuzzComputeAnchor
123+
- name: evm-abi-decode-bytes
124+
dir: ./x/token/services/network/evm
125+
pkg: ./abi
126+
func: FuzzDecodeBytes
127+
- name: evm-abi-decode-bool-array
128+
dir: ./x/token/services/network/evm
129+
pkg: ./abi
130+
func: FuzzDecodeBoolArray
131+
- name: evm-abi-decode-uint64
132+
dir: ./x/token/services/network/evm
133+
pkg: ./abi
134+
func: FuzzDecodeUint64
135+
- name: evm-abi-decode-bytes32
136+
dir: ./x/token/services/network/evm
137+
pkg: ./abi
138+
func: FuzzDecodeBytes32
139+
- name: evm-hex-to-address
140+
dir: ./x/token/services/network/evm
141+
pkg: ./client
142+
func: FuzzHexToAddress
143+
- name: evm-hex-to-hash
144+
dir: ./x/token/services/network/evm
145+
pkg: ./client
146+
func: FuzzHexToHash
147+
- name: evm-bytes-to-address
148+
dir: ./x/token/services/network/evm
149+
pkg: ./client
150+
func: FuzzBytesToAddress
105151

106152
steps:
107153
- name: Checkout code
@@ -122,6 +168,7 @@ jobs:
122168
fuzz-${{ matrix.name }}-
123169
124170
- name: Run fuzz campaign
171+
working-directory: ${{ matrix.dir || '.' }}
125172
run: |
126173
set -o pipefail
127174
go test ${{ matrix.pkg }} \
@@ -132,6 +179,9 @@ jobs:
132179
133180
- name: Collect crash artifacts
134181
if: failure()
182+
# Same directory the campaign ran in: both the log and the corpus that reproduces the crash are
183+
# written relative to it, and losing them would leave only the fact that something failed.
184+
working-directory: ${{ matrix.dir || '.' }}
135185
run: |
136186
mkdir -p fuzz-failure
137187
cp fuzz-output.log fuzz-failure/ || true
@@ -143,7 +193,7 @@ jobs:
143193
uses: actions/upload-artifact@v4
144194
with:
145195
name: fuzz-failure-${{ matrix.name }}
146-
path: fuzz-failure/
196+
path: ${{ matrix.dir || '.' }}/fuzz-failure/
147197
retention-days: 30
148198

149199
- name: File or update GitHub issue

.github/workflows/tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,47 @@ jobs:
220220
parallel: true
221221
fail-on-error: false
222222

223+
# The evm suites run on the feature branch rather than on main, because that is where the driver
224+
# lives until it graduates. They are their own job for two reasons: they need foundry, which nothing
225+
# else in this workflow does, and they need no fabric binaries at all.
226+
#
227+
# No coverage upload here on purpose. The other jobs upload with parallel: true and publish-coverage
228+
# closes the set; adding this one would either make that job wait on a run that is skipped on main,
229+
# or leave a parallel report that never finishes.
230+
itest-evm:
231+
needs: checks
232+
if: github.ref == 'refs/heads/feature/evm-network-driver' || github.base_ref == 'feature/evm-network-driver'
233+
runs-on: ubuntu-latest
234+
strategy:
235+
fail-fast: false
236+
matrix:
237+
tests: [ evm, evm-fabtoken ]
238+
239+
steps:
240+
- name: Checkout code
241+
uses: actions/checkout@v4
242+
with:
243+
# forge-std is a submodule of the contracts project, and the deploy script imports it.
244+
# Without this the checkout is missing lib/forge-std and forge fails to compile.
245+
submodules: recursive
246+
247+
- name: Set up Go
248+
uses: actions/setup-go@v5
249+
with:
250+
go-version-file: "go.mod"
251+
cache-dependency-path: "**/*.sum"
252+
253+
- name: Set up tools
254+
run: make install-tools
255+
256+
- name: Set up foundry
257+
uses: foundry-rs/foundry-toolchain@v1
258+
with:
259+
version: stable
260+
261+
- name: Run ${{ matrix.tests }}
262+
run: make integration-tests-${{ matrix.tests }}
263+
223264
publish-coverage:
224265
needs: [ utest, itest ]
225266
runs-on: ubuntu-latest

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ cmd/token_validation_service/out/
1414
/site/
1515
coverage.out
1616
/.codex/
17+
18+
# The EVM integration suites generate a node binary tree and a network under out/ and testdata/.
19+
# Both hold real Go files, so a stray "git add -A" commits them and a linter then reports on them.
20+
integration/token/fungible/evm/out/
21+
integration/token/fungible/evm/testdata/
22+
integration/token/fungible/evmfabtoken/out/
23+
integration/token/fungible/evmfabtoken/testdata/
24+
# ginkgo leaves its compiled suite binary behind when a run fails.
25+
integration/token/fungible/evm/evm.test
26+
integration/token/fungible/evmfabtoken/evmfabtoken.test
27+
# ginkgo -cover writes this next to the suite it ran.
28+
integration/token/fungible/*/coverprofile.out

Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ unit-tests-regression:
8383
install-softhsm:
8484
./ci/scripts/install_softhsm.sh
8585

86+
# The EVM integration suites run against this Besu image.
87+
BESU_IMAGE ?= hyperledger/besu:24.3.0
88+
8689
.PHONY: docker-images
8790
# build/pull docker images needed for testing
88-
docker-images: fabric-docker-images monitoring-docker-images testing-docker-images
91+
docker-images: fabric-docker-images monitoring-docker-images testing-docker-images besu-docker-images
8992

9093
.PHONY: testing-docker-images
9194
# pull docker images for testing (postgres, vault)
@@ -102,6 +105,11 @@ fabric-docker-images:
102105
docker pull hyperledger/fabric-ccenv:$(FABRIC_TWO_DIGIT_VERSION)
103106
docker image tag hyperledger/fabric-ccenv:$(FABRIC_TWO_DIGIT_VERSION) hyperledger/fabric-ccenv:latest
104107

108+
.PHONY: besu-docker-images
109+
# pull the besu docker image the EVM integration suites run against
110+
besu-docker-images:
111+
docker pull $(BESU_IMAGE)
112+
105113
.PHONY: monitoring-docker-images
106114
# pull monitoring docker images (explorer, prometheus, grafana, jaeger)
107115
monitoring-docker-images:
@@ -111,6 +119,17 @@ monitoring-docker-images:
111119
docker pull grafana/grafana:latest
112120
docker pull cr.jaegertracing.io/jaegertracing/jaeger:2.12.0
113121

122+
.PHONY: integration-tests-evm
123+
# run the fungible integration tests against an EVM backend (Besu).
124+
# Unlike the fabric suites this needs no FAB_BINS, but it does need docker and forge.
125+
integration-tests-evm: besu-docker-images
126+
cd ./integration/token/fungible/evm; ginkgo $(GINKGO_TEST_OPTS) .
127+
128+
.PHONY: integration-tests-evm-fabtoken
129+
# run the fungible integration tests against an EVM backend with the fabtoken driver.
130+
integration-tests-evm-fabtoken: besu-docker-images
131+
cd ./integration/token/fungible/evmfabtoken; ginkgo $(GINKGO_TEST_OPTS) .
132+
114133
.PHONY: integration-tests-nft-dlog
115134
# run nft integration tests with idemix
116135
integration-tests-nft-dlog:
@@ -150,6 +169,10 @@ clean:
150169
rm -rf ./integration/token/fungible/dlog/out/
151170
rm -rf ./integration/token/fungible/dlog/testdata/
152171
rm -rf ./integration/token/fungible/dlogx/out/
172+
rm -rf ./integration/token/fungible/evm/out/
173+
rm -rf ./integration/token/fungible/evm/testdata/
174+
rm -rf ./integration/token/fungible/evmfabtoken/out/
175+
rm -rf ./integration/token/fungible/evmfabtoken/testdata/
153176
rm -rf ./integration/token/fungible/dloghsm/out/
154177
rm -rf ./integration/token/fungible/dloghsm/testdata/
155178
rm -rf ./integration/token/fungible/dlogstress/out/

cmd/artifactgen/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ require (
2424
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
2525
github.com/IBM/idemix v0.2.0 // indirect
2626
github.com/IBM/mathlib v0.3.0 // indirect
27+
github.com/LFDT-Panurus/panurus/x/token/services/network/evm v0.0.0 // indirect
2728
github.com/Masterminds/semver/v3 v3.5.0 // indirect
2829
github.com/Masterminds/squirrel v1.5.4 // indirect
2930
github.com/Microsoft/go-winio v0.6.2 // indirect
@@ -233,3 +234,5 @@ require (
233234
modernc.org/memory v1.11.0 // indirect
234235
modernc.org/sqlite v1.53.0 // indirect
235236
)
237+
238+
replace github.com/LFDT-Panurus/panurus/x/token/services/network/evm => ../../x/token/services/network/evm

0 commit comments

Comments
 (0)