ledgerwatch / erigon-lib

Dependencies of Erigon project, rewritten from scratch and licensed under Apache 2.0
Apache License 2.0
59 stars 93 forks source link

Added struct to hold bor sprints in numeric order #1038

Closed mh0lt closed 1 year ago

mh0lt commented 1 year ago

This checking replaces the config processing for bor sprints which has the following issues:

  1. It uses string ordering for blocks which is lexical so does not handle decimal scale when sorting numbers
  2. It parses the config map every calculation - which is expensive relative to just checking the index order

This is likely not an issue for the existing main net as the map only has 2 entries and their sort order is coincidentally the same for both lexical and numeric ordering. Performance is likely also a non issue compared to the other processing during execution flow.

These changes are intended to support tx indexing where in the snapshotting process the calc will get called at least twice for each bor block during 1000's of iterations.