Merge remote-tracking branch 'origin/unstable' into tree-states

This commit is contained in:
Michael Sproul
2022-03-01 16:03:41 +11:00
209 changed files with 6107 additions and 1362 deletions

View File

@@ -2,7 +2,7 @@
name = "state_processing"
version = "0.2.0"
authors = ["Paul Hauner <paul@paulhauner.com>", "Michael Sproul <michael@sigmaprime.io>"]
edition = "2018"
edition = "2021"
[dev-dependencies]
env_logger = "0.9.0"

View File

@@ -3,7 +3,7 @@
not(test),
deny(
clippy::integer_arithmetic,
clippy::disallowed_method,
clippy::disallowed_methods,
clippy::indexing_slicing,
clippy::unwrap_used,
clippy::expect_used,

View File

@@ -370,7 +370,7 @@ pub fn process_execution_payload<T: EthSpec>(
parent_hash: payload.parent_hash,
fee_recipient: payload.fee_recipient,
state_root: payload.state_root,
receipt_root: payload.receipt_root,
receipts_root: payload.receipts_root,
logs_bloom: payload.logs_bloom.clone(),
random: payload.random,
block_number: payload.block_number,

View File

@@ -59,8 +59,8 @@ pub enum BlockProcessingError {
InconsistentBlockFork(InconsistentFork),
InconsistentStateFork(InconsistentFork),
ExecutionHashChainIncontiguous {
expected: Hash256,
found: Hash256,
expected: ExecutionBlockHash,
found: ExecutionBlockHash,
},
ExecutionRandaoMismatch {
expected: Hash256,

View File

@@ -177,7 +177,7 @@ where
Ok(SignatureSet::single_pubkey(
block.body().randao_reveal(),
get_pubkey(proposer_index).ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?,
get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?,
message,
))
}
@@ -199,15 +199,13 @@ where
block_header_signature_set(
state,
&proposer_slashing.signed_header_1,
get_pubkey(proposer_index)
.ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?,
get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?,
spec,
),
block_header_signature_set(
state,
&proposer_slashing.signed_header_2,
get_pubkey(proposer_index)
.ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?,
get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?,
spec,
),
))
@@ -363,7 +361,7 @@ where
Ok(SignatureSet::single_pubkey(
&signed_exit.signature,
get_pubkey(proposer_index).ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?,
get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?,
message,
))
}
@@ -521,7 +519,7 @@ where
{
let mut pubkeys = Vec::with_capacity(T::SyncSubcommitteeSize::to_usize());
for pubkey in pubkey_bytes {
pubkeys.push(get_pubkey(pubkey).ok_or_else(|| Error::ValidatorPubkeyUnknown(*pubkey))?);
pubkeys.push(get_pubkey(pubkey).ok_or(Error::ValidatorPubkeyUnknown(*pubkey))?);
}
let domain = spec.get_domain(epoch, Domain::SyncCommittee, fork, genesis_validators_root);

View File

@@ -4,7 +4,6 @@ use crate::per_epoch_processing::{
Delta, Error,
};
use safe_arith::SafeArith;
use std::array::IntoIter as ArrayIter;
use types::{BeaconState, ChainSpec, EthSpec};
/// Combination of several deltas for different components of an attestation reward.
@@ -30,13 +29,13 @@ impl AttestationDelta {
inactivity_penalty_delta,
} = self;
let mut result = Delta::default();
for delta in ArrayIter::new([
for delta in [
source_delta,
target_delta,
head_delta,
inclusion_delay_delta,
inactivity_penalty_delta,
]) {
] {
result.combine(delta)?;
}
Ok(result)