make signed block + sidecar consensus spec

This commit is contained in:
realbigsean
2022-11-10 14:22:30 -05:00
parent cb393f5b7d
commit fe04d945cc
8 changed files with 37 additions and 19 deletions

View File

@@ -97,6 +97,7 @@ pub mod sqlite;
pub mod blobs_sidecar;
pub mod kzg_commitment;
pub mod kzg_proof;
pub mod signed_block_and_blobs;
use ethereum_types::{H160, H256};
@@ -149,6 +150,7 @@ pub use crate::historical_batch::HistoricalBatch;
pub use crate::indexed_attestation::IndexedAttestation;
pub use crate::kzg_commitment::KzgCommitment;
pub use crate::kzg_proof::KzgProof;
pub use crate::signed_block_and_blobs::SignedBeaconBlockAndBlobsSidecar;
pub use crate::participation_flags::ParticipationFlags;
pub use crate::participation_list::ParticipationList;
pub use crate::payload::{

View File

@@ -0,0 +1,18 @@
use serde_derive::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use tree_hash_derive::TreeHash;
use crate::{BlobsSidecar, EthSpec, SignedBeaconBlock};
#[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash, PartialEq)]
#[serde(bound = "T: EthSpec")]
pub struct SignedBeaconBlockAndBlobsSidecar<T: EthSpec> {
pub beacon_block: SignedBeaconBlock<T>,
pub blobs_sidecar: BlobsSidecar<T>,
}
impl<T: EthSpec> SignedBeaconBlockAndBlobsSidecar<T> {
/// SSZ decode with fork variant determined by slot.
pub fn from_ssz_bytes(bytes: &[u8], spec: &ChainSpec) -> Result<Self, ssz::DecodeError> {
SignedBeaconBlock::from_ssz_bytes(bytes, spec)
}
}