Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: electra block processing #391

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,061 changes: 1,050 additions & 11 deletions ethereum-consensus/src/electra/block_processing.rs

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions ethereum-consensus/src/electra/execution_engine.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use crate::{
deneb::polynomial_commitments::VersionedHash, electra::ExecutionPayload,
execution_engine::PayloadRequest, primitives::Root,
};

pub struct NewPayloadRequest<
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
> {
pub execution_payload: ExecutionPayload<
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
MAX_BYTES_PER_TRANSACTION,
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
>,
pub versioned_hashes: Vec<VersionedHash>,
pub parent_beacon_block_root: Root,
}

impl<
const BYTES_PER_LOGS_BLOOM: usize,
const MAX_EXTRA_DATA_BYTES: usize,
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
> PayloadRequest
for NewPayloadRequest<
BYTES_PER_LOGS_BLOOM,
MAX_EXTRA_DATA_BYTES,
MAX_BYTES_PER_TRANSACTION,
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
>
{
}
6 changes: 3 additions & 3 deletions ethereum-consensus/src/electra/execution_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize,
const MAX_EXECUTION_LAYER_EXITS: usize,
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize,
>
TryFrom<
&'a ExecutionPayload<
Expand All @@ -101,7 +101,7 @@ impl<
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_EXECUTION_LAYER_EXITS,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
>,
> for ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>
{
Expand All @@ -115,7 +115,7 @@ impl<
MAX_TRANSACTIONS_PER_PAYLOAD,
MAX_WITHDRAWALS_PER_PAYLOAD,
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD,
MAX_EXECUTION_LAYER_EXITS,
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
>,
) -> Result<ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>, Self::Error>
{
Expand Down
2 changes: 0 additions & 2 deletions ethereum-consensus/src/electra/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@ pub fn switch_to_compounding_validator<
const PENDING_BALANCE_DEPOSITS_LIMIT: usize,
const PENDING_PARTIAL_WITHDRAWALS_LIMIT: usize,
const PENDING_CONSOLIDATIONS_LIMIT: usize,
const MAX_VALIDATORS_PER_SLOT: usize,
jacobkaufmann marked this conversation as resolved.
Show resolved Hide resolved
const MAX_COMMITTEES_PER_SLOT: usize,
>(
state: &mut BeaconState<
SLOTS_PER_HISTORICAL_ROOT,
Expand Down
1 change: 1 addition & 0 deletions ethereum-consensus/src/electra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod beacon_block;
pub mod beacon_state;
pub mod block_processing;
pub mod constants;
pub mod execution_engine;
pub mod execution_payload;
pub mod fork;
pub mod genesis;
Expand Down
Loading
Loading