mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Remove ineffectual block RPC limits post merge (#6798)
* Remove ineffectual block RPC limits post merge * Remove more things
This commit is contained in:
@@ -17,12 +17,11 @@ use tokio_util::{
|
|||||||
compat::{Compat, FuturesAsyncReadCompatExt},
|
compat::{Compat, FuturesAsyncReadCompatExt},
|
||||||
};
|
};
|
||||||
use types::{
|
use types::{
|
||||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockCapella, BeaconBlockElectra,
|
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BlobSidecar, ChainSpec, DataColumnSidecar,
|
||||||
BeaconBlockFulu, BlobSidecar, ChainSpec, DataColumnSidecar, EmptyBlock, EthSpec, EthSpecId,
|
EmptyBlock, EthSpec, EthSpecId, ForkContext, ForkName, LightClientBootstrap,
|
||||||
ForkContext, ForkName, LightClientBootstrap, LightClientBootstrapAltair,
|
LightClientBootstrapAltair, LightClientFinalityUpdate, LightClientFinalityUpdateAltair,
|
||||||
LightClientFinalityUpdate, LightClientFinalityUpdateAltair, LightClientOptimisticUpdate,
|
LightClientOptimisticUpdate, LightClientOptimisticUpdateAltair, LightClientUpdate,
|
||||||
LightClientOptimisticUpdateAltair, LightClientUpdate, MainnetEthSpec, MinimalEthSpec,
|
MainnetEthSpec, MinimalEthSpec, Signature, SignedBeaconBlock,
|
||||||
Signature, SignedBeaconBlock,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Note: Hardcoding the `EthSpec` type for `SignedBeaconBlock` as min/max values is
|
// Note: Hardcoding the `EthSpec` type for `SignedBeaconBlock` as min/max values is
|
||||||
@@ -55,74 +54,16 @@ pub static SIGNED_BEACON_BLOCK_ALTAIR_MAX: LazyLock<usize> = LazyLock::new(|| {
|
|||||||
.len()
|
.len()
|
||||||
});
|
});
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_CAPELLA_MAX_WITHOUT_PAYLOAD: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
SignedBeaconBlock::<MainnetEthSpec>::from_block(
|
|
||||||
BeaconBlock::Capella(BeaconBlockCapella::full(&MainnetEthSpec::default_spec())),
|
|
||||||
Signature::empty(),
|
|
||||||
)
|
|
||||||
.as_ssz_bytes()
|
|
||||||
.len()
|
|
||||||
});
|
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_ELECTRA_MAX_WITHOUT_PAYLOAD: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
SignedBeaconBlock::<MainnetEthSpec>::from_block(
|
|
||||||
BeaconBlock::Electra(BeaconBlockElectra::full(&MainnetEthSpec::default_spec())),
|
|
||||||
Signature::empty(),
|
|
||||||
)
|
|
||||||
.as_ssz_bytes()
|
|
||||||
.len()
|
|
||||||
});
|
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_FULU_MAX_WITHOUT_PAYLOAD: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
SignedBeaconBlock::<MainnetEthSpec>::from_block(
|
|
||||||
BeaconBlock::Fulu(BeaconBlockFulu::full(&MainnetEthSpec::default_spec())),
|
|
||||||
Signature::empty(),
|
|
||||||
)
|
|
||||||
.as_ssz_bytes()
|
|
||||||
.len()
|
|
||||||
});
|
|
||||||
|
|
||||||
/// The `BeaconBlockBellatrix` block has an `ExecutionPayload` field which has a max size ~16 GiB for future proofing.
|
/// The `BeaconBlockBellatrix` block has an `ExecutionPayload` field which has a max size ~16 GiB for future proofing.
|
||||||
/// We calculate the value from its fields instead of constructing the block and checking the length.
|
/// We calculate the value from its fields instead of constructing the block and checking the length.
|
||||||
/// Note: This is only the theoretical upper bound. We further bound the max size we receive over the network
|
/// Note: This is only the theoretical upper bound. We further bound the max size we receive over the network
|
||||||
/// with `max_chunk_size`.
|
/// with `max_chunk_size`.
|
||||||
///
|
|
||||||
/// FIXME: Given that these limits are useless we should probably delete them. See:
|
|
||||||
///
|
|
||||||
/// https://github.com/sigp/lighthouse/issues/6790
|
|
||||||
pub static SIGNED_BEACON_BLOCK_BELLATRIX_MAX: LazyLock<usize> =
|
pub static SIGNED_BEACON_BLOCK_BELLATRIX_MAX: LazyLock<usize> =
|
||||||
LazyLock::new(|| // Size of a full altair block
|
LazyLock::new(|| // Size of a full altair block
|
||||||
*SIGNED_BEACON_BLOCK_ALTAIR_MAX
|
*SIGNED_BEACON_BLOCK_ALTAIR_MAX
|
||||||
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_bellatrix_size() // adding max size of execution payload (~16gb)
|
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_bellatrix_size() // adding max size of execution payload (~16gb)
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET); // Adding the additional ssz offset for the `ExecutionPayload` field
|
+ ssz::BYTES_PER_LENGTH_OFFSET); // Adding the additional ssz offset for the `ExecutionPayload` field
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_CAPELLA_MAX: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
*SIGNED_BEACON_BLOCK_CAPELLA_MAX_WITHOUT_PAYLOAD
|
|
||||||
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_capella_size() // adding max size of execution payload (~16gb)
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET
|
|
||||||
}); // Adding the additional ssz offset for the `ExecutionPayload` field
|
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_DENEB_MAX: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
*SIGNED_BEACON_BLOCK_CAPELLA_MAX_WITHOUT_PAYLOAD
|
|
||||||
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_deneb_size() // adding max size of execution payload (~16gb)
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET // Adding the additional offsets for the `ExecutionPayload`
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET
|
|
||||||
}); // Length offset for the blob commitments field.
|
|
||||||
//
|
|
||||||
pub static SIGNED_BEACON_BLOCK_ELECTRA_MAX: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
*SIGNED_BEACON_BLOCK_ELECTRA_MAX_WITHOUT_PAYLOAD
|
|
||||||
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_electra_size() // adding max size of execution payload (~16gb)
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET // Adding the additional ssz offset for the `ExecutionPayload` field
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET
|
|
||||||
}); // Length offset for the blob commitments field.
|
|
||||||
|
|
||||||
pub static SIGNED_BEACON_BLOCK_FULU_MAX: LazyLock<usize> = LazyLock::new(|| {
|
|
||||||
*SIGNED_BEACON_BLOCK_FULU_MAX_WITHOUT_PAYLOAD
|
|
||||||
+ types::ExecutionPayload::<MainnetEthSpec>::max_execution_payload_fulu_size()
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET
|
|
||||||
+ ssz::BYTES_PER_LENGTH_OFFSET
|
|
||||||
});
|
|
||||||
|
|
||||||
pub static BLOB_SIDECAR_SIZE: LazyLock<usize> =
|
pub static BLOB_SIDECAR_SIZE: LazyLock<usize> =
|
||||||
LazyLock::new(BlobSidecar::<MainnetEthSpec>::max_size);
|
LazyLock::new(BlobSidecar::<MainnetEthSpec>::max_size);
|
||||||
|
|
||||||
@@ -203,26 +144,12 @@ pub fn rpc_block_limits_by_fork(current_fork: ForkName) -> RpcLimits {
|
|||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair blocks
|
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair blocks
|
||||||
*SIGNED_BEACON_BLOCK_ALTAIR_MAX, // Altair block is larger than base blocks
|
*SIGNED_BEACON_BLOCK_ALTAIR_MAX, // Altair block is larger than base blocks
|
||||||
),
|
),
|
||||||
ForkName::Bellatrix => RpcLimits::new(
|
// After the merge the max SSZ size of a block is absurdly big. The size is actually
|
||||||
|
// bound by other constants, so here we default to the bellatrix's max value
|
||||||
|
_ => RpcLimits::new(
|
||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks
|
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks
|
||||||
*SIGNED_BEACON_BLOCK_BELLATRIX_MAX, // Bellatrix block is larger than base and altair blocks
|
*SIGNED_BEACON_BLOCK_BELLATRIX_MAX, // Bellatrix block is larger than base and altair blocks
|
||||||
),
|
),
|
||||||
ForkName::Capella => RpcLimits::new(
|
|
||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks
|
|
||||||
*SIGNED_BEACON_BLOCK_CAPELLA_MAX, // Capella block is larger than base, altair and merge blocks
|
|
||||||
),
|
|
||||||
ForkName::Deneb => RpcLimits::new(
|
|
||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks
|
|
||||||
*SIGNED_BEACON_BLOCK_DENEB_MAX, // Deneb block is larger than all prior fork blocks
|
|
||||||
),
|
|
||||||
ForkName::Electra => RpcLimits::new(
|
|
||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than altair and bellatrix blocks
|
|
||||||
*SIGNED_BEACON_BLOCK_ELECTRA_MAX, // Electra block is larger than Deneb block
|
|
||||||
),
|
|
||||||
ForkName::Fulu => RpcLimits::new(
|
|
||||||
*SIGNED_BEACON_BLOCK_BASE_MIN, // Base block is smaller than all other blocks
|
|
||||||
*SIGNED_BEACON_BLOCK_FULU_MAX, // Fulu block is largest
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use test_random_derive::TestRandom;
|
|||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
use self::indexed_attestation::{IndexedAttestationBase, IndexedAttestationElectra};
|
use self::indexed_attestation::IndexedAttestationBase;
|
||||||
|
|
||||||
/// A block of the `BeaconChain`.
|
/// A block of the `BeaconChain`.
|
||||||
#[superstruct(
|
#[superstruct(
|
||||||
@@ -499,52 +499,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockBell
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockCapella<E, Payload> {
|
|
||||||
/// Return a Capella block where the block has maximum size.
|
|
||||||
pub fn full(spec: &ChainSpec) -> Self {
|
|
||||||
let base_block: BeaconBlockBase<_, Payload> = BeaconBlockBase::full(spec);
|
|
||||||
let bls_to_execution_changes = vec![
|
|
||||||
SignedBlsToExecutionChange {
|
|
||||||
message: BlsToExecutionChange {
|
|
||||||
validator_index: 0,
|
|
||||||
from_bls_pubkey: PublicKeyBytes::empty(),
|
|
||||||
to_execution_address: Address::ZERO,
|
|
||||||
},
|
|
||||||
signature: Signature::empty()
|
|
||||||
};
|
|
||||||
E::max_bls_to_execution_changes()
|
|
||||||
]
|
|
||||||
.into();
|
|
||||||
let sync_aggregate = SyncAggregate {
|
|
||||||
sync_committee_signature: AggregateSignature::empty(),
|
|
||||||
sync_committee_bits: BitVector::default(),
|
|
||||||
};
|
|
||||||
BeaconBlockCapella {
|
|
||||||
slot: spec.genesis_slot,
|
|
||||||
proposer_index: 0,
|
|
||||||
parent_root: Hash256::zero(),
|
|
||||||
state_root: Hash256::zero(),
|
|
||||||
body: BeaconBlockBodyCapella {
|
|
||||||
proposer_slashings: base_block.body.proposer_slashings,
|
|
||||||
attester_slashings: base_block.body.attester_slashings,
|
|
||||||
attestations: base_block.body.attestations,
|
|
||||||
deposits: base_block.body.deposits,
|
|
||||||
voluntary_exits: base_block.body.voluntary_exits,
|
|
||||||
bls_to_execution_changes,
|
|
||||||
sync_aggregate,
|
|
||||||
randao_reveal: Signature::empty(),
|
|
||||||
eth1_data: Eth1Data {
|
|
||||||
deposit_root: Hash256::zero(),
|
|
||||||
block_hash: Hash256::zero(),
|
|
||||||
deposit_count: 0,
|
|
||||||
},
|
|
||||||
graffiti: Graffiti::default(),
|
|
||||||
execution_payload: Payload::Capella::default(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockCapella<E, Payload> {
|
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockCapella<E, Payload> {
|
||||||
/// Returns an empty Capella block to be used during genesis.
|
/// Returns an empty Capella block to be used during genesis.
|
||||||
fn empty(spec: &ChainSpec) -> Self {
|
fn empty(spec: &ChainSpec) -> Self {
|
||||||
@@ -604,79 +558,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockDene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockElectra<E, Payload> {
|
|
||||||
/// Return a Electra block where the block has maximum size.
|
|
||||||
pub fn full(spec: &ChainSpec) -> Self {
|
|
||||||
let base_block: BeaconBlockBase<_, Payload> = BeaconBlockBase::full(spec);
|
|
||||||
let indexed_attestation: IndexedAttestationElectra<E> = IndexedAttestationElectra {
|
|
||||||
attesting_indices: VariableList::new(vec![0_u64; E::MaxValidatorsPerSlot::to_usize()])
|
|
||||||
.unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
};
|
|
||||||
let attester_slashings = vec![
|
|
||||||
AttesterSlashingElectra {
|
|
||||||
attestation_1: indexed_attestation.clone(),
|
|
||||||
attestation_2: indexed_attestation,
|
|
||||||
};
|
|
||||||
E::max_attester_slashings_electra()
|
|
||||||
]
|
|
||||||
.into();
|
|
||||||
let attestation = AttestationElectra {
|
|
||||||
aggregation_bits: BitList::with_capacity(E::MaxValidatorsPerSlot::to_usize()).unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
committee_bits: BitVector::new(),
|
|
||||||
};
|
|
||||||
let mut attestations_electra = vec![];
|
|
||||||
for _ in 0..E::MaxAttestationsElectra::to_usize() {
|
|
||||||
attestations_electra.push(attestation.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
let bls_to_execution_changes = vec![
|
|
||||||
SignedBlsToExecutionChange {
|
|
||||||
message: BlsToExecutionChange {
|
|
||||||
validator_index: 0,
|
|
||||||
from_bls_pubkey: PublicKeyBytes::empty(),
|
|
||||||
to_execution_address: Address::ZERO,
|
|
||||||
},
|
|
||||||
signature: Signature::empty()
|
|
||||||
};
|
|
||||||
E::max_bls_to_execution_changes()
|
|
||||||
]
|
|
||||||
.into();
|
|
||||||
let sync_aggregate = SyncAggregate {
|
|
||||||
sync_committee_signature: AggregateSignature::empty(),
|
|
||||||
sync_committee_bits: BitVector::default(),
|
|
||||||
};
|
|
||||||
BeaconBlockElectra {
|
|
||||||
slot: spec.genesis_slot,
|
|
||||||
proposer_index: 0,
|
|
||||||
parent_root: Hash256::zero(),
|
|
||||||
state_root: Hash256::zero(),
|
|
||||||
body: BeaconBlockBodyElectra {
|
|
||||||
proposer_slashings: base_block.body.proposer_slashings,
|
|
||||||
attester_slashings,
|
|
||||||
attestations: attestations_electra.into(),
|
|
||||||
deposits: base_block.body.deposits,
|
|
||||||
voluntary_exits: base_block.body.voluntary_exits,
|
|
||||||
bls_to_execution_changes,
|
|
||||||
sync_aggregate,
|
|
||||||
randao_reveal: Signature::empty(),
|
|
||||||
eth1_data: Eth1Data {
|
|
||||||
deposit_root: Hash256::zero(),
|
|
||||||
block_hash: Hash256::zero(),
|
|
||||||
deposit_count: 0,
|
|
||||||
},
|
|
||||||
graffiti: Graffiti::default(),
|
|
||||||
execution_payload: Payload::Electra::default(),
|
|
||||||
blob_kzg_commitments: VariableList::empty(),
|
|
||||||
execution_requests: ExecutionRequests::default(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockElectra<E, Payload> {
|
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockElectra<E, Payload> {
|
||||||
/// Returns an empty Electra block to be used during genesis.
|
/// Returns an empty Electra block to be used during genesis.
|
||||||
fn empty(spec: &ChainSpec) -> Self {
|
fn empty(spec: &ChainSpec) -> Self {
|
||||||
@@ -708,79 +589,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockElec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockFulu<E, Payload> {
|
|
||||||
/// Return a Fulu block where the block has maximum size.
|
|
||||||
pub fn full(spec: &ChainSpec) -> Self {
|
|
||||||
let base_block: BeaconBlockBase<_, Payload> = BeaconBlockBase::full(spec);
|
|
||||||
let indexed_attestation: IndexedAttestationElectra<E> = IndexedAttestationElectra {
|
|
||||||
attesting_indices: VariableList::new(vec![0_u64; E::MaxValidatorsPerSlot::to_usize()])
|
|
||||||
.unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
};
|
|
||||||
let attester_slashings = vec![
|
|
||||||
AttesterSlashingElectra {
|
|
||||||
attestation_1: indexed_attestation.clone(),
|
|
||||||
attestation_2: indexed_attestation,
|
|
||||||
};
|
|
||||||
E::max_attester_slashings_electra()
|
|
||||||
]
|
|
||||||
.into();
|
|
||||||
let attestation = AttestationElectra {
|
|
||||||
aggregation_bits: BitList::with_capacity(E::MaxValidatorsPerSlot::to_usize()).unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
committee_bits: BitVector::new(),
|
|
||||||
};
|
|
||||||
let mut attestations_electra = vec![];
|
|
||||||
for _ in 0..E::MaxAttestationsElectra::to_usize() {
|
|
||||||
attestations_electra.push(attestation.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
let bls_to_execution_changes = vec![
|
|
||||||
SignedBlsToExecutionChange {
|
|
||||||
message: BlsToExecutionChange {
|
|
||||||
validator_index: 0,
|
|
||||||
from_bls_pubkey: PublicKeyBytes::empty(),
|
|
||||||
to_execution_address: Address::ZERO,
|
|
||||||
},
|
|
||||||
signature: Signature::empty()
|
|
||||||
};
|
|
||||||
E::max_bls_to_execution_changes()
|
|
||||||
]
|
|
||||||
.into();
|
|
||||||
let sync_aggregate = SyncAggregate {
|
|
||||||
sync_committee_signature: AggregateSignature::empty(),
|
|
||||||
sync_committee_bits: BitVector::default(),
|
|
||||||
};
|
|
||||||
BeaconBlockFulu {
|
|
||||||
slot: spec.genesis_slot,
|
|
||||||
proposer_index: 0,
|
|
||||||
parent_root: Hash256::zero(),
|
|
||||||
state_root: Hash256::zero(),
|
|
||||||
body: BeaconBlockBodyFulu {
|
|
||||||
proposer_slashings: base_block.body.proposer_slashings,
|
|
||||||
attester_slashings,
|
|
||||||
attestations: attestations_electra.into(),
|
|
||||||
deposits: base_block.body.deposits,
|
|
||||||
voluntary_exits: base_block.body.voluntary_exits,
|
|
||||||
bls_to_execution_changes,
|
|
||||||
sync_aggregate,
|
|
||||||
randao_reveal: Signature::empty(),
|
|
||||||
eth1_data: Eth1Data {
|
|
||||||
deposit_root: Hash256::zero(),
|
|
||||||
block_hash: Hash256::zero(),
|
|
||||||
deposit_count: 0,
|
|
||||||
},
|
|
||||||
graffiti: Graffiti::default(),
|
|
||||||
execution_payload: Payload::Fulu::default(),
|
|
||||||
blob_kzg_commitments: VariableList::empty(),
|
|
||||||
execution_requests: ExecutionRequests::default(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockFulu<E, Payload> {
|
impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockFulu<E, Payload> {
|
||||||
/// Returns an empty Fulu block to be used during genesis.
|
/// Returns an empty Fulu block to be used during genesis.
|
||||||
fn empty(spec: &ChainSpec) -> Self {
|
fn empty(spec: &ChainSpec) -> Self {
|
||||||
|
|||||||
@@ -128,58 +128,6 @@ impl<E: EthSpec> ExecutionPayload<E> {
|
|||||||
// Max size of variable length `transactions` field
|
// Max size of variable length `transactions` field
|
||||||
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::arithmetic_side_effects)]
|
|
||||||
/// Returns the maximum size of an execution payload.
|
|
||||||
pub fn max_execution_payload_capella_size() -> usize {
|
|
||||||
// Fixed part
|
|
||||||
ExecutionPayloadCapella::<E>::default().as_ssz_bytes().len()
|
|
||||||
// Max size of variable length `extra_data` field
|
|
||||||
+ (E::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
|
|
||||||
// Max size of variable length `transactions` field
|
|
||||||
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
|
||||||
// Max size of variable length `withdrawals` field
|
|
||||||
+ (E::max_withdrawals_per_payload() * <Withdrawal as Encode>::ssz_fixed_len())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::arithmetic_side_effects)]
|
|
||||||
/// Returns the maximum size of an execution payload.
|
|
||||||
pub fn max_execution_payload_deneb_size() -> usize {
|
|
||||||
// Fixed part
|
|
||||||
ExecutionPayloadDeneb::<E>::default().as_ssz_bytes().len()
|
|
||||||
// Max size of variable length `extra_data` field
|
|
||||||
+ (E::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
|
|
||||||
// Max size of variable length `transactions` field
|
|
||||||
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
|
||||||
// Max size of variable length `withdrawals` field
|
|
||||||
+ (E::max_withdrawals_per_payload() * <Withdrawal as Encode>::ssz_fixed_len())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::arithmetic_side_effects)]
|
|
||||||
/// Returns the maximum size of an execution payload.
|
|
||||||
pub fn max_execution_payload_electra_size() -> usize {
|
|
||||||
// Fixed part
|
|
||||||
ExecutionPayloadElectra::<E>::default().as_ssz_bytes().len()
|
|
||||||
// Max size of variable length `extra_data` field
|
|
||||||
+ (E::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
|
|
||||||
// Max size of variable length `transactions` field
|
|
||||||
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
|
||||||
// Max size of variable length `withdrawals` field
|
|
||||||
+ (E::max_withdrawals_per_payload() * <Withdrawal as Encode>::ssz_fixed_len())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::arithmetic_side_effects)]
|
|
||||||
/// Returns the maximum size of an execution payload.
|
|
||||||
pub fn max_execution_payload_fulu_size() -> usize {
|
|
||||||
// Fixed part
|
|
||||||
ExecutionPayloadFulu::<E>::default().as_ssz_bytes().len()
|
|
||||||
// Max size of variable length `extra_data` field
|
|
||||||
+ (E::max_extra_data_bytes() * <u8 as Encode>::ssz_fixed_len())
|
|
||||||
// Max size of variable length `transactions` field
|
|
||||||
+ (E::max_transactions_per_payload() * (ssz::BYTES_PER_LENGTH_OFFSET + E::max_bytes_per_transaction()))
|
|
||||||
// Max size of variable length `withdrawals` field
|
|
||||||
+ (E::max_withdrawals_per_payload() * <Withdrawal as Encode>::ssz_fixed_len())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec> ForkVersionDeserialize for ExecutionPayload<E> {
|
impl<E: EthSpec> ForkVersionDeserialize for ExecutionPayload<E> {
|
||||||
|
|||||||
Reference in New Issue
Block a user