Skip to content

Conversation

@AurelienRichez
Copy link
Contributor

Description

This PR rewrites getNBlocksBack in OmmersValidation so that it does not use getBlockByNumber.

  • It reduces our dependency on the block number mapping storage: The other parts that are using getBlockByNumber are out of the core flow of mantis (json rpc calls). This means that it opens a path to be able to switch the best branch just by changing a hash in the storage, and having the block number mapping built somewhere else. We can insert new blocks without rebuilding the index each time.
  • We can validate ommers for any block without considering if it is on top of the best chain or not. In the end it will allow to have only one implementation instead of treating alternative branches are a special case (currently we have a different way of retrieving blocks if they are in the blockQueue).

@AurelienRichez AurelienRichez force-pushed the refactor/ETCM-1060-rewrite-ommers-validation branch from 63d33ed to f533ddf Compare July 29, 2021 12:31
val blocks =
(numbers.toList.flatMap(nb => bestBranch.getBlockByNumber(nb)) :+ block) ::: queuedBlocks
blocks
val remainingBlocks = Iterator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remarks as in OmmersValidation

@AurelienRichez AurelienRichez force-pushed the refactor/ETCM-1060-rewrite-ommers-validation branch from f533ddf to a245a6b Compare August 4, 2021 09:28
@AurelienRichez AurelienRichez force-pushed the refactor/ETCM-1060-rewrite-ommers-validation branch from a245a6b to 22f0cd9 Compare August 9, 2021 07:45
@AurelienRichez AurelienRichez force-pushed the refactor/ETCM-1060-rewrite-ommers-validation branch from 22f0cd9 to c0a5315 Compare August 9, 2021 12:11
@AurelienRichez AurelienRichez merged commit a136443 into develop Aug 9, 2021
@AurelienRichez AurelienRichez deleted the refactor/ETCM-1060-rewrite-ommers-validation branch August 9, 2021 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants