Use proposer index cache for block proposal #4313
Labels
consensus
An issue/PR that touches consensus code, such as state_processing or block verification.
optimization
Something to make Lighthouse run more efficiently.
Description
During block proposal we compute the proposer index from scratch here:
lighthouse/beacon_node/beacon_chain/src/beacon_chain.rs
Line 4308 in 693886b
Steps to resolve
We should use the beacon proposer cache, like this:
lighthouse/beacon_node/beacon_chain/src/beacon_chain.rs
Lines 3877 to 3882 in 693886b
On a cache miss we could either fall back to computing the index as we do now, or we could prime the cache using the available beacon state. The disadvantage of priming the cache is that it delays the
getPayload
request to the builder/execution layer. However, we might end up needing to prime the cache anyway. If we fix #4264 then gossip verification will try to prime the cache here:lighthouse/beacon_node/beacon_chain/src/block_verification.rs
Lines 807 to 814 in 693886b
Therefore I think we may as well try priming the cache if we miss. It's more future proof.
The text was updated successfully, but these errors were encountered: