Open holgerd77 opened 7 months ago
Adding this as a separate comment since Kaustinen6 could still be somewhat relevant.
Before Kaustinen 7 launch, we should be able to run these test vectors https://hackmd.io/@jsign/verkle-testing#/4
Relevant repo with tests: https://github.com/ethereum/execution-spec-tests/tree/verkle/main/tests/verkle
Not directly related to Kaustinen7, but update on the state of verkle as of August 26th 2024: https://notes.ethereum.org/@gballet/verkle-and-binary#/
This is a meta issue to collect and update Kaustinen sync instructions as well as other additional docs and some references, so that these get a bit better accessible and do not always "get lost" again with some PRs merged (latest the Kaustinen6 instructions from #3355.
verkle-gen-devnet-6
(Specs/Config)2024-04-12
Instructions
Adopted instructions from #3355 and #3179
EthereumJS Client (Execution)
Verified: 2024-05-02
Install and build EthereumJS as described here (
master
branch)Run EthereumJS with:
(rm -Rf datadir/kaustinen6 && )npm run client:start:ts -- --ignoreStatelessInvalidExecs --dataDir=./datadir --network kaustinen6 --rpcEngine --rpcEngineAuth false
If you want to reduce noice during sync additionally set
--logLevel warn
.Lodestar (lodestar-quickstart)
Verified: -
Clean the lodestar-quickstart datadir's lodestar folder (here
k6data/lodestar
and run the following:/setup.sh --dataDir k6data --network kaustinen6 --justCL
to start lodestar.
Lodestar (manual)
Verified: 2024-05-02
Install Lodestar from source as described here (
g11tech/verge
branch)Clone the EthPandaOps specs/config repo for Verkle:
git clone https://github.com/ethpandaops/verkle-devnets.git
(assumed to be on the same directory level as thelodestar
repo for further relative folder path references)Optional but recommended to copy or symlink the current testnet config folder to the
lodestar
repo for easier/shorter path references:cd lodestart && cp -Rf ../verkle-devnets/network-configs/gen-devnet-6 kaustinen-testnet
Start Lodestar with:
(rm -Rf kaustinen && )./lodestar beacon --paramsFile kaustinen-testnet/config.yaml --genesisStateFile kaustinen-testnet/genesis.ssz --eth1.depositContractDeployBlock 0 --bootnodesFile kaustinen-testnet/boot_enr.yaml --dataDir=kaustinen
Debugging
Ignore Invalid Executions
The
--ignoreStatelessInvalidExecs
option for the EL client (EthereumJS) gives the possibility to ignore invalid executions and just continue with the stateless sync.Invalid blocks are then saved as
json
into a directoryinvalidblocks
within the data directory and can be used for debugging.Executing a Single Block
To execute and debug a single block the EL client can be started with the
--startExecutionFrom
flag. The targeted block needs to have been synced before to be available for execution. There is currently no comfortable functionality to stop execution. This can be hacked in by adding something likeif (block.header.number >= 26) { return }
before theVM.runBlock()
call in the clientVMExecution
. class (link above).Understanding Execution Flow
For understanding and debugging the execution flow the build in
debug
logging functionality of thevm
,evm
andstatemanager
packages can be used and combined, see e.g. this docs for some introduction.Different loggers can be prepended to the client start command like this:
Log output will the look like the following:
The
vm:*
logger (can also used in a more fine grained way likevm:block
) give a high level view on the block execution flow, theevm:*
logger can be used for EVM processing output and thestatemanager:*
logger shows pre and post state as well as state access and verification information.Execution Flow
During a basic execution flow (so: a verkle block execution) roughly the following things happen:
FullEthereumService
class by calling intosetupVerkleVM()
VMExecution.run()
method roughly around hereVM.runBlock()
calls into initVerkleExecutionWitness() fromStatelessVerkleStateManager
passing in block.executionWitness. This is extracting the pre and the post state from the execution witness within the state manager.StatelessVerkleStateManager
, accessing values provided by the pre state (or erroring out otherwise) and following a tree design and key schema (e.g. how to compose together an account nonce key) as described in EIP-6800.statemanager
package. AnAccessWitness
is initialized as part of theStatelessVerkleStateManager
and then passed over along an EVM call inVM.runTx()
and then calls into methods likemessage.accessWitness!.touchTxOriginAndComputeGas(fromAddress)
within the EVM. TheAccessWitness
tracks stem and chunk reads as described in EIP-4762.VM.runBlock()
to compare the accesses tracked by theAccessWitness
with the state included in both pre and post state.Example Data
Verkle Block
An example for a verkle block with execution witness can be found here.