Commit 82cb8ff6 authored by Francis Li's avatar Francis Li Committed by GitHub

Update op-geth depdency to 1.14.11 base (#12262)

* 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
parent daff2812
......@@ -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
......@@ -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"
......@@ -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))
}
......
......@@ -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
......
......@@ -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
......
module github.com/ethereum-optimism/optimism
go 1.21
go 1.22
toolchain go1.22.7
require (
github.com/BurntSushi/toml v1.4.0
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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=
......@@ -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=
......@@ -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=
......
......@@ -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
......
......@@ -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"
......@@ -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)
}
......
......@@ -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")
......@@ -60,7 +60,7 @@ 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})
......@@ -68,7 +68,7 @@ func TestForgeAllocs_FromState(t *testing.T) {
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
......
......@@ -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))
}
......@@ -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)
}
......
......@@ -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
......
......@@ -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"
......@@ -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)
}
......
......@@ -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"
......@@ -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{
......
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
......@@ -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 ""
......
......@@ -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/):
......
......@@ -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)
......@@ -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))
......@@ -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 {
......
......@@ -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 {
......@@ -170,7 +172,7 @@ 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
}
......@@ -178,30 +180,30 @@ func (o *OracleBackedL2Chain) StateAt(root common.Hash) (*state.StateDB, error)
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) {
......
......@@ -83,7 +83,8 @@ func TestAppendToChain(t *testing.T) {
newBlock := blocks[4]
require.Nil(t, chain.GetBlock(newBlock.Hash(), newBlock.NumberU64()), "block unknown before being added")
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock))
_, err := chain.InsertBlockWithoutSetHead(newBlock, false)
require.NoError(t, err)
require.Equal(t, blocks[3].Header(), chain.CurrentHeader(), "should not update chain head yet")
require.Equal(t, common.Hash{}, chain.GetCanonicalHash(uint64(4)), "not yet a canonical hash")
require.Nil(t, chain.GetHeaderByNumber(uint64(4)), "not yet a canonical header")
......@@ -99,7 +100,8 @@ func TestAppendToChain(t *testing.T) {
func TestSetFinalized(t *testing.T) {
blocks, chain := setupOracleBackedChainWithLowerHead(t, 5, 0)
for _, block := range blocks[1:] {
require.NoError(t, chain.InsertBlockWithoutSetHead(block))
_, err := chain.InsertBlockWithoutSetHead(block, false)
require.NoError(t, err)
}
chain.SetFinalized(blocks[2].Header())
require.Equal(t, blocks[2].Header(), chain.CurrentFinalBlock())
......@@ -108,7 +110,8 @@ func TestSetFinalized(t *testing.T) {
func TestSetSafe(t *testing.T) {
blocks, chain := setupOracleBackedChainWithLowerHead(t, 5, 0)
for _, block := range blocks[1:] {
require.NoError(t, chain.InsertBlockWithoutSetHead(block))
_, err := chain.InsertBlockWithoutSetHead(block, false)
require.NoError(t, err)
}
chain.SetSafe(blocks[2].Header())
require.Equal(t, blocks[2].Header(), chain.CurrentSafeBlock())
......@@ -127,7 +130,7 @@ func TestUpdateStateDatabaseWhenImportingBlock(t *testing.T) {
require.False(t, chain.HasBlockAndState(newBlock.Root(), newBlock.NumberU64()), "state from non-imported block should not be available")
err = chain.InsertBlockWithoutSetHead(newBlock)
_, err = chain.InsertBlockWithoutSetHead(newBlock, false)
require.NoError(t, err)
db, err = chain.StateAt(newBlock.Root())
require.NoError(t, err, "state should be available after importing")
......@@ -141,7 +144,7 @@ func TestRejectBlockWithStateRootMismatch(t *testing.T) {
// Create invalid block by keeping the modified state root but exclude the transaction
invalidBlock := types.NewBlockWithHeader(newBlock.Header())
err := chain.InsertBlockWithoutSetHead(invalidBlock)
_, err := chain.InsertBlockWithoutSetHead(invalidBlock, false)
require.ErrorContains(t, err, "block root mismatch")
}
......@@ -166,8 +169,9 @@ func TestGetHeaderByNumber(t *testing.T) {
// Append a block
newBlock := createBlock(t, chain)
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock))
_, err := chain.SetCanonical(newBlock)
_, err := chain.InsertBlockWithoutSetHead(newBlock, false)
require.NoError(t, err)
_, err = chain.SetCanonical(newBlock)
require.NoError(t, err)
require.Equal(t, newBlock.Header(), chain.GetHeaderByNumber(newBlock.NumberU64()))
......@@ -179,8 +183,9 @@ func TestGetHeaderByNumber(t *testing.T) {
// Append a block
newBlock := createBlock(t, chain)
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock))
_, err := chain.SetCanonical(newBlock)
_, err := chain.InsertBlockWithoutSetHead(newBlock, false)
require.NoError(t, err)
_, err = chain.SetCanonical(newBlock)
require.NoError(t, err)
require.Equal(t, newBlock.Header(), chain.GetHeaderByNumber(newBlock.NumberU64()))
......@@ -192,11 +197,14 @@ func TestGetHeaderByNumber(t *testing.T) {
newBlock1 := blocks[3]
newBlock2 := blocks[4]
newBlock3 := blocks[5]
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock1))
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock2))
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock3))
_, err := chain.InsertBlockWithoutSetHead(newBlock1, false)
require.NoError(t, err)
_, err = chain.InsertBlockWithoutSetHead(newBlock2, false)
require.NoError(t, err)
_, err = chain.InsertBlockWithoutSetHead(newBlock3, false)
require.NoError(t, err)
_, err := chain.SetCanonical(newBlock3)
_, err = chain.SetCanonical(newBlock3)
require.NoError(t, err)
require.Equal(t, newBlock3.Header(), chain.GetHeaderByNumber(newBlock3.NumberU64()), "Lookup block3")
......@@ -255,7 +263,8 @@ func TestPrecompileOracle(t *testing.T) {
require.NoError(t, err)
newBlock := createBlock(t, chain, WithInput(test.input), WithTargetAddress(test.target))
require.NoError(t, chain.InsertBlockWithoutSetHead(newBlock))
_, err = chain.InsertBlockWithoutSetHead(newBlock, false)
require.NoError(t, err)
require.Equal(t, 1, precompileOracle.Calls)
})
}
......
......@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"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/params"
......@@ -237,7 +238,7 @@ func (s stubEngineBackend) StateAt(root common.Hash) (*state.StateDB, error) {
panic("unsupported")
}
func (s stubEngineBackend) InsertBlockWithoutSetHead(block *types.Block) error {
func (s stubEngineBackend) InsertBlockWithoutSetHead(block *types.Block, makeWitness bool) (*stateless.Witness, error) {
panic("unsupported")
}
......
......@@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"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/eth/downloader"
......@@ -37,7 +38,7 @@ type EngineBackend interface {
StateAt(root common.Hash) (*state.StateDB, error)
InsertBlockWithoutSetHead(block *types.Block) error
InsertBlockWithoutSetHead(block *types.Block, makeWitness bool) (*stateless.Witness, error)
SetCanonical(head *types.Block) (common.Hash, error)
SetFinalized(header *types.Header)
SetSafe(header *types.Header)
......@@ -494,7 +495,7 @@ func (ea *L2EngineAPI) newPayload(_ context.Context, payload *eth.ExecutionPaylo
return &eth.PayloadStatusV1{Status: eth.ExecutionAccepted}, nil
}
log.Trace("Inserting block without sethead", "hash", block.Hash(), "number", block.Number)
if err := ea.backend.InsertBlockWithoutSetHead(block); err != nil {
if _, err := ea.backend.InsertBlockWithoutSetHead(block, false); err != nil {
ea.log.Warn("NewPayloadV1: inserting block failed", "error", err)
// TODO not remembering the payload as invalid
return ea.invalid(err, parent.Header()), nil
......
......@@ -20,7 +20,7 @@ func TestLocalPreimageSource(t *testing.T) {
L2OutputRoot: common.HexToHash("0x2222"),
L2Claim: common.HexToHash("0x3333"),
L2ClaimBlockNumber: 1234,
L2ChainConfig: params.GoerliChainConfig,
L2ChainConfig: params.SepoliaChainConfig,
}
source := NewLocalPreimageSource(cfg)
tests := []struct {
......
......@@ -65,7 +65,7 @@ func OpenGethDB(dataDirPath string, readOnly bool) (*Cheater, error) {
return nil, err
}
ch, err := core.NewBlockChain(db, nil, nil, nil,
beacon.New(ethash.NewFullFaker()), vm.Config{}, nil, nil)
beacon.New(ethash.NewFullFaker()), vm.Config{}, nil)
if err != nil {
_ = db.Close()
return nil, fmt.Errorf("failed to open blockchain around chain db: %w", err)
......
......@@ -40,7 +40,7 @@ FROM --platform=linux/amd64 debian:bullseye-slim as go-build
RUN apt-get update && apt-get install -y curl ca-certificates jq binutils
ENV GO_VERSION=1.21.1
ENV GO_VERSION=1.22.7
# Fetch go manually, rather than using a Go base image, so we can copy the installation into the final stage
RUN curl -sL https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz -o go$GO_VERSION.linux-amd64.tar.gz && \
......
FROM golang:1.23.1-bookworm AS go-base
FROM golang:1.22.7-bookworm AS go-base
RUN go install github.com/tomwright/dasel/v2/cmd/dasel@master
......@@ -32,4 +32,4 @@ SHELL ["/bin/bash", "-c"]
COPY --from=base /root/.foundry/bin/forge /usr/local/bin/forge
COPY --from=base /root/.foundry/bin/cast /usr/local/bin/cast
COPY --from=base /root/.foundry/bin/anvil /usr/local/bin/anvil
COPY --from=go-base /go/bin/dasel /usr/local/bin/dasel
\ No newline at end of file
COPY --from=go-base /go/bin/dasel /usr/local/bin/dasel
......@@ -7,10 +7,10 @@
# All target images use this as base image, and add the final build results.
# It will default to the target platform.
ARG TARGET_BASE_IMAGE=alpine:3.18
ARG TARGET_BASE_IMAGE=alpine:3.20
# We may be cross-building for another platform. Specify which platform we need as builder.
FROM --platform=$BUILDPLATFORM golang:1.21.3-alpine3.18 AS builder
FROM --platform=$BUILDPLATFORM golang:1.22.7-alpine3.20 AS builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment