This commit is contained in:
Diva M 2023-03-15 12:37:53 -05:00
parent 91a06ba484
commit 34cea6d1c3
No known key found for this signature in database
GPG Key ID: 1BAE5E01126680FE
5 changed files with 26 additions and 11 deletions

View File

@ -57,9 +57,9 @@ use types::{
Attestation, AttestationData, AttesterSlashing, BeaconStateError, BlindedPayload,
CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ForkName, FullPayload,
ProposerPreparationData, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof,
SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlsToExecutionChange,
SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlockContents, SignedBlsToExecutionChange,
SignedContributionAndProof, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
SyncCommitteeMessage, SyncContributionData, SignedBlockContents,
SyncCommitteeMessage, SyncContributionData,
};
use version::{
add_consensus_version_header, execution_optimistic_fork_versioned_response,

View File

@ -102,8 +102,8 @@ pub mod blob_sidecar;
pub mod blobs_sidecar;
pub mod signed_blob;
pub mod signed_block_and_blobs;
pub mod transaction;
pub mod signed_block_contents;
pub mod transaction;
use ethereum_types::{H160, H256};
@ -184,7 +184,10 @@ pub use crate::signed_beacon_block::{
};
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
pub use crate::signed_blob::*;
pub use crate::signed_block_and_blobs::{SignedBeaconBlockAndBlobsSidecar, SignedBeaconBlockAndBlobsSidecarDecode, SignedBeaconBlockAndBlobSidecars};
pub use crate::signed_block_and_blobs::{
SignedBeaconBlockAndBlobSidecars, SignedBeaconBlockAndBlobsSidecar,
SignedBeaconBlockAndBlobsSidecarDecode,
};
pub use crate::signed_block_contents::SignedBlockContents;
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;

View File

@ -1,9 +1,9 @@
use crate::{test_utils::TestRandom, BlobSidecar, EthSpec, Signature};
use derivative::Derivative;
use serde_derive::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash_derive::TreeHash;
use derivative::Derivative;
#[derive(
Debug,

View File

@ -1,5 +1,5 @@
use crate::{AbstractExecPayload, EthSpec, FullPayload, SignedBeaconBlock, SignedBlobSidecar};
use crate::signed_block_and_blobs::SignedBeaconBlockAndBlobSidecars;
use crate::{AbstractExecPayload, EthSpec, FullPayload, SignedBeaconBlock, SignedBlobSidecar};
use derivative::Derivative;
use serde_derive::{Deserialize, Serialize};
use ssz_types::VariableList;
@ -17,12 +17,19 @@ pub enum SignedBlockContents<T: EthSpec, Payload: AbstractExecPayload<T> = FullP
impl<T: EthSpec, Payload: AbstractExecPayload<T>> SignedBlockContents<T, Payload> {
pub fn signed_block(&self) -> &SignedBeaconBlock<T, Payload> {
match self {
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => &block_and_sidecars.signed_block,
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => {
&block_and_sidecars.signed_block
}
SignedBlockContents::Block(block) => block,
}
}
pub fn deconstruct(self) -> (SignedBeaconBlock<T, Payload>, Option<VariableList<SignedBlobSidecar<T>, <T as EthSpec>::MaxBlobsPerBlock>>) {
pub fn deconstruct(
self,
) -> (
SignedBeaconBlock<T, Payload>,
Option<VariableList<SignedBlobSidecar<T>, <T as EthSpec>::MaxBlobsPerBlock>>,
) {
match self {
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => (
block_and_sidecars.signed_block,
@ -33,8 +40,10 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> SignedBlockContents<T, Payload
}
}
impl<T: EthSpec, Payload: AbstractExecPayload<T>> From<SignedBeaconBlock<T, Payload>> for SignedBlockContents<T, Payload> {
impl<T: EthSpec, Payload: AbstractExecPayload<T>> From<SignedBeaconBlock<T, Payload>>
for SignedBlockContents<T, Payload>
{
fn from(block: SignedBeaconBlock<T, Payload>) -> Self {
SignedBlockContents::Block(block)
}
}
}

View File

@ -14,7 +14,10 @@ use std::sync::Arc;
use std::time::Duration;
use tokio::sync::mpsc;
use tokio::time::sleep;
use types::{AbstractExecPayload, BeaconBlock, BlindedPayload, BlockType, EthSpec, FullPayload, Graffiti, PublicKeyBytes, SignedBlockContents, Slot};
use types::{
AbstractExecPayload, BeaconBlock, BlindedPayload, BlockType, EthSpec, FullPayload, Graffiti,
PublicKeyBytes, SignedBlockContents, Slot,
};
#[derive(Debug)]
pub enum BlockError {