mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Check proposer index during block production (#2740)
## Issue Addressed Resolves #2612 ## Proposed Changes Implements both the checks mentioned in the original issue. 1. Verifies the `randao_reveal` in the beacon node 2. Cross checks the proposer index after getting back the block from the beacon node. ## Additional info The block production time increases by ~10x because of the signature verification on the beacon node (based on the `beacon_block_production_process_seconds` metric) when running on a local testnet.
This commit is contained in:
@@ -46,6 +46,8 @@ pub enum BlockSignatureStrategy {
|
||||
NoVerification,
|
||||
/// Validate each signature individually, as its object is being processed.
|
||||
VerifyIndividual,
|
||||
/// Validate only the randao reveal signature.
|
||||
VerifyRandao,
|
||||
/// Verify all signatures in bulk at the beginning of block processing.
|
||||
VerifyBulk,
|
||||
}
|
||||
@@ -115,6 +117,7 @@ pub fn per_block_processing<T: EthSpec>(
|
||||
}
|
||||
BlockSignatureStrategy::VerifyIndividual => VerifySignatures::True,
|
||||
BlockSignatureStrategy::NoVerification => VerifySignatures::False,
|
||||
BlockSignatureStrategy::VerifyRandao => VerifySignatures::False,
|
||||
};
|
||||
|
||||
let proposer_index = process_block_header(state, block, spec)?;
|
||||
@@ -123,11 +126,16 @@ pub fn per_block_processing<T: EthSpec>(
|
||||
verify_block_signature(state, signed_block, block_root, spec)?;
|
||||
}
|
||||
|
||||
let verify_randao = if let BlockSignatureStrategy::VerifyRandao = block_signature_strategy {
|
||||
VerifySignatures::True
|
||||
} else {
|
||||
verify_signatures
|
||||
};
|
||||
// Ensure the current and previous epoch caches are built.
|
||||
state.build_committee_cache(RelativeEpoch::Previous, spec)?;
|
||||
state.build_committee_cache(RelativeEpoch::Current, spec)?;
|
||||
|
||||
process_randao(state, block, verify_signatures, spec)?;
|
||||
process_randao(state, block, verify_randao, spec)?;
|
||||
process_eth1_data(state, block.body().eth1_data())?;
|
||||
process_operations(state, block.body(), proposer_index, verify_signatures, spec)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user