erigon-pulse/consensus/bor
Manav Darji 5c0c9fdff9
consensus/bor: optimise get span, fixes in header validation (#7689)
This PR does the following things. 

- Optimises the get span for bor function. The function was responsible
to fetch span from heimdall and store in cache. If not found, it would
iterate back (or front) depending on the last found span in cache. In
this iteration it would also fetch the span every time it moves front /
back which is not necessary at all. As we know the `spanLength` we can
leverage it to directly jump to the required span ID without fetching
all the intermediate ones.
- Adds a check for `number > 255` in validating producers from headers'
extra data with ones in span. As bor fetches this data from contract, it
used to give correct results for 0th span (i.e. 0-255 blocks) and hence
no error occurs. Erigon on the other hand directly uses span to get
producers for all blocks. Hence, the data in 0th span turns out to be
wrong (as it's hardcoded in contract). We can skip validation for 0th
span blocks until we start fetching data from contract.
- As we're planning to use erigon as a validator, it will also be
responsible for preparing headers. It used to write all the validators
in the `header.Extra` field instead of just the selected producers. As
we have `GetCurrentProducers` function available now, we can use it
instead of `GetCurrentValidators`.
2023-06-12 12:48:15 +01:00
..
abi Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
clerk Move hexutil.Bytes to erigon-lib (#7305) 2023-04-13 11:19:02 +00:00
contract Remove excessive logging in bor (#7690) 2023-06-08 21:24:43 +01:00
heimdall consensus/bor: use current producers for extra data validation (#7564) 2023-05-24 12:57:31 +07:00
heimdallgrpc Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
statefull State sync transactions added to debug_traceBlockByNumber call (#6830) 2023-02-20 08:04:11 +00:00
valset Added non root logger to bor.ValidatorSet (#7668) 2023-06-06 10:55:59 +01:00
api.go lru lib version up (#7695) 2023-06-09 13:46:58 +07:00
bor.go consensus/bor: optimise get span, fixes in header validation (#7689) 2023-06-12 12:48:15 +01:00
errors.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
genesis_contract_mock.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
genesis.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
heimall.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
merkle.go Bor file structure updated (#6167) 2023-01-31 14:00:57 +05:30
snapshot_test.go lru lib version up (#7695) 2023-06-09 13:46:58 +07:00
snapshot.go [bor] Desambiguate the term checkpoint (#7698) 2023-06-09 22:19:24 +01:00
span_mock.go consensus/bor: use current producers for extra data validation (#7564) 2023-05-24 12:57:31 +07:00
span.go consensus/bor: use current producers for extra data validation (#7564) 2023-05-24 12:57:31 +07:00