Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Commit

Permalink
update v0.6: check proposer is not slashed (ethereum/consensus-specs#757
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sorpaas committed May 2, 2019
1 parent a33ccd7 commit d79988c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions beacon/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub enum Error {
BlockPreviousRootInvalid,
/// Block signature is invalid.
BlockSignatureInvalid,
/// Block proposer has been slashed.
BlockProposerSlashed,
/// Randao signature is invalid.
RandaoSignatureInvalid,
/// Proposer slashing contains invalid slot.
Expand Down
4 changes: 4 additions & 0 deletions beacon/src/executive/per_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ impl<'state, 'config, C: Config> Executive<'state, 'config, C> {
if let Some(signature) = block.signature() {
let proposer = &self.state.validator_registry[self.beacon_proposer_index(self.state.slot, false)? as usize];

if proposer.slashed {
return Err(Error::BlockProposerSlashed)
}

if !self.config.bls_verify(&proposer.pubkey, &Hashable::<C::Hasher>::truncated_hash(block), signature, self.config.domain_id(&self.state.fork, self.current_epoch(), self.config.domain_beacon_block())) {
return Err(Error::BlockSignatureInvalid)
}
Expand Down

0 comments on commit d79988c

Please sign in to comment.