Skip to content

Commit 546ed2a

Browse files
committed
Merge branch 'upstream-master' into michael/v1.14.10
# Conflicts: # .github/CODEOWNERS # beacon/engine/gen_epe.go # beacon/engine/types.go # core/vm/interpreter.go # eth/catalyst/api_test.go # eth/ethconfig/gen_config.go # miner/payload_building.go # miner/payload_building_test.go # miner/worker.go
2 parents 84ffbca + 80b529e commit 546ed2a

40 files changed

+1257
-396
lines changed

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ jobs:
8585
if: type = push
8686
os: osx
8787
osx_image: xcode14.2
88-
go: 1.23.x
88+
go: 1.23.1 # See https://github.com/ethereum/go-ethereum/pull/30478
8989
env:
9090
- azure-osx
9191
git:
9292
submodules: false # avoid cloning ethereum/tests
9393
script:
94+
- ln -sf /Users/travis/gopath/bin/go1.23.1 /usr/local/bin/go # Work around travis go-setup bug
9495
- go run build/ci.go install -dlgo
9596
- go run build/ci.go archive -type tar -signer OSX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
9697
- go run build/ci.go install -dlgo -arch arm64

beacon/engine/gen_epe.go

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon/engine/types.go

+31-10
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,22 @@ type executableDataMarshaling struct {
105105
ExcessBlobGas *hexutil.Uint64
106106
}
107107

108+
// StatelessPayloadStatusV1 is the result of a stateless payload execution.
109+
type StatelessPayloadStatusV1 struct {
110+
Status string `json:"status"`
111+
StateRoot common.Hash `json:"stateRoot"`
112+
ReceiptsRoot common.Hash `json:"receiptsRoot"`
113+
ValidationError *string `json:"validationError"`
114+
}
115+
108116
//go:generate go run github.com/fjl/gencodec -type ExecutionPayloadEnvelope -field-override executionPayloadEnvelopeMarshaling -out gen_epe.go
109117

110118
type ExecutionPayloadEnvelope struct {
111119
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
112120
BlockValue *big.Int `json:"blockValue" gencodec:"required"`
113121
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"`
114122
Override bool `json:"shouldOverrideBuilder"`
123+
Witness *hexutil.Bytes `json:"witness"`
115124

116125
// OP-Stack: Ecotone specific fields
117126
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot,omitempty"`
@@ -129,9 +138,10 @@ type executionPayloadEnvelopeMarshaling struct {
129138
}
130139

131140
type PayloadStatusV1 struct {
132-
Status string `json:"status"`
133-
LatestValidHash *common.Hash `json:"latestValidHash"`
134-
ValidationError *string `json:"validationError"`
141+
Status string `json:"status"`
142+
Witness *hexutil.Bytes `json:"witness"`
143+
LatestValidHash *common.Hash `json:"latestValidHash"`
144+
ValidationError *string `json:"validationError"`
135145
}
136146

137147
type TransitionConfigurationV1 struct {
@@ -212,6 +222,20 @@ func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
212222
// Withdrawals value will propagate through the returned block. Empty
213223
// Withdrawals value must be passed via non-nil, length 0 value in data.
214224
func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (*types.Block, error) {
225+
block, err := ExecutableDataToBlockNoHash(data, versionedHashes, beaconRoot)
226+
if err != nil {
227+
return nil, err
228+
}
229+
if block.Hash() != data.BlockHash {
230+
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", data.BlockHash, block.Hash())
231+
}
232+
return block, nil
233+
}
234+
235+
// ExecutableDataToBlockNoHash is analogous to ExecutableDataToBlock, but is used
236+
// for stateless execution, so it skips checking if the executable data hashes to
237+
// the requested hash (stateless has to *compute* the root hash, it's not given).
238+
func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (*types.Block, error) {
215239
txs, err := decodeTransactions(data.Transactions)
216240
if err != nil {
217241
return nil, err
@@ -281,13 +305,10 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
281305
ParentBeaconRoot: beaconRoot,
282306
RequestsHash: requestsHash,
283307
}
284-
block := types.NewBlockWithHeader(header)
285-
block = block.WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals, Requests: requests})
286-
block = block.WithWitness(data.ExecutionWitness)
287-
if block.Hash() != data.BlockHash {
288-
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", data.BlockHash, block.Hash())
289-
}
290-
return block, nil
308+
return types.NewBlockWithHeader(header).
309+
WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals, Requests: requests}).
310+
WithWitness(data.ExecutionWitness),
311+
nil
291312
}
292313

293314
// BlockToExecutableData constructs the ExecutableData structure by filling the

cmd/geth/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ var (
174174
utils.BeaconGenesisRootFlag,
175175
utils.BeaconGenesisTimeFlag,
176176
utils.BeaconCheckpointFlag,
177-
utils.CollectWitnessFlag,
178177
}, utils.NetworkFlags, utils.DatabaseFlags)
179178

180179
rpcFlags = []cli.Flag{

cmd/utils/flags.go

-10
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,6 @@ var (
650650
Usage: "Disables db compaction after import",
651651
Category: flags.LoggingCategory,
652652
}
653-
CollectWitnessFlag = &cli.BoolFlag{
654-
Name: "collectwitness",
655-
Usage: "Enable state witness generation during block execution. Work in progress flag, don't use.",
656-
Category: flags.MiscCategory,
657-
}
658653

659654
// MISC settings
660655
SyncTargetFlag = &cli.StringFlag{
@@ -1438,7 +1433,6 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
14381433
func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
14391434
if ctx.IsSet(MinerEtherbaseFlag.Name) {
14401435
log.Warn("Option --miner.etherbase is deprecated as the etherbase is set by the consensus client post-merge")
1441-
return
14421436
}
14431437
if !ctx.IsSet(MinerPendingFeeRecipientFlag.Name) {
14441438
return
@@ -1912,9 +1906,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
19121906
// TODO(fjl): force-enable this in --dev mode
19131907
cfg.EnablePreimageRecording = ctx.Bool(VMEnableDebugFlag.Name)
19141908
}
1915-
if ctx.IsSet(CollectWitnessFlag.Name) {
1916-
cfg.EnableWitnessCollection = ctx.Bool(CollectWitnessFlag.Name)
1917-
}
19181909

19191910
if ctx.IsSet(RPCGlobalGasCapFlag.Name) {
19201911
cfg.RPCGasCap = ctx.Uint64(RPCGlobalGasCapFlag.Name)
@@ -2372,7 +2363,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
23722363
}
23732364
vmcfg := vm.Config{
23742365
EnablePreimageRecording: ctx.Bool(VMEnableDebugFlag.Name),
2375-
EnableWitnessCollection: ctx.Bool(CollectWitnessFlag.Name),
23762366
}
23772367
if ctx.IsSet(VMTraceFlag.Name) {
23782368
if name := ctx.String(VMTraceFlag.Name); name != "" {

core/block_validator.go

-24
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import (
2020
"errors"
2121
"fmt"
2222

23-
"github.com/ethereum/go-ethereum/common"
2423
"github.com/ethereum/go-ethereum/consensus"
2524
"github.com/ethereum/go-ethereum/core/state"
26-
"github.com/ethereum/go-ethereum/core/stateless"
2725
"github.com/ethereum/go-ethereum/core/types"
2826
"github.com/ethereum/go-ethereum/params"
2927
"github.com/ethereum/go-ethereum/trie"
@@ -160,28 +158,6 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
160158
return nil
161159
}
162160

163-
// ValidateWitness cross validates a block execution with stateless remote clients.
164-
//
165-
// Normally we'd distribute the block witness to remote cross validators, wait
166-
// for them to respond and then merge the results. For now, however, it's only
167-
// Geth, so do an internal stateless run.
168-
func (v *BlockValidator) ValidateWitness(witness *stateless.Witness, receiptRoot common.Hash, stateRoot common.Hash) error {
169-
// Run the cross client stateless execution
170-
// TODO(karalabe): Self-stateless for now, swap with other clients
171-
crossReceiptRoot, crossStateRoot, err := ExecuteStateless(v.config, witness)
172-
if err != nil {
173-
return fmt.Errorf("stateless execution failed: %v", err)
174-
}
175-
// Stateless cross execution suceeeded, validate the withheld computed fields
176-
if crossReceiptRoot != receiptRoot {
177-
return fmt.Errorf("cross validator receipt root mismatch (cross: %x local: %x)", crossReceiptRoot, receiptRoot)
178-
}
179-
if crossStateRoot != stateRoot {
180-
return fmt.Errorf("cross validator state root mismatch (cross: %x local: %x)", crossStateRoot, stateRoot)
181-
}
182-
return nil
183-
}
184-
185161
// CalcGasLimit computes the gas limit of the next block after parent. It aims
186162
// to keep the baseline gas close to the provided target, and increase it towards
187163
// the target if the baseline gas is lower.

core/block_validator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func testHeaderVerificationForMerging(t *testing.T, isClique bool) {
201201
t.Fatalf("post-block %d: unexpected result returned: %v", i, result)
202202
case <-time.After(25 * time.Millisecond):
203203
}
204-
chain.InsertBlockWithoutSetHead(postBlocks[i])
204+
chain.InsertBlockWithoutSetHead(postBlocks[i], false)
205205
}
206206

207207
// Verify the blocks with pre-merge blocks and post-merge blocks

0 commit comments

Comments
 (0)