Skip to content

Commit

Permalink
Update op-geth depdency to 1.14.11 base (ethereum-optimism#12262)
Browse files Browse the repository at this point in the history
* Update op-geth depdency to 1.14.10 base

* Update op-geth to v1.14.11 merge base

* Update to ethereum-optimism/op-geth commit
  • Loading branch information
0x00101010 authored Oct 2, 2024
1 parent daff281 commit 82cb8ff
Show file tree
Hide file tree
Showing 25 changed files with 95 additions and 76 deletions.
4 changes: 2 additions & 2 deletions cannon/Dockerfile.diff
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ COPY --from=cannon-v2 /usr/local/bin/cannon /usr/local/bin/cannon-v2
# verify the latest singlethreaded VM behavior against cannon-v2
RUN cd cannon && make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2
RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && \
make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2 \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
make diff-singlethreaded-2-cannon -e OTHER_CANNON=/usr/local/bin/cannon-v2 \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE
5 changes: 3 additions & 2 deletions cannon/mipsevm/testutil/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/srcmap"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum/go-ethereum/triedb"
"github.com/stretchr/testify/require"

"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
Expand Down Expand Up @@ -95,8 +96,8 @@ func NewEVMEnv(contracts *ContractMetadata) (*vm.EVM, *state.StateDB) {
bc := &testChain{startTime: *chainCfg.CancunTime + offsetBlocks*12}
header := bc.GetHeader(common.Hash{}, 17034870+offsetBlocks)
db := rawdb.NewMemoryDatabase()
statedb := state.NewDatabase(db)
state, err := state.New(types.EmptyRootHash, statedb, nil)
statedb := state.NewDatabase(triedb.NewDatabase(db, nil), nil)
state, err := state.New(types.EmptyRootHash, statedb)
if err != nil {
panic(fmt.Errorf("failed to create memory state db: %w", err))
}
Expand Down
2 changes: 1 addition & 1 deletion cannon/testdata/example/alloc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module alloc

go 1.22

toolchain go1.22.0
toolchain go1.22.7

require github.com/ethereum-optimism/optimism v0.0.0

Expand Down
2 changes: 1 addition & 1 deletion cannon/testdata/example/claim/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module claim

go 1.22

toolchain go1.22.0
toolchain go1.22.7

require github.com/ethereum-optimism/optimism v0.0.0

Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/ethereum-optimism/optimism

go 1.21
go 1.22

toolchain go1.22.7

require (
github.com/BurntSushi/toml v1.4.0
Expand All @@ -13,7 +15,7 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac
github.com/ethereum/go-ethereum v1.14.8
github.com/ethereum/go-ethereum v1.14.11
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/go-cmp v0.6.0
Expand Down Expand Up @@ -62,7 +64,7 @@ require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/boltdb/bolt v1.3.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
Expand Down Expand Up @@ -91,7 +93,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/ferranbt/fastssz v0.1.2 // indirect
Expand Down Expand Up @@ -216,7 +218,7 @@ require (
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
Expand Down Expand Up @@ -249,7 +251,7 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum v1.14.8 => github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827042333-110c433a2469
replace github.com/ethereum/go-ethereum v1.14.11 => github.com/ethereum-optimism/op-geth v1.101408.1-0.20241002211323-d5a96613c22b

// replace github.com/ethereum/go-ethereum => ../op-geth

Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
Expand Down Expand Up @@ -181,14 +181,14 @@ github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/u
github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827042333-110c433a2469 h1:sGqlBjx0+z/ExU6VNo5OHSXS/5nc6BfkEQJvSdVbWp0=
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827042333-110c433a2469/go.mod h1:Mk8AhvlqFbjI9oW2ymThSSoqc6kiEH0/tCmHGMEu6ac=
github.com/ethereum-optimism/op-geth v1.101408.1-0.20241002211323-d5a96613c22b h1:9C6WytqAcqWKXQTMw2Da/S/aIJJmMvT+2MUpFnMdGrg=
github.com/ethereum-optimism/op-geth v1.101408.1-0.20241002211323-d5a96613c22b/go.mod h1:7S4pp8KHBmEmKkRjL1BPOc6jY9hW+64YeMUjR3RVLw4=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac h1:hCIrLuOPV3FJfMDvXeOhCC3uQNvFoMIIlkT2mN2cfeg=
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240910145426-b3905c89e8ac/go.mod h1:XaVXL9jg8BcyOeugECgIUGa9Y3DjYJj71RHmb5qon6M=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A=
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
Expand Down Expand Up @@ -767,8 +767,8 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk=
github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI=
Expand Down
2 changes: 1 addition & 1 deletion op-alt-da/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack
FROM $OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go

FROM alpine:3.18
FROM alpine:3.20

COPY --from=builder /usr/local/bin/da-server /usr/local/bin/da-server

Expand Down
5 changes: 3 additions & 2 deletions op-chain-ops/cmd/op-simulate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/triedb"
"github.com/holiman/uint256"
"github.com/pkg/profile"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -248,8 +249,8 @@ func (d *simChainContext) GetHeader(h common.Hash, n uint64) *types.Header {
func simulate(ctx context.Context, logger log.Logger, conf *params.ChainConfig,
prestatePath string, tx *types.Transaction, header *types.Header, doProfile bool) error {
memDB := rawdb.NewMemoryDatabase()
stateDB := gstate.NewDatabase(memDB)
state, err := gstate.New(types.EmptyRootHash, stateDB, nil)
stateDB := gstate.NewDatabase(triedb.NewDatabase(memDB, nil), nil)
state, err := gstate.New(types.EmptyRootHash, stateDB)
if err != nil {
return fmt.Errorf("failed to create in-memory state: %w", err)
}
Expand Down
10 changes: 5 additions & 5 deletions op-chain-ops/foundry/allocs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func TestForgeAllocs_FromState(t *testing.T) {
oplog.SetGlobalLogHandler(oplog.NewLogHandler(os.Stdout, cfg))

rawDB := rawdb.NewMemoryDatabase()
stateDB := state.NewDatabaseWithConfig(rawDB, &triedb.Config{
stateDB := state.NewDatabase(triedb.NewDatabase(rawDB, &triedb.Config{
Preimages: true,
IsVerkle: false,
HashDB: hashdb.Defaults,
PathDB: nil,
})
st, err := state.New(types.EmptyRootHash, stateDB, nil)
}), nil)
st, err := state.New(types.EmptyRootHash, stateDB)
require.NoError(t, err)

alice := common.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266")
Expand All @@ -60,15 +60,15 @@ func TestForgeAllocs_FromState(t *testing.T) {
// (see doc-comment in Commit, absolute footgun)
root, err := st.Commit(0, false)
require.NoError(t, err)
st, err = state.New(root, stateDB, nil)
st, err = state.New(root, stateDB)
require.NoError(t, err)

st.SetState(contract, common.Hash{0: 0xa}, common.Hash{0: 1})
st.SetState(contract, crypto.Keccak256Hash([]byte("hello")), crypto.Keccak256Hash([]byte("world")))

root, err = st.Commit(0, false)
require.NoError(t, err)
st, err = state.New(root, stateDB, nil)
st, err = state.New(root, stateDB)
require.NoError(t, err)

var allocs ForgeAllocs
Expand Down
8 changes: 4 additions & 4 deletions op-chain-ops/script/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,14 @@ func NewHost(

// Create an in-memory database, to host our temporary script state changes
h.rawDB = rawdb.NewMemoryDatabase()
h.stateDB = state.NewDatabaseWithConfig(h.rawDB, &triedb.Config{
h.stateDB = state.NewDatabase(triedb.NewDatabase(h.rawDB, &triedb.Config{
Preimages: true, // To be able to iterate the state we need the Preimages
IsVerkle: false,
HashDB: hashdb.Defaults,
PathDB: nil,
})
}), nil)
var err error
h.state, err = state.New(types.EmptyRootHash, h.stateDB, nil)
h.state, err = state.New(types.EmptyRootHash, h.stateDB)
if err != nil {
panic(fmt.Errorf("failed to create memory state db: %w", err))
}
Expand Down Expand Up @@ -653,7 +653,7 @@ func (h *Host) StateDump() (*foundry.ForgeAllocs, error) {
return nil, fmt.Errorf("failed to commit state: %w", err)
}
// We need a state object around the state DB
st, err := state.New(root, h.stateDB, nil)
st, err := state.New(root, h.stateDB)
if err != nil {
return nil, fmt.Errorf("failed to create state object for state-dumping: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion op-dispute-mon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG OP_STACK_GO_BUILDER=us-docker.pkg.dev/oplabs-tools-artifacts/images/op-stack
FROM $OP_STACK_GO_BUILDER as builder
# See "make golang-docker" and /ops/docker/op-stack-go

FROM alpine:3.18
FROM alpine:3.20

COPY --from=builder /usr/local/bin/op-dispute-mon /usr/local/bin/op-dispute-mon

Expand Down
3 changes: 2 additions & 1 deletion op-e2e/actions/helpers/l1_miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/triedb"

"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-service/eth"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (s *L1Miner) ActL1StartBlock(timeDelta uint64) Action {

parent := s.l1Chain.CurrentHeader()
parentHash := parent.Hash()
statedb, err := state.New(parent.Root, state.NewDatabase(s.l1Database), nil)
statedb, err := state.New(parent.Root, state.NewDatabase(triedb.NewDatabase(s.l1Database, nil), nil))
if err != nil {
t.Fatalf("failed to init state db around block %s (state %s): %w", parentHash, parent.Root, err)
}
Expand Down
3 changes: 2 additions & 1 deletion op-node/rollup/derive/fuzz_parsers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/triedb"
"github.com/google/go-cmp/cmp"
"github.com/holiman/uint256"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -244,7 +245,7 @@ func FuzzUnmarshallLogEvent(f *testing.F) {
}

// Set the EVM state up once to fuzz against
state, err := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil)
state, err := state.New(common.Hash{}, state.NewDatabase(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil), nil))
require.NoError(f, err)
state.SetBalance(from, uint256.MustFromBig(BytesToBigInt([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff})), tracing.BalanceChangeUnspecified)
_, addr, _, err := runtime.Create(common.FromHex(bindings.OptimismPortalMetaData.Bin), &runtime.Config{
Expand Down
8 changes: 4 additions & 4 deletions op-program/Dockerfile.repro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3-alpine3.18 as builder
FROM golang:1.22.7-alpine3.20 as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash

Expand Down Expand Up @@ -28,11 +28,11 @@ ARG TARGETOS TARGETARCH

# Build the cannon, op-program, and op-program-client.elf binaries.
RUN --mount=type=cache,target=/root/.cache/go-build cd cannon && make cannon \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$CANNON_VERSION"
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$CANNON_VERSION"
RUN --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-host \
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"
GOOS=$TARGETOS GOARCH=$TARGETARCH GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"
RUN --mount=type=cache,target=/root/.cache/go-build cd op-program && make op-program-client-mips \
GOOS=linux GOARCH=mips GOMIPS=softfloat GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"
GOOS=linux GOARCH=mips GOMIPS=softfloat GITCOMMIT=$GIT_COMMIT GITDATE=$GIT_DATE VERSION="$OP_PROGRAM_VERSION"

# Run the op-program-client.elf binary directly through cannon's load-elf subcommand.
RUN /app/cannon/bin/cannon load-elf --type singlethreaded-2 --path /app/op-program/bin/op-program-client.elf --out /app/op-program/bin/prestate.bin.gz --meta ""
Expand Down
4 changes: 2 additions & 2 deletions op-program/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ From within the `op-program` directory, options can be reviewed with:
The absolute pre-state of the op-program can be generated by executing the makefile
`reproducible-prestate` target. Effectively, this builds a docker image specified
by [Dockerfile.repro](./Dockerfile.repro) pinned with the following dependencies:
- golang version `1.21.3`
- alpine `3.18`
- golang version `1.22.7`
- alpine `3.20`

After running `make reproducible-prestate`, the following files can be found in
[./bin/](./bin/):
Expand Down
6 changes: 3 additions & 3 deletions op-program/client/l2/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestUpdateState(t *testing.T) {
genesisBlock := l2Genesis.MustCommit(db, trieDB)
assertStateDataAvailable(t, db, l2Genesis, genesisBlock)

statedb, err := state.New(genesisBlock.Root(), state.NewDatabase(rawdb.NewDatabase(db)), nil)
statedb, err := state.New(genesisBlock.Root(), state.NewDatabase(triedb.NewDatabase(rawdb.NewDatabase(db), nil), nil))
require.NoError(t, err)
statedb.MakeSinglethreaded()
statedb.SetBalance(userAccount, uint256.NewInt(50), tracing.BalanceChangeUnspecified)
Expand All @@ -148,7 +148,7 @@ func TestUpdateState(t *testing.T) {
err = statedb.Database().TrieDB().Commit(newRoot, true)
require.NoError(t, err)

statedb, err = state.New(newRoot, state.NewDatabase(rawdb.NewDatabase(db)), nil)
statedb, err = state.New(newRoot, state.NewDatabase(triedb.NewDatabase(rawdb.NewDatabase(db), nil), nil))
require.NoError(t, err)
statedb.MakeSinglethreaded()
require.Equal(t, uint256.NewInt(50), statedb.GetBalance(userAccount))
Expand Down Expand Up @@ -183,7 +183,7 @@ func createGenesis() *core.Genesis {
}

func assertStateDataAvailable(t *testing.T, db ethdb.KeyValueStore, l2Genesis *core.Genesis, genesisBlock *types.Block) {
statedb, err := state.New(genesisBlock.Root(), state.NewDatabase(rawdb.NewDatabase(db)), nil)
statedb, err := state.New(genesisBlock.Root(), state.NewDatabase(triedb.NewDatabase(rawdb.NewDatabase(db), nil), nil))
require.NoError(t, err)

for address, account := range l2Genesis.Alloc {
Expand Down
18 changes: 10 additions & 8 deletions op-program/client/l2/engine_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import (
"github.com/ethereum/go-ethereum/consensus/beacon"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/stateless"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/triedb"
)

type OracleBackedL2Chain struct {
Expand Down Expand Up @@ -170,38 +172,38 @@ func (o *OracleBackedL2Chain) Engine() consensus.Engine {
}

func (o *OracleBackedL2Chain) StateAt(root common.Hash) (*state.StateDB, error) {
stateDB, err := state.New(root, state.NewDatabase(rawdb.NewDatabase(o.db)), nil)
stateDB, err := state.New(root, state.NewDatabase(triedb.NewDatabase(rawdb.NewDatabase(o.db), nil), nil))
if err != nil {
return nil, err
}
stateDB.MakeSinglethreaded()
return stateDB, nil
}

func (o *OracleBackedL2Chain) InsertBlockWithoutSetHead(block *types.Block) error {
func (o *OracleBackedL2Chain) InsertBlockWithoutSetHead(block *types.Block, makeWitness bool) (*stateless.Witness, error) {
processor, err := engineapi.NewBlockProcessorFromHeader(o, block.Header())
if err != nil {
return err
return nil, err
}
for i, tx := range block.Transactions() {
err = processor.AddTx(tx)
if err != nil {
return fmt.Errorf("invalid transaction (%d): %w", i, err)
return nil, fmt.Errorf("invalid transaction (%d): %w", i, err)
}
}
expected, err := processor.Assemble()
if err != nil {
return fmt.Errorf("invalid block: %w", err)
return nil, fmt.Errorf("invalid block: %w", err)
}
if expected.Hash() != block.Hash() {
return fmt.Errorf("block root mismatch, expected: %v, actual: %v", expected.Hash(), block.Hash())
return nil, fmt.Errorf("block root mismatch, expected: %v, actual: %v", expected.Hash(), block.Hash())
}
err = processor.Commit()
if err != nil {
return fmt.Errorf("commit block: %w", err)
return nil, fmt.Errorf("commit block: %w", err)
}
o.blocks[block.Hash()] = block
return nil
return nil, nil
}

func (o *OracleBackedL2Chain) SetCanonical(head *types.Block) (common.Hash, error) {
Expand Down
Loading

0 comments on commit 82cb8ff

Please sign in to comment.