Skip to content

Commit

Permalink
Reverting Adding snapshots as a separate stage commit (erigontech#5329)
Browse files Browse the repository at this point in the history
* reverting Adding snapshots as a separate stage commit

* more fixes to merge conflicts
  • Loading branch information
leonardchinonso authored Sep 10, 2022
1 parent d1ddb5e commit 7495986
Show file tree
Hide file tree
Showing 9 changed files with 333 additions and 475 deletions.
5 changes: 5 additions & 0 deletions core/types/bor_receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (

const BorTxKeyPrefix string = "matic-bor-receipt-"

type BorConfigSprint struct {
IsBor bool
Sprint uint64
}

// BorReceiptKey = num (uint64 big endian)
func BorReceiptKey(number uint64) []byte {
return dbutils.EncodeBlockNumber(number)
Expand Down
21 changes: 1 addition & 20 deletions eth/stagedsync/default_stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,8 @@ import (
"github.com/ledgerwatch/erigon/ethdb/prune"
)

func DefaultStages(ctx context.Context, sm prune.Mode, snapshots SnapshotsCfg, headers HeadersCfg, cumulativeIndex CumulativeIndexCfg, blockHashCfg BlockHashesCfg, bodies BodiesCfg, issuance IssuanceCfg, senders SendersCfg, exec ExecuteBlockCfg, hashState HashStateCfg, trieCfg TrieCfg, history HistoryCfg, logIndex LogIndexCfg, callTraces CallTracesCfg, txLookup TxLookupCfg, finish FinishCfg, test bool) []*Stage {
func DefaultStages(ctx context.Context, sm prune.Mode, headers HeadersCfg, cumulativeIndex CumulativeIndexCfg, blockHashCfg BlockHashesCfg, bodies BodiesCfg, issuance IssuanceCfg, senders SendersCfg, exec ExecuteBlockCfg, hashState HashStateCfg, trieCfg TrieCfg, history HistoryCfg, logIndex LogIndexCfg, callTraces CallTracesCfg, txLookup TxLookupCfg, finish FinishCfg, test bool) []*Stage {
return []*Stage{
{
ID: stages.Snapshots,
Description: "Download snapshots",
Forward: func(firstCycle bool, badBlockUnwind bool, s *StageState, u Unwinder, tx kv.RwTx) error {
if badBlockUnwind {
return nil
}
return SpawnStageSnapshots(s, ctx, tx, snapshots, firstCycle)
},
Unwind: func(firstCycle bool, u *UnwindState, s *StageState, tx kv.RwTx) error {
return nil
},
Prune: func(firstCycle bool, p *PruneState, tx kv.RwTx) error {
return SnapshotsPrune(p, snapshots, ctx, tx)
},
},
{
ID: stages.Headers,
Description: "Download headers",
Expand Down Expand Up @@ -311,7 +295,6 @@ func StateStages(ctx context.Context, headers HeadersCfg, bodies BodiesCfg, bloc
}

var DefaultForwardOrder = UnwindOrder{
stages.Snapshots,
stages.Headers,
stages.BlockHashes,
stages.Bodies,
Expand Down Expand Up @@ -339,7 +322,6 @@ type PruneOrder []stages.SyncStage

var DefaultUnwindOrder = UnwindOrder{
stages.Finish,
stages.Snapshots,
stages.TxLookup,
stages.LogIndex,
stages.StorageHistoryIndex,
Expand Down Expand Up @@ -372,7 +354,6 @@ var StateUnwindOrder = UnwindOrder{

var DefaultPruneOrder = PruneOrder{
stages.Finish,
stages.Snapshots,
stages.TxLookup,
stages.LogIndex,
stages.StorageHistoryIndex,
Expand Down
Loading

0 comments on commit 7495986

Please sign in to comment.