mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
core: improve default config
This commit is contained in:
parent
233e56eff3
commit
b256850507
12 changed files with 82 additions and 80 deletions
|
|
@ -324,9 +324,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) {
|
||||||
genesis := &Genesis{Config: params.AllEthashProtocolChanges}
|
genesis := &Genesis{Config: params.AllEthashProtocolChanges}
|
||||||
makeChainForBench(db, genesis, full, count)
|
makeChainForBench(db, genesis, full, count)
|
||||||
db.Close()
|
db.Close()
|
||||||
options := *defaultConfig
|
options := DefaultConfig().WithArchive(true)
|
||||||
options.ArchiveMode = true
|
|
||||||
|
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
|
@ -337,7 +335,7 @@ func benchReadChain(b *testing.B, full bool, count uint64) {
|
||||||
}
|
}
|
||||||
db = rawdb.NewDatabase(pdb)
|
db = rawdb.NewDatabase(pdb)
|
||||||
|
|
||||||
chain, err := NewBlockChain(db, genesis, ethash.NewFaker(), &options)
|
chain, err := NewBlockChain(db, genesis, ethash.NewFaker(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("error creating chain: %v", err)
|
b.Fatalf("error creating chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ func testHeaderVerification(t *testing.T, scheme string) {
|
||||||
headers[i] = block.Header()
|
headers[i] = block.Header()
|
||||||
}
|
}
|
||||||
// Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
|
// Run the header checker for blocks one-by-one, checking for both valid and invalid nonces
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), options)
|
||||||
defer chain.Stop()
|
defer chain.Stop()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -212,9 +212,10 @@ func (o *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultConfig are the default blockchain options if none are specified by the
|
// DefaultConfig returns the default config.
|
||||||
// user (also used during testing).
|
// Note the returned object is safe to modify!
|
||||||
var defaultConfig = &BlockChainConfig{
|
func DefaultConfig() *BlockChainConfig {
|
||||||
|
return &BlockChainConfig{
|
||||||
TrieCleanLimit: 256,
|
TrieCleanLimit: 256,
|
||||||
TrieDirtyLimit: 256,
|
TrieDirtyLimit: 256,
|
||||||
TrieTimeLimit: 5 * time.Minute,
|
TrieTimeLimit: 5 * time.Minute,
|
||||||
|
|
@ -223,12 +224,18 @@ var defaultConfig = &BlockChainConfig{
|
||||||
SnapshotWait: true,
|
SnapshotWait: true,
|
||||||
ChainHistoryMode: history.KeepAll,
|
ChainHistoryMode: history.KeepAll,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DefaultBlockChainConfig returns the default config with a provided state scheme.
|
// WithArchive enabled/disables archive mode on the config.
|
||||||
func DefaultBlockChainConfig(scheme string) *BlockChainConfig {
|
func (cfg BlockChainConfig) WithArchive(on bool) *BlockChainConfig {
|
||||||
config := *defaultConfig
|
cfg.ArchiveMode = on
|
||||||
config.StateScheme = scheme
|
return &cfg
|
||||||
return &config
|
}
|
||||||
|
|
||||||
|
// WithStateScheme sets the state storage scheme on the config.
|
||||||
|
func (cfg BlockChainConfig) WithStateScheme(scheme string) *BlockChainConfig {
|
||||||
|
cfg.StateScheme = scheme
|
||||||
|
return &cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
// txLookup is wrapper over transaction lookup along with the corresponding
|
// txLookup is wrapper over transaction lookup along with the corresponding
|
||||||
|
|
@ -312,7 +319,7 @@ type BlockChain struct {
|
||||||
// and Processor.
|
// and Processor.
|
||||||
func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, cfg *BlockChainConfig) (*BlockChain, error) {
|
func NewBlockChain(db ethdb.Database, genesis *Genesis, engine consensus.Engine, cfg *BlockChainConfig) (*BlockChain, error) {
|
||||||
if cfg == nil {
|
if cfg == nil {
|
||||||
cfg = DefaultBlockChainConfig(rawdb.HashScheme)
|
cfg = DefaultConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open trie database with provided config
|
// Open trie database with provided config
|
||||||
|
|
|
||||||
|
|
@ -1931,7 +1931,7 @@ func testIssue23496(t *testing.T, scheme string) {
|
||||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||||
}
|
}
|
||||||
engine = ethash.NewFullFaker()
|
engine = ethash.NewFullFaker()
|
||||||
options = DefaultBlockChainConfig(scheme)
|
options = DefaultConfig().WithStateScheme(scheme)
|
||||||
)
|
)
|
||||||
chain, err := NewBlockChain(db, gspec, engine, options)
|
chain, err := NewBlockChain(db, gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1985,7 +1985,7 @@ func testIssue23496(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
chain, err = NewBlockChain(db, gspec, engine, DefaultBlockChainConfig(scheme))
|
chain, err = NewBlockChain(db, gspec, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ func (basic *snapshotTestBasic) prepare(t *testing.T) (*BlockChain, []*types.Blo
|
||||||
}
|
}
|
||||||
engine = ethash.NewFullFaker()
|
engine = ethash.NewFullFaker()
|
||||||
)
|
)
|
||||||
chain, err := NewBlockChain(db, gspec, engine, DefaultBlockChainConfig(basic.scheme))
|
chain, err := NewBlockChain(db, gspec, engine, DefaultConfig().WithStateScheme(basic.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create chain: %v", err)
|
t.Fatalf("Failed to create chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +232,7 @@ func (snaptest *snapshotTest) test(t *testing.T) {
|
||||||
|
|
||||||
// Restart the chain normally
|
// Restart the chain normally
|
||||||
chain.Stop()
|
chain.Stop()
|
||||||
newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme))
|
newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultConfig().WithStateScheme(snaptest.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -274,13 +274,13 @@ func (snaptest *crashSnapshotTest) test(t *testing.T) {
|
||||||
// the crash, we do restart twice here: one after the crash and one
|
// the crash, we do restart twice here: one after the crash and one
|
||||||
// after the normal stop. It's used to ensure the broken snapshot
|
// after the normal stop. It's used to ensure the broken snapshot
|
||||||
// can be detected all the time.
|
// can be detected all the time.
|
||||||
newchain, err := NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme))
|
newchain, err := NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultConfig().WithStateScheme(snaptest.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
newchain.Stop()
|
newchain.Stop()
|
||||||
|
|
||||||
newchain, err = NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme))
|
newchain, err = NewBlockChain(newdb, snaptest.gspec, snaptest.engine, DefaultConfig().WithStateScheme(snaptest.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -325,7 +325,7 @@ func (snaptest *gappedSnapshotTest) test(t *testing.T) {
|
||||||
newchain.Stop()
|
newchain.Stop()
|
||||||
|
|
||||||
// Restart the chain with enabling the snapshot
|
// Restart the chain with enabling the snapshot
|
||||||
options = DefaultBlockChainConfig(snaptest.scheme)
|
options = DefaultConfig().WithStateScheme(snaptest.scheme)
|
||||||
newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, options)
|
newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
|
|
@ -354,7 +354,7 @@ func (snaptest *setHeadSnapshotTest) test(t *testing.T) {
|
||||||
chain.SetHead(snaptest.setHead)
|
chain.SetHead(snaptest.setHead)
|
||||||
chain.Stop()
|
chain.Stop()
|
||||||
|
|
||||||
newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme))
|
newchain, err := NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultConfig().WithStateScheme(snaptest.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -416,7 +416,7 @@ func (snaptest *wipeCrashSnapshotTest) test(t *testing.T) {
|
||||||
tmp.triedb.Close()
|
tmp.triedb.Close()
|
||||||
tmp.stopWithoutSaving()
|
tmp.stopWithoutSaving()
|
||||||
|
|
||||||
newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultBlockChainConfig(snaptest.scheme))
|
newchain, err = NewBlockChain(snaptest.db, snaptest.gspec, snaptest.engine, DefaultConfig().WithStateScheme(snaptest.scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to recreate chain: %v", err)
|
t.Fatalf("Failed to recreate chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ func newCanonical(engine consensus.Engine, n int, full bool, scheme string) (eth
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// Initialize a fresh chain with only a genesis block
|
// Initialize a fresh chain with only a genesis block
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options)
|
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options)
|
||||||
|
|
||||||
// Create and inject the requested chain
|
// Create and inject the requested chain
|
||||||
|
|
@ -724,7 +724,7 @@ func testFastVsFullChains(t *testing.T, scheme string) {
|
||||||
})
|
})
|
||||||
// Import the chain as an archive node for the comparison baseline
|
// Import the chain as an archive node for the comparison baseline
|
||||||
archiveDb := rawdb.NewMemoryDatabase()
|
archiveDb := rawdb.NewMemoryDatabase()
|
||||||
archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer archive.Stop()
|
defer archive.Stop()
|
||||||
|
|
||||||
if n, err := archive.InsertChain(blocks); err != nil {
|
if n, err := archive.InsertChain(blocks); err != nil {
|
||||||
|
|
@ -732,7 +732,7 @@ func testFastVsFullChains(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
// Fast import the chain as a non-archive node to test
|
// Fast import the chain as a non-archive node to test
|
||||||
fastDb := rawdb.NewMemoryDatabase()
|
fastDb := rawdb.NewMemoryDatabase()
|
||||||
fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer fast.Stop()
|
defer fast.Stop()
|
||||||
|
|
||||||
if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil {
|
if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil {
|
||||||
|
|
@ -745,7 +745,7 @@ func testFastVsFullChains(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
defer ancientDb.Close()
|
defer ancientDb.Close()
|
||||||
|
|
||||||
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer ancient.Stop()
|
defer ancient.Stop()
|
||||||
|
|
||||||
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(len(blocks)/2)); err != nil {
|
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(len(blocks)/2)); err != nil {
|
||||||
|
|
@ -852,11 +852,8 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) {
|
||||||
archiveDb := makeDb()
|
archiveDb := makeDb()
|
||||||
defer archiveDb.Close()
|
defer archiveDb.Close()
|
||||||
|
|
||||||
options := *defaultConfig
|
options := DefaultConfig().WithArchive(true).WithStateScheme(scheme)
|
||||||
options.ArchiveMode = true
|
archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), options)
|
||||||
options.StateScheme = scheme
|
|
||||||
|
|
||||||
archive, _ := NewBlockChain(archiveDb, gspec, ethash.NewFaker(), &options)
|
|
||||||
if n, err := archive.InsertChain(blocks); err != nil {
|
if n, err := archive.InsertChain(blocks); err != nil {
|
||||||
t.Fatalf("failed to process block %d: %v", n, err)
|
t.Fatalf("failed to process block %d: %v", n, err)
|
||||||
}
|
}
|
||||||
|
|
@ -869,7 +866,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) {
|
||||||
// Import the chain as a non-archive node and ensure all pointers are updated
|
// Import the chain as a non-archive node and ensure all pointers are updated
|
||||||
fastDb := makeDb()
|
fastDb := makeDb()
|
||||||
defer fastDb.Close()
|
defer fastDb.Close()
|
||||||
fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
fast, _ := NewBlockChain(fastDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer fast.Stop()
|
defer fast.Stop()
|
||||||
|
|
||||||
if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil {
|
if n, err := fast.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0); err != nil {
|
||||||
|
|
@ -882,7 +879,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) {
|
||||||
// Import the chain as a ancient-first node and ensure all pointers are updated
|
// Import the chain as a ancient-first node and ensure all pointers are updated
|
||||||
ancientDb := makeDb()
|
ancientDb := makeDb()
|
||||||
defer ancientDb.Close()
|
defer ancientDb.Close()
|
||||||
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer ancient.Stop()
|
defer ancient.Stop()
|
||||||
|
|
||||||
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil {
|
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil {
|
||||||
|
|
@ -903,7 +900,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) {
|
||||||
for i, block := range blocks {
|
for i, block := range blocks {
|
||||||
headers[i] = block.Header()
|
headers[i] = block.Header()
|
||||||
}
|
}
|
||||||
light, _ := NewBlockChain(lightDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
light, _ := NewBlockChain(lightDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
if n, err := light.InsertHeaderChain(headers); err != nil {
|
if n, err := light.InsertHeaderChain(headers); err != nil {
|
||||||
t.Fatalf("failed to insert header %d: %v", n, err)
|
t.Fatalf("failed to insert header %d: %v", n, err)
|
||||||
}
|
}
|
||||||
|
|
@ -976,7 +973,7 @@ func testChainTxReorgs(t *testing.T, scheme string) {
|
||||||
})
|
})
|
||||||
// Import the chain. This runs all block validation rules.
|
// Import the chain. This runs all block validation rules.
|
||||||
db := rawdb.NewMemoryDatabase()
|
db := rawdb.NewMemoryDatabase()
|
||||||
blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
if i, err := blockchain.InsertChain(chain); err != nil {
|
if i, err := blockchain.InsertChain(chain); err != nil {
|
||||||
t.Fatalf("failed to insert original chain[%d]: %v", i, err)
|
t.Fatalf("failed to insert original chain[%d]: %v", i, err)
|
||||||
}
|
}
|
||||||
|
|
@ -1050,7 +1047,7 @@ func testLogReorgs(t *testing.T, scheme string) {
|
||||||
signer = types.LatestSigner(gspec.Config)
|
signer = types.LatestSigner(gspec.Config)
|
||||||
)
|
)
|
||||||
|
|
||||||
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
rmLogsCh := make(chan RemovedLogsEvent)
|
rmLogsCh := make(chan RemovedLogsEvent)
|
||||||
|
|
@ -1106,7 +1103,7 @@ func testLogRebirth(t *testing.T, scheme string) {
|
||||||
gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}}
|
gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}}
|
||||||
signer = types.LatestSigner(gspec.Config)
|
signer = types.LatestSigner(gspec.Config)
|
||||||
engine = ethash.NewFaker()
|
engine = ethash.NewFaker()
|
||||||
blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, DefaultBlockChainConfig(scheme))
|
blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
)
|
)
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
|
|
@ -1187,7 +1184,7 @@ func testSideLogRebirth(t *testing.T, scheme string) {
|
||||||
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
|
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
|
||||||
gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}}
|
gspec = &Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{addr1: {Balance: big.NewInt(10000000000000000)}}}
|
||||||
signer = types.LatestSigner(gspec.Config)
|
signer = types.LatestSigner(gspec.Config)
|
||||||
blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
blockchain, _ = NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
)
|
)
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
|
|
@ -1386,7 +1383,7 @@ func testEIP155Transition(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
if _, err := blockchain.InsertChain(blocks); err != nil {
|
if _, err := blockchain.InsertChain(blocks); err != nil {
|
||||||
|
|
@ -1479,7 +1476,7 @@ func testEIP161AccountRemoval(t *testing.T, scheme string) {
|
||||||
block.AddTx(tx)
|
block.AddTx(tx)
|
||||||
})
|
})
|
||||||
// account must exist pre eip 161
|
// account must exist pre eip 161
|
||||||
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
blockchain, _ := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
if _, err := blockchain.InsertChain(types.Blocks{blocks[0]}); err != nil {
|
if _, err := blockchain.InsertChain(types.Blocks{blocks[0]}); err != nil {
|
||||||
|
|
@ -1537,7 +1534,7 @@ func testBlockchainHeaderchainReorgConsistency(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
// Import the canonical and fork chain side by side, verifying the current block
|
// Import the canonical and fork chain side by side, verifying the current block
|
||||||
// and current header consistency
|
// and current header consistency
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -1627,7 +1624,7 @@ func testLargeReorgTrieGC(t *testing.T, scheme string) {
|
||||||
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
chain, err := NewBlockChain(db, genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(db, genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -1695,7 +1692,7 @@ func testBlockchainRecovery(t *testing.T, scheme string) {
|
||||||
t.Fatalf("failed to create temp freezer db: %v", err)
|
t.Fatalf("failed to create temp freezer db: %v", err)
|
||||||
}
|
}
|
||||||
defer ancientDb.Close()
|
defer ancientDb.Close()
|
||||||
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
ancient, _ := NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
|
|
||||||
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil {
|
if n, err := ancient.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), uint64(3*len(blocks)/4)); err != nil {
|
||||||
t.Fatalf("failed to insert receipt %d: %v", n, err)
|
t.Fatalf("failed to insert receipt %d: %v", n, err)
|
||||||
|
|
@ -1708,7 +1705,7 @@ func testBlockchainRecovery(t *testing.T, scheme string) {
|
||||||
rawdb.WriteHeadFastBlockHash(ancientDb, midBlock.Hash())
|
rawdb.WriteHeadFastBlockHash(ancientDb, midBlock.Hash())
|
||||||
|
|
||||||
// Reopen broken blockchain again
|
// Reopen broken blockchain again
|
||||||
ancient, _ = NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultBlockChainConfig(scheme))
|
ancient, _ = NewBlockChain(ancientDb, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer ancient.Stop()
|
defer ancient.Stop()
|
||||||
if num := ancient.CurrentBlock().Number.Uint64(); num != 0 {
|
if num := ancient.CurrentBlock().Number.Uint64(); num != 0 {
|
||||||
t.Errorf("head block mismatch: have #%v, want #%v", num, 0)
|
t.Errorf("head block mismatch: have #%v, want #%v", num, 0)
|
||||||
|
|
@ -1751,7 +1748,7 @@ func testLowDiffLongChain(t *testing.T, scheme string) {
|
||||||
diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||||
defer diskdb.Close()
|
defer diskdb.Close()
|
||||||
|
|
||||||
chain, err := NewBlockChain(diskdb, genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(diskdb, genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -1966,7 +1963,7 @@ func testInsertKnownChainData(t *testing.T, typ string, scheme string) {
|
||||||
}
|
}
|
||||||
defer chaindb.Close()
|
defer chaindb.Close()
|
||||||
|
|
||||||
chain, err := NewBlockChain(chaindb, genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(chaindb, genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -2235,7 +2232,7 @@ func getLongAndShortChains(scheme string) (*BlockChain, []*types.Block, []*types
|
||||||
genDb, longChain, _ := GenerateChainWithGenesis(genesis, engine, 80, func(i int, b *BlockGen) {
|
genDb, longChain, _ := GenerateChainWithGenesis(genesis, engine, 80, func(i int, b *BlockGen) {
|
||||||
b.SetCoinbase(common.Address{1})
|
b.SetCoinbase(common.Address{1})
|
||||||
})
|
})
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, fmt.Errorf("failed to create tester chain: %v", err)
|
return nil, nil, nil, nil, fmt.Errorf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -2503,7 +2500,7 @@ func testSideImportPrunedBlocks(t *testing.T, scheme string) {
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
chain, err := NewBlockChain(db, genesis, engine, DefaultBlockChainConfig(scheme))
|
chain, err := NewBlockChain(db, genesis, engine, DefaultConfig().WithStateScheme(scheme))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -2602,7 +2599,7 @@ func testDeleteCreateRevert(t *testing.T, scheme string) {
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
})
|
})
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
|
|
@ -2716,7 +2713,7 @@ func testDeleteRecreateSlots(t *testing.T, scheme string) {
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
})
|
})
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
options.VmConfig = vm.Config{
|
options.VmConfig = vm.Config{
|
||||||
Tracer: logger.NewJSONLogger(nil, os.Stdout),
|
Tracer: logger.NewJSONLogger(nil, os.Stdout),
|
||||||
}
|
}
|
||||||
|
|
@ -2800,7 +2797,7 @@ func testDeleteRecreateAccount(t *testing.T, scheme string) {
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
})
|
})
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
options.VmConfig = vm.Config{
|
options.VmConfig = vm.Config{
|
||||||
Tracer: logger.NewJSONLogger(nil, os.Stdout),
|
Tracer: logger.NewJSONLogger(nil, os.Stdout),
|
||||||
}
|
}
|
||||||
|
|
@ -2977,7 +2974,7 @@ func testDeleteRecreateSlotsAcrossManyBlocks(t *testing.T, scheme string) {
|
||||||
current = exp
|
current = exp
|
||||||
})
|
})
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
options.VmConfig = vm.Config{
|
options.VmConfig = vm.Config{
|
||||||
//Debug: true,
|
//Debug: true,
|
||||||
//Tracer: vm.NewJSONLogger(nil, os.Stdout),
|
//Tracer: vm.NewJSONLogger(nil, os.Stdout),
|
||||||
|
|
@ -3117,7 +3114,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
options.VmConfig = vm.Config{
|
options.VmConfig = vm.Config{
|
||||||
//Debug: true,
|
//Debug: true,
|
||||||
//Tracer: vm.NewJSONLogger(nil, os.Stdout),
|
//Tracer: vm.NewJSONLogger(nil, os.Stdout),
|
||||||
|
|
@ -3209,7 +3206,7 @@ func testEIP2718Transition(t *testing.T, scheme string) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Import the canonical chain
|
// Import the canonical chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
|
|
@ -3304,7 +3301,7 @@ func testEIP1559Transition(t *testing.T, scheme string) {
|
||||||
|
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
})
|
})
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
|
|
@ -3418,7 +3415,7 @@ func testSetCanonical(t *testing.T, scheme string) {
|
||||||
diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
diskdb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||||
defer diskdb.Close()
|
defer diskdb.Close()
|
||||||
|
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(diskdb, gspec, engine, options)
|
chain, err := NewBlockChain(diskdb, gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
|
|
@ -3528,7 +3525,7 @@ func testCanonicalHashMarker(t *testing.T, scheme string) {
|
||||||
_, forkB, _ := GenerateChainWithGenesis(gspec, engine, c.forkB, func(i int, gen *BlockGen) {})
|
_, forkB, _ := GenerateChainWithGenesis(gspec, engine, c.forkB, func(i int, gen *BlockGen) {})
|
||||||
|
|
||||||
// Initialize test chain
|
// Initialize test chain
|
||||||
options := DefaultBlockChainConfig(scheme)
|
options := DefaultConfig().WithStateScheme(scheme)
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
|
|
@ -3860,9 +3857,9 @@ func TestTransientStorageReset(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Initialize the blockchain with 1153 enabled.
|
// Initialize the blockchain with 1153 enabled.
|
||||||
options := *defaultConfig
|
options := DefaultConfig()
|
||||||
options.VmConfig = vmConfig
|
options.VmConfig = vmConfig
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, &options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -3956,11 +3953,11 @@ func TestEIP3651(t *testing.T) {
|
||||||
|
|
||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
})
|
})
|
||||||
options := *defaultConfig
|
options := DefaultConfig()
|
||||||
options.VmConfig = vm.Config{
|
options.VmConfig = vm.Config{
|
||||||
Tracer: logger.NewMarkdownLogger(&logger.Config{}, os.Stderr).Hooks(),
|
Tracer: logger.NewMarkdownLogger(&logger.Config{}, os.Stderr).Hooks(),
|
||||||
}
|
}
|
||||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, &options)
|
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), gspec, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tester chain: %v", err)
|
t.Fatalf("failed to create tester chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -4219,7 +4216,7 @@ func testChainReorgSnapSync(t *testing.T, ancientLimit uint64) {
|
||||||
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
options := DefaultBlockChainConfig(rawdb.PathScheme)
|
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
chain, _ := NewBlockChain(db, gspec, beacon.New(ethash.NewFaker()), options)
|
chain, _ := NewBlockChain(db, gspec, beacon.New(ethash.NewFaker()), options)
|
||||||
defer chain.Stop()
|
defer chain.Stop()
|
||||||
|
|
||||||
|
|
@ -4330,13 +4327,13 @@ func testInsertChainWithCutoff(t *testing.T, cutoff uint64, ancientLimit uint64,
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Enable pruning in cache config.
|
// Enable pruning in cache config.
|
||||||
config := DefaultBlockChainConfig(rawdb.PathScheme)
|
config := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
config.ChainHistoryMode = history.KeepPostMerge
|
config.ChainHistoryMode = history.KeepPostMerge
|
||||||
|
|
||||||
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
db, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
options := DefaultBlockChainConfig(rawdb.PathScheme)
|
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
chain, _ := NewBlockChain(db, genesis, beacon.New(ethash.NewFaker()), options)
|
chain, _ := NewBlockChain(db, genesis, beacon.New(ethash.NewFaker()), options)
|
||||||
defer chain.Stop()
|
defer chain.Stop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
|
||||||
|
|
||||||
func GenerateVerkleChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (common.Hash, ethdb.Database, []*types.Block, []types.Receipts, []*verkle.VerkleProof, []verkle.StateDiff) {
|
func GenerateVerkleChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (common.Hash, ethdb.Database, []*types.Block, []types.Receipts, []*verkle.VerkleProof, []verkle.StateDiff) {
|
||||||
db := rawdb.NewMemoryDatabase()
|
db := rawdb.NewMemoryDatabase()
|
||||||
cacheConfig := DefaultBlockChainConfig(rawdb.PathScheme)
|
cacheConfig := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
cacheConfig.SnapshotLimit = 0
|
cacheConfig.SnapshotLimit = 0
|
||||||
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))
|
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))
|
||||||
defer triedb.Close()
|
defer triedb.Close()
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ func ExampleGenerateChain() {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Import the chain. This runs all block validation rules.
|
// Import the chain. This runs all block validation rules.
|
||||||
blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultBlockChainConfig(rawdb.HashScheme))
|
blockchain, _ := NewBlockChain(db, gspec, ethash.NewFaker(), DefaultConfig().WithStateScheme(rawdb.HashScheme))
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
if i, err := blockchain.InsertChain(chain); err != nil {
|
if i, err := blockchain.InsertChain(chain); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ func testSetupGenesis(t *testing.T, scheme string) {
|
||||||
tdb := triedb.NewDatabase(db, newDbConfig(scheme))
|
tdb := triedb.NewDatabase(db, newDbConfig(scheme))
|
||||||
oldcustomg.Commit(db, tdb)
|
oldcustomg.Commit(db, tdb)
|
||||||
|
|
||||||
bc, _ := NewBlockChain(db, &oldcustomg, ethash.NewFullFaker(), DefaultBlockChainConfig(scheme))
|
bc, _ := NewBlockChain(db, &oldcustomg, ethash.NewFullFaker(), DefaultConfig().WithStateScheme(scheme))
|
||||||
defer bc.Stop()
|
defer bc.Stop()
|
||||||
|
|
||||||
_, blocks, _ := GenerateChainWithGenesis(&oldcustomg, ethash.NewFaker(), 4, nil)
|
_, blocks, _ := GenerateChainWithGenesis(&oldcustomg, ethash.NewFaker(), 4, nil)
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ func TestProcessVerkle(t *testing.T) {
|
||||||
// Verkle trees use the snapshot, which must be enabled before the
|
// Verkle trees use the snapshot, which must be enabled before the
|
||||||
// data is saved into the tree+database.
|
// data is saved into the tree+database.
|
||||||
// genesis := gspec.MustCommit(bcdb, triedb)
|
// genesis := gspec.MustCommit(bcdb, triedb)
|
||||||
options := DefaultBlockChainConfig(rawdb.PathScheme)
|
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
options.SnapshotLimit = 0
|
options.SnapshotLimit = 0
|
||||||
blockchain, _ := NewBlockChain(bcdb, gspec, beacon.New(ethash.NewFaker()), options)
|
blockchain, _ := NewBlockChain(bcdb, gspec, beacon.New(ethash.NewFaker()), options)
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
@ -255,7 +255,7 @@ func TestProcessParentBlockHash(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run("Verkle", func(t *testing.T) {
|
t.Run("Verkle", func(t *testing.T) {
|
||||||
db := rawdb.NewMemoryDatabase()
|
db := rawdb.NewMemoryDatabase()
|
||||||
cacheConfig := DefaultBlockChainConfig(rawdb.PathScheme)
|
cacheConfig := DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
cacheConfig.SnapshotLimit = 0
|
cacheConfig.SnapshotLimit = 0
|
||||||
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))
|
triedb := triedb.NewDatabase(db, cacheConfig.triedbConfig(true))
|
||||||
statedb, _ := state.New(types.EmptyVerkleHash, state.NewDatabase(triedb, nil))
|
statedb, _ := state.New(types.EmptyVerkleHash, state.NewDatabase(triedb, nil))
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ func testFilters(t *testing.T, history uint64, noHistory bool) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var l uint64
|
var l uint64
|
||||||
options := core.DefaultBlockChainConfig(rawdb.HashScheme)
|
options := core.DefaultConfig().WithStateScheme(rawdb.HashScheme)
|
||||||
options.TxLookupLimit = &l
|
options.TxLookupLimit = &l
|
||||||
bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options)
|
bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -437,7 +437,7 @@ func TestRangeLogs(t *testing.T) {
|
||||||
chain, _ := core.GenerateChain(gspec.Config, gspec.ToBlock(), ethash.NewFaker(), db, 1000, func(i int, gen *core.BlockGen) {})
|
chain, _ := core.GenerateChain(gspec.Config, gspec.ToBlock(), ethash.NewFaker(), db, 1000, func(i int, gen *core.BlockGen) {})
|
||||||
|
|
||||||
var l uint64
|
var l uint64
|
||||||
options := core.DefaultBlockChainConfig(rawdb.HashScheme)
|
options := core.DefaultConfig().WithStateScheme(rawdb.HashScheme)
|
||||||
options.TxLookupLimit = &l
|
options.TxLookupLimit = &l
|
||||||
bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options)
|
bc, err := core.NewBlockChain(db, gspec, ethash.NewFaker(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ func testSupplyTracer(t *testing.T, genesis *core.Genesis, gen func(*core.BlockG
|
||||||
return nil, nil, fmt.Errorf("failed to create call tracer: %v", err)
|
return nil, nil, fmt.Errorf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
options := core.DefaultBlockChainConfig(rawdb.PathScheme)
|
options := core.DefaultConfig().WithStateScheme(rawdb.PathScheme)
|
||||||
options.VmConfig = vm.Config{Tracer: tracer}
|
options.VmConfig = vm.Config{Tracer: tracer}
|
||||||
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options)
|
chain, err := core.NewBlockChain(rawdb.NewMemoryDatabase(), genesis, engine, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue