status-im / nimbus-eth2

Nim implementation of the Ethereum Beacon Chain
https://nimbus.guide
Other
503 stars 212 forks source link

Consider checkpoint sync to main beacon node startup #3285

Open arnetheduck opened 2 years ago

arnetheduck commented 2 years ago

Originally posted by @jclapis in https://github.com/status-im/nimbus-eth2/issues/3209#issuecomment-1003598851

arnetheduck commented 2 years ago

TODO:

arnetheduck commented 2 years ago

For those looking for behavior similar to checkpoint sync in other clients:

# Run TNS when database is missing, skipping the backfill
[ -f "$DATADIR/db/nbc.sqlite3" ] || build/nimbus_beacon_node --data-dir:"$DATADIR" trustedNodeSync --backfill:false
# now run beacon node as normal..
build/nimbus_beacon_node ...
dapplion commented 1 year ago

This would be nice!

maxtreyver commented 1 year ago

Yes, huge +1 on this. I'm new to the ETH staking community, and this particular UX discomfort was a big negative of Nimbus compared to others (Lighthouse, Teku, I think Prysm has it or something like it too?)

michaelsproul commented 2 months ago

Just ran into this after my disk filled up. Especially with Docker images and volumes to fuss around with, a flag is nicer than a separate command.

etan-status commented 2 months ago

https://nimbus.guide/start-syncing.html#checkpoint-sync

You can use --external-beacon-api-url with --trusted-state-root to sync from Checkpointz on main command. DB dir has to be empty though.

etan-status commented 2 months ago

--trusted-block-root doesn't work currently with checkpointz, as it needs LC data to be served. Tracking issue: https://github.com/ethpandaops/checkpointz/issues/143

Only --trusted-state-root works for now.

michaelsproul commented 2 months ago

Thanks @etan-status, I will use that next time!

Curious to try --trusted-block-root with Lighthouse's LC data server too.

michaelsproul commented 2 months ago

Are there any plans to support checkpoint sync without specifying a block root/state root ahead of time? I think it could still be slightly more ergonomic, as it wouldn't require editing .service files, or deployment scripts or similar. Instead the user could check the logs after syncing to ensure they're on the right chain. I'm aware lots of users do not check, so if you want to require them to check the block root, I think the mandatory block root/state root flag is a good middle ground.

etan-status commented 2 months ago

Yes, with EIP-7658 it would be possible to bake in a deeply finalized block root into the network metadata and start syncing from there. With light client data being backfillable, its availability on the network would improve, and when full data from the deeply finalized block to a recent one is available, syncing can be performed automatically.

Operation based on a trusted server requires the additional trustedNodeSync step on Nimbus. The main startup command only supports secure sync with an explicit (not "finalized") --trusted-block-root (can be an older checkpoint, but requires server to serve LC data; or alternatively with an explicit --trusted-state-root (has to be a recent checkpoint, but also works with checkpointz). For testnets with post-altair genesis, it also works without any root, as long as the server supports LC data.

etan-status commented 2 months ago

EIP-7658 is in this PR: https://github.com/ethereum/consensus-specs/pull/3614

etan-status commented 2 months ago

@michaelsproul re Lighthouse LC data server, would be great to get feedback on https://github.com/ethpandaops/checkpointz/issues/143 whether it is acceptable to proxy the LC related routes for you as well. Nimbus/Lodestar are fine with it.