New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow persisting headers that are disconnected from genesis #1823
Allow persisting headers that are disconnected from genesis #1823
Conversation
eb574e5
to
6738c00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a very minor spider-sense reaction to the overloading of genesis_parent_hash
to trick the database into doing the right thing but I don't have any better ideas or concrete objections.
eth/db/header.py
Outdated
@@ -83,6 +83,10 @@ def persist_header(self, | |||
) -> Tuple[Tuple[BlockHeader, ...], Tuple[BlockHeader, ...]]: | |||
raise NotImplementedError("ChainDB classes must implement this method") | |||
|
|||
@abstractmethod | |||
def persist_checkpoint_header(self, header: BlockHeader, score: int) -> None: | |||
raise NotImplementedError("ChainDB classes must implement this method") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New paradigm uses ...
for this.
tests failing, waiting to see what tests say when conflicts are gone.
6738c00
to
835c9ad
Compare
Add an *optional* `genesis_parent_hash` parameter to `eth.db.header.HeaderDB.persist_header_chain` and `eth.db.chain.ChainDB.persist_block` that allows to overwrite the hash that is used to identify the genesis header. This allows persisting headers / blocks that aren't (yet) connected back to the true genesis header. This feature opens up new, faster syncing techniques.
835c9ad
to
6ac4322
Compare
Yes, I agree. But at the same time, it's strikingly simple so it may not be that bad after all :D
Yep, I started off on the previous release. But now that you upgraded Trinity to latest py-evm code (thanks for taking care of that!) I have this rebased and polished. |
I added another commit to kill the |
What was wrong?
We want to allow persisting headers that are disconnected from genesis (with the intend to connect them back later). This is to allow syncing from a trusted checkpoint.
How was it fixed?
Add an optional
genesis_parent_hash
parameter toeth.db.header.HeaderDB.persist_header_chain
andeth.db.chain.ChainDB.persist_block
that allows to overwrite the hash that is usedto identify the genesis header. This allows persisting headers / blocks that aren't (yet)
connected back to the true genesis header.
To-Do
Cute Animal Picture