Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge v1.14.8 #1410

Merged
merged 77 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
de366fd
accounts/abi: embed Go template instead of string literal (#30098)
winniehere Jul 2, 2024
6f2e1cf
params: release Geth v1.14.6
gballet Jul 2, 2024
640e0f1
params: begin v1.14.7 release cycle
gballet Jul 2, 2024
c6cae0f
Merge remote-tracking branch 'gballet/release-1.14.6'
fjl Jul 2, 2024
2d9d423
build: upgrade -dlgo version to Go 1.22.5 (#30112)
sandakersmann Jul 3, 2024
c4b4d05
crypto: remove hardcoded value for secp256k1.N (#30126)
zhiqiangxu Jul 9, 2024
10467ac
go.mod: update uint256 to 1.3.0 (#30134)
holiman Jul 9, 2024
37590b2
eth/catalyst: fix params in failure log (#30131)
arajasek Jul 9, 2024
803dc6b
core/txpool/blobpool: revert #29989, WLock on Nonce (#30142)
MariusVanDerWijden Jul 11, 2024
0aafbb3
params: go-ethereum v1.14.7 stable
fjl Jul 11, 2024
bcaf374
params: begin v1.14.8 release cycle
fjl Jul 11, 2024
aa55f5e
Merge branch 'master' into release/1.14
fjl Jul 11, 2024
cf03784
core/state: fix prefetcher for verkle (#29760)
rjl493456442 Jul 11, 2024
a0631f3
core/txpool/blobpool: use nonce from argument instead of tx.Nonce() (…
minh-bq Jul 15, 2024
79d2327
trie: add RollBackAccount function to verkle trees (#30135)
gballet Jul 15, 2024
4bbe993
p2p: fix ip change log parameter (#30158)
qqqeck Jul 15, 2024
169aa91
cmd/utils: fix typo in flag description (#30127)
jeremyschlatter Jul 15, 2024
a0d2613
core/types: don't modify signature V when reading large chainID (#30157)
danyalprout Jul 15, 2024
8adce57
SECURITY.md: correct PGP key block formatting (#30123)
JeukHwang Jul 15, 2024
71210b0
all: simplify tests using t.TempDir() (#30150)
zhiqiangxu Jul 15, 2024
0d38b0c
eth/catalyst: fix (*SimulatedBeacon).AdjustTime() conversion (#30138)
jmank88 Jul 16, 2024
b530d8e
trie, triedb: remove unnecessary child resolver interface (#30167)
rjl493456442 Jul 16, 2024
15936c6
core/txpool/legacypool: use maps.Keys and maps.Copy (#30091)
mask-pp Jul 16, 2024
c54294b
core/state: don't compute verkle storage tree roots (#30130)
gballet Jul 16, 2024
f59d013
core/rawdb, triedb, cmd: create an isolated disk namespace for verkle…
rjl493456442 Jul 16, 2024
ad49c70
p2p/discover: remove type encPubkey (#30172)
fjl Jul 18, 2024
df3f0a8
go.mod: upgrade to btcsuite/btcd/btcec v2.3.4 (#30181)
AlexanderMint Jul 18, 2024
944718b
ethdb: remove snapshot (#30189)
s1na Jul 22, 2024
380688c
eth/gasprice: remove default from config (#30080)
MariusVanDerWijden Jul 22, 2024
7abe84c
rpc: use stable object in notifier test (#30193)
lightclient Jul 22, 2024
ef583e9
core/state: remove useless metrics (#30184)
rjl493456442 Jul 22, 2024
57e6627
rpc: show more error detail for `invalidMessageError` (#30191)
zhiqiangxu Jul 23, 2024
7026bae
core/tracing: update latest release version (#30211)
s1na Jul 23, 2024
6693fe1
core/txpool: use the cached address in ValidateTransactionWithState (…
minh-bq Jul 23, 2024
1939813
core/state: check db error after intermediate call (#30171)
rjl493456442 Jul 23, 2024
35b4183
cmd/utils: allow configurating blob pool from flags (#30203)
minh-bq Jul 23, 2024
766ce23
core/state: fix SetStorage override behavior (#30185)
rjl493456442 Jul 23, 2024
4ad88e9
triedb/pathdb: print out all trie owner and hash information (#30200)
rjl493456442 Jul 24, 2024
4dfc75d
beacon/types, cmd/devp2p, p2p/enr: clean up uses of fmt.Errorf (#30182)
yukionfire Jul 24, 2024
ac0f220
eth/tracers, internal/ethapi: remove unnecessary map pointer in state…
caseylove Jul 24, 2024
f94baab
internal/ethapi: fix state override test (#30228)
lightclient Jul 26, 2024
b0f66e3
p2p/nat: return correct port for ExtIP NAT (#30234)
dknopik Jul 27, 2024
6e33dbf
p2p: fix flaky test TestServerPortMapping (#30241)
bearpebble Jul 30, 2024
de6d597
p2p/discover: schedule revalidation also when all nodes are excluded …
dknopik Jul 31, 2024
ff6e43e
miner: remove outdated comment (#30248)
darioush Aug 1, 2024
dad8f23
eth/downloader: correct sync mode logging to show old mode (#30219)
smin-k Aug 1, 2024
b635089
all: remove deprecated protobuf dependencies (#30232)
Icarus9913 Aug 1, 2024
67b8137
accounts/abi/bind: add accessList support to base bond contract (#30195)
ysh0566 Aug 1, 2024
e467577
internal/debug: remove memsize (#30253)
fjl Aug 2, 2024
16cf5c5
eth/downloader: gofmt (#30261)
fjl Aug 2, 2024
142c94d
cmd/evm: don't overwrite sender account (#30259)
lightclient Aug 2, 2024
1058695
eth/catalyst: get params.ExcessBlobGas but check with params.BlobGasU…
jsvisa Aug 5, 2024
cf8aa31
params: remove unused les parameters (#30268)
stevemilk Aug 6, 2024
dbc1d04
core/vm/runtime: ensure tracer benchmark calls `OnTxStart` (#30257)
lightclient Aug 6, 2024
e9981bc
ethclient: support networkID in hex format (#30263)
kkqy Aug 6, 2024
b37ac5c
core/vm: improved stack swap performance (#30249)
lmittmann Aug 6, 2024
978041f
signer/core: improve performance of isPrimitiveTypeValid function (#3…
llkhacquan Aug 8, 2024
4a3aed3
core/vm: use uint64 in memory for indices everywhere (#30252)
lmittmann Aug 8, 2024
9ea766d
build: upgrade -dlgo version to Go 1.22.6 (#30273)
sandakersmann Aug 8, 2024
d3dae66
tests: fix TransactionTest to actually run (#30272)
taiking Aug 8, 2024
ebe31df
eth/downloader, core/types: take withdrawals-size into account in dow…
psogv0308 Aug 8, 2024
83e70aa
cmd/evm: fix evm basefee (#30281)
holiman Aug 8, 2024
811a69c
go.mod: update uint256 to 1.3.1 (#30280)
holiman Aug 9, 2024
32a1e06
beacon/engine, consensus/beacon: use params.MaximumExtraDataSize inst…
artjoma Aug 10, 2024
33a13b6
p2p/simulations: remove packages (#30250)
lightclient Aug 12, 2024
5adf4ad
eth/protocols/snap: cleanup dangling account trie nodes due to incomp…
rjl493456442 Aug 12, 2024
880511d
params: release go-ethereum v1.14.8 stable
fjl Aug 12, 2024
a9523b6
Merge branch 'master' into release/1.14
fjl Aug 12, 2024
1901120
Merge pull request #1405 from maticnetwork/develop
cffls Jan 16, 2025
08ffda5
Merge develop into upstream_merge
kamuikatsurgi Jan 22, 2025
f09f89e
make bor && make all successful
kamuikatsurgi Jan 22, 2025
c070fff
Remove unnecessary file introduced and fix Makefile
kamuikatsurgi Jan 22, 2025
78513d7
Merge develop and remove commented code
kamuikatsurgi Jan 30, 2025
cb10335
Merge latest develop branch
kamuikatsurgi Jan 30, 2025
2d2dbcc
Merge develop branch
kamuikatsurgi Jan 31, 2025
c79edcf
Merge develop and add relevant comments
kamuikatsurgi Feb 7, 2025
fc1d1fb
Merge develop
kamuikatsurgi Feb 11, 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
Prev Previous commit
Next Next commit
core/rawdb, triedb, cmd: create an isolated disk namespace for verkle…
… (#30105)

* core, triedb/pathdb, cmd: define verkle state ancient store

* core/rawdb, triedb: add verkle namespace in pathdb
  • Loading branch information
rjl493456442 authored Jul 16, 2024
commit f59d013e4064adbb092b323781104c07550a8bff
3 changes: 2 additions & 1 deletion cmd/geth/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ func removeDB(ctx *cli.Context) error {
// Delete state data
statePaths := []string{
rootDir,
filepath.Join(ancientDir, rawdb.StateFreezerName),
filepath.Join(ancientDir, rawdb.MerkleStateFreezerName),
filepath.Join(ancientDir, rawdb.VerkleStateFreezerName),
}
confirmAndRemoveDB(statePaths, "state data", ctx, removeStateDataFlag.Name)

Expand Down
6 changes: 3 additions & 3 deletions core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func TestVerkleGenesisCommit(t *testing.T) {
}

db := rawdb.NewMemoryDatabase()
triedb := triedb.NewDatabase(db, &triedb.Config{IsVerkle: true, PathDB: pathdb.Defaults})
triedb := triedb.NewDatabase(db, triedb.VerkleDefaults)
block := genesis.MustCommit(db, triedb)
if !bytes.Equal(block.Root().Bytes(), expected) {
t.Fatalf("invalid genesis state root, expected %x, got %x", expected, block.Root())
Expand All @@ -321,8 +321,8 @@ func TestVerkleGenesisCommit(t *testing.T) {
if !triedb.IsVerkle() {
t.Fatalf("expected trie to be verkle")
}

if !rawdb.HasAccountTrieNode(db, nil) {
vdb := rawdb.NewTable(db, string(rawdb.VerklePrefix))
if !rawdb.HasAccountTrieNode(vdb, nil) {
t.Fatal("could not find node")
}
}
12 changes: 11 additions & 1 deletion core/rawdb/accessors_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func DeleteTrieNode(db ethdb.KeyValueWriter, owner common.Hash, path []byte, has

// ReadStateScheme reads the state scheme of persistent state, or none
// if the state is not present in database.
func ReadStateScheme(db ethdb.Reader) string {
func ReadStateScheme(db ethdb.Database) string {
// Check if state in path-based scheme is present.
if HasAccountTrieNode(db, nil) {
return PathScheme
Expand All @@ -255,6 +255,16 @@ func ReadStateScheme(db ethdb.Reader) string {
if id := ReadPersistentStateID(db); id != 0 {
return PathScheme
}
// Check if verkle state in path-based scheme is present.
vdb := NewTable(db, string(VerklePrefix))
if HasAccountTrieNode(vdb, nil) {
return PathScheme
}
// The root node of verkle might be deleted during the initial snap sync,
// check the persistent state id then.
if id := ReadPersistentStateID(vdb); id != 0 {
return PathScheme
}
// In a hash-based scheme, the genesis state is consistently stored
// on the disk. To assess the scheme of the persistent state, it
// suffices to inspect the scheme of the genesis state.
Expand Down
17 changes: 12 additions & 5 deletions core/rawdb/ancient_scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,29 @@ var stateFreezerNoSnappy = map[string]bool{

// The list of identifiers of ancient stores.
var (
ChainFreezerName = "chain" // the folder name of chain segment ancient store.
StateFreezerName = "state" // the folder name of reverse diff ancient store.
ChainFreezerName = "chain" // the folder name of chain segment ancient store.
MerkleStateFreezerName = "state" // the folder name of state history ancient store.
VerkleStateFreezerName = "state_verkle" // the folder name of state history ancient store.
)

// freezers the collections of all builtin freezers.
var freezers = []string{ChainFreezerName, StateFreezerName}
var freezers = []string{ChainFreezerName, MerkleStateFreezerName, VerkleStateFreezerName}

// NewStateFreezer initializes the ancient store for state history.
//
// - if the empty directory is given, initializes the pure in-memory
// state freezer (e.g. dev mode).
// - if non-empty directory is given, initializes the regular file-based
// state freezer.
func NewStateFreezer(ancientDir string, readOnly bool) (ethdb.ResettableAncientStore, error) {
func NewStateFreezer(ancientDir string, verkle bool, readOnly bool) (ethdb.ResettableAncientStore, error) {
if ancientDir == "" {
return NewMemoryFreezer(readOnly, stateFreezerNoSnappy), nil
}
return newResettableFreezer(filepath.Join(ancientDir, StateFreezerName), "eth/db/state", readOnly, stateHistoryTableSize, stateFreezerNoSnappy)
var name string
if verkle {
name = filepath.Join(ancientDir, VerkleStateFreezerName)
} else {
name = filepath.Join(ancientDir, MerkleStateFreezerName)
}
return newResettableFreezer(name, "eth/db/state", readOnly, stateHistoryTableSize, stateFreezerNoSnappy)
}
6 changes: 3 additions & 3 deletions core/rawdb/ancient_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func inspectFreezers(db ethdb.Database) ([]freezerInfo, error) {
}
infos = append(infos, info)

case StateFreezerName:
case MerkleStateFreezerName, VerkleStateFreezerName:
datadir, err := db.AncientDatadir()
if err != nil {
return nil, err
}
f, err := NewStateFreezer(datadir, true)
f, err := NewStateFreezer(datadir, freezer == VerkleStateFreezerName, true)
if err != nil {
continue // might be possible the state freezer is not existent
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func InspectFreezerTable(ancient string, freezerName string, tableName string, s
switch freezerName {
case ChainFreezerName:
path, tables = resolveChainFreezerDir(ancient), chainFreezerNoSnappy
case StateFreezerName:
case MerkleStateFreezerName, VerkleStateFreezerName:
path, tables = filepath.Join(ancient, freezerName), stateFreezerNoSnappy
default:
return fmt.Errorf("unknown freezer, supported ones: %v", freezers)
Expand Down
24 changes: 24 additions & 0 deletions core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
beaconHeaders stat
cliqueSnaps stat

// Verkle statistics
verkleTries stat
verkleStateLookups stat

// Les statistic
chtTrieNodes stat
bloomTrieNodes stat
Expand Down Expand Up @@ -550,6 +554,24 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
bytes.HasPrefix(key, BloomTrieIndexPrefix) ||
bytes.HasPrefix(key, BloomTriePrefix): // Bloomtrie sub
bloomTrieNodes.Add(size)

// Verkle trie data is detected, determine the sub-category
case bytes.HasPrefix(key, VerklePrefix):
remain := key[len(VerklePrefix):]
switch {
case IsAccountTrieNode(remain):
verkleTries.Add(size)
case bytes.HasPrefix(remain, stateIDPrefix) && len(remain) == len(stateIDPrefix)+common.HashLength:
verkleStateLookups.Add(size)
case bytes.Equal(remain, persistentStateIDKey):
metadata.Add(size)
case bytes.Equal(remain, trieJournalKey):
metadata.Add(size)
case bytes.Equal(remain, snapSyncStatusFlagKey):
metadata.Add(size)
default:
unaccounted.Add(size)
}
default:
var accounted bool
for _, meta := range [][]byte{
Expand Down Expand Up @@ -590,6 +612,8 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
{"Key-Value store", "Path trie state lookups", stateLookups.Size(), stateLookups.Count()},
{"Key-Value store", "Path trie account nodes", accountTries.Size(), accountTries.Count()},
{"Key-Value store", "Path trie storage nodes", storageTries.Size(), storageTries.Count()},
{"Key-Value store", "Verkle trie nodes", verkleTries.Size(), verkleTries.Count()},
{"Key-Value store", "Verkle trie state lookups", verkleStateLookups.Size(), verkleStateLookups.Count()},
{"Key-Value store", "Trie preimages", preimages.Size(), preimages.Count()},
{"Key-Value store", "Account snapshot", accountSnaps.Size(), accountSnaps.Count()},
{"Key-Value store", "Storage snapshot", storageSnaps.Size(), storageSnaps.Count()},
Expand Down
7 changes: 7 additions & 0 deletions core/rawdb/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ var (
TrieNodeStoragePrefix = []byte("O") // TrieNodeStoragePrefix + accountHash + hexPath -> trie node
stateIDPrefix = []byte("L") // stateIDPrefix + state root -> state id

// VerklePrefix is the database prefix for Verkle trie data, which includes:
// (a) Trie nodes
// (b) In-memory trie node journal
// (c) Persistent state ID
// (d) State ID lookups, etc.
VerklePrefix = []byte("v")

PreimagePrefix = []byte("secure-key-") // PreimagePrefix + hash -> preimage
configPrefix = []byte("ethereum-config-") // config prefix for the db
genesisPrefix = []byte("ethereum-genesis-") // genesis state prefix for the db
Expand Down
11 changes: 9 additions & 2 deletions triedb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ type Config struct {
// default settings.
var HashDefaults = &Config{
Preimages: false,
IsVerkle: false,
HashDB: hashdb.Defaults,
}

// VerkleDefaults represents a config for holding verkle trie data
// using path-based scheme with default settings.
var VerkleDefaults = &Config{
Preimages: false,
IsVerkle: true,
PathDB: pathdb.Defaults,
}

// backend defines the methods needed to access/update trie nodes in different
// state scheme.
type backend interface {
Expand Down Expand Up @@ -84,7 +93,6 @@ type backend interface {
// relevant with trie nodes and node preimages.
type Database struct {
config *Config // Configuration for trie database
diskdb ethdb.Database // Persistent database to store the snapshot
preimages *preimageStore // The store for caching preimages
backend backend // The backend for managing trie nodes
}
Expand All @@ -102,7 +110,6 @@ func NewDatabase(diskdb ethdb.Database, config *Config) *Database {
}
db := &Database{
config: config,
diskdb: diskdb,
preimages: preimages,
}
if config.HashDB != nil && config.PathDB != nil {
Expand Down
10 changes: 9 additions & 1 deletion triedb/pathdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ func New(diskdb ethdb.Database, config *Config, isVerkle bool) *Database {
}
config = config.sanitize()

// Establish a dedicated database namespace tailored for verkle-specific
// data, ensuring the isolation of both verkle and merkle tree data. It's
// important to note that the introduction of a prefix won't lead to
// substantial storage overhead, as the underlying database will efficiently
// compress the shared key prefix.
if isVerkle {
diskdb = rawdb.NewTable(diskdb, string(rawdb.VerklePrefix))
}
db := &Database{
readOnly: config.ReadOnly,
isVerkle: isVerkle,
Expand Down Expand Up @@ -190,7 +198,7 @@ func (db *Database) repairHistory() error {
// all of them. Fix the tests first.
return nil
}
freezer, err := rawdb.NewStateFreezer(ancient, db.readOnly)
freezer, err := rawdb.NewStateFreezer(ancient, db.isVerkle, db.readOnly)
if err != nil {
log.Crit("Failed to open state history freezer", "err", err)
}
Expand Down
8 changes: 4 additions & 4 deletions triedb/pathdb/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestTruncateHeadHistory(t *testing.T) {
roots []common.Hash
hs = makeHistories(10)
db = rawdb.NewMemoryDatabase()
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false)
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false, false)
)
defer freezer.Close()

Expand Down Expand Up @@ -157,7 +157,7 @@ func TestTruncateTailHistory(t *testing.T) {
roots []common.Hash
hs = makeHistories(10)
db = rawdb.NewMemoryDatabase()
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false)
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false, false)
)
defer freezer.Close()

Expand Down Expand Up @@ -200,7 +200,7 @@ func TestTruncateTailHistories(t *testing.T) {
roots []common.Hash
hs = makeHistories(10)
db = rawdb.NewMemoryDatabase()
freezer, _ = rawdb.NewStateFreezer(t.TempDir()+fmt.Sprintf("%d", i), false)
freezer, _ = rawdb.NewStateFreezer(t.TempDir()+fmt.Sprintf("%d", i), false, false)
)
defer freezer.Close()

Expand Down Expand Up @@ -228,7 +228,7 @@ func TestTruncateOutOfRange(t *testing.T) {
var (
hs = makeHistories(10)
db = rawdb.NewMemoryDatabase()
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false)
freezer, _ = rawdb.NewStateFreezer(t.TempDir(), false, false)
)
defer freezer.Close()

Expand Down