mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-04 20:21:15 +00:00
Wire the NOMT binary merkle trie engine into geth's triedb/state framework. This adds two new packages: - triedb/nomtdb: backend implementing triedb.backend interface, manages flat state persistence in ethdb and delegates trie ops to nomt/db - trie/nomttrie: NomtTrie implementing state.Trie, accumulates LeafOps during block execution and flushes to NOMT engine on Hash()/Commit() Key design choices: - Single flat keyspace: accounts use keccak256(addr), storage uses keccak256(keccak256(addr) || keccak256(slot)) as 256-bit trie paths - OpenStorageTrie returns the account trie itself (no separate tries) - Flat state (account/storage values) stored in ethdb with prefixed keys - NOMT trie stores only hashes; reads delegate to ethdb flat state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 lines
749 B
Go
22 lines
749 B
Go
// Package nomtdb implements the triedb backend for NOMT (Near-Optimal Merkle
|
|
// Trie), a page-based binary merkle trie engine.
|
|
//
|
|
// NOMT handles only the trie structure (merkle pages). Flat key-value storage
|
|
// (accounts, storage slots) is stored in geth's existing ethdb (PebbleDB)
|
|
// under NOMT-specific key prefixes.
|
|
package nomtdb
|
|
|
|
// Config holds configuration for the NOMT triedb backend.
|
|
type Config struct {
|
|
// DataDir is the directory for NOMT's Bitbox storage files.
|
|
DataDir string
|
|
|
|
// HTCapacity is the number of hash table buckets. Must be a power of 2.
|
|
// Defaults to 1<<20 (~1M buckets) if zero.
|
|
HTCapacity uint64
|
|
}
|
|
|
|
// Defaults is the default configuration for the NOMT backend.
|
|
var Defaults = &Config{
|
|
HTCapacity: 1 << 20,
|
|
}
|