go-ethereum/core
Péter Szilágyi 9326a118c7
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`.
2024-09-20 16:43:42 +03:00
..
asm all: fix mismatched names in comments (#29348) 2024-03-26 21:01:28 +01:00
bloombits all: fix typos in comments (#29873) 2024-05-29 12:24:10 +02:00
forkid all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
rawdb Revert "core/rawdb: remove unused transition status state accessors" (#30449) 2024-09-18 11:53:50 +03:00
state core/state, core/vm: Nyota contract create init simplification (#30409) 2024-09-13 15:37:30 +02:00
stateless beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
tracing core/tracing: add verkle gas change reasons to changelog (#30444) 2024-09-17 16:10:59 +02:00
txpool core, trie: prealloc capacity for maps (#30437) 2024-09-16 10:56:02 +02:00
types core, trie: prealloc capacity for maps (#30437) 2024-09-16 10:56:02 +02:00
vm beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
.gitignore
bench_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
block_validator_test.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
block_validator.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
blockchain_insert.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
blockchain_reader.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
blockchain_repair_test.go core: minor fix for the log wrapper with debug purpose (#30454) 2024-09-19 14:38:06 +08:00
blockchain_sethead_test.go core: minor fix for the log wrapper with debug purpose (#30454) 2024-09-19 14:38:06 +08:00
blockchain_snapshot_test.go core: minor fix for the log wrapper with debug purpose (#30454) 2024-09-19 14:38:06 +08:00
blockchain_test.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
blockchain.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
bloom_indexer.go core: preallocate batch size in bloomIndexer (#25289) 2022-08-03 17:02:09 +02:00
chain_indexer_test.go all: improve some error strings (#29842) 2024-05-28 13:44:40 +02:00
chain_indexer.go core,console: replace noarg fmt.Errorf with errors.New (#27332) 2023-05-25 08:24:09 -04:00
chain_makers_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
chain_makers.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
dao_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
error.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
events.go eth/filters: remove use of event.TypeMux for pending logs (#20312) 2019-12-10 12:39:14 +01:00
evm.go all: use big.Sign to compare with zero (#29490) 2024-04-09 12:14:30 +02:00
gaspool.go core, miner: revert block gas counter in case of invalid transaction (#26799) 2023-03-07 05:23:52 -05:00
gen_genesis.go core: go fmt (#29544) 2024-04-16 15:42:16 +03:00
genesis_alloc.go all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
genesis_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
genesis.go genesis: fix dev mode alloc (#30460) 2024-09-19 14:35:14 +08:00
headerchain_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
headerchain.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
mkalloc.go accounts, cmd/geth, core: close opened files (#29598) 2024-04-30 15:47:21 +02:00
rlp_test.go core: move genesis alloc types to core/types (#29003) 2024-02-16 19:05:33 +01:00
sender_cacher.go all: refactor txpool into it's own package in prep for 4844 2022-10-24 16:35:53 +03:00
state_prefetcher.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
state_processor_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
state_processor.go internal/ethapi: eth_multicall (#27720) 2024-09-06 11:31:00 +02:00
state_transition.go internal/ethapi: eth_multicall (#27720) 2024-09-06 11:31:00 +02:00
stateless.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
txindexer_test.go core: use in-memory freezer for tests (#29720) 2024-05-08 09:43:33 +03:00
txindexer.go core: cache transaction indexing tail in memory (#28908) 2024-02-06 10:44:42 +08:00
types.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00