Skip to content

Commit 8fc7db8

Browse files
gballetSuperFluffy
authored andcommitted
Merge v1.14.10
params: begin v1.14.10 release cycle (#30457) genesis: fix dev mode alloc (#30460) Balance being null causes `getGenesisState` to fail as the balance field is required in json marshaling of an account. core: minor fix for the log wrapper with debug purpose (#30454) After this PR, ethereum/go-ethereum#28187, the way to set the default logger is different. This PR only updates the way to set logger in some test cases' comments that existed in the codebase (since this commit ethereum/go-ethereum@b63e3c37a6). Although I am not sure if it a good way to leave the code in the comment, it truly makes me more efficiently to debug and fix the failing test cases. ethdb/pebble: handle errors (#30367) .github: add release maintainers to params/ CODEOWNERS (#30458) build: fix macos builds by working around travis osx flaw (#30479) This should fix ethereum/go-ethereum#30471. See investigation in ethereum/go-ethereum#30478 for more background. beacon, core, eth, miner: integrate witnesses into production Geth (#30069) This PR integrates witness-enabled block production, witness-creating payload execution and stateless cross-validation into the `engine` API. The purpose of the PR is to enable the following use-cases (for API details, please see next section): - Cross validating locally created blocks: - Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to trigger witness creation too. - Call `getPayload` as before to retrieve the new block and also the above created witness. - Call `executeStatelessPayload` against another client to cross-validate the block. - Cross validating locally processed blocks: - Call `newPayloadWithWitness` instead of `newPayload` to trigger witness creation too. - Call `executeStatelessPayload` against another client to cross-validate the block. - Block production for stateless clients (local or MEV builders): - Call `forkchoiceUpdatedWithWitness` instead of `forkchoiceUpdated` to trigger witness creation too. - Call `getPayload` as before to retrieve the new block and also the above created witness. - Propagate witnesses across the consensus libp2p network for stateless Ethereum. - Stateless validator validation: - Call `executeStatelessPayload` with the propagated witness to statelessly validate the block. *Note, the various `WithWitness` methods could also *just be* an additional boolean flag on the base methods, but this PR wanted to keep the methods separate until a final consensus is reached on how to integrate in production.* --- The following `engine` API types are introduced: ```go // StatelessPayloadStatusV1 is the result of a stateless payload execution. type StatelessPayloadStatusV1 struct { Status string `json:"status"` StateRoot common.Hash `json:"stateRoot"` ReceiptsRoot common.Hash `json:"receiptsRoot"` ValidationError *string `json:"validationError"` } ``` - Add `forkchoiceUpdatedWithWitnessV1,2,3` with same params and returns as `forkchoiceUpdatedV1,2,3`, but triggering a stateless witness building if block production is requested. - Extend `getPayloadV2,3` to return `executionPayloadEnvelope` with an additional `witness` field of type `bytes` iff created via `forkchoiceUpdatedWithWitnessV2,3`. - Add `newPayloadWithWitnessV1,2,3,4` with same params and returns as `newPayloadV1,2,3,4`, but triggering a stateless witness creation during payload execution to allow cross validating it. - Extend `payloadStatusV1` with a `witness` field of type `bytes` if returned by `newPayloadWithWitnessV1,2,3,4`. - Add `executeStatelessPayloadV1,2,3,4` with same base params as `newPayloadV1,2,3,4` and one more additional param (`witness`) of type `bytes`. The method returns `statelessPayloadStatusV1`, which mirrors `payloadStatusV1` but replaces `latestValidHash` with `stateRoot` and `receiptRoot`. travis: work around travis/osx/go1.23 setup bug (#30491) This is a work-around for a strange issue with travis, specifically, `os=osx, go: 1.23.1`. When this is used, the actual go that ends up being used is `go1.19.4 darwin/amd64 `. Using `which go`, it told me that the `go` in the path was a softlink at `/Users/travis/gopath/bin/go1.23.1 `. However, this was not true: using `command -v go`, it told me that the actual `go` that was used is a softlink at `/usr/local/bin/go`. This change rewrites the `/usr/local/bin/go` softlink to point to the binary at `/Users/travis/gopath/bin/go1.23.1`, so we get the right go-version. cmd/utils: fix `setEtherbase` (#30488) Make `setEtherbase` fall thorugh and handle `miner.pending.feeRecipient` after showing deprecation-warning for `miner.etherbase`-flag. core/state: fix comment of `mode` (#30490) core/state: commit snapshot only if the base layer exists (#30493) This pull request skips the state snapshot update if the base layer is not existent, eliminating the numerous warning logs after an unclean shutdown. Specifically, Geth will rewind its chain head to a historical block after unclean shutdown and state snapshot will be remained as unchanged waiting for recovery. During this period of time, the snapshot is unusable and all state updates should be ignored/skipped for state snapshot update. internal/ethapi/api: for simulated calls, set gaspool to max value if global gascap is 0 (#30474) In #27720, we introduced RPC global gas cap. A value of `0` means an unlimited gas cap. However, this was not the case for simulated calls. This PR fixes the behaviour. core/rawdb: make sure specified state scheme is valid (#30499) This change exits with error if user provided a `--state.scheme` which is neither `hash` nor `path` internal/ethapi: fix gascap 0 for eth_simulateV1 (#30496) Similar to #30474. core/tracing, core/vm: add ContractCode to the OpContext (#30466) Extends the opcontext interface to include accessor for code being executed in current context. While it is possible to get the code via `statedb.GetCode`, that approach doesn't work for initcode. core/vm: more benchmarks for bls g1/g2-multiexp precompiles (#30459) This change adds more comprehensive benchmarks with a wider-variety of input sizes for g1 and g2 multi exponentiation. p2p/discover: fix flaky tests writing to test.log after completion (#30506) This PR fixes two tests, which had a tendency to sometimes write to the `*testing.T` `log` facility after the test function had completed, which is not allowed. This PR fixes it by using waitgroups to ensure that the handler/logwriter terminates before the test exits. closes #30505 deps: update supranational/blst (#30504) This update should only affect the fuzzers, as far as I know. But it seems like it might also fix some arm/macos compilation issue in ethereum/go-ethereum#30494 Closes #30494 (I think) core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback (#30495) Here we move the method that drops all transactions by temporarily increasing the fee into the TxPool itself. It's better to have it there because we can set it back to the configured value afterwards. This resolves a TODO in the simulated backend. core/txpool/blobpool: revert part of #30437, return all reinject-addresses core/txpool/blobpool: add test to check internal shuffling Revert "core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback" (#30521) Reverts ethereum/go-ethereum#30495 You are free to create a proper Clear method if that's the best way. But one that does a proper cleanup, not some hacky call to set gas which screws up logs, metrics and everything along the way. Also doesn't work for legacy pool local transactions. The current code had a hack in the simulated code, now we have a hack in live txpooling code. No, that's not acceptable. I want the live code to be proper, meaningful API, meaningful comments, meaningful implementation. params: release Geth v1.14.10
1 parent 9c351c7 commit 8fc7db8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1288
-404
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
@@ -94,13 +94,22 @@ type executableDataMarshaling struct {
9494
ExcessBlobGas *hexutil.Uint64
9595
}
9696

97+
// StatelessPayloadStatusV1 is the result of a stateless payload execution.
98+
type StatelessPayloadStatusV1 struct {
99+
Status string `json:"status"`
100+
StateRoot common.Hash `json:"stateRoot"`
101+
ReceiptsRoot common.Hash `json:"receiptsRoot"`
102+
ValidationError *string `json:"validationError"`
103+
}
104+
97105
//go:generate go run github.com/fjl/gencodec -type ExecutionPayloadEnvelope -field-override executionPayloadEnvelopeMarshaling -out gen_epe.go
98106

99107
type ExecutionPayloadEnvelope struct {
100108
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
101109
BlockValue *big.Int `json:"blockValue" gencodec:"required"`
102110
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"`
103111
Override bool `json:"shouldOverrideBuilder"`
112+
Witness *hexutil.Bytes `json:"witness"`
104113
}
105114

106115
type BlobsBundleV1 struct {
@@ -115,9 +124,10 @@ type executionPayloadEnvelopeMarshaling struct {
115124
}
116125

117126
type PayloadStatusV1 struct {
118-
Status string `json:"status"`
119-
LatestValidHash *common.Hash `json:"latestValidHash"`
120-
ValidationError *string `json:"validationError"`
127+
Status string `json:"status"`
128+
Witness *hexutil.Bytes `json:"witness"`
129+
LatestValidHash *common.Hash `json:"latestValidHash"`
130+
ValidationError *string `json:"validationError"`
121131
}
122132

123133
type TransitionConfigurationV1 struct {
@@ -198,6 +208,20 @@ func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
198208
// Withdrawals value will propagate through the returned block. Empty
199209
// Withdrawals value must be passed via non-nil, length 0 value in data.
200210
func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (*types.Block, error) {
211+
block, err := ExecutableDataToBlockNoHash(data, versionedHashes, beaconRoot)
212+
if err != nil {
213+
return nil, err
214+
}
215+
if block.Hash() != data.BlockHash {
216+
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", data.BlockHash, block.Hash())
217+
}
218+
return block, nil
219+
}
220+
221+
// ExecutableDataToBlockNoHash is analogous to ExecutableDataToBlock, but is used
222+
// for stateless execution, so it skips checking if the executable data hashes to
223+
// the requested hash (stateless has to *compute* the root hash, it's not given).
224+
func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (*types.Block, error) {
201225
txs, err := decodeTransactions(data.Transactions)
202226
if err != nil {
203227
return nil, err
@@ -267,13 +291,10 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
267291
ParentBeaconRoot: beaconRoot,
268292
RequestsHash: requestsHash,
269293
}
270-
block := types.NewBlockWithHeader(header)
271-
block = block.WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals, Requests: requests})
272-
block = block.WithWitness(data.ExecutionWitness)
273-
if block.Hash() != data.BlockHash {
274-
return nil, fmt.Errorf("blockhash mismatch, want %x, got %x", data.BlockHash, block.Hash())
275-
}
276-
return block, nil
294+
return types.NewBlockWithHeader(header).
295+
WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals, Requests: requests}).
296+
WithWitness(data.ExecutionWitness),
297+
nil
277298
}
278299

279300
// BlockToExecutableData constructs the ExecutableData structure by filling the

cmd/geth/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ var (
156156
utils.BeaconGenesisRootFlag,
157157
utils.BeaconGenesisTimeFlag,
158158
utils.BeaconCheckpointFlag,
159-
utils.CollectWitnessFlag,
160159
}, utils.NetworkFlags, utils.DatabaseFlags)
161160

162161
rpcFlags = []cli.Flag{

cmd/utils/flags.go

-10
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,6 @@ var (
601601
Usage: "Disables db compaction after import",
602602
Category: flags.LoggingCategory,
603603
}
604-
CollectWitnessFlag = &cli.BoolFlag{
605-
Name: "collectwitness",
606-
Usage: "Enable state witness generation during block execution. Work in progress flag, don't use.",
607-
Category: flags.MiscCategory,
608-
}
609604

610605
// MISC settings
611606
SyncTargetFlag = &cli.StringFlag{
@@ -1361,7 +1356,6 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
13611356
func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
13621357
if ctx.IsSet(MinerEtherbaseFlag.Name) {
13631358
log.Warn("Option --miner.etherbase is deprecated as the etherbase is set by the consensus client post-merge")
1364-
return
13651359
}
13661360
if !ctx.IsSet(MinerPendingFeeRecipientFlag.Name) {
13671361
return
@@ -1817,9 +1811,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
18171811
// TODO(fjl): force-enable this in --dev mode
18181812
cfg.EnablePreimageRecording = ctx.Bool(VMEnableDebugFlag.Name)
18191813
}
1820-
if ctx.IsSet(CollectWitnessFlag.Name) {
1821-
cfg.EnableWitnessCollection = ctx.Bool(CollectWitnessFlag.Name)
1822-
}
18231814

18241815
if ctx.IsSet(RPCGlobalGasCapFlag.Name) {
18251816
cfg.RPCGasCap = ctx.Uint64(RPCGlobalGasCapFlag.Name)
@@ -2252,7 +2243,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
22522243
}
22532244
vmcfg := vm.Config{
22542245
EnablePreimageRecording: ctx.Bool(VMEnableDebugFlag.Name),
2255-
EnableWitnessCollection: ctx.Bool(CollectWitnessFlag.Name),
22562246
}
22572247
if ctx.IsSet(VMTraceFlag.Name) {
22582248
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)