mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
refactor deneb block processing
This commit is contained in:
@@ -11,6 +11,7 @@ use beacon_chain::{
|
||||
BeaconChain, BeaconChainError, BeaconForkChoiceStore, ChainConfig, ForkChoiceError,
|
||||
StateSkipConfig, WhenSlotSkipped,
|
||||
};
|
||||
use beacon_chain::block_verification_types::RpcBlock;
|
||||
use fork_choice::{
|
||||
ForkChoiceStore, InvalidAttestation, InvalidBlock, PayloadVerificationStatus, QueuedAttestation,
|
||||
};
|
||||
@@ -200,7 +201,7 @@ impl ForkChoiceTest {
|
||||
if !predicate(block.0.message(), &state) {
|
||||
break;
|
||||
}
|
||||
if let Ok(block_hash) = self.harness.process_block_result(block.clone()).await {
|
||||
if let Ok(block_hash) = self.harness.process_block_result(RpcBlock::new(block.0, block.1).unwrap()).await {
|
||||
self.harness.attest_block(
|
||||
&state,
|
||||
block.0.state_root(),
|
||||
|
||||
@@ -21,8 +21,6 @@ pub struct ConsensusContext<T: EthSpec> {
|
||||
#[ssz(skip_serializing, skip_deserializing)]
|
||||
indexed_attestations:
|
||||
HashMap<(AttestationData, BitList<T::MaxValidatorsPerCommittee>), IndexedAttestation<T>>,
|
||||
/// Whether `verify_kzg_commitments_against_transactions` has successfully passed.
|
||||
kzg_commitments_consistent: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
@@ -45,7 +43,6 @@ impl<T: EthSpec> ConsensusContext<T> {
|
||||
proposer_index: None,
|
||||
current_block_root: None,
|
||||
indexed_attestations: HashMap::new(),
|
||||
kzg_commitments_consistent: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,13 +158,4 @@ impl<T: EthSpec> ConsensusContext<T> {
|
||||
pub fn num_cached_indexed_attestations(&self) -> usize {
|
||||
self.indexed_attestations.len()
|
||||
}
|
||||
|
||||
pub fn set_kzg_commitments_consistent(mut self, kzg_commitments_consistent: bool) -> Self {
|
||||
self.kzg_commitments_consistent = kzg_commitments_consistent;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn kzg_commitments_consistent(&self) -> bool {
|
||||
self.kzg_commitments_consistent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,9 +169,10 @@ pub use crate::selection_proof::SelectionProof;
|
||||
pub use crate::shuffling_id::AttestationShufflingId;
|
||||
pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof;
|
||||
pub use crate::signed_beacon_block::{
|
||||
ssz_tagged_signed_beacon_block, SignedBeaconBlock, SignedBeaconBlockAltair,
|
||||
SignedBeaconBlockBase, SignedBeaconBlockCapella, SignedBeaconBlockDeneb, SignedBeaconBlockHash,
|
||||
SignedBeaconBlockMerge, SignedBlindedBeaconBlock,
|
||||
ssz_tagged_signed_beacon_block, ssz_tagged_signed_beacon_block_arc, SignedBeaconBlock,
|
||||
SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockCapella,
|
||||
SignedBeaconBlockDeneb, SignedBeaconBlockHash, SignedBeaconBlockMerge,
|
||||
SignedBlindedBeaconBlock,
|
||||
};
|
||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||
pub use crate::signed_blob::*;
|
||||
|
||||
@@ -642,6 +642,27 @@ pub mod ssz_tagged_signed_beacon_block {
|
||||
}
|
||||
}
|
||||
|
||||
pub mod ssz_tagged_signed_beacon_block_arc {
|
||||
use super::*;
|
||||
pub mod encode {
|
||||
pub use super::ssz_tagged_signed_beacon_block::encode::*;
|
||||
}
|
||||
|
||||
pub mod decode {
|
||||
pub use super::ssz_tagged_signed_beacon_block::decode::{is_ssz_fixed_len, ssz_fixed_len};
|
||||
use super::*;
|
||||
#[allow(unused_imports)]
|
||||
use ssz::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub fn from_ssz_bytes<E: EthSpec, Payload: AbstractExecPayload<E>>(
|
||||
bytes: &[u8],
|
||||
) -> Result<Arc<SignedBeaconBlock<E, Payload>>, DecodeError> {
|
||||
ssz_tagged_signed_beacon_block::decode::from_ssz_bytes(bytes).map(Arc::new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user