Skip to content

Commit

Permalink
Merge pull request #391 from jacobkaufmann/feat-electra-block-processing
Browse files Browse the repository at this point in the history
feat: electra block processing
  • Loading branch information
ralexstokes authored Apr 26, 2024
2 parents 6c73053 + 149a0a5 commit 43ca5e0
Show file tree
Hide file tree
Showing 8 changed files with 1,144 additions and 444 deletions.
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,
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

0 comments on commit 43ca5e0

Please sign in to comment.