Skip to content

Commit

Permalink
fix : freezer, TestStateProcessorErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xsharma committed Jul 3, 2023
1 parent a25bc77 commit 6d4e600
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/rawdb/ancient_scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var chainFreezerNoSnappy = map[string]bool{
ChainFreezerBodiesTable: false,
ChainFreezerReceiptTable: false,
ChainFreezerDifficultyTable: true,
freezerBorReceiptTable: false,
}

// The list of identifiers of ancient stores.
Expand Down
6 changes: 6 additions & 0 deletions core/rawdb/chain_freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash
return fmt.Errorf("can't write td to Freezer: %v", err)
}

// bor block receipt
borBlockReceipt := ReadBorReceiptRLP(nfdb, hash, number)
if err := op.AppendRaw(freezerBorReceiptTable, number, borBlockReceipt); err != nil {
return fmt.Errorf("can't write bor-receipt to freezer: %v", err)
}

hashes = append(hashes, hash)
}

Expand Down
13 changes: 10 additions & 3 deletions core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func u64(val uint64) *uint64 { return &val }
// contain invalid transactions
func TestStateProcessorErrors(t *testing.T) {
var (
cacheConfig = &CacheConfig{
TrieCleanLimit: 154,
TrieCleanJournal: "triecache",
Preimages: true,
}

config = &params.ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
Expand Down Expand Up @@ -256,7 +262,7 @@ func TestStateProcessorErrors(t *testing.T) {
},
}
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
)

defer blockchain.Stop()
Expand Down Expand Up @@ -303,7 +309,7 @@ func TestStateProcessorErrors(t *testing.T) {
},
}
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
)

defer blockchain.Stop()
Expand Down Expand Up @@ -360,6 +366,7 @@ func TestStateProcessorErrors(t *testing.T) {
TerminalTotalDifficultyPassed: true,
// TODO marcello double check
ShanghaiTime: u64(0),
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
},
Alloc: GenesisAlloc{
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
Expand All @@ -370,7 +377,7 @@ func TestStateProcessorErrors(t *testing.T) {
}
genesis = gspec.MustCommit(db)
blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
smallInitCode = [320]byte{}
)
Expand Down
2 changes: 0 additions & 2 deletions eth/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func TestSnapSyncDisabling67(t *testing.T) {
// Tests that snap sync gets disabled as soon as a real block is successfully
// imported into the blockchain.
func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
t.Parallel()

// Create an empty handler and ensure it's in snap sync mode
empty := newTestHandler()
if atomic.LoadUint32(&empty.handler.snapSync) == 0 {
Expand Down

0 comments on commit 6d4e600

Please sign in to comment.