Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cd191ed
trie: introduce UpdateBatch
rjl493456442 Aug 15, 2025
0dcd0e2
integrate trie batch update into statedb intermediate root calculation
jwasinger Aug 18, 2025
d902ace
all: add block access list construction via flag --experimentalbal. …
jwasinger Jul 2, 2025
038f038
more cleanups
jwasinger Aug 4, 2025
10dbc70
fix lint
jwasinger Aug 4, 2025
5ad76d3
update metrics for BAL
jwasinger Aug 4, 2025
206b22b
try fix
jwasinger Aug 4, 2025
e615211
fix
jwasinger Aug 4, 2025
7b40a5b
remove accidental line deletion
jwasinger Aug 5, 2025
c223cec
add debug_getEncodedBlockAccesslist
jwasinger Aug 6, 2025
1c60b1a
remove BAL prefetcher: with account/storage reads planning to be rem…
jwasinger Aug 6, 2025
2322ff9
fix method name
jwasinger Aug 6, 2025
6d26f07
rework of state diff calculation to be much faster. remove diff accu…
jwasinger Aug 7, 2025
43d6f2a
add test data
jwasinger Aug 7, 2025
58cad97
experimental: test gating the tx execution concurrency based on numb…
jwasinger Aug 7, 2025
fb98718
instantiate live state object set from reader upfront. Apply BAL cha…
jwasinger Aug 11, 2025
39abcf1
fix tests
jwasinger Aug 12, 2025
faad758
cleanups and documentation
jwasinger Aug 13, 2025
e14a463
add timer for block preprocess state loading
jwasinger Aug 16, 2025
fb50477
Merge remote-tracking branch 'jwasinger/batch-update-intermediate-roo…
jwasinger Aug 19, 2025
fdb7123
fix build
jwasinger Aug 19, 2025
83ad18c
optimize tx execution prestate instantiation
jwasinger Aug 19, 2025
9bb4956
moar
jwasinger Aug 20, 2025
3f1e343
fix state diff storage instantation
jwasinger Aug 20, 2025
fe78a5e
fix remaining tests
jwasinger Aug 20, 2025
d735907
less statedb copies up-front before beginning tx execution
jwasinger Aug 20, 2025
c0b1fb9
add metric for BAL->diff creation
jwasinger Aug 20, 2025
88bcc7e
wip: don't build state-diffs from BAL up-front
jwasinger Aug 21, 2025
45d8208
fixes
jwasinger Aug 21, 2025
9c394ad
test removal of tx worker concurrency limit
jwasinger Aug 21, 2025
3ef13ca
wip: refactor state processor
jwasinger Aug 26, 2025
845911f
fix regression
jwasinger Aug 26, 2025
ba9e7e2
fix function description comment
jwasinger Aug 26, 2025
d086d0c
glamsterdam->amsterdam
jwasinger Aug 26, 2025
d3a56e2
move some non-encoding-related code out of bal_encoding.go into bal.go
jwasinger Aug 26, 2025
bdac6e8
general refactors. removing dead code
jwasinger Aug 26, 2025
defc1c8
more docs around bal reader
jwasinger Aug 27, 2025
d12a996
add NewPayloadV5 for creating access-list-containing blocks post-amst…
jwasinger Aug 27, 2025
e54f653
enable engine_newPayloadV5
jwasinger Aug 27, 2025
d36ce42
change BAL balance to uint256.Int
jwasinger Aug 27, 2025
0fbc368
remove ssz encoder tags
jwasinger Aug 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion beacon/engine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package engine

import (
"fmt"
"github.com/ethereum/go-ethereum/core/types/bal"
"math/big"
"slices"

Expand Down Expand Up @@ -76,6 +77,7 @@ type ExecutableData struct {
Withdrawals []*types.Withdrawal `json:"withdrawals"`
BlobGasUsed *uint64 `json:"blobGasUsed"`
ExcessBlobGas *uint64 `json:"excessBlobGas"`
BlockAccessList *bal.BlockAccessList `json:"blockAccessList"`
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"`
}

Expand Down Expand Up @@ -274,6 +276,11 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
requestsHash = &h
}

body := types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}
if data.BlockAccessList != nil {
body.AccessList = data.BlockAccessList
}

header := &types.Header{
ParentHash: data.ParentHash,
UncleHash: types.EmptyUncleHash,
Expand All @@ -297,7 +304,7 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
RequestsHash: requestsHash,
}
return types.NewBlockWithHeader(header).
WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}).
WithBody(body).
WithWitness(data.ExecutionWitness),
nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/evm/blockrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
continue
}
result := &testResult{Name: name, Pass: true}
if err := tests[name].Run(false, rawdb.PathScheme, ctx.Bool(WitnessCrossCheckFlag.Name), tracer, func(res error, chain *core.BlockChain) {
if err := tests[name].Run(false, rawdb.PathScheme, ctx.Bool(WitnessCrossCheckFlag.Name), false, tracer, func(res error, chain *core.BlockChain) {
if ctx.Bool(DumpFlag.Name) {
if s, _ := chain.State(); s != nil {
result.State = dump(s)
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ var (
utils.BeaconGenesisTimeFlag,
utils.BeaconCheckpointFlag,
utils.BeaconCheckpointFileFlag,
utils.ExperimentalBALFlag,
}, utils.NetworkFlags, utils.DatabaseFlags)

rpcFlags = []cli.Flag{
Expand Down
11 changes: 11 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,14 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
Value: metrics.DefaultConfig.InfluxDBOrganization,
Category: flags.MetricsCategory,
}

// Block Access List flags

ExperimentalBALFlag = &cli.BoolFlag{
Name: "experimentalbal",
Usage: "Enable block-access-list building when importing post-Cancun blocks, and validation that access lists contained in post-Cancun blocks correctly correspond to the state changes in those blocks. This is used for development purposes only. Do not enable it otherwise.",
Category: flags.MiscCategory,
}
)

var (
Expand Down Expand Up @@ -1852,6 +1860,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.VMTraceJsonConfig = ctx.String(VMTraceJsonConfigFlag.Name)
}
}

cfg.ExperimentalBAL = ctx.Bool(ExperimentalBALFlag.Name)
}

// MakeBeaconLightConfig constructs a beacon light client config based on the
Expand Down Expand Up @@ -2244,6 +2254,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
}
options.VmConfig = vmcfg

options.EnableBAL = ctx.Bool(ExperimentalBALFlag.Name)
chain, err := core.NewBlockChain(chainDb, gspec, engine, options)
if err != nil {
Fatalf("Can't create BlockChain: %v", err)
Expand Down
5 changes: 5 additions & 0 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
// Assign the final state root to header.
header.Root = state.IntermediateRoot(true)

// embed the block access list in the body
if chain.Config().IsAmsterdam(header.Number, header.Time) {
body.AccessList = state.ConstructionBlockAccessList().ToEncodingObj()
}

// Assemble the final block.
block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))

Expand Down
13 changes: 8 additions & 5 deletions core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {

// ValidateState validates the various changes that happen after a state transition,
// such as amount of used gas, the receipt roots and the state root itself.
func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, res *ProcessResult, stateless bool) error {
func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateDB, res *ProcessResult, validateStateRoot, stateless bool) error {
if res == nil {
return errors.New("nil ProcessResult value")
}
Expand Down Expand Up @@ -160,10 +160,13 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
} else if res.Requests != nil {
return errors.New("block has requests before prague fork")
}
// Validate the state root against the received state root and throw
// an error if they don't match.
if root := statedb.IntermediateRoot(v.config.IsEIP158(header.Number)); header.Root != root {
return fmt.Errorf("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())

if validateStateRoot {
// Validate the state root against the received state root and throw
// an error if they don't match.
if root := statedb.IntermediateRoot(v.config.IsEIP158(header.Number)); header.Root != root {
return fmt.Errorf("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())
}
}
return nil
}
Expand Down
Loading