Skip to content

Commit 6d87312

Browse files
buddh0joeylichang
andauthored
fix: Prague code merge [v1.13.15, v1.14.11] CI fix (#55)
* fix compile for statedb_test.go * format addresses of core/vm/contracts * fix compilation of package simulated * tests: update tests * remove rootParent in triePrefetcher * add ClearAccessList for processing system txs before Cancun * copy prefetcher when copy statedb * always prefetch the account trie once the prefetcher is constructed * recover TriePrefetchInAdvance * fix comment for s.StopPrefetcher * fix noTrie in statedb.go * improve SnapToDiffLayer * fix test cases in core/state * fix compilation of test cases in core * fix compilation of test cases in cmd, internal and trie * remove Requests in BlockBody * define RequestsHash in parlia engine * fix compilation of test cases in eth * fix compilation of test cases in ethclient and miner * fix compilation of test cases in triedb/pathdb * add todo for relation between witness and noTrie * fix Nancy CI * fix golangci-lint part I * update golang to 1.23.x from 1.21.x in workflows * remove sepoliaAllocData and holeskyAllocData * modifiy interface FinalizeAndAssemble * fix golangci-lint part II * fix golangci-lint part III * fix golangci-lint done * check for multidb * improve interface EnableBlockValidator * fix getGenesisState * code review for core/rawdb * fix mustCopyTrie * fix state_processor * adapt for changes in func NewBlock * improve EncodeSigHeader * fix test cases in dir core, part I * fix TestParliaBlobFeeReward * fix repairHistory * remove diskdb in triedb.Database * fix asyncnodebuffer * adapt memory freezer for blob table * comment verkle related test cases * fix golang lint * use 1.21.x to run golangci-lint * fix TestBsc1Messages * fix TestSnapSyncWithBlobs * fix traceTx * update golang version for docker * improve newWorker * fix: truncate state history ut * TestTailTruncateHistory clear up * fix test cases in dir tests * remove deprecated flags in truffle test * comment filterNode * HeaderChain.GenesisHeader * fix golangcilint * fix truffle-test CI * update .nancy-ignore to avoid conflicts with develop branch * update diff go-ethereum patch * remove isTTDReached in worker * fix mockparlia FinalizeAndAssemble * fix golangci-lint * fix makeEnv * change log level for tri prefetch --------- Co-authored-by: joeylichang <joeycli0919@gmail.com> Co-authored-by: joey <joeycli@tencent.com>
1 parent 82e0d8c commit 6d87312

File tree

107 files changed

+716
-1058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+716
-1058
lines changed

.github/workflows/build-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
unit-test:
1616
strategy:
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:

.github/workflows/evm-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
evm-test:
1616
strategy:
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:

.github/workflows/nancy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build:
1414
strategy:
1515
matrix:
16-
go-version: [1.21.x]
16+
go-version: [1.23.x]
1717
os: [ubuntu-latest]
1818
runs-on: ${{ matrix.os }}
1919
steps:

.github/workflows/pre-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Build Release
1616
strategy:
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
os: [ubuntu-latest, macos-latest, windows-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Build Release
1515
strategy:
1616
matrix:
17-
go-version: [1.21.x]
17+
go-version: [1.23.x]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
runs-on: ${{ matrix.os }}
2020
steps:

.github/workflows/unit-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
unit-test:
1616
strategy:
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:

.nancy-ignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CVE-2024-34478 # "CWE-754: Improper Check for Unusual or Exceptional Conditions." This vulnerability is BTC only, BSC does not have the issue.
22
CVE-2024-6104 # "CWE-532: Information Exposure Through Log Files" This is caused by the vulnerabilities go-retryablehttp@v0.7.4, it is only used in cmd devp2p, impact is limited. will upgrade to v0.7.7 later
3-
CVE-2024-8421 # "CWE-400: Uncontrolled Resource Consumption (Resource Exhaustion)" This vulnerability is caused by issues in the golang.org/x/net package. Even the latest version(v0.29.0) has not yet addressed it, but we will continue to monitor updates closely.
3+
CVE-2024-8421 # "CWE-400: Uncontrolled Resource Consumption (Resource Exhaustion)" This vulnerability is caused by issues in the golang.org/x/net package. Even the latest version(v0.29.0) has not yet addressed it, but we will continue to monitor updates closely.
4+
CVE-2024-51744 # "CWE-347: Improper Verification of Cryptographic Signature" & "CWE-755: Improper Handling of Exceptional Conditions" This vulnerability is caused mishandling of JWT error code, BSC does not have the issue as it does not check the detail error code.

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ all:
3030
test: all
3131
$(GORUN) build/ci.go test -timeout 1h
3232

33+
#? truffle-test: Run the integration test.
3334
truffle-test:
34-
docker build . -f ./docker/Dockerfile --target bsc-genesis -t bsc-genesis
3535
docker build . -f ./docker/Dockerfile --target bsc -t bsc
36+
docker build . -f ./docker/Dockerfile --target bsc-genesis -t bsc-genesis
3637
docker build . -f ./docker/Dockerfile.truffle -t truffle-test
3738
docker compose -f ./tests/truffle/docker-compose.yml up genesis
3839
docker compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc bsc-validator1

cmd/geth/testdata/config.toml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ NetworkId = 714
33
SyncMode = "full"
44
NoPruning = false
55
NoPrefetch = false
6-
LightPeers = 100
76
DatabaseCache = 512
87
DatabaseFreezer = ""
98
TrieCleanCache = 256

cmd/utils/history_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func TestHistoryImportAndExport(t *testing.T) {
162162
}
163163

164164
// Now import Era.
165-
db2, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "",, "", false, false, false, false, false)
165+
db2, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false, false, false, false, false)
166166
if err != nil {
167167
panic(err)
168168
}

consensus/beacon/consensus.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -378,30 +378,30 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
378378

379379
// FinalizeAndAssemble implements consensus.Engine, setting the final state and
380380
// assembling the block.
381-
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
381+
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
382382
// FinalizeAndAssemble is different with Prepare, it can be used in both block generation.
383383
if !beacon.IsPoSHeader(header) {
384-
return beacon.ethone.FinalizeAndAssemble(chain, header, state, txs, uncles, receipts, withdrawals)
384+
return beacon.ethone.FinalizeAndAssemble(chain, header, state, body, receipts)
385385
}
386386
shanghai := chain.Config().IsShanghai(header.Number, header.Time)
387387
if shanghai {
388388
// All blocks after Shanghai must include a withdrawals root.
389-
if withdrawals == nil {
390-
withdrawals = make([]*types.Withdrawal, 0)
389+
if body.Withdrawals == nil {
390+
body.Withdrawals = make([]*types.Withdrawal, 0)
391391
}
392392
} else {
393-
if len(withdrawals) > 0 {
393+
if len(body.Withdrawals) > 0 {
394394
return nil, nil, errors.New("withdrawals set before Shanghai activation")
395395
}
396396
}
397397
// Finalize and assemble the block.
398-
beacon.Finalize(chain, header, state, &txs, uncles, withdrawals, nil, nil, nil)
398+
beacon.Finalize(chain, header, state, &body.Transactions, body.Uncles, body.Withdrawals, nil, nil, nil)
399399

400400
// Assign the final state root to header.
401401
header.Root = state.IntermediateRoot(true)
402402

403403
// Assemble the final block.
404-
block := types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles, Withdrawals: withdrawals}, receipts, trie.NewStackTrie(nil))
404+
block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))
405405

406406
// Create the block witness and attach to block.
407407
// This step needs to happen as late as possible to catch all access events.

consensus/clique/clique.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -594,18 +594,18 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
594594

595595
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
596596
// nor block rewards given, and returns the final block.
597-
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
598-
if len(withdrawals) > 0 {
597+
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
598+
if len(body.Withdrawals) > 0 {
599599
return nil, nil, errors.New("clique does not support withdrawals")
600600
}
601601
// Finalize block
602-
c.Finalize(chain, header, state, &txs, uncles, nil, nil, nil, nil)
602+
c.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)
603603

604604
// Assign the final state root to header.
605605
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
606606

607607
// Assemble and return the final block for sealing.
608-
return types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
608+
return types.NewBlock(header, &types.Body{Transactions: body.Transactions}, receipts, trie.NewStackTrie(nil)), receipts, nil
609609
}
610610

611611
// Authorize injects a private key into the consensus engine to mint new blocks

consensus/consensus.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ type Engine interface {
120120
//
121121
// Note: The block header and state database might be updated to reflect any
122122
// consensus rules that happen at finalization (e.g. block rewards).
123-
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
124-
uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error)
123+
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error)
125124

126125
// Seal generates a new sealing request for the given input block and pushes
127126
// the result into the given channel.

consensus/ethash/consensus.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -517,18 +517,18 @@ func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.
517517

518518
// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
519519
// uncle rewards, setting the final state and assembling the block.
520-
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
521-
if len(withdrawals) > 0 {
520+
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
521+
if len(body.Withdrawals) > 0 {
522522
return nil, nil, errors.New("ethash does not support withdrawals")
523523
}
524524
// Finalize block
525-
ethash.Finalize(chain, header, state, &txs, uncles, nil, nil, nil, nil)
525+
ethash.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)
526526

527527
// Assign the final state root to header.
528528
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
529529

530530
// Header seems complete, assemble into a block and return
531-
return types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
531+
return types.NewBlock(header, &types.Body{Transactions: body.Transactions, Uncles: body.Uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
532532
}
533533

534534
func (ethash *Ethash) Delay(_ consensus.ChainReader, _ *types.Header, _ *time.Duration) *time.Duration {

consensus/parlia/parlia.go

+28-15
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ const (
7676
)
7777

7878
var (
79-
uncleHash = types.CalcUncleHash(nil) // Always Keccak256(RLP([])) as uncles are meaningless outside of PoW.
80-
diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures
81-
diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures
79+
diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures
80+
diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures
8281
// 100 native token
8382
maxSystemBalance = new(uint256.Int).Mul(uint256.NewInt(100), uint256.NewInt(params.Ether))
8483
verifyVoteAttestationErrorCounter = metrics.NewRegisteredCounter("parlia/verifyVoteAttestation/error", nil)
@@ -590,7 +589,7 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
590589
return errInvalidMixDigest
591590
}
592591
// Ensure that the block doesn't contain any uncles which are meaningless in PoA
593-
if header.UncleHash != uncleHash {
592+
if header.UncleHash != types.EmptyUncleHash {
594593
return errInvalidUncleHash
595594
}
596595
// Ensure that the block's difficulty is meaningful (may not be correct at this point)
@@ -647,6 +646,18 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
647646
}
648647
}
649648

649+
prague := chain.Config().IsPrague(header.Number, header.Time)
650+
if !prague {
651+
if header.RequestsHash != nil {
652+
return fmt.Errorf("invalid RequestsHash, have %#x, expected nil", header.ParentBeaconRoot)
653+
}
654+
} else {
655+
// TODO(Nathan): need a BEP to define this and `Requests` in struct Body
656+
if !header.EmptyRequestsHash() {
657+
return errors.New("header has wrong RequestsHash")
658+
}
659+
}
660+
650661
// All basic checks passed, verify cascading fields
651662
return p.verifyCascadingFields(chain, header, parents)
652663
}
@@ -1348,11 +1359,11 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
13481359
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
13491360
// nor block rewards given, and returns the final block.
13501361
func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB,
1351-
txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, _ []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
1362+
body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
13521363
// No block rewards in PoA, so the state remains as is and uncles are dropped
13531364
cx := chainContext{Chain: chain, parlia: p}
1354-
if txs == nil {
1355-
txs = make([]*types.Transaction, 0)
1365+
if body.Transactions == nil {
1366+
body.Transactions = make([]*types.Transaction, 0)
13561367
}
13571368
if receipts == nil {
13581369
receipts = make([]*types.Receipt, 0)
@@ -1368,14 +1379,14 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
13681379
}
13691380

13701381
if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
1371-
err := p.initializeFeynmanContract(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
1382+
err := p.initializeFeynmanContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
13721383
if err != nil {
13731384
log.Error("init feynman contract failed", "error", err)
13741385
}
13751386
}
13761387

13771388
if header.Number.Cmp(common.Big1) == 0 {
1378-
err := p.initContract(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
1389+
err := p.initContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
13791390
if err != nil {
13801391
log.Error("init contract failed")
13811392
}
@@ -1399,21 +1410,21 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
13991410
}
14001411
}
14011412
if !signedRecently {
1402-
err = p.slash(spoiledVal, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
1413+
err = p.slash(spoiledVal, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
14031414
if err != nil {
14041415
// it is possible that slash validator failed because of the slash channel is disabled.
14051416
log.Error("slash validator failed", "block hash", header.Hash(), "address", spoiledVal)
14061417
}
14071418
}
14081419
}
14091420

1410-
err := p.distributeIncoming(p.val, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
1421+
err := p.distributeIncoming(p.val, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
14111422
if err != nil {
14121423
return nil, nil, err
14131424
}
14141425

14151426
if p.chainConfig.IsPlato(header.Number) {
1416-
if err := p.distributeFinalityReward(chain, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil {
1427+
if err := p.distributeFinalityReward(chain, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true); err != nil {
14171428
return nil, nil, err
14181429
}
14191430
}
@@ -1422,7 +1433,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
14221433
if p.chainConfig.IsFeynman(header.Number, header.Time) && isBreatheBlock(parent.Time, header.Time) {
14231434
// we should avoid update validators in the Feynman upgrade block
14241435
if !p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
1425-
if err := p.updateValidatorSetV2(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil {
1436+
if err := p.updateValidatorSetV2(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true); err != nil {
14261437
return nil, nil, err
14271438
}
14281439
}
@@ -1432,7 +1443,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
14321443
if header.GasLimit < header.GasUsed {
14331444
return nil, nil, errors.New("gas consumption of system txs exceed the gas limit")
14341445
}
1435-
header.UncleHash = types.CalcUncleHash(nil)
1446+
header.UncleHash = types.EmptyUncleHash
14361447
var blk *types.Block
14371448
var rootHash common.Hash
14381449
wg := sync.WaitGroup{}
@@ -1442,7 +1453,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
14421453
wg.Done()
14431454
}()
14441455
go func() {
1445-
blk = types.NewBlock(header, &types.Body{Transactions: txs}, receipts, trie.NewStackTrie(nil))
1456+
blk = types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))
14461457
wg.Done()
14471458
}()
14481459
wg.Wait()
@@ -2161,6 +2172,8 @@ func applyMessage(
21612172
if chainConfig.IsCancun(header.Number, header.Time) {
21622173
rules := vmenv.ChainConfig().Rules(vmenv.Context.BlockNumber, vmenv.Context.Random != nil, vmenv.Context.Time)
21632174
state.Prepare(rules, msg.From(), vmenv.Context.Coinbase, msg.To(), vm.ActivePrecompiles(rules), msg.AccessList)
2175+
} else {
2176+
state.ClearAccessList()
21642177
}
21652178
// Increment the nonce for the next transaction
21662179
state.SetNonce(msg.From(), state.GetNonce(msg.From())+1)

core/blockchain.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,8 @@ func (bc *BlockChain) InsertHeaderChain(chain []*types.Header) (int, error) {
31613161
func (bc *BlockChain) HeadChain() *HeaderChain {
31623162
return bc.hc
31633163
}
3164-
func (bc *BlockChain) TriesInMemory() uint64 { return state.TriesInMemory }
3164+
3165+
func (bc *BlockChain) TriesInMemory() uint64 { return bc.triesInMemory }
31653166

31663167
func EnablePersistDiff(limit uint64) BlockChainOption {
31673168
return func(chain *BlockChain) (*BlockChain, error) {
@@ -3170,7 +3171,7 @@ func EnablePersistDiff(limit uint64) BlockChainOption {
31703171
}
31713172
}
31723173

3173-
func EnableBlockValidator(chainConfig *params.ChainConfig, _ consensus.Engine, mode VerifyMode, peers verifyPeers) BlockChainOption {
3174+
func EnableBlockValidator(chainConfig *params.ChainConfig, mode VerifyMode, peers verifyPeers) BlockChainOption {
31743175
return func(bc *BlockChain) (*BlockChain, error) {
31753176
if mode.NeedRemoteVerify() {
31763177
vm, err := NewVerifyManager(bc, peers, mode == InsecureVerify)

core/blockchain_diff_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func newTwoForkedBlockchains(len1, len2 int) (chain1 *BlockChain, chain2 *BlockC
268268
BaseFee: big.NewInt(params.InitialBaseFee),
269269
}
270270
engine1 := ethash.NewFaker()
271-
chain1, _ = NewBlockChain(db1, nil, gspec, nil, engine1, vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, engine1, 0, nil))
271+
chain1, _ = NewBlockChain(db1, nil, gspec, nil, engine1, vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, 0, nil))
272272
generator1 := func(i int, block *BlockGen) {
273273
// The chain maker doesn't have access to a chain, so the difficulty will be
274274
// lets unset (nil). Set it here to the correct value.
@@ -324,8 +324,7 @@ func newTwoForkedBlockchains(len1, len2 int) (chain1 *BlockChain, chain2 *BlockC
324324
Alloc: GenesisAlloc{testAddr: {Balance: big.NewInt(100000000000000000)}},
325325
BaseFee: big.NewInt(params.InitialBaseFee),
326326
}
327-
engine2 := ethash.NewFaker()
328-
chain2, _ = NewBlockChain(db2, nil, gspec2, nil, ethash.NewFaker(), vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, engine2, 0, nil))
327+
chain2, _ = NewBlockChain(db2, nil, gspec2, nil, ethash.NewFaker(), vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, 0, nil))
329328
generator2 := func(i int, block *BlockGen) {
330329
// The chain maker doesn't have access to a chain, so the difficulty will be
331330
// lets unset (nil). Set it here to the correct value.

core/blockchain_notries_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ func makeTestBackendWithRemoteValidator(blocks int, mode VerifyMode, failed *ver
104104
peers := []VerifyPeer{peer}
105105

106106
verifier, err := NewBlockChain(db, nil, gspec, nil, engine, vm.Config{},
107-
nil, nil, EnablePersistDiff(100000), EnableBlockValidator(params.TestChainConfig, engine2, LocalVerify, nil))
107+
nil, nil, EnablePersistDiff(100000), EnableBlockValidator(params.TestChainConfig, LocalVerify, nil))
108108
if err != nil {
109109
return nil, nil, nil, err
110110
}
111111

112112
fastnode, err := NewBlockChain(db2, nil, gspec2, nil, engine2, vm.Config{},
113-
nil, nil, EnableBlockValidator(params.TestChainConfig, engine2, mode, newMockRemoteVerifyPeer(peers)))
113+
nil, nil, EnableBlockValidator(params.TestChainConfig, mode, newMockRemoteVerifyPeer(peers)))
114114
if err != nil {
115115
return nil, nil, nil, err
116116
}

core/blockchain_repair_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1841,14 +1841,14 @@ func testRepairWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme s
18411841
}
18421842
// Force run a freeze cycle
18431843
type freezer interface {
1844-
Freeze() error
1844+
Freeze(threshold uint64) error
18451845
Ancients() (uint64, error)
18461846
}
18471847
if tt.freezeThreshold < uint64(tt.canonicalBlocks) {
18481848
final := uint64(tt.canonicalBlocks) - tt.freezeThreshold
18491849
chain.SetFinalized(canonblocks[int(final)-1].Header())
18501850
}
1851-
db.(freezer).Freeze()
1851+
db.(freezer).Freeze(tt.freezeThreshold)
18521852

18531853
// Set the simulated pivot block
18541854
if tt.pivotBlock != nil {

0 commit comments

Comments
 (0)