Skip to content

Commit 865e1e9

Browse files
authored
cmd/utils, core/rawdb, triedb/pathdb: flip hash to path scheme (ethereum#29108)
* cmd/utils, core/rawdb, triedb/pathdb: flip hash to path scheme * graphql: run tests in hash mode as the chain maker needs it
1 parent db4cf69 commit 865e1e9

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

cmd/utils/flags.go

+3
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
16681668
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 {
16691669
cfg.TransactionHistory = 0
16701670
log.Warn("Disabled transaction unindexing for archive node")
1671+
1672+
cfg.StateScheme = rawdb.HashScheme
1673+
log.Warn("Forcing hash state-scheme for archive mode")
16711674
}
16721675
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheTrieFlag.Name) {
16731676
cfg.TrieCleanCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheTrieFlag.Name) / 100

core/rawdb/accessors_trie.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func ReadStateScheme(db ethdb.Reader) string {
315315
// the stored state.
316316
//
317317
// - If the provided scheme is none, use the scheme consistent with persistent
318-
// state, or fallback to hash-based scheme if state is empty.
318+
// state, or fallback to path-based scheme if state is empty.
319319
//
320320
// - If the provided scheme is hash, use hash-based scheme or error out if not
321321
// compatible with persistent state scheme.
@@ -329,10 +329,8 @@ func ParseStateScheme(provided string, disk ethdb.Database) (string, error) {
329329
stored := ReadStateScheme(disk)
330330
if provided == "" {
331331
if stored == "" {
332-
// use default scheme for empty database, flip it when
333-
// path mode is chosen as default
334-
log.Info("State schema set to default", "scheme", "hash")
335-
return HashScheme, nil
332+
log.Info("State schema set to default", "scheme", "path")
333+
return PathScheme, nil // use default scheme for empty database
336334
}
337335
log.Info("State scheme set to already existing", "scheme", stored)
338336
return stored, nil // reuse scheme of persistent scheme

graphql/graphql_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/ethereum/go-ethereum/consensus/beacon"
3333
"github.com/ethereum/go-ethereum/consensus/ethash"
3434
"github.com/ethereum/go-ethereum/core"
35+
"github.com/ethereum/go-ethereum/core/rawdb"
3536
"github.com/ethereum/go-ethereum/core/types"
3637
"github.com/ethereum/go-ethereum/core/vm"
3738
"github.com/ethereum/go-ethereum/crypto"
@@ -452,6 +453,7 @@ func newGQLService(t *testing.T, stack *node.Node, shanghai bool, gspec *core.Ge
452453
TrieDirtyCache: 5,
453454
TrieTimeout: 60 * time.Minute,
454455
SnapshotCache: 5,
456+
StateScheme: rawdb.HashScheme,
455457
}
456458
var engine consensus.Engine = ethash.NewFaker()
457459
if shanghai {

triedb/pathdb/database.go

-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ func New(diskdb ethdb.Database, config *Config) *Database {
203203
log.Crit("Failed to disable database", "err", err) // impossible to happen
204204
}
205205
}
206-
log.Warn("Path-based state scheme is an experimental feature")
207206
return db
208207
}
209208

0 commit comments

Comments
 (0)