Skip to content

Fork choice should run after RPC blob processing #5474

@michaelsproul

Description

@michaelsproul

Description

It seems like we don't run fork choice after importing a block on this code path:

Ok(AvailabilityProcessingStatus::Imported(hash)) => {
debug!(
self.log,
"Block components retrieved";
"result" => "imported block and blobs",
"slot" => %slot,
"block_hash" => %hash,
);
}

This happens when we need to fetch blobs over RPC, and then complete block import off the back of a blob RPC response.

When there are no blobs, we run fork choice after importing the block here:

self.chain.recompute_head_at_current_slot().await;

Similarly, when gossip blobs complete a block, we run fork choice here:

self.chain.recompute_head_at_current_slot().await;

Therefore I think the only case missing is the one where we get blobs by RPC.

Version

Lighthouse v5.1.2

Additional Info

Some logs for slot 8708202 which was processed poorly by one of our mainnet nodes:

Mar 24 23:20:49.049 DEBG Successfully verified gossip block commitments: [0xb271…88cb, 0xa124…b7c1, 0x828d…98d7, 0x99d3…c902, 0x929f…d3df, 0x9075…4243], root: 0x03e76b4edf5a4ad6a54254846b3f184301e61081131ec69229e96d7362563dda, slot: 8708202, graffiti: teku/v24.3.0, service: beacon
Mar 24 23:20:49.373 DEBG Searching for block components block: 0x03e76b4edf5a4ad6a54254846b3f184301e61081131ec69229e96d7362563dda, peer_ids: [PeerId("16Uiu2HAkwNyHdQvmb1WW6wYoxg7i8RPZU2H9bC23ZfnmgAdtKeZP")], service: sync
Mar 24 23:20:49.373 DEBG Sending BlobsByRoot Request lookup_type: Current, peer: 16Uiu2HAkwNyHdQvmb1WW6wYoxg7i8RPZU2H9bC23ZfnmgAdtKeZP, blob_indices: [2, 5], block_root: 0x03e76b4edf5a4ad6a54254846b3f184301e61081131ec69229e96d7362563dda, method: BlobsByRoot, service: sync
Mar 24 23:20:49.663 DEBG Successfully verified gossip blob commitment: 0x9075…4243, index: 5, root: 0x03e7…3dda, slot: 8708202
Mar 24 23:20:49.855 DEBG Peer returned blob for single lookup blob_id: BlobIdentifier { block_root: 0x03e76b4edf5a4ad6a54254846b3f184301e61081131ec69229e96d7362563dda, index: 2 }, peer_id: 16Uiu2HAkwNyHdQvmb1WW6wYoxg7i8RPZU2H9bC23ZfnmgAdtKeZP, service: sync
Mar 24 23:20:50.142 DEBG Block components retrieved block_hash: 0x03e7…3dda, slot: 8708202, result: imported block and blobs

As we can see from these logs, the BN had all block components by 23:20:50.142, just 3.1s into the slot. However we don't see the head get updated until >8s later:

Mar 24 23:20:58.523 DEBG Fork choice updated head old_head: 0xf4d9e783aed03445d3a64e2e741a1631c03a11a38e1fcf4c081785e123a7ff41, old_head_weight: Some(1948605000000000), new_head: 0x03e76b4edf5a4ad6a54254846b3f184301e61081131ec69229e96d7362563dda, new_head_weight: Some(970590000000000), service: beacon

This triggers a snapshot cache miss for advancing the head, because the "head" that the state advance is looking for is the stale head from the previous slot, which has been (rightly) removed from the cache:

Mar 24 23:20:56.001 WARN Did not advance head state reason: Err(HeadMissingFromSnapshotCache(0xf4d9e783aed03445d3a64e2e741a1631c03a11a38e1fcf4c081785e123a7ff41)), service: state_advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdeneb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions