fmt
This commit is contained in:
parent
91a06ba484
commit
34cea6d1c3
@ -57,9 +57,9 @@ use types::{
|
|||||||
Attestation, AttestationData, AttesterSlashing, BeaconStateError, BlindedPayload,
|
Attestation, AttestationData, AttesterSlashing, BeaconStateError, BlindedPayload,
|
||||||
CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ForkName, FullPayload,
|
CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ForkName, FullPayload,
|
||||||
ProposerPreparationData, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof,
|
ProposerPreparationData, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof,
|
||||||
SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlsToExecutionChange,
|
SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlockContents, SignedBlsToExecutionChange,
|
||||||
SignedContributionAndProof, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
|
SignedContributionAndProof, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
|
||||||
SyncCommitteeMessage, SyncContributionData, SignedBlockContents,
|
SyncCommitteeMessage, SyncContributionData,
|
||||||
};
|
};
|
||||||
use version::{
|
use version::{
|
||||||
add_consensus_version_header, execution_optimistic_fork_versioned_response,
|
add_consensus_version_header, execution_optimistic_fork_versioned_response,
|
||||||
|
@ -102,8 +102,8 @@ pub mod blob_sidecar;
|
|||||||
pub mod blobs_sidecar;
|
pub mod blobs_sidecar;
|
||||||
pub mod signed_blob;
|
pub mod signed_blob;
|
||||||
pub mod signed_block_and_blobs;
|
pub mod signed_block_and_blobs;
|
||||||
pub mod transaction;
|
|
||||||
pub mod signed_block_contents;
|
pub mod signed_block_contents;
|
||||||
|
pub mod transaction;
|
||||||
|
|
||||||
use ethereum_types::{H160, H256};
|
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_beacon_block_header::SignedBeaconBlockHeader;
|
||||||
pub use crate::signed_blob::*;
|
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_block_contents::SignedBlockContents;
|
||||||
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
||||||
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use crate::{test_utils::TestRandom, BlobSidecar, EthSpec, Signature};
|
use crate::{test_utils::TestRandom, BlobSidecar, EthSpec, Signature};
|
||||||
|
use derivative::Derivative;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use test_random_derive::TestRandom;
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
use derivative::Derivative;
|
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug,
|
Debug,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::{AbstractExecPayload, EthSpec, FullPayload, SignedBeaconBlock, SignedBlobSidecar};
|
|
||||||
use crate::signed_block_and_blobs::SignedBeaconBlockAndBlobSidecars;
|
use crate::signed_block_and_blobs::SignedBeaconBlockAndBlobSidecars;
|
||||||
|
use crate::{AbstractExecPayload, EthSpec, FullPayload, SignedBeaconBlock, SignedBlobSidecar};
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use ssz_types::VariableList;
|
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> {
|
impl<T: EthSpec, Payload: AbstractExecPayload<T>> SignedBlockContents<T, Payload> {
|
||||||
pub fn signed_block(&self) -> &SignedBeaconBlock<T, Payload> {
|
pub fn signed_block(&self) -> &SignedBeaconBlock<T, Payload> {
|
||||||
match self {
|
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,
|
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 {
|
match self {
|
||||||
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => (
|
SignedBlockContents::BlockAndBlobSidecars(block_and_sidecars) => (
|
||||||
block_and_sidecars.signed_block,
|
block_and_sidecars.signed_block,
|
||||||
@ -33,7 +40,9 @@ 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 {
|
fn from(block: SignedBeaconBlock<T, Payload>) -> Self {
|
||||||
SignedBlockContents::Block(block)
|
SignedBlockContents::Block(block)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,10 @@ use std::sync::Arc;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tokio::time::sleep;
|
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)]
|
#[derive(Debug)]
|
||||||
pub enum BlockError {
|
pub enum BlockError {
|
||||||
|
Loading…
Reference in New Issue
Block a user