cmd/utils, core/rawdb, triedb/pathdb: flip hash to path scheme (#29108)
* cmd/utils, core/rawdb, triedb/pathdb: flip hash to path scheme * graphql: run tests in hash mode as the chain maker needs it
This commit is contained in:
parent
db4cf69166
commit
865e1e9f57
|
@ -1668,6 +1668,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 {
|
if ctx.String(GCModeFlag.Name) == "archive" && cfg.TransactionHistory != 0 {
|
||||||
cfg.TransactionHistory = 0
|
cfg.TransactionHistory = 0
|
||||||
log.Warn("Disabled transaction unindexing for archive node")
|
log.Warn("Disabled transaction unindexing for archive node")
|
||||||
|
|
||||||
|
cfg.StateScheme = rawdb.HashScheme
|
||||||
|
log.Warn("Forcing hash state-scheme for archive mode")
|
||||||
}
|
}
|
||||||
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheTrieFlag.Name) {
|
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheTrieFlag.Name) {
|
||||||
cfg.TrieCleanCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheTrieFlag.Name) / 100
|
cfg.TrieCleanCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheTrieFlag.Name) / 100
|
||||||
|
|
|
@ -315,7 +315,7 @@ func ReadStateScheme(db ethdb.Reader) string {
|
||||||
// the stored state.
|
// the stored state.
|
||||||
//
|
//
|
||||||
// - If the provided scheme is none, use the scheme consistent with persistent
|
// - If the provided scheme is none, use the scheme consistent with persistent
|
||||||
// state, or fallback to hash-based scheme if state is empty.
|
// state, or fallback to path-based scheme if state is empty.
|
||||||
//
|
//
|
||||||
// - If the provided scheme is hash, use hash-based scheme or error out if not
|
// - If the provided scheme is hash, use hash-based scheme or error out if not
|
||||||
// compatible with persistent state scheme.
|
// compatible with persistent state scheme.
|
||||||
|
@ -329,10 +329,8 @@ func ParseStateScheme(provided string, disk ethdb.Database) (string, error) {
|
||||||
stored := ReadStateScheme(disk)
|
stored := ReadStateScheme(disk)
|
||||||
if provided == "" {
|
if provided == "" {
|
||||||
if stored == "" {
|
if stored == "" {
|
||||||
// use default scheme for empty database, flip it when
|
log.Info("State schema set to default", "scheme", "path")
|
||||||
// path mode is chosen as default
|
return PathScheme, nil // use default scheme for empty database
|
||||||
log.Info("State schema set to default", "scheme", "hash")
|
|
||||||
return HashScheme, nil
|
|
||||||
}
|
}
|
||||||
log.Info("State scheme set to already existing", "scheme", stored)
|
log.Info("State scheme set to already existing", "scheme", stored)
|
||||||
return stored, nil // reuse scheme of persistent scheme
|
return stored, nil // reuse scheme of persistent scheme
|
||||||
|
|
|
@ -32,6 +32,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/consensus/beacon"
|
"github.com/ethereum/go-ethereum/consensus/beacon"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
@ -452,6 +453,7 @@ func newGQLService(t *testing.T, stack *node.Node, shanghai bool, gspec *core.Ge
|
||||||
TrieDirtyCache: 5,
|
TrieDirtyCache: 5,
|
||||||
TrieTimeout: 60 * time.Minute,
|
TrieTimeout: 60 * time.Minute,
|
||||||
SnapshotCache: 5,
|
SnapshotCache: 5,
|
||||||
|
StateScheme: rawdb.HashScheme,
|
||||||
}
|
}
|
||||||
var engine consensus.Engine = ethash.NewFaker()
|
var engine consensus.Engine = ethash.NewFaker()
|
||||||
if shanghai {
|
if shanghai {
|
||||||
|
|
|
@ -203,7 +203,6 @@ func New(diskdb ethdb.Database, config *Config) *Database {
|
||||||
log.Crit("Failed to disable database", "err", err) // impossible to happen
|
log.Crit("Failed to disable database", "err", err) // impossible to happen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Warn("Path-based state scheme is an experimental feature")
|
|
||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue