Merge remote-tracking branch 'origin/master' into v0.8.3

This commit is contained in:
Michael Sproul
2019-09-05 12:27:58 +10:00
69 changed files with 3927 additions and 2798 deletions

View File

@@ -8,7 +8,7 @@ use ssz::Decode;
use state_processing::per_block_processing::{
errors::BlockProcessingError, process_attestations, process_attester_slashings,
process_block_header, process_deposits, process_exits, process_proposer_slashings,
process_transfers,
process_transfers, VerifySignatures,
};
use std::fmt::Debug;
use std::path::Path;
@@ -53,7 +53,7 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_attestations(state, &[self.clone()], spec)
process_attestations(state, &[self.clone()], VerifySignatures::True, spec)
}
}
@@ -67,7 +67,7 @@ impl<E: EthSpec> Operation<E> for AttesterSlashing<E> {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_attester_slashings(state, &[self.clone()], spec)
process_attester_slashings(state, &[self.clone()], VerifySignatures::True, spec)
}
}
@@ -91,7 +91,7 @@ impl<E: EthSpec> Operation<E> for ProposerSlashing {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_proposer_slashings(state, &[self.clone()], spec)
process_proposer_slashings(state, &[self.clone()], VerifySignatures::True, spec)
}
}
@@ -101,7 +101,7 @@ impl<E: EthSpec> Operation<E> for Transfer {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_transfers(state, &[self.clone()], spec)
process_transfers(state, &[self.clone()], VerifySignatures::True, spec)
}
}
@@ -115,7 +115,7 @@ impl<E: EthSpec> Operation<E> for VoluntaryExit {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_exits(state, &[self.clone()], spec)
process_exits(state, &[self.clone()], VerifySignatures::True, spec)
}
}
@@ -133,7 +133,13 @@ impl<E: EthSpec> Operation<E> for BeaconBlock<E> {
state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), BlockProcessingError> {
process_block_header(state, self, spec, true)
Ok(process_block_header(
state,
self,
None,
VerifySignatures::True,
spec,
)?)
}
}

View File

@@ -4,7 +4,7 @@ use crate::case_result::compare_beacon_state_results_without_caches;
use crate::decode::{ssz_decode_file, yaml_decode_file};
use serde_derive::Deserialize;
use state_processing::{
per_block_processing, per_slot_processing, BlockInvalid, BlockProcessingError,
per_block_processing, per_slot_processing, BlockProcessingError, BlockSignatureStrategy,
};
use types::{BeaconBlock, BeaconState, EthSpec, RelativeEpoch};
@@ -80,14 +80,18 @@ impl<E: EthSpec> Case for SanityBlocks<E> {
.build_committee_cache(RelativeEpoch::Current, spec)
.unwrap();
per_block_processing(&mut state, block, spec)?;
per_block_processing(
&mut state,
block,
None,
BlockSignatureStrategy::VerifyIndividual,
spec,
)?;
if block.state_root == state.canonical_root() {
Ok(())
} else {
Err(BlockProcessingError::Invalid(
BlockInvalid::StateRootMismatch,
))
Err(BlockProcessingError::StateRootMismatch)
}
})
.map(|_| state);