From 38e88a113c3974e89f904441488db8581fbd4c4b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Jun 2025 15:55:02 +0200 Subject: [PATCH] core: rename to BlockChainOptions --- cmd/utils/flags.go | 2 +- core/blockchain.go | 14 +++++++------- core/blockchain_repair_test.go | 2 +- core/blockchain_sethead_test.go | 2 +- core/blockchain_snapshot_test.go | 6 +++--- eth/api_debug_test.go | 2 +- eth/backend.go | 2 +- eth/protocols/snap/handler_fuzzing_test.go | 2 +- eth/tracers/api_test.go | 4 ++-- internal/ethapi/api_test.go | 2 +- miner/payload_building_test.go | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 660b40aecd..130e4727e5 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -2164,7 +2164,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh if err != nil { Fatalf("%v", err) } - options := &core.BlockchainOptions{ + options := &core.BlockChainOptions{ TrieCleanLimit: ethconfig.Defaults.TrieCleanCache, NoPrefetch: ctx.Bool(CacheNoPrefetchFlag.Name), TrieDirtyLimit: ethconfig.Defaults.TrieDirtyCache, diff --git a/core/blockchain.go b/core/blockchain.go index 08bd8207a0..723bb56e90 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -149,8 +149,8 @@ const ( BlockChainVersion uint64 = 9 ) -// BlockchainOptions contains the configuration fields for setting up blockchain. -type BlockchainOptions struct { +// BlockChainOptions contains the configuration fields for setting up blockchain. +type BlockChainOptions struct { // Trie database related options TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk @@ -187,7 +187,7 @@ type BlockchainOptions struct { } // triedbConfig derives the configures for trie database. -func (o *BlockchainOptions) triedbConfig(isVerkle bool) *triedb.Config { +func (o *BlockChainOptions) triedbConfig(isVerkle bool) *triedb.Config { config := &triedb.Config{ Preimages: o.Preimages, IsVerkle: isVerkle, @@ -214,7 +214,7 @@ func (o *BlockchainOptions) triedbConfig(isVerkle bool) *triedb.Config { // defaultOptions are the default blockchain options if none are specified by the // user (also used during testing). -var defaultOptions = &BlockchainOptions{ +var defaultOptions = &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -226,7 +226,7 @@ var defaultOptions = &BlockchainOptions{ // BlockchainOptionsWithScheme returns a deep copied default chain config with // a provided state scheme. -func BlockchainOptionsWithScheme(scheme string) *BlockchainOptions { +func BlockchainOptionsWithScheme(scheme string) *BlockChainOptions { config := *defaultOptions config.StateScheme = scheme return &config @@ -255,7 +255,7 @@ type txLookup struct { // canonical chain. type BlockChain struct { chainConfig *params.ChainConfig // Chain & network configuration - options *BlockchainOptions // Blockchain configuration + options *BlockChainOptions // Blockchain configuration db ethdb.Database // Low level persistent database to store final content in snaps *snapshot.Tree // Snapshot tree for fast trie leaf access @@ -311,7 +311,7 @@ type BlockChain struct { // NewBlockChain returns a fully initialised block chain using information // available in the database. It initialises the default Ethereum Validator // and Processor. -func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, options *BlockchainOptions) (*BlockChain, error) { +func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, options *BlockChainOptions) (*BlockChain, error) { if options == nil { options = defaultOptions } diff --git a/core/blockchain_repair_test.go b/core/blockchain_repair_test.go index b8ab1a222d..a0c8647973 100644 --- a/core/blockchain_repair_test.go +++ b/core/blockchain_repair_test.go @@ -1781,7 +1781,7 @@ func testRepairWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme s Config: params.AllEthashProtocolChanges, } engine = ethash.NewFullFaker() - option = &BlockchainOptions{ + option = &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/core/blockchain_sethead_test.go b/core/blockchain_sethead_test.go index 5f415f770f..d4872efc8c 100644 --- a/core/blockchain_sethead_test.go +++ b/core/blockchain_sethead_test.go @@ -1985,7 +1985,7 @@ func testSetHeadWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme Config: params.AllEthashProtocolChanges, } engine = ethash.NewFullFaker() - options = &BlockchainOptions{ + options = &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/core/blockchain_snapshot_test.go b/core/blockchain_snapshot_test.go index 2c64709b27..4ceb0c2079 100644 --- a/core/blockchain_snapshot_test.go +++ b/core/blockchain_snapshot_test.go @@ -310,7 +310,7 @@ func (snaptest *gappedSnapshotTest) test(t *testing.T) { gappedBlocks, _ := GenerateChain(snaptest.gspec.Config, blocks[len(blocks)-1], snaptest.engine, snaptest.genDb, snaptest.gapped, func(i int, b *BlockGen) {}) // Insert a few more blocks without enabling snapshot - var options = &BlockchainOptions{ + var options = &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -383,7 +383,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) { // and state committed. chain.Stop() - config := &BlockchainOptions{ + config := &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -399,7 +399,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) { newchain.Stop() // Restart the chain, the wiper should start working - config = &BlockchainOptions{ + config = &BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/api_debug_test.go b/eth/api_debug_test.go index 2862041f70..a7ded703b9 100644 --- a/eth/api_debug_test.go +++ b/eth/api_debug_test.go @@ -67,7 +67,7 @@ func newTestBlockChain(t *testing.T, n int, gspec *core.Genesis, generator func( _, blocks, _ := core.GenerateChainWithGenesis(gspec, engine, n, generator) // Import the canonical chain - options := &core.BlockchainOptions{ + options := &core.BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/backend.go b/eth/backend.go index c8ec2bb410..1ccd47e829 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -194,7 +194,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { vmConfig = vm.Config{ EnablePreimageRecording: config.EnablePreimageRecording, } - options = &core.BlockchainOptions{ + options = &core.BlockChainOptions{ TrieCleanLimit: config.TrieCleanCache, NoPrefetch: config.NoPrefetch, TrieDirtyLimit: config.TrieDirtyCache, diff --git a/eth/protocols/snap/handler_fuzzing_test.go b/eth/protocols/snap/handler_fuzzing_test.go index 33b957d851..af521c3526 100644 --- a/eth/protocols/snap/handler_fuzzing_test.go +++ b/eth/protocols/snap/handler_fuzzing_test.go @@ -116,7 +116,7 @@ func getChain() *core.BlockChain { Alloc: ga, } _, blocks, _ := core.GenerateChainWithGenesis(gspec, ethash.NewFaker(), 2, func(i int, gen *core.BlockGen) {}) - options := &core.BlockchainOptions{ + options := &core.BlockChainOptions{ TrieCleanLimit: 0, TrieDirtyLimit: 0, TrieTimeLimit: 5 * time.Minute, diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index b1413fe918..90bdcd645d 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -77,7 +77,7 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, generator func(i i _, blocks, _ := core.GenerateChainWithGenesis(gspec, backend.engine, n, generator) // Import the canonical chain - options := &core.BlockchainOptions{ + options := &core.BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, @@ -1144,7 +1144,7 @@ func newTestMergedBackend(t *testing.T, n int, gspec *core.Genesis, generator fu _, blocks, _ := core.GenerateChainWithGenesis(gspec, backend.engine, n, generator) // Import the canonical chain - options := &core.BlockchainOptions{ + options := &core.BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 2614a611f0..81ebe6b05e 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -444,7 +444,7 @@ type testBackend struct { func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.Engine, generator func(i int, b *core.BlockGen)) *testBackend { var ( txLookupLimit = uint64(0) - options = &core.BlockchainOptions{ + options = &core.BlockChainOptions{ TrieCleanLimit: 256, TrieDirtyLimit: 256, TrieTimeLimit: 5 * time.Minute, diff --git a/miner/payload_building_test.go b/miner/payload_building_test.go index 78f3923974..8749839674 100644 --- a/miner/payload_building_test.go +++ b/miner/payload_building_test.go @@ -117,7 +117,7 @@ func newTestWorkerBackend(t *testing.T, chainConfig *params.ChainConfig, engine default: t.Fatalf("unexpected consensus engine type: %T", engine) } - chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockchainOptions{ArchiveMode: true}) + chain, err := core.NewBlockChain(db, gspec, engine, &core.BlockChainOptions{ArchiveMode: true}) if err != nil { t.Fatalf("core.NewBlockChain failed: %v", err) }