erigon-pulse/turbo/stages
Mark Holt f2d0118a33
Bor snapshot block production (#8065)
I have added:

```go
{
	ID:          stages.BorHeimdall,
	Description: "Download Bor-specific data from Heimdall",
	Forward: func(firstCycle bool, badBlockUnwind bool, s *StageState, u Unwinder, tx kv.RwTx, logger log.Logger) error {
		if badBlockUnwind {
			return nil
		}
		return BorHeimdallForward(s, u, ctx, tx, borHeimdallCfg, true, logger)
	},
	Unwind: func(firstCycle bool, u *UnwindState, s *StageState, tx kv.RwTx, logger log.Logger) error {
		return BorHeimdallUnwind(u, ctx, s, tx, borHeimdallCfg)
	},
	Prune: func(firstCycle bool, p *PruneState, tx kv.RwTx, logger log.Logger) error {
		return BorHeimdallPrune(p, ctx, tx, borHeimdallCfg)
	},
},
```
To MiningStages as well as Default as otherwise bor events are not added
when the block producer creates new blocks.

There are a couple of questions I have around this implementation:

* Is this the right place to add this
* As the state is also executed when the default stage is processed ther
is some duplicate processing for the block producing node.
* There is a duplicated call to heimdall which could be removed if the
stages share state - but its not clear if we want to do this.
* I don't think the mining stage needs to prune as this will be
replicated in the default iteration

This can be tested using the devnet with the following arguments:

```
--chain bor-devnet --bor.localheimdall --scenarios state-sync
```

This will generate sync events via an ethereum devnet which are
transmitted to bor chain and will be executed at the end of the snapshot
delay, which results in events generated from the bor chain. This tests
the whole sync, block generation, event lifecycle. As it needs to wait
for sprints to end after a sufficient delay it is quite slow to run.
2023-08-30 08:06:09 +01:00
..
bodydownload Replaced old version of Engine API with newer version (#7972) 2023-08-05 23:33:10 +02:00
headerdownload Snapshots of Bor events (#7901) 2023-08-18 17:10:35 +01:00
mock Bor snapshot block production (#8065) 2023-08-30 08:06:09 +01:00
blockchain_test.go Replaced old version of Engine API with newer version (#7972) 2023-08-05 23:33:10 +02:00
chain_makers_test.go Replaced old version of Engine API with newer version (#7972) 2023-08-05 23:33:10 +02:00
genesis_test.go Snapshots of Bor events (#7901) 2023-08-18 17:10:35 +01:00
stageloop.go Bor snapshot block production (#8065) 2023-08-30 08:06:09 +01:00