-
Notifications
You must be signed in to change notification settings - Fork 37
feat: checkpoint-sync-url now can be a list of checkpoint nodes #1411
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
base: main
Are you sure you want to change the base?
Conversation
…int nodes for comparisons
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.
Just a small comment
if anchor_state.latest_block_header.parent_root != first_block.message.parent_root do | ||
Logger.error( | ||
"[Checkpoint sync] Root mismatch when comparing latest finalized block with downloaded state" | ||
) | ||
|
||
Logger.flush() | ||
System.halt(1) | ||
end | ||
|
||
# We already checked block and state match | ||
{:ok, store} = Store.get_forkchoice_store(anchor_state, anchor_block) | ||
|
||
# Save store in DB | ||
StoreDb.persist_store(store) | ||
|
||
store |
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'm not fan of Halts, but given that it was already used in the previous state of the function we could just maintain it here, in any case i think it's better to go for the positive and halt in the else instead of simulating and early return.
if anchor_state.latest_block_header.parent_root == first_block.message.parent_root do
{:ok, store} = Store.get_forkchoice_store(anchor_state, anchor_block)
# Save store in DB
StoreDb.persist_store(store)
store
else
Logger.error(
"[Checkpoint sync] Root mismatch when comparing latest finalized block with downloaded state"
)
Logger.flush()
System.halt(1)
end
Motivation
We want the ability to download the state from multiple checkpoint nodes when performing a checkpoint sync then compare the downloaded states failing if any of them are different
Description
Note
/eth/v1/beacon/deposit_snapshot
as this endpoint will be deprecated in the Electra fork. For this reason I didn't add the comparison when downloading the snapshot as it was hard to find two nodes that agreed in the result.How to try it
iex -S mix run -- --checkpoint-sync-url "https://mainnet-checkpoint-sync.stakely.io, https://sync.invis.tools" --discovery-port 9009 --mode full
Closes #1085