erigon-pulse/consensus/bor
milen 74ec3a9db7
stagedsync: fix bor heimdall mining flow (#9149)
Currently the mining loop is broken for the polygon chain. This PR fixes
this.

High level changes:

- Introduces new Bor<->Heimdall stage specifically for the needs of the
mining flow
- Extracts out common logic from Bor<->Heimdall sync and mining stages
into shared functions
- Removes `mine` flag for the Bor<->Heimdall sync stage
- Extends the current `StartMining` function to prefetch span zero if
needed before the mining loop is started
- Fixes Bor to read span zero (instead of span 1) from heimdall when the
span is not initially set in the local smart contract that the Spanner
uses

Test with devnet "state-sync" scenario:
![Screenshot 2024-01-05 at 17 41
23](https://github.com/ledgerwatch/erigon/assets/94537774/34ca903a-69b8-416a-900f-a32f2d4417fa)
2024-01-09 11:37:39 +00:00
..
abi Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
borcfg polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
clerk Bor span testing (#7897) 2023-07-18 09:47:04 +01:00
contract bor: logs prefix, grep-friendly (#8787) 2023-11-20 12:16:06 +07:00
finality polygon: astrid sync heimdall wrapper (#9017) 2023-12-20 16:48:37 +01:00
heimdall polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
heimdallgrpc polygon: astrid sync heimdall wrapper (#9017) 2023-12-20 16:48:37 +01:00
mock borheimdall: add test for span persistence (#8988) 2023-12-14 22:50:59 +02:00
statefull Snapshots of Bor events (#7901) 2023-08-18 17:10:35 +01:00
valset polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
bor_test.go polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
bor.go stagedsync: fix bor heimdall mining flow (#9149) 2024-01-09 11:37:39 +00:00
errors.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
fake.go Move ApplyDAOHardFork & UpgradeBuildInSystemContract to engine.Initialize (#8095) 2023-08-30 15:51:19 +02:00
genesis_contract.go borheimdall: add test for span persistence (#8988) 2023-12-14 22:50:59 +02:00
merkle.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
snapshot_test.go Bor span testing (#7897) 2023-07-18 09:47:04 +01:00
snapshot.go polygon/sync: canonical chain builder (#9117) 2024-01-04 10:44:57 +01:00
spanner.go borheimdall: add test for span persistence (#8988) 2023-12-14 22:50:59 +02:00