Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3e64938
remove: Verkle-related files with no codebase deps
CPerezz Sep 20, 2025
765a4eb
fixup
CPerezz Sep 20, 2025
8d9e512
refactor: update Prestate and transition logic for binary trie support
CPerezz Sep 22, 2025
c5c6c37
feat: add ChunkifyCode function for EVM bytecode chunking
CPerezz Sep 22, 2025
c243b59
refactor: rename Verkle commands to Binary Trie equivalents
CPerezz Sep 22, 2025
e451687
refactor: update flags and transition logic for Binary Trie support
CPerezz Sep 22, 2025
2b01a27
refactor: update DumpVKTLeaves to DumpBinTrieLeaves and adjust trie u…
CPerezz Sep 22, 2025
5c41727
refactor: update functions and comments for Binary Trie implementation
CPerezz Sep 22, 2025
d9d0372
refactor: rename flags for Binary Trie integration
CPerezz Sep 22, 2025
787fc30
feat: add BinaryCodeChunkKey and BinaryCodeChunkCode functions for co…
CPerezz Sep 22, 2025
d765ba4
feat: introduce TransitionTrie for Binary Trie integration
CPerezz Sep 23, 2025
e0f1af2
refactor: update references to TransitionTrie and BinaryTrie integration
CPerezz Sep 23, 2025
3d754a7
trie/bintrie: fix StemNode serialization to only return actual data
CPerezz Sep 23, 2025
dbea5be
Fix Binary Trie StemNode serialization array size calculation
CPerezz Sep 24, 2025
b7f88c5
various tweaks
gballet Sep 24, 2025
371cf20
more replacements of TransitionTrie with VerkleTrie
gballet Sep 24, 2025
58d9451
fix(state): Use BinaryTrie instead of VerkleTrie when IsVerkle is set
CPerezz Sep 26, 2025
d06392d
fix(bintrie): Remove incorrect type assertion in BinaryTrie.Commit
CPerezz Sep 26, 2025
b6c2848
fix(t8ntool): Add error handling and debug logging to MakePreState
CPerezz Sep 26, 2025
292c231
fix(bintrie): Fix iterator to properly handle StemNode leaf values
CPerezz Sep 26, 2025
85114d6
fix: handle nil child nodes in BinaryTrie InternalNode
CPerezz Sep 26, 2025
b1d8345
fix: preserve Binary Trie in Apply after commit
CPerezz Sep 27, 2025
0195768
fix(t8n): preserve Binary Trie after commit and use correct JSON fiel…
CPerezz Sep 27, 2025
a69a226
fix(t8n): revert change to avoid hardcoded MPT creation.
CPerezz Sep 29, 2025
67fdcc9
fix(t8ntool, bintrie): address PR review comments
CPerezz Sep 29, 2025
0b4b040
fix(t8ntool): update JSON field name for Binary Trie in Prestate
CPerezz Sep 29, 2025
44d9dd0
refactor: use named constants for binary node serialization sizes
CPerezz Sep 29, 2025
98209a5
refactor: replace magic numbers with named constants in Binary Trie
CPerezz Sep 29, 2025
6e124f1
feat: add GetBinaryTreeKeyBasicData function for Binary Trie
CPerezz Sep 29, 2025
8628294
fix(t8ntool, bintrie): leftovers overlooked from review addressed
CPerezz Sep 29, 2025
595fe12
fix(bintrie): rename NodeWidth to StemNodeWidth throughout package
CPerezz Sep 29, 2025
3d8e32c
fix: implement InsertValuesAtStem for HashedNode in Binary Trie
CPerezz Sep 30, 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
77 changes: 0 additions & 77 deletions .github/workflows/stable-spec-tests.yml

This file was deleted.

35 changes: 23 additions & 12 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/bintrie"
"github.com/ethereum/go-ethereum/triedb"
"github.com/holiman/uint256"
"golang.org/x/crypto/sha3"
Expand All @@ -47,7 +48,7 @@ import (
type Prestate struct {
Env stEnv `json:"env"`
Pre types.GenesisAlloc `json:"pre"`
VKT map[common.Hash]hexutil.Bytes `json:"vkt,omitempty"`
BT map[common.Hash]hexutil.Bytes `json:"vkt,omitempty"`
}

//go:generate go run github.com/fjl/gencodec -type ExecutionResult -field-override executionResultMarshaling -out gen_execresult.go
Expand Down Expand Up @@ -418,25 +419,28 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
execRs.Requests = requests
}

// Re-create statedb instance with new root upon the updated database
// for accessing latest states.
// Re-create statedb instance with new root for MPT mode
statedb, err = state.New(root, statedb.Database())
if err != nil {
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not reopen state: %v", err))
}

body, _ := rlp.EncodeToBytes(includedTxs)
return statedb, execRs, body, nil
}

func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prestate, verkle bool) *state.StateDB {
tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true, IsVerkle: verkle})
func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prestate, isBintrie bool) *state.StateDB {
tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true, IsVerkle: isBintrie})
sdb := state.NewDatabase(tdb, nil)

root := types.EmptyRootHash
if verkle {
root = types.EmptyVerkleHash
if isBintrie {
root = types.EmptyBinaryHash
}
statedb, err := state.New(root, sdb)
if err != nil {
panic(fmt.Errorf("failed to create initial statedb: %v", err))
}
statedb, _ := state.New(root, sdb)
for addr, a := range pre.Pre {
statedb.SetCode(addr, a.Code, tracing.CodeChangeUnspecified)
statedb.SetNonce(addr, a.Nonce, tracing.NonceChangeGenesis)
Expand All @@ -450,13 +454,20 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest
if err != nil {
panic(err)
}
// If verkle mode started, establish the conversion
if verkle {
if _, ok := statedb.GetTrie().(*trie.VerkleTrie); ok {
// If bintrie mode started, check if conversion happened
if isBintrie {
if _, ok := statedb.GetTrie().(*bintrie.BinaryTrie); ok {
return statedb
}
//TODO(@CPerezz): Fix this in upstream geth
// If we're in bintrie mode but don't have a BinaryTrie, something went wrong
panic(fmt.Errorf("binary trie mode enabled but trie is %T, not *bintrie.BinaryTrie", statedb.GetTrie()))
}
// For MPT mode, reopen the state with the committed root
statedb, err = state.New(mptRoot, sdb)
if err != nil {
panic(fmt.Errorf("failed to re-open statedb after commit with root %x: %v", mptRoot, err))
}
statedb, _ = state.New(mptRoot, sdb)
return statedb
}

Expand Down
9 changes: 5 additions & 4 deletions cmd/evm/internal/t8ntool/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ var (
"\t<file> - into the file <file> ",
Value: "block.json",
}
OutputVKTFlag = &cli.StringFlag{
OutputBTFlag = &cli.StringFlag{
Name: "output.vkt",
Usage: "Determines where to put the `VKT` of the post-state.\n" +
Usage: "Determines where to put the `BT` of the post-state.\n" +
"\t`stdout` - into the stdout output\n" +
"\t`stderr` - into the stderr output\n" +
"\t<file> - into the file <file> ",
Expand Down Expand Up @@ -139,9 +139,10 @@ var (
Usage: "`stdin` or file name of where to find the transactions list in RLP form.",
Value: "txs.rlp",
}
InputVKTFlag = &cli.StringFlag{
// TODO(@CPerezz): rename `Name` of the file in a follow-up PR (relays on EEST -> https://github.com/ethereum/execution-spec-tests/tree/verkle/main)
InputBTFlag = &cli.StringFlag{
Name: "input.vkt",
Usage: "`stdin` or file name of where to find the prestate VKT.",
Usage: "`stdin` or file name of where to find the prestate BT.",
}
SealCliqueFlag = &cli.StringFlag{
Name: "seal.clique",
Expand Down
Loading
Loading