Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] e35: 1step test #10059

Closed
wants to merge 13 commits into from
34 changes: 19 additions & 15 deletions turbo/stages/mock/mock_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK
var err error

cfg := ethconfig.Defaults
cfg.Sync.LoopBlockLimit = 1
cfg.StateStream = true
cfg.BatchSize = 1 * datasize.MB
cfg.Sync.BodyDownloadTimeoutSeconds = 10
Expand Down Expand Up @@ -741,8 +742,10 @@ func (ms *MockSentry) insertPoWBlocks(chain *core.ChainPack) error {
initialCycle, firstCycle := MockInsertAsInitialCycle, false
hook := stages2.NewHook(ms.Ctx, ms.DB, ms.Notifications, ms.Sync, ms.BlockReader, ms.ChainConfig, ms.Log, nil)

if err = stages2.StageLoopIteration(ms.Ctx, ms.DB, wrap.TxContainer{}, ms.Sync, initialCycle, firstCycle, ms.Log, ms.BlockReader, hook); err != nil {
return err
for i := 0; i < len(chain.Blocks); i++ {
if err = stages2.StageLoopIteration(ms.Ctx, ms.DB, wrap.TxContainer{}, ms.Sync, initialCycle, firstCycle, ms.Log, ms.BlockReader, hook); err != nil {
return err
}
}
if ms.TxPool != nil {
ms.ReceiveWg.Wait() // Wait for TxPool notification
Expand Down Expand Up @@ -770,19 +773,20 @@ func (ms *MockSentry) insertPoSBlocks(chain *core.ChainPack) error {

tipHash := chain.TopBlock.Hash()

status, _, lvh, err := wr.UpdateForkChoice(ctx, tipHash, tipHash, tipHash)

if err != nil {
return err
}
if err := ms.DB.UpdateNosync(ms.Ctx, func(tx kv.RwTx) error {
rawdb.WriteHeadBlockHash(tx, lvh)
return nil
}); err != nil {
return err
}
if status != execution.ExecutionStatus_Success {
return fmt.Errorf("insertion failed for block %d, code: %s", chain.Blocks[chain.Length()-1].NumberU64(), status.String())
for i := 0; i < len(chain.Blocks); i++ {
status, _, lvh, err := wr.UpdateForkChoice(ctx, tipHash, tipHash, tipHash)
if err != nil {
return err
}
if err := ms.DB.UpdateNosync(ms.Ctx, func(tx kv.RwTx) error {
rawdb.WriteHeadBlockHash(tx, lvh)
return nil
}); err != nil {
return err
}
if status != execution.ExecutionStatus_Success {
return fmt.Errorf("insertion failed for block %d, code: %s", chain.Blocks[chain.Length()-1].NumberU64(), status.String())
}
}

return nil
Expand Down
Loading