Commit ca85dc42 authored by Michael de Hoog's avatar Michael de Hoog Committed by GitHub

Update to Geth 1.14.7 (#11382)

* chore: update to support geth v1.14.7

* Update geth

* Fix "private key curve is not secp256k1" error

* Temporarily quiet noisy logs

* signature test

* Add comments about S256 curve override fix

* Update geth

* go.mod: update to op-geth v1.101407.0-rc.1

* op-e2e: fix L1/L2 miner settings

* Also update devnet L1 base image

* ci: bump ci-builder in circleci

---------
Co-authored-by: default avatarDanyal Prout <me@dany.al>
Co-authored-by: default avatarprotolambda <proto@protolambda.com>
Co-authored-by: default avatarSebastian Stammler <seb@oplabs.co>
parent e157ed73
......@@ -3,7 +3,7 @@ version: 2.1
parameters:
ci_builder_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.50.0
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.51.0
ci_builder_rust_image:
type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest
......
......@@ -2,9 +2,9 @@ package cmd
import (
"io"
"log/slog"
"os"
"golang.org/x/exp/slog"
"golang.org/x/term"
"github.com/ethereum/go-ethereum/log"
......
......@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/stretchr/testify/require"
......@@ -40,7 +41,7 @@ func TestEVM(t *testing.T) {
require.NoError(t, err)
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger // no-tracer by default, but test_util.MarkdownTracer
var tracer *tracing.Hooks // no-tracer by default, but test_util.MarkdownTracer
for _, f := range testFiles {
t.Run(f.Name(), func(t *testing.T) {
......@@ -102,7 +103,7 @@ func TestEVM(t *testing.T) {
func TestEVM_CloneFlags(t *testing.T) {
//contracts, addrs := testContractsSetup(t)
//var tracer vm.EVMLogger
//var tracer *tracing.Hooks
cases := []struct {
name string
......@@ -156,7 +157,7 @@ func TestEVM_CloneFlags(t *testing.T) {
func TestEVMSingleStep(t *testing.T) {
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger
var tracer *tracing.Hooks
cases := []struct {
name string
......@@ -194,7 +195,7 @@ func TestEVMSingleStep(t *testing.T) {
func TestEVMSysWriteHint(t *testing.T) {
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger
var tracer *tracing.Hooks
cases := []struct {
name string
......@@ -375,7 +376,7 @@ func TestEVMSysWriteHint(t *testing.T) {
func TestEVMFault(t *testing.T) {
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger // no-tracer by default, but see test_util.MarkdownTracer
var tracer *tracing.Hooks // no-tracer by default, but see test_util.MarkdownTracer
sender := common.Address{0x13, 0x37}
env, evmState := testutil.NewEVMEnv(contracts, addrs)
......@@ -422,7 +423,7 @@ func TestEVMFault(t *testing.T) {
func TestHelloEVM(t *testing.T) {
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger // no-tracer by default, but see test_util.MarkdownTracer
var tracer *tracing.Hooks // no-tracer by default, but see test_util.MarkdownTracer
evm := testutil.NewMIPSEVM(contracts, addrs)
evm.SetTracer(tracer)
testutil.LogStepFailureAtCleanup(t, evm)
......@@ -464,7 +465,7 @@ func TestHelloEVM(t *testing.T) {
func TestClaimEVM(t *testing.T) {
contracts, addrs := testContractsSetup(t)
var tracer vm.EVMLogger // no-tracer by default, but see test_util.MarkdownTracer
var tracer *tracing.Hooks // no-tracer by default, but see test_util.MarkdownTracer
evm := testutil.NewMIPSEVM(contracts, addrs)
evm.SetTracer(tracer)
testutil.LogStepFailureAtCleanup(t, evm)
......
......@@ -6,6 +6,7 @@ import (
"math/big"
"os"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
......@@ -122,6 +123,6 @@ func (d *testChain) GetHeader(h common.Hash, n uint64) *types.Header {
}
}
func MarkdownTracer() vm.EVMLogger {
return logger.NewMarkdownLogger(&logger.Config{}, os.Stdout)
func MarkdownTracer() *tracing.Hooks {
return logger.NewMarkdownLogger(&logger.Config{}, os.Stdout).Hooks()
}
......@@ -9,6 +9,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/stretchr/testify/require"
......@@ -33,7 +34,7 @@ func NewMIPSEVM(artifacts *Artifacts, addrs *Addresses) *MIPSEVM {
return &MIPSEVM{env, evmState, addrs, nil, artifacts, math.MaxUint64, nil}
}
func (m *MIPSEVM) SetTracer(tracer vm.EVMLogger) {
func (m *MIPSEVM) SetTracer(tracer *tracing.Hooks) {
m.env.Config.Tracer = tracer
}
......
......@@ -8,11 +8,11 @@ require (
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4
github.com/consensys/gnark-crypto v0.12.1
github.com/crate-crypto/go-kzg-4844 v0.7.0
github.com/crate-crypto/go-kzg-4844 v1.0.0
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-20240803025447-c92ef420eec2
github.com/ethereum/go-ethereum v1.13.15
github.com/ethereum/go-ethereum v1.14.7
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
......@@ -51,9 +51,9 @@ require (
require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
......@@ -63,8 +63,8 @@ require (
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
......@@ -72,28 +72,29 @@ require (
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set/v2 v2.3.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0 // indirect
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fatih/color v1.15.0 // 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/fatih/color v1.16.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/ferranbt/fastssz v0.1.2 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getsentry/sentry-go v0.20.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
......@@ -103,7 +104,7 @@ require (
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/uuid v1.6.0 // indirect
......@@ -129,7 +130,8 @@ require (
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 // indirect
github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c // indirect
github.com/karalabe/hid v1.0.1-0.20240306101548-573246063e52 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
......@@ -189,6 +191,9 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/protolambda/bls12-381-util v0.1.0 // indirect
github.com/protolambda/zrnt v0.32.2 // indirect
github.com/protolambda/ztyp v0.2.2 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.44.0 // indirect
github.com/quic-go/webtransport-go v0.8.0 // indirect
......@@ -221,14 +226,14 @@ require (
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.23.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101315.3-rc.2
replace github.com/ethereum/go-ethereum v1.14.7 => github.com/ethereum-optimism/op-geth v1.101407.0-rc.1
//replace github.com/ethereum/go-ethereum v1.13.9 => ../op-geth
......
This diff is collapsed.
......@@ -62,7 +62,7 @@ func newMiniL2BlockWithNumberParentAndL1Information(numTx int, l2Number *big.Int
Difficulty: common.Big0,
Number: big.NewInt(l1Number),
Time: blockTime,
}, nil, nil, nil, trie.NewStackTrie(nil))
}, nil, nil, trie.NewStackTrie(nil))
l1InfoTx, err := derive.L1InfoDeposit(&defaultTestRollupConfig, eth.SystemConfig{}, 0, eth.BlockToInfo(l1Block), blockTime)
if err != nil {
panic(err)
......@@ -77,7 +77,7 @@ func newMiniL2BlockWithNumberParentAndL1Information(numTx int, l2Number *big.Int
return types.NewBlock(&types.Header{
Number: l2Number,
ParentHash: parent,
}, txs, nil, nil, trie.NewStackTrie(nil))
}, &types.Body{Transactions: txs}, nil, trie.NewStackTrie(nil))
}
// addTooManyBlocks adds blocks to the channel until it hits an error,
......
......@@ -3,6 +3,7 @@ package batcher
import (
"context"
"errors"
"log/slog"
"math/big"
"testing"
"time"
......@@ -10,7 +11,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)
type mockGasPricer struct {
......
......@@ -67,19 +67,19 @@ func ChannelManagerReturnsErrReorg(t *testing.T, batchType uint) {
a := types.NewBlock(&types.Header{
Number: big.NewInt(0),
}, nil, nil, nil, nil)
}, nil, nil, nil)
b := types.NewBlock(&types.Header{
Number: big.NewInt(1),
ParentHash: a.Hash(),
}, nil, nil, nil, nil)
}, nil, nil, nil)
c := types.NewBlock(&types.Header{
Number: big.NewInt(2),
ParentHash: b.Hash(),
}, nil, nil, nil, nil)
}, nil, nil, nil)
x := types.NewBlock(&types.Header{
Number: big.NewInt(2),
ParentHash: common.Hash{0xff},
}, nil, nil, nil, nil)
}, nil, nil, nil)
require.NoError(t, m.AddL2Block(a))
require.NoError(t, m.AddL2Block(b))
......@@ -169,7 +169,7 @@ func ChannelManager_Clear(t *testing.T, batchType uint) {
b := types.NewBlock(&types.Header{
Number: big.NewInt(1),
ParentHash: a.Hash(),
}, nil, nil, nil, nil)
}, nil, nil, nil)
require.NoError(m.AddL2Block(b))
require.Len(m.blocks, 1)
require.Equal(b.Hash(), m.tip)
......
......@@ -271,7 +271,8 @@ func check4844Precompile(ctx context.Context, env *actionEnv) error {
return fmt.Errorf("failed to compute commitment: %w", err)
}
point := kzg4844.Point{}
proof, claim, err := kzg4844.ComputeProof(kzg4844.Blob(x), point)
blob := kzg4844.Blob(x)
proof, claim, err := kzg4844.ComputeProof(&blob, point)
if err != nil {
return fmt.Errorf("failed to compute proof: %w", err)
}
......
......@@ -11,6 +11,7 @@ import (
"path"
"time"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/holiman/uint256"
"github.com/pkg/profile"
"github.com/urfave/cli/v2"
......@@ -258,7 +259,7 @@ func simulate(ctx context.Context, logger log.Logger, conf *params.ChainConfig,
}
for addr, acc := range dump {
state.CreateAccount(addr)
state.SetBalance(addr, uint256.MustFromBig((*big.Int)(&acc.Balance)))
state.SetBalance(addr, uint256.MustFromBig((*big.Int)(&acc.Balance)), tracing.BalanceChangeUnspecified)
state.SetNonce(addr, acc.Nonce)
state.SetCode(addr, acc.Code)
state.SetStorage(addr, acc.Storage)
......
......@@ -3,11 +3,11 @@ package main
import (
"encoding/hex"
"fmt"
"log/slog"
"os"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
......
package main
import (
"log/slog"
"os"
"time"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
......
......@@ -298,7 +298,7 @@ func processBlockRange(
// process each transaction in the block
for j := 0; j < len(b.Transactions); j++ {
tx := b.Transactions[j]
ok, err := checkTransaction(ctx, c, *tx, log)
ok, err := checkTransaction(ctx, c, tx, log)
if err != nil {
log.Error("Failed to Check Tx", "Err", err)
return []result{}, err
......@@ -346,8 +346,8 @@ func batchBlockByNumber(ctx context.Context, c *ethclient.Client, blockNumbers [
}
// checkTransaction will check if a transaction is a user deposit, and not initiated by the system address
func checkTransaction(ctx context.Context, c *ethclient.Client, tx types.Transaction, log log.Logger) (bool, error) {
from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), &tx)
func checkTransaction(ctx context.Context, c *ethclient.Client, tx *types.Transaction, log log.Logger) (bool, error) {
from, err := types.Sender(types.LatestSignerForChainID(tx.ChainId()), tx)
if err != nil {
log.Error("Failed to Get Sender", "Err", err)
return false, err
......@@ -355,7 +355,7 @@ func checkTransaction(ctx context.Context, c *ethclient.Client, tx types.Transac
// we are filtering for deposit transactions which are not system transactions
if tx.Type() == depositType &&
from != systemAddress {
log.Info("Got Transaction", "From", from, "Nonce", *tx.EffectiveNonce(), "Type", tx.Type())
log.Info("Got Transaction", "From", from, "Nonce", tx.EffectiveNonce(), "Type", tx.Type())
return true, nil
}
return false, nil
......
......@@ -3,7 +3,6 @@ package srcmap
import (
"fmt"
"io"
"math/big"
"os"
"strconv"
"strings"
......@@ -192,20 +191,6 @@ type SourceMapTracer struct {
out io.Writer
}
func (s *SourceMapTracer) CaptureTxStart(gasLimit uint64) {}
func (s *SourceMapTracer) CaptureTxEnd(restGas uint64) {}
func (s *SourceMapTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
}
func (s *SourceMapTracer) CaptureEnd(output []byte, gasUsed uint64, err error) {}
func (s *SourceMapTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
}
func (s *SourceMapTracer) CaptureExit(output []byte, gasUsed uint64, err error) {}
func (s *SourceMapTracer) info(codeAddr *common.Address, pc uint64) string {
info := "non-contract"
if codeAddr != nil {
......@@ -243,5 +228,3 @@ func (s *SourceMapTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64
fmt.Fprintf(s.out, "%3d: %x\n", -i, stack[len(stack)-1-i].Bytes32())
}
}
var _ vm.EVMLogger = (*SourceMapTracer)(nil)
......@@ -307,7 +307,7 @@ func (f *FaultDisputeGameContractLatest) ClaimCreditTx(ctx context.Context, reci
call := f.contract.Call(methodClaimCredit, recipient)
_, err := f.multiCaller.SingleCall(ctx, rpcblock.Latest, call)
if err != nil {
return txmgr.TxCandidate{}, fmt.Errorf("%w: %v", ErrSimulationFailed, err.Error())
return txmgr.TxCandidate{}, fmt.Errorf("%w: %w", ErrSimulationFailed, err)
}
return call.ToTxCandidate()
}
......
......@@ -89,7 +89,8 @@ func (l *PreimageLoader) loadBlobPreimage(proof *ProofData) (*types.PreimageOrac
// Compute the KZG proof for the required field element
var point kzg4844.Point
new(big.Int).SetUint64(requiredFieldElement).FillBytes(point[:])
kzgProof, claim, err := kzg4844.ComputeProof(kzg4844.Blob(blob), point)
data := kzg4844.Blob(blob)
kzgProof, claim, err := kzg4844.ComputeProof(&data, point)
if err != nil {
return nil, fmt.Errorf("failed to compute kzg proof: %w", err)
}
......
......@@ -63,15 +63,15 @@ func TestPreimageLoader_SimpleTypes(t *testing.T) {
}
func TestPreimageLoader_BlobPreimage(t *testing.T) {
blob := testBlob()
commitment, err := kzg4844.BlobToCommitment(kzg4844.Blob(blob))
blob := kzg4844.Blob(testBlob())
commitment, err := kzg4844.BlobToCommitment(&blob)
require.NoError(t, err)
fieldIndex := uint64(24)
elementData := blob[fieldIndex<<5 : (fieldIndex+1)<<5]
var point kzg4844.Point
new(big.Int).SetUint64(fieldIndex).FillBytes(point[:])
kzgProof, claim, err := kzg4844.ComputeProof(kzg4844.Blob(blob), point)
kzgProof, claim, err := kzg4844.ComputeProof(&blob, point)
require.NoError(t, err)
elementDataWithLengthPrefix := make([]byte, len(elementData)+lengthPrefixSize)
binary.BigEndian.PutUint64(elementDataWithLengthPrefix[:lengthPrefixSize], uint64(len(elementData)))
......@@ -129,7 +129,7 @@ func TestPreimageLoader_BlobPreimage(t *testing.T) {
t.Run("Valid", func(t *testing.T) {
kv := kvstore.NewMemKV()
loader := NewPreimageLoader(kv.Get)
storeBlob(t, kv, gokzg4844.KZGCommitment(commitment), blob)
storeBlob(t, kv, gokzg4844.KZGCommitment(commitment), gokzg4844.Blob(blob))
actual, err := loader.LoadPreimage(proof)
require.NoError(t, err)
......
......@@ -437,7 +437,7 @@ func (s *stubL1Source) BlockByNumber(_ context.Context, number *big.Int) (*types
if !ok {
return nil, errors.New("not found")
}
return (&types.Block{}).WithBody(txs, nil), nil
return (&types.Block{}).WithBody(types.Body{Transactions: txs}), nil
}
func (s *stubL1Source) TransactionReceipt(_ context.Context, txHash common.Hash) (*types.Receipt, error) {
......
......@@ -207,10 +207,13 @@ func (s *L1Miner) ActL1EndBlock(t Testing) {
s.l1Building = false
s.l1BuildingHeader.GasUsed = s.l1BuildingHeader.GasLimit - uint64(*s.l1GasPool)
s.l1BuildingHeader.Root = s.l1BuildingState.IntermediateRoot(s.l1Cfg.Config.IsEIP158(s.l1BuildingHeader.Number))
block := types.NewBlock(s.l1BuildingHeader, s.l1Transactions, nil, s.l1Receipts, trie.NewStackTrie(nil))
var withdrawals []*types.Withdrawal
if s.l1Cfg.Config.IsShanghai(s.l1BuildingHeader.Number, s.l1BuildingHeader.Time) {
block = block.WithWithdrawals(make([]*types.Withdrawal, 0))
withdrawals = make([]*types.Withdrawal, 0)
}
block := types.NewBlock(s.l1BuildingHeader, &types.Body{Transactions: s.l1Transactions, Withdrawals: withdrawals}, s.l1Receipts, trie.NewStackTrie(nil))
if s.l1Cfg.Config.IsCancun(s.l1BuildingHeader.Number, s.l1BuildingHeader.Time) {
parent := s.l1Chain.GetHeaderByHash(s.l1BuildingHeader.ParentHash)
var (
......
......@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool/blobpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
......@@ -54,6 +55,8 @@ func NewL1Replica(t Testing, log log.Logger, genesis *core.Genesis) *L1Replica {
NetworkId: genesis.Config.ChainID.Uint64(),
Genesis: genesis,
RollupDisableTxPoolGossip: true,
StateScheme: rawdb.HashScheme,
NoPruning: true,
BlobPool: blobpool.Config{
Datadir: t.TempDir(),
Datacap: blobpool.DefaultConfig.Datacap,
......@@ -80,7 +83,6 @@ func NewL1Replica(t Testing, log log.Logger, genesis *core.Genesis) *L1Replica {
backend, err := eth.New(n, ethCfg)
require.NoError(t, err)
backend.Merger().FinalizePoS()
n.RegisterAPIs(tracers.APIs(backend.APIBackend))
......
......@@ -5,6 +5,7 @@ import (
"github.com/ethereum-optimism/optimism/op-e2e/e2eutils"
"github.com/ethereum-optimism/optimism/op-program/client/l2/engineapi"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
......@@ -85,6 +86,8 @@ func newBackend(t e2eutils.TestingBase, genesis *core.Genesis, jwtPath string, o
ethCfg := &ethconfig.Config{
NetworkId: genesis.Config.ChainID.Uint64(),
Genesis: genesis,
StateScheme: rawdb.HashScheme,
NoPruning: true,
}
nodeCfg := &node.Config{
Name: "l2-geth",
......
......@@ -397,7 +397,7 @@ func DeepReorg(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
// Create a var to store the ref for the second to last block of the second sequencing window
var blockA39 eth.L1BlockRef
var aliceL2TxBlock types.Block
var aliceL2TxBlock *types.Block
// Mine enough empty blocks on L1 to reach two sequence windows.
for i := uint64(0); i < sd.RollupCfg.SeqWindowSize*3; i++ {
// At block #50, send a batch to L1 containing all L2 blocks built up to this point.
......@@ -448,7 +448,7 @@ func DeepReorg(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
b0, err := l2Client.BlockByNumber(t.Ctx(), big.NewInt(int64(sequencer.L2Unsafe().Number)))
require.NoError(t, err, "failed to fetch unsafe head of L2 after submitting alice's transaction")
aliceL2TxBlock = *b0
aliceL2TxBlock = b0
}
// Ask sequencer to handle new L1 head and build L2 blocks up to the L1 head
......@@ -572,6 +572,8 @@ func DeepReorg(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
require.Equal(t, verifier.L2Safe(), verifier.L2Unsafe(), "L2 safe and unsafe head should be equal")
checkVerifEngine()
require.NotNil(gt, aliceL2TxBlock)
// Ensure that the parent of the L2 block containing Alice's transaction still exists
b0, err := l2Client.BlockByHash(t.Ctx(), aliceL2TxBlock.ParentHash())
require.NoError(t, err, "Parent of the L2 block containing Alice's transaction should still exist on L2")
......
......@@ -243,12 +243,12 @@ func TestBackupUnsafe(gt *testing.T) {
To: &dp.Addresses.Bob,
Value: e2eutils.Ether(2),
})
block = block.WithBody([]*types.Transaction{block.Transactions()[0], validTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], validTx}})
}
if i == 3 {
// Make block B3 as an invalid block
invalidTx := testutils.RandomTx(rng, big.NewInt(100), signer)
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], invalidTx}})
}
// Add A1, B2, B3, B4, B5 into the channel
err = channelOut.AddBlock(sd.RollupCfg, block)
......@@ -404,12 +404,12 @@ func TestBackupUnsafeReorgForkChoiceInputError(gt *testing.T) {
To: &dp.Addresses.Bob,
Value: e2eutils.Ether(2),
})
block = block.WithBody([]*types.Transaction{block.Transactions()[0], validTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], validTx}})
}
if i == 3 {
// Make block B3 as an invalid block
invalidTx := testutils.RandomTx(rng, big.NewInt(100), signer)
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], invalidTx}})
}
// Add A1, B2, B3, B4, B5 into the channel
err = channelOut.AddBlock(sd.RollupCfg, block)
......@@ -537,12 +537,12 @@ func TestBackupUnsafeReorgForkChoiceNotInputError(gt *testing.T) {
To: &dp.Addresses.Bob,
Value: e2eutils.Ether(2),
})
block = block.WithBody([]*types.Transaction{block.Transactions()[0], validTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], validTx}})
}
if i == 3 {
// Make block B3 as an invalid block
invalidTx := testutils.RandomTx(rng, big.NewInt(100), signer)
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], invalidTx}})
}
// Add A1, B2, B3, B4, B5 into the channel
err = channelOut.AddBlock(sd.RollupCfg, block)
......@@ -919,7 +919,7 @@ func TestInvalidPayloadInSpanBatch(gt *testing.T) {
if i == 8 {
// Make block A8 as an invalid block
invalidTx := testutils.RandomTx(rng, big.NewInt(100), signer)
block = block.WithBody([]*types.Transaction{block.Transactions()[0], invalidTx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], invalidTx}})
}
// Add A1 ~ A12 into the channel
err = channelOut.AddBlock(sd.RollupCfg, block)
......@@ -968,7 +968,7 @@ func TestInvalidPayloadInSpanBatch(gt *testing.T) {
Data: data,
})
// Create valid new block B1 at the same height as A1
block = block.WithBody([]*types.Transaction{block.Transactions()[0], tx}, []*types.Header{})
block = block.WithBody(types.Body{Transactions: []*types.Transaction{block.Transactions()[0], tx}})
}
// Add B1, A2 ~ A12 into the channel
err = channelOut.AddBlock(sd.RollupCfg, block)
......
......@@ -5,13 +5,12 @@ import (
"errors"
"flag"
"fmt"
"log/slog"
"os"
"path/filepath"
"testing"
"time"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
......
......@@ -2,6 +2,7 @@ package devnet
import (
"context"
"log/slog"
"testing"
"time"
......@@ -10,7 +11,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)
func TestDevnet(t *testing.T) {
......
......@@ -3,11 +3,13 @@ package geth
import (
"fmt"
"math/big"
"time"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/txpool/blobpool"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/catalyst"
......@@ -31,6 +33,15 @@ func InitL1(chainID uint64, blockTime uint64, finalizedDistance uint64, genesis
Datacap: blobpool.DefaultConfig.Datacap,
PriceBump: blobpool.DefaultConfig.PriceBump,
},
StateScheme: rawdb.HashScheme,
Miner: miner.Config{
PendingFeeRecipient: common.Address{},
ExtraData: nil,
GasCeil: 0,
GasPrice: nil,
// enough to build blocks within 1 second, but high enough to avoid unnecessary test CPU cycles.
Recommit: time.Millisecond * 400,
},
}
nodeConfig := &node.Config{
Name: "l1-geth",
......@@ -46,8 +57,6 @@ func InitL1(chainID uint64, blockTime uint64, finalizedDistance uint64, genesis
if err != nil {
return nil, nil, err
}
// Activate merge
l1Eth.Merger().FinalizePoS()
// Instead of running a whole beacon node, we run this fake-proof-of-stake sidecar that sequences L1 blocks using the Engine API.
l1Node.RegisterLifecycle(&fakePoS{
......@@ -86,14 +95,14 @@ func InitL2(name string, l2ChainID *big.Int, genesis *core.Genesis, jwtPath stri
ethConfig := &ethconfig.Config{
NetworkId: l2ChainID.Uint64(),
Genesis: genesis,
StateScheme: rawdb.HashScheme,
Miner: miner.Config{
Etherbase: common.Address{},
PendingFeeRecipient: common.Address{},
ExtraData: nil,
GasFloor: 0,
GasCeil: 0,
GasPrice: nil,
Recommit: 0,
NewPayloadTimeout: 0,
// enough to build blocks within 1 second, but high enough to avoid unnecessary test CPU cycles.
Recommit: time.Millisecond * 400,
},
}
nodeConfig := defaultNodeConfig(fmt.Sprintf("l2-geth-%v", name), jwtPath)
......@@ -110,6 +119,7 @@ func createGethNode(l2 bool, nodeCfg *node.Config, ethCfg *ethconfig.Config, opt
return nil, nil, fmt.Errorf("failed to apply geth option %d: %w", i, err)
}
}
ethCfg.StateScheme = rawdb.HashScheme
ethCfg.NoPruning = true // force everything to be an archive node
n, err := node.New(nodeCfg)
if err != nil {
......
......@@ -8,14 +8,14 @@ import (
)
var (
emptyBlob kzg4844.Blob
emptyBlob *kzg4844.Blob
emptyBlobCommit kzg4844.Commitment
emptyBlobProof kzg4844.Proof
)
func init() {
var err error
emptyBlob = kzg4844.Blob{}
emptyBlob = &kzg4844.Blob{}
emptyBlobCommit, err = kzg4844.BlobToCommitment(emptyBlob)
if err != nil {
panic("failed to create empty blob commitment: " + err.Error())
......@@ -30,7 +30,7 @@ func init() {
// https://github.com/ethereum/go-ethereum/commit/2a6beb6a39d7cb3c5906dd4465d65da6efcc73cd
func CreateEmptyBlobTx(withSidecar bool, chainID uint64) *types.BlobTx {
sidecar := &types.BlobTxSidecar{
Blobs: []kzg4844.Blob{emptyBlob},
Blobs: []kzg4844.Blob{*emptyBlob},
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
}
......
......@@ -111,6 +111,7 @@ func initialize(binPath string, config external.Config) error {
cmd := exec.Command(
binPath,
"--datadir", config.DataDir,
"--state.scheme=hash",
"init", config.GenesisPath,
)
return cmd.Run()
......@@ -146,6 +147,7 @@ func execute(binPath string, config external.Config) (*gethSession, error) {
"--ws.port", "0",
"--ws.api", "debug,eth,txpool,net,engine",
"--syncmode=full",
"--state.scheme=hash",
"--nodiscover",
"--port", "0",
"--maxpeers", "0",
......
......@@ -3,6 +3,7 @@ package p2p
import (
"context"
"errors"
"log/slog"
"sync/atomic"
"testing"
"time"
......@@ -10,7 +11,6 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
"github.com/ethereum-optimism/optimism/op-service/clock"
"github.com/ethereum-optimism/optimism/op-service/testlog"
......
package rollup
import (
"log/slog"
"math/big"
"testing"
......@@ -8,7 +9,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)
func u64ptr(n uint64) *uint64 {
......
......@@ -6,12 +6,11 @@ import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-service/eth"
......
......@@ -21,7 +21,7 @@ func RandomSingularBatch(rng *rand.Rand, txCount int, chainID *big.Int) *Singula
if err != nil {
panic("tx Marshal binary" + err.Error())
}
txsEncoded = append(txsEncoded, hexutil.Bytes(txEncoded))
txsEncoded = append(txsEncoded, txEncoded)
}
return &SingularBatch{
ParentHash: testutils.RandomHash(rng),
......
......@@ -63,10 +63,11 @@ func TestChannelOutAddBlock(t *testing.T) {
cout := tcase.ChannelOut(t, &rollupCfg)
header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)}
block := types.NewBlockWithHeader(header).WithBody(
[]*types.Transaction{
types.Body{
Transactions: []*types.Transaction{
types.NewTx(&types.DynamicFeeTx{}),
},
nil,
},
)
err := cout.AddBlock(&rollupCfg, block)
require.Error(t, err)
......
......@@ -5,6 +5,7 @@ import (
"math/big"
"testing"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/google/go-cmp/cmp"
"github.com/holiman/uint256"
"github.com/stretchr/testify/require"
......@@ -234,7 +235,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)
require.NoError(f, err)
state.SetBalance(from, uint256.MustFromBig(BytesToBigInt([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff})))
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{
Origin: from,
State: state,
......
......@@ -175,7 +175,7 @@ func (tx *spanBatchTx) convertToFullTx(nonce, gas uint64, to *common.Address, ch
}
// newSpanBatchTx converts types.Transaction to spanBatchTx
func newSpanBatchTx(tx types.Transaction) (*spanBatchTx, error) {
func newSpanBatchTx(tx *types.Transaction) (*spanBatchTx, error) {
var inner spanBatchTxData
switch tx.Type() {
case types.LegacyTxType:
......
......@@ -39,7 +39,7 @@ func TestSpanBatchTxConvert(t *testing.T) {
tx := testCase.mkTx(rng, signer)
v, r, s := tx.RawSignatureValues()
sbtx, err := newSpanBatchTx(*tx)
sbtx, err := newSpanBatchTx(tx)
require.NoError(t, err)
tx2, err := sbtx.convertToFullTx(tx.Nonce(), tx.Gas(), tx.To(), chainID, v, r, s)
......@@ -77,7 +77,7 @@ func TestSpanBatchTxRoundTrip(t *testing.T) {
for txIdx := 0; txIdx < testCase.trials; txIdx++ {
tx := testCase.mkTx(rng, signer)
sbtx, err := newSpanBatchTx(*tx)
sbtx, err := newSpanBatchTx(tx)
require.NoError(t, err)
sbtxEncoded, err := sbtx.MarshalBinary()
......@@ -100,7 +100,7 @@ func (txData *spanBatchDummyTxData) txType() byte { return types.DepositTxType }
func TestSpanBatchTxInvalidTxType(t *testing.T) {
// span batch never contain deposit tx
depositTx := types.NewTx(&types.DepositTx{})
_, err := newSpanBatchTx(*depositTx)
_, err := newSpanBatchTx(depositTx)
require.ErrorContains(t, err, "invalid tx type")
var sbtx spanBatchTx
......
......@@ -424,7 +424,7 @@ func (sbtx *spanBatchTxs) AddTxs(txs [][]byte, chainID *big.Int) error {
totalBlockTxCount := uint64(len(txs))
offset := sbtx.totalBlockTxCount
for idx := 0; idx < int(totalBlockTxCount); idx++ {
var tx types.Transaction
tx := &types.Transaction{}
if err := tx.UnmarshalBinary(txs[idx]); err != nil {
return errors.New("failed to decode tx")
}
......
......@@ -16,7 +16,8 @@ import (
// RandomL2Block returns a random block whose first transaction is a random pre-Ecotone upgrade
// L1 Info Deposit transaction.
func RandomL2Block(rng *rand.Rand, txCount int, t time.Time) (*types.Block, []*types.Receipt) {
l1Block := types.NewBlock(testutils.RandomHeader(rng), nil, nil, nil, trie.NewStackTrie(nil))
body := types.Body{}
l1Block := types.NewBlock(testutils.RandomHeader(rng), &body, nil, trie.NewStackTrie(nil))
rollupCfg := rollup.Config{}
if testutils.RandomBool(rng) {
t := uint64(0)
......@@ -45,5 +46,5 @@ func RandomL2BlockWithChainIdAndTime(rng *rand.Rand, txCount int, chainId *big.I
for i := 0; i < txCount; i++ {
txs = append(txs, testutils.RandomTx(rng, big.NewInt(int64(rng.Uint32())), signer))
}
return block.WithBody(txs, nil)
return block.WithBody(types.Body{Transactions: txs})
}
package event
import (
"log/slog"
"time"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
)
......
......@@ -74,7 +74,7 @@ func (o *OracleKeyValueStore) Delete(key []byte) error {
panic("not supported")
}
func (o *OracleKeyValueStore) Stat(property string) (string, error) {
func (o *OracleKeyValueStore) Stat() (string, error) {
panic("not supported")
}
......
......@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
......@@ -130,12 +131,12 @@ func TestUpdateState(t *testing.T) {
statedb, err := state.New(genesisBlock.Root(), state.NewDatabase(rawdb.NewDatabase(db)), nil)
require.NoError(t, err)
statedb.SetBalance(userAccount, uint256.NewInt(50))
statedb.SetBalance(userAccount, uint256.NewInt(50), tracing.BalanceChangeUnspecified)
require.Equal(t, uint256.NewInt(50), statedb.GetBalance(userAccount))
statedb.SetNonce(userAccount, uint64(5))
require.Equal(t, uint64(5), statedb.GetNonce(userAccount))
statedb.SetBalance(unknownAccount, uint256.NewInt(60))
statedb.SetBalance(unknownAccount, uint256.NewInt(60), tracing.BalanceChangeUnspecified)
require.Equal(t, uint256.NewInt(60), statedb.GetBalance(unknownAccount))
statedb.SetCode(codeAccount, []byte{1})
require.Equal(t, []byte{1}, statedb.GetCode(codeAccount))
......
......@@ -179,7 +179,10 @@ func createL2Block(t *testing.T, number int) *types.Block {
Number: big.NewInt(int64(number)),
BaseFee: big.NewInt(7),
}
return types.NewBlock(header, []*types.Transaction{types.NewTx(tx)}, nil, nil, trie.NewStackTrie(nil))
body := &types.Body{
Transactions: []*types.Transaction{types.NewTx(tx)},
}
return types.NewBlock(header, body, nil, trie.NewStackTrie(nil))
}
type stubEngineBackend struct {
......
......@@ -124,7 +124,11 @@ func (b *BlockProcessor) AddTx(tx *types.Transaction) error {
}
func (b *BlockProcessor) Assemble() (*types.Block, error) {
return b.dataProvider.Engine().FinalizeAndAssemble(b.dataProvider, b.header, b.state, b.transactions, nil, b.receipts, nil)
body := types.Body{
Transactions: b.transactions,
}
return b.dataProvider.Engine().FinalizeAndAssemble(b.dataProvider, b.header, b.state, &body, b.receipts)
}
func (b *BlockProcessor) Commit() error {
......
......@@ -66,7 +66,7 @@ func (p *PreimageOracle) BlockByHash(blockHash common.Hash) *types.Block {
header := p.headerByBlockHash(blockHash)
txs := p.LoadTransactions(blockHash, header.TxHash)
return types.NewBlockWithHeader(header).WithBody(txs, nil)
return types.NewBlockWithHeader(header).WithBody(types.Body{Transactions: txs})
}
func (p *PreimageOracle) LoadTransactions(blockHash common.Hash, txHash common.Hash) []*types.Transaction {
......
......@@ -31,7 +31,7 @@ func (p DB) Delete(key []byte) error {
return nil
}
func (p DB) Stat(property string) (string, error) {
func (p DB) Stat() (string, error) {
panic("not supported")
}
......
......@@ -2,13 +2,12 @@ package client
import (
"context"
"log/slog"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"golang.org/x/exp/slog"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/stretchr/testify/require"
)
......
......@@ -91,6 +91,9 @@ func SignerFactoryFromConfig(l log.Logger, privateKey, mnemonic, hdPath string,
return nil, common.Address{}, fmt.Errorf("failed to parse the private key: %w", err)
}
}
// we force the curve to Geth's instance, because Geth does an equality check in the nocgo version:
// https://github.com/ethereum/go-ethereum/blob/723b1e36ad6a9e998f06f74cc8b11d51635c6402/crypto/signature_nocgo.go#L82
privKey.PublicKey.Curve = crypto.S256()
fromAddress = crypto.PubkeyToAddress(privKey.PublicKey)
signer = func(chainID *big.Int) SignerFn {
s := PrivateKeySignerFn(privKey, chainID)
......
package crypto
import (
"context"
"math/big"
"testing"
"github.com/stretchr/testify/require"
"github.com/ethereum-optimism/optimism/op-service/signer"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
)
// should be run with CGO_ENABLED=0
func TestSignerFactoryFromMnemonic(t *testing.T) {
mnemonic := "test test test test test test test test test test test junk"
hdPath := "m/44'/60'/0'/0/1"
testSigner(t, "", mnemonic, hdPath, signer.CLIConfig{})
}
func TestSignerFactoryFromKey(t *testing.T) {
priv := "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
testSigner(t, priv, "", "", signer.CLIConfig{})
}
func testSigner(t *testing.T, priv, mnemonic, hdPath string, cfg signer.CLIConfig) {
logger := testlog.Logger(t, log.LevelDebug)
factoryFn, addr, err := SignerFactoryFromConfig(logger, priv, mnemonic, hdPath, cfg)
require.NoError(t, err)
expectedAddr := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
require.Equal(t, expectedAddr, addr)
chainID := big.NewInt(10)
signerFn := factoryFn(chainID) // for chain ID 10
tx := types.NewTx(&types.DynamicFeeTx{
ChainID: chainID,
Nonce: 0,
GasTipCap: big.NewInt(1),
GasFeeCap: big.NewInt(1),
Gas: 21000,
To: nil,
Value: big.NewInt(0),
Data: []byte("test"),
})
signedTx, err := signerFn(context.Background(), addr, tx)
require.NoError(t, err)
gethSigner := types.LatestSignerForChainID(chainID)
sender, err := gethSigner.Sender(signedTx)
require.NoError(t, err)
require.Equal(t, expectedAddr, sender)
}
......@@ -3,6 +3,7 @@ package dial
import (
"context"
"errors"
"log/slog"
"testing"
"time"
......@@ -10,7 +11,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testutils"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
)
func TestWaitRollupSync(t *testing.T) {
......
......@@ -57,7 +57,7 @@ func (b *Blob) TerminalString() string {
}
func (b *Blob) ComputeKZGCommitment() (kzg4844.Commitment, error) {
return kzg4844.BlobToCommitment(*b.KZGBlob())
return kzg4844.BlobToCommitment(b.KZGBlob())
}
// KZGToVersionedHash computes the "blob hash" (a.k.a. versioned-hash) of a blob-commitment, as used in a blob-tx.
......@@ -70,7 +70,7 @@ func KZGToVersionedHash(commitment kzg4844.Commitment) (out common.Hash) {
// VerifyBlobProof verifies that the given blob and proof corresponds to the given commitment,
// returning error if the verification fails.
func VerifyBlobProof(blob *Blob, commitment kzg4844.Commitment, proof kzg4844.Proof) error {
return kzg4844.VerifyBlobProof(*blob.KZGBlob(), commitment, proof)
return kzg4844.VerifyBlobProof(blob.KZGBlob(), commitment, proof)
}
// FromData encodes the given input data into this blob. The encoding scheme is as follows:
......
......@@ -3,11 +3,11 @@ package log
import (
"fmt"
"io"
"log/slog"
"os"
"strings"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"
"golang.org/x/term"
"github.com/ethereum/go-ethereum/log"
......
......@@ -2,8 +2,7 @@ package log
import (
"context"
"golang.org/x/exp/slog"
"log/slog"
)
type LvlSetter interface {
......
......@@ -2,10 +2,10 @@ package log
import (
"context"
"log/slog"
"testing"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
)
......
package log
import (
"log/slog"
"sync"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
)
......
......@@ -2,10 +2,10 @@ package log_test
import (
"io"
"log/slog"
"testing"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
......
......@@ -43,11 +43,11 @@ func (b *BoundContract) DecodeCall(data []byte) (string, *CallResult, error) {
method, err := b.abi.MethodById(data[:4])
if err != nil {
// ABI doesn't return a nicely typed error so treat any failure to find the method as unknown
return "", nil, fmt.Errorf("%w: %v", ErrUnknownMethod, err.Error())
return "", nil, fmt.Errorf("%w: %w", ErrUnknownMethod, err)
}
args, err := method.Inputs.Unpack(data[4:])
if err != nil {
return "", nil, fmt.Errorf("%w: %v", ErrInvalidCall, err.Error())
return "", nil, fmt.Errorf("%w: %w", ErrInvalidCall, err)
}
return method.Name, &CallResult{args}, nil
}
......@@ -58,7 +58,7 @@ func (b *BoundContract) DecodeEvent(log *types.Log) (string, *CallResult, error)
}
event, err := b.abi.EventByID(log.Topics[0])
if err != nil {
return "", nil, fmt.Errorf("%w: %v", ErrUnknownEvent, err.Error())
return "", nil, fmt.Errorf("%w: %w", ErrUnknownEvent, err)
}
argsMap := make(map[string]interface{})
......@@ -69,13 +69,13 @@ func (b *BoundContract) DecodeEvent(log *types.Log) (string, *CallResult, error)
}
}
if err := abi.ParseTopicsIntoMap(argsMap, indexed, log.Topics[1:]); err != nil {
return "", nil, fmt.Errorf("%w indexed topics: %v", ErrInvalidEvent, err.Error())
return "", nil, fmt.Errorf("%w indexed topics: %w", ErrInvalidEvent, err)
}
nonIndexed := event.Inputs.NonIndexed()
if len(nonIndexed) > 0 {
if err := nonIndexed.UnpackIntoMap(argsMap, log.Data); err != nil {
return "", nil, fmt.Errorf("%w non-indexed topics: %v", ErrInvalidEvent, err.Error())
return "", nil, fmt.Errorf("%w non-indexed topics: %w", ErrInvalidEvent, err)
}
}
args := make([]interface{}, 0, len(event.Inputs))
......
......@@ -25,8 +25,8 @@ func makeTestBlobSidecar(index uint64) (eth.IndexedBlobHash, *eth.BlobSidecar) {
// make first byte of test blob match its index so we can easily verify if is returned in the
// expected order
blob[0] = byte(index)
commit, _ := kzg4844.BlobToCommitment(blob)
proof, _ := kzg4844.ComputeBlobProof(blob, commit)
commit, _ := kzg4844.BlobToCommitment(&blob)
proof, _ := kzg4844.ComputeBlobProof(&blob, commit)
hash := eth.KZGToVersionedHash(commit)
idh := eth.IndexedBlobHash{
......
......@@ -2,10 +2,10 @@ package sources
import (
"context"
"log/slog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"golang.org/x/exp/slog"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-service/client"
......
......@@ -2,10 +2,9 @@ package testlog
import (
"context"
"log/slog"
"strings"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
)
......
......@@ -21,14 +21,13 @@ import (
"bufio"
"bytes"
"context"
"log/slog"
"os"
"runtime"
"strconv"
"strings"
"sync"
"golang.org/x/exp/slog"
"github.com/ethereum/go-ethereum/log"
)
......
......@@ -299,7 +299,10 @@ func RandomBlockPrependTxsWithTime(rng *rand.Rand, txCount int, t uint64, ptxs .
}
header.GasUsed = cumulativeGasUsed
header.GasLimit = cumulativeGasUsed + uint64(rng.Int63n(int64(cumulativeGasUsed)))
block := types.NewBlock(header, txs, nil, receipts, trie.NewStackTrie(nil))
body := types.Body{
Transactions: txs,
}
block := types.NewBlock(header, &body, receipts, trie.NewStackTrie(nil))
logIndex := uint(0)
for i, r := range receipts {
r.BlockHash = block.Hash()
......
......@@ -326,8 +326,8 @@ func MakeSidecar(blobs []*eth.Blob) (*types.BlobTxSidecar, []common.Hash, error)
sidecar := &types.BlobTxSidecar{}
blobHashes := make([]common.Hash, 0, len(blobs))
for i, blob := range blobs {
rawBlob := *blob.KZGBlob()
sidecar.Blobs = append(sidecar.Blobs, rawBlob)
rawBlob := blob.KZGBlob()
sidecar.Blobs = append(sidecar.Blobs, *rawBlob)
commitment, err := kzg4844.BlobToCommitment(rawBlob)
if err != nil {
return nil, nil, fmt.Errorf("cannot compute KZG commitment of blob %d in tx candidate: %w", i, err)
......
......@@ -564,7 +564,7 @@ func TestTxMgr_CraftBlobTx(t *testing.T) {
// verify the blobs
for i := range sidecar.Blobs {
require.NoError(t, kzg4844.VerifyBlobProof(sidecar.Blobs[i], sidecar.Commitments[i], sidecar.Proofs[i]))
require.NoError(t, kzg4844.VerifyBlobProof(&sidecar.Blobs[i], sidecar.Commitments[i], sidecar.Proofs[i]))
}
b1 := eth.Blob(sidecar.Blobs[0])
d1, err := b1.ToData()
......
......@@ -10,6 +10,7 @@ import (
"path/filepath"
"strings"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/holiman/uint256"
"github.com/ethereum/go-ethereum/common"
......@@ -337,7 +338,7 @@ func StoragePatch(patch io.Reader, address common.Address) HeadFn {
func SetBalance(addr common.Address, amount *big.Int) HeadFn {
return func(_ *types.Header, headState *state.StateDB) error {
headState.SetBalance(addr, uint256.MustFromBig(amount))
headState.SetBalance(addr, uint256.MustFromBig(amount), tracing.BalanceChangeUnspecified)
return nil
}
}
......
......@@ -31,9 +31,9 @@ func main() {
oplog.SetGlobalLogHandler(log.NewTerminalHandlerWithLevel(os.Stdout, lvl, true))
return nil
}
app.Action = cli.ActionFunc(func(c *cli.Context) error {
app.Action = func(c *cli.Context) error {
return errors.New("see 'cheat' and 'engine' subcommands and --help")
})
}
app.Writer = os.Stdout
app.ErrWriter = os.Stderr
app.Commands = []*cli.Command{
......
......@@ -44,7 +44,7 @@ func getBlock(ctx context.Context, client client.RPC, method string, tag string)
if err != nil {
return nil, err
}
return types.NewBlockWithHeader(&bl.Header).WithBody(bl.Transactions, nil), nil
return types.NewBlockWithHeader(&bl.Header).WithBody(types.Body{Transactions: bl.Transactions}), nil
}
func getHeader(ctx context.Context, client client.RPC, method string, tag string) (*types.Header, error) {
......
FROM ethereum/client-go:v1.13.15
FROM ethereum/client-go:v1.14.7
RUN apk add --no-cache 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