mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 20:22:02 +00:00
Add incomplete per-block processing benchmarks
Still needs to fill block with operations
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use self::verify_proposer_slashing::verify_proposer_slashing;
|
||||
use errors::{BlockInvalid as Invalid, BlockProcessingError as Error, IntoWithIndex};
|
||||
use hashing::hash;
|
||||
use log::debug;
|
||||
use ssz::{ssz_encode, SignedRoot, TreeHash};
|
||||
use types::*;
|
||||
|
||||
@@ -70,22 +69,21 @@ fn per_block_processing_signature_optional(
|
||||
// Verify that `block.slot == state.slot`.
|
||||
verify!(block.slot == state.slot, Invalid::StateSlotMismatch);
|
||||
|
||||
// Ensure the current epoch cache is built.
|
||||
// Ensure the current and previous epoch cache is built.
|
||||
state.build_epoch_cache(RelativeEpoch::Current, spec)?;
|
||||
state.build_epoch_cache(RelativeEpoch::Previous, spec)?;
|
||||
|
||||
if should_verify_block_signature {
|
||||
verify_block_signature(&state, &block, &spec)?;
|
||||
}
|
||||
process_randao(&mut state, &block, &spec)?;
|
||||
process_eth1_data(&mut state, &block.eth1_data)?;
|
||||
process_proposer_slashings(&mut state, &block.body.proposer_slashings[..], spec)?;
|
||||
process_attester_slashings(&mut state, &block.body.attester_slashings[..], spec)?;
|
||||
process_attestations(&mut state, &block.body.attestations[..], spec)?;
|
||||
process_deposits(&mut state, &block.body.deposits[..], spec)?;
|
||||
process_exits(&mut state, &block.body.voluntary_exits[..], spec)?;
|
||||
process_transfers(&mut state, &block.body.transfers[..], spec)?;
|
||||
|
||||
debug!("per_block_processing complete.");
|
||||
process_proposer_slashings(&mut state, &block.body.proposer_slashings, spec)?;
|
||||
process_attester_slashings(&mut state, &block.body.attester_slashings, spec)?;
|
||||
process_attestations(&mut state, &block.body.attestations, spec)?;
|
||||
process_deposits(&mut state, &block.body.deposits, spec)?;
|
||||
process_exits(&mut state, &block.body.voluntary_exits, spec)?;
|
||||
process_transfers(&mut state, &block.body.transfers, spec)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -11,8 +11,11 @@ fn runs_without_error() {
|
||||
let spec = ChainSpec::few_validators();
|
||||
|
||||
let mut builder = BeaconStateBencher::new(8, &spec);
|
||||
builder.teleport_to_end_of_epoch(spec.genesis_epoch + 4, &spec);
|
||||
let mut state = builder.build();
|
||||
|
||||
let target_slot = (spec.genesis_epoch + 4).end_slot(spec.slots_per_epoch);
|
||||
builder.teleport_to_slot(target_slot, &spec);
|
||||
|
||||
let (mut state, _keypairs) = builder.build();
|
||||
|
||||
per_epoch_processing(&mut state, &spec).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user