Skip to content

[Merged by Bors] - Fix post-merge checkpoint sync#3065

Closed
paulhauner wants to merge 1 commit intosigp:unstablefrom
paulhauner:ws-fcu
Closed

[Merged by Bors] - Fix post-merge checkpoint sync#3065
paulhauner wants to merge 1 commit intosigp:unstablefrom
paulhauner:ws-fcu

Conversation

@paulhauner
Copy link
Copy Markdown
Member

@paulhauner paulhauner commented Mar 9, 2022

Issue Addressed

This address an issue which was preventing checkpoint-sync.

When the node starts from checkpoint sync, the head block and the finalized block are the same value. We did not respect this when sending a forkchoiceUpdated (fcU) call to the EL and were expecting fork choice to hold the finalized ancestor of the head and returning an error when it didn't.

This PR uses only fork choice for sending fcU updates. This is actually quite nice and avoids some atomicity issues between chain.canonical_head and chain.fork_choice. Now, whenever chain.fork_choice.get_head returns a value we also cache the values required for the next fcU call.

TODO

@paulhauner paulhauner added blocked bellatrix Required to support the Bellatrix Upgrade labels Mar 9, 2022
@paulhauner paulhauner changed the title Ws fcu Fix post-merge checkpoint sync Mar 9, 2022
@paulhauner paulhauner removed the blocked label Mar 9, 2022
@paulhauner paulhauner added work-in-progress PR is a work-in-progress ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress ready-for-review The code is ready for review labels Mar 9, 2022
Copy link
Copy Markdown
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Looks good from a code PoV, although I haven't actually tried to run it 😅

Happy to merge once someone vouches that checkpoint sync works now on merge-devnet-5

@paulhauner
Copy link
Copy Markdown
Member Author

Proof!

lighthouse --testnet-dir merge-devnet-5 bn --datadir lh2 -z --checkpoint-sync-url http://localhost:5052
Mar 10 06:01:20.073 INFO Logging to file                         path: "lh2/beacon/logs/beacon.log"
Mar 10 06:01:20.074 INFO Lighthouse started                      version: Lighthouse/v2.1.3-b081402
Mar 10 06:01:20.074 INFO Configured for network                  name: custom (merge-devnet-5)
Mar 10 06:01:20.074 INFO Data directory initialised              datadir: lh2
Mar 10 06:01:20.074 INFO Deposit contract                        address: 0x4242424242424242424242424242424242424242, deploy_block: 0
Mar 10 06:01:20.137 INFO Starting checkpoint sync                remote_url: http://localhost:5052/, service: beacon
Mar 10 06:01:20.253 INFO Loaded checkpoint block and state       state_root: 0xde640ec77a79c02bcf979aa02ceec007b1b9cc034cb536b215d7b78c15938393, block_root: 0x3366cd0d1eadfd6584ba91d5a1e29a5728e9e5f8507028f9a7aa10f9b4dc628b, slot: 47296, service: beacon
Mar 10 06:01:20.726 INFO Block production disabled               reason: no eth1 backend configured
Mar 10 06:01:23.964 INFO Beacon chain initialized                head_slot: 47296, head_block: 0x3366…628b, head_state: 0xde64…8393, service: beacon
Mar 10 06:01:23.965 INFO Timer service started                   service: node_timer
Mar 10 06:01:23.965 INFO UPnP Attempting to initialise routes    service: UPnP
Mar 10 06:01:23.965 INFO Libp2p Starting                         bandwidth_config: 3-Average, peer_id: 16Uiu2HAmSxwxv1dPp9WXEeKD82BLvdUuX1xbRphifvrChQeHLfa4, service: libp2p
Mar 10 06:01:23.965 INFO ENR Initialised                         tcp: Some(33361), udp: None, ip: None, id: 0x0ecb..74ac, seq: 1, enr: enr:-K24QFQStI9OSViucGp99xdS1W8aWGs-t8Wvd1p6vniEpbp4O1VFPzSlqZNZQ-xlxrCJCXcVx87_JSZ8OgymM_PlrzcBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpB66onJYAAQcf__________gmlkgnY0iXNlY3AyNTZrMaED1J1fuZJ6qPVpJjtsjKp591jGAxvEkMCqNIFHY3JBqa2Ic3luY25ldHMAg3RjcIKCUQ, service: libp2p
Mar 10 06:01:23.966 ERRO Could not add peer to the local routing table, error: ENR has no UDP socket to connect to, addr: ENR: NodeId: 0xa7ef..1720, Socket: None, service: libp2p
Mar 10 06:01:23.966 INFO Listening established                   address: /ip4/0.0.0.0/tcp/33361/p2p/16Uiu2HAmSxwxv1dPp9WXEeKD82BLvdUuX1xbRphifvrChQeHLfa4, service: libp2p
Mar 10 06:01:23.967 INFO HTTP server is disabled
Mar 10 06:01:30.001 WARN Low peer count                          peer_count: 0, service: slot_notifier
Mar 10 06:01:30.001 INFO Searching for peers                     current_slot: 47382, head_slot: 47296, finalized_epoch: 1476, finalized_root: 0xeb7d…2a00, peers: 0, service: slot_notifier

@paulhauner paulhauner added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Mar 10, 2022
@paulhauner
Copy link
Copy Markdown
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Mar 10, 2022
## Issue Addressed

This address an issue which was preventing checkpoint-sync.

When the node starts from checkpoint sync, the head block and the finalized block are the same value. We did not respect this when sending a `forkchoiceUpdated` (fcU) call to the EL and were expecting fork choice to hold the *finalized ancestor of the head* and returning an error when it didn't.

This PR uses *only fork choice* for sending fcU updates. This is actually quite nice and avoids some atomicity issues between `chain.canonical_head` and `chain.fork_choice`. Now, whenever `chain.fork_choice.get_head` returns a value we also cache the values required for the next fcU call.

## TODO

- [x] ~~Blocked on #3043~~
- [x] Ensure there isn't a warn message at startup.
@bors bors bot changed the title Fix post-merge checkpoint sync [Merged by Bors] - Fix post-merge checkpoint sync Mar 10, 2022
@bors bors bot closed this Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bellatrix Required to support the Bellatrix Upgrade ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants