Skip to content
Open
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
6 changes: 5 additions & 1 deletion cmd/generic-fuzzer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@ func startFuzzer(ctx *cli.Context) (err error) {
var factories []common.GeneratorFn
for _, fName := range fNames {
if f := fuzzing.Factory(fName, fork); f == nil {
return fmt.Errorf("unknown target %v", fName)
log.Error("Unknown or unavailable fuzzing engine", "engine", fName)
} else {
factories = append(factories, f)
}
log.Info("Added factory", "name", fName)
}
if len(factories) == 0 {
return fmt.Errorf("no fuzzing-engines enabled")
}

var index atomic.Uint64
factory = func() *fuzzing.GstMaker {
i := int(index.Add(1))
Expand Down
19 changes: 19 additions & 0 deletions common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ var (
Name: "revme",
Usage: "Location of reth 'revme' binary",
}
BorFlag = &cli.StringSliceFlag{
Name: "bor",
Usage: "Location of reth bor evm binary",
}
BorBatchFlag = &cli.StringSliceFlag{
Name: "borbatch",
Usage: "Location of reth bor evm binary",
}
ThreadFlag = &cli.IntFlag{
Name: "parallel",
Usage: "Number of parallel executions to use.",
Expand Down Expand Up @@ -161,6 +169,8 @@ var (
NimbusBatchFlag,
EvmoneFlag,
RethFlag,
BorFlag,
BorBatchFlag,
}
traceLengthSA = utils.NewSlidingAverage()
)
Expand All @@ -181,6 +191,8 @@ func InitVMs(c *cli.Context) []evms.Evm {
nimBatchBins = c.StringSlice(NimbusBatchFlag.Name)
evmoneBins = c.StringSlice(EvmoneFlag.Name)
revmBins = c.StringSlice(RethFlag.Name)
borBins = c.StringSlice(BorFlag.Name)
borBatchBins = c.StringSlice(BorBatchFlag.Name)

vms []evms.Evm
)
Expand Down Expand Up @@ -226,6 +238,13 @@ func InitVMs(c *cli.Context) []evms.Evm {
for i, bin := range revmBins {
vms = append(vms, evms.NewRethVM(bin, fmt.Sprintf("%d", i)))
}
for i, bin := range borBins {
vms = append(vms, evms.NewBorEVM(bin, fmt.Sprintf("bor-%d", i)))
}
for i, bin := range borBatchBins {
vms = append(vms, evms.NewBorBatchVM(bin, fmt.Sprintf("borbatch-%d", i)))
}

return vms

}
Expand Down
132 changes: 132 additions & 0 deletions docker/Dockerfile.L2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#
# The (second) Mega Dockerfile
#
# This dockerfile is an attempt to bundle the following components into
# one big dockerfile:
#
# - [x] Goevmlab binary 'generic-fuzzer' (bor-fork)
# - [x] Go-ethereum binary 'evm' (holiman/bor fork)
# - [x] Polygon 'bor'
#

#---------------------------------------------------------------
# golang-builder (debian-based)
#---------------------------------------------------------------
#FROM golang:latest as golang-builder
# The polygon/bor repo contains an older version of blst, which is affected by
# https://github.com/supranational/blst/issues/245 . Thus, we cannot use 'latest', until
# bor updates to a newer base-version of geth/blst
FROM golang:1.23 as golang-builder

# Clone all as a single step

RUN git clone https://github.com/holiman/goevmlab --depth 1 && \
git clone https://github.com/ethereum/go-ethereum --depth 1 && \
git clone https://github.com/holiman/go-ethereum --depth 1 --branch bor borgo-ethereum && \
git clone https://github.com/maticnetwork/bor --depth 1 && \
git clone https://github.com/ethereum-optimism/op-geth --depth 1 && \
git clone https://github.com/OffchainLabs/go-ethereum --depth 1 arbitrum && \
git clone https://github.com/celo-org/op-geth --depth 1 celo

# BSC:
RUN git clone https://github.com/node-real/bsc-erigon.git && \
git clone https://github.com/bnb-chain/bsc.git bsc-geth

#
# Go-evmlab
#

RUN cd goevmlab && git pull
RUN cd goevmlab && \
go build ./cmd/generic-fuzzer && \
go build ./cmd/generic-generator && \
go build ./cmd/checkslow && \
go build ./cmd/minimizer && \
go build ./cmd/repro && \
go build ./cmd/runtest && \
go build ./cmd/tracediff && \
go build ./cmd/traceview

# GETH (regular)
#
RUN cd go-ethereum && git pull && go run build/ci.go install -static ./cmd/evm

# GETH (bor/Polygon flavour)
#
RUN cd borgo-ethereum && git pull && go run build/ci.go install -static ./cmd/evm

# BOR (Polygon)
#
RUN cd bor && git pull && go run build/ci.go install -static ./cmd/evm

# OP-Geth (Optimism)
#
RUN cd op-geth && git pull && go run build/ci.go install -static ./cmd/evm

# Offchain labs (Arbitrum)
#
RUN cd arbitrum && git pull && go run build/ci.go install -static ./cmd/evm

# Celo
RUN cd celo && git pull && go build -o celovm ./cmd/evm

# Two different binance bsc clients
RUN cd bsc-geth && git pull && go run build/ci.go install -static ./cmd/evm
RUN cd bsc-erigon && git pull && go build ./cmd/evm


#
# Main non-builder
#

FROM debian:testing

RUN apt-get update -q
RUN apt-get install -qy --no-install-recommends curl jq nano ca-certificates

# Go-evmlab targets
COPY --from=golang-builder /go/goevmlab/generic-fuzzer /usr/bin
COPY --from=golang-builder /go/goevmlab/generic-generator /usr/bin
COPY --from=golang-builder /go/goevmlab/checkslow /usr/bin
COPY --from=golang-builder /go/goevmlab/minimizer /usr/bin
COPY --from=golang-builder /go/goevmlab/repro /usr/bin
COPY --from=golang-builder /go/goevmlab/runtest /usr/bin
COPY --from=golang-builder /go/goevmlab/tracediff /usr/bin
COPY --from=golang-builder /go/goevmlab/traceview /usr/bin


COPY --from=golang-builder /go/borgo-ethereum/build/bin/evm /borgovm
ENV BORGETH_BIN=/borgovm

COPY --from=golang-builder /go/go-ethereum/build/bin/evm /gethvm
ENV GETH_BIN=/gethvm

COPY --from=golang-builder /go/bor/build/bin/evm /borvm
ENV BOR_BIN=/borvm

COPY --from=golang-builder /go/op-geth/build/bin/evm /opvm
ENV OP_BIN=/opvm

COPY --from=golang-builder /go/arbitrum/build/bin/evm /arbvm
ENV ARB_BIN=/arbvm

COPY --from=golang-builder /go/celo/celovm /celovm
ENV CELO_BIN=/celovm

COPY --from=golang-builder /go/bsc-geth/build/bin/evm /bsc-gethvm
ENV BSC_GETH_BIN=/bsc-gethvm
COPY --from=golang-builder /go/bsc-erigon/evm /bsc-erigonvm
ENV BSC_ERIG_BIN=/bsc-erigonvm

COPY readme_l2.md /README.md

# Arbitrum and Optimism are same same as mainnet (but only up to London(?))
ENV VMS_REGULAR="--gethbatch=$GETH_BIN --gethbatch=$OP_BIN --gethbatch=$ARB_BIN --gethbatch=$CELO_BIN"

# On bor, we can only run the real bor-client against the bor-flavoured geth
ENV VMS_BOR="--gethbatch=$BORGETH_BIN --borbatch=$BOR_BIN"

# On BSC, we can run the two "bsc"-vms, but also mainnet vms. Supports Prague.
ENV VMS_BSC="--gethbatch=$BSC_GETH_BIN --erigonbatch=BSC_ERIG_BIN --gethbatch$GETH_BIN"

ENTRYPOINT ["/bin/bash"]
4 changes: 4 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ and then build
```
docker buildx build --progress=plain -t holiman/omnifuzz .
```
or
```
docker buildx build --progress=plain --push --load -t holiman/omnifuzz-l2 -f Dockerfile.L2.txt .
```

## The container itself

Expand Down
60 changes: 60 additions & 0 deletions docker/readme_l2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
This is a dockerfile containing various L2 VMs, plus go-evmlab itself.
The evm binaries are available as ENV vars:

- "regular" vms
- `$GETH_BIN`=/gethvm - The regular normal geth.
- `$OP_BIN`=/opvm - optimism fork of geth. Supports up to Prague
- `$ARB_BIN`=/arbvm - offchain labs arbitrum fork of geth. Supports up to Prague
- `$CELO_BIN`=/celovm - celo fork of op-geth. Supports up to London (the codebase supports Prague ,in theory, but the Celo network has not activated Prague)
- Berlin + London: Celo Mainnet "Espresso" HF, March 8 2022
- Ethereum alignment (?): Celo Mainnet "Gingerbread" HF, Sep 26 2023
- https://forum.celo.org/t/introducing-celo-s-gingerbread-hard-fork-join-for-q-a-on-june-21/5918

- "non-regular" vms, where the consensus rules are changed.
- `$BORGETH_BIN`=/borgovm - A bor-flavoured geth, which is same as regular geth but with a few tiny tweaks to make it execute statetests similarly.
- `$BOR_BIN`=/borvm - the vm from https://github.com/maticnetwork/bor
- This is based on an older geth, this needs it's own shim: `--bor` or `--borbatch`. (All the other use `--geth`/`--gethbatch`)



## Generating reference output

TOOD

## Checkslow

## Run a test against all clients

```
docker run -it -v /home/user/workspace/tests/fuzztmp:/fuzztmp --entrypoint bash holiman/omnifuzz

$ runtest $FUZZ_CLIENTS /fuzztmp/
```


## Fuzzing

If you want to do fuzzing, you should ensure that the directory where tests are saved is mounted outside the docker container

```
docker run -it -v /home/user/fuzzing:/fuzztmp

$ generic-fuzzer --outdir=/fuzztmp --fork=Cancun $VMS_REGULAR

# or

$ generic-fuzzer --outdir=/fuzztmp --fork=London $VMS_REGULAR
```
or
```
docker run -it -v /home/user/fuzzing:/fuzztmp

$ generic-fuzzer --outdir=/fuzztmp --fork=London $VMS_BOR
```
or
```
docker run -it -v /home/user/fuzzing:/fuzztmp

$ generic-fuzzer --outdir=/fuzztmp --fork=Prague $VMS_BSC
```

Loading