go-ethereum/core/vm
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
..
runtime core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
testdata core/vm: update gascosts for BLS12-381 + use gnark instead of kilic (#29441) 2024-04-16 10:53:43 +02:00
analysis_test.go all: use min/max/clear from go1.21 (#29307) 2024-03-21 13:50:13 +01:00
analysis.go core/vm: clarify comment (#27045) 2023-04-04 02:59:40 -04:00
common.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
contract.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
contracts_fuzz_test.go eth/tracers: live chain tracing with hooks (#29189) 2024-03-22 18:53:53 +01:00
contracts_test.go core/vm: add KZG benchmark (#29583) 2024-04-19 13:46:43 +02:00
contracts.go internal/ethapi: eth_multicall (#27720) 2024-09-06 11:31:00 +02:00
doc.go core/vm: remove JIT VM codes (#16362) 2018-03-26 13:48:04 +03:00
eips.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
errors.go core/vm: better error-info for vm errors (#29354) 2024-04-06 12:22:55 +02:00
evm.go core/state, core/vm: Nyota contract create init simplification (#30409) 2024-09-13 15:37:30 +02:00
gas_table_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
gas_table.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
gas.go core/vm: use uint256 in EVM implementation (#20787) 2020-06-08 15:24:40 +03:00
instructions_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
instructions.go core/vm: reuse Memory instances (#30137) 2024-08-20 14:31:06 +02:00
interface.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
interpreter_test.go core/state: state reader abstraction (#29761) 2024-09-05 13:10:47 +03:00
interpreter.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
jump_table_export.go core: fix typos (#28255) 2023-10-10 10:22:03 +02:00
jump_table_test.go all: fix typos in comments (#28881) 2024-02-05 22:16:32 +01:00
jump_table.go core/vm: improved stack swap performance (#30249) 2024-08-06 14:38:47 +02:00
memory_table.go core/vm: implement EIP-5656, mcopy instruction (#26181) 2023-07-11 03:55:34 -04:00
memory_test.go core/vm: implement EIP-5656, mcopy instruction (#26181) 2023-07-11 03:55:34 -04:00
memory.go core/vm: reuse Memory instances (#30137) 2024-08-20 14:31:06 +02:00
opcodes.go eth/tracers/js: fix isPush for push0 (#28520) 2023-11-14 13:14:38 +01:00
operations_acl.go core/vm: remove panic when address is not present (#30414) 2024-09-11 16:11:08 +03:00
operations_verkle.go trie, core/state: Nyota EIP-6800 & EIP-4762 spec updates (#30357) 2024-08-30 14:13:02 +02:00
stack_table.go core/vm: 64 bit memory and gas calculations (#19210) 2019-03-12 11:40:05 +02:00
stack.go core/vm: improved stack swap performance (#30249) 2024-08-06 14:38:47 +02:00