-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from ralexstokes/electra/helpers
add `electra` helpers
- Loading branch information
Showing
9 changed files
with
4,946 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
use crate::{ | ||
electra::{Attestation, BeaconBlockBody, BeaconState}, | ||
state_transition::Context, | ||
Error, | ||
}; | ||
|
||
pub fn process_attestation< | ||
const SLOTS_PER_HISTORICAL_ROOT: usize, | ||
const HISTORICAL_ROOTS_LIMIT: usize, | ||
const ETH1_DATA_VOTES_BOUND: usize, | ||
const VALIDATOR_REGISTRY_LIMIT: usize, | ||
const EPOCHS_PER_HISTORICAL_VECTOR: usize, | ||
const EPOCHS_PER_SLASHINGS_VECTOR: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const SYNC_COMMITTEE_SIZE: usize, | ||
const BYTES_PER_LOGS_BLOOM: usize, | ||
const MAX_EXTRA_DATA_BYTES: usize, | ||
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, | ||
HISTORICAL_ROOTS_LIMIT, | ||
ETH1_DATA_VOTES_BOUND, | ||
VALIDATOR_REGISTRY_LIMIT, | ||
EPOCHS_PER_HISTORICAL_VECTOR, | ||
EPOCHS_PER_SLASHINGS_VECTOR, | ||
MAX_VALIDATORS_PER_COMMITTEE, | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
PENDING_BALANCE_DEPOSITS_LIMIT, | ||
PENDING_PARTIAL_WITHDRAWALS_LIMIT, | ||
PENDING_CONSOLIDATIONS_LIMIT, | ||
>, | ||
_attestation: &Attestation<MAX_VALIDATORS_PER_SLOT, MAX_COMMITTEES_PER_SLOT>, | ||
_context: &Context, | ||
) -> Result<(), Error> { | ||
todo!() | ||
} | ||
|
||
pub fn process_execution_payload< | ||
const SLOTS_PER_HISTORICAL_ROOT: usize, | ||
const HISTORICAL_ROOTS_LIMIT: usize, | ||
const ETH1_DATA_VOTES_BOUND: usize, | ||
const VALIDATOR_REGISTRY_LIMIT: usize, | ||
const EPOCHS_PER_HISTORICAL_VECTOR: usize, | ||
const EPOCHS_PER_SLASHINGS_VECTOR: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const SYNC_COMMITTEE_SIZE: usize, | ||
const BYTES_PER_LOGS_BLOOM: usize, | ||
const MAX_EXTRA_DATA_BYTES: usize, | ||
const PENDING_BALANCE_DEPOSITS_LIMIT: usize, | ||
const PENDING_PARTIAL_WITHDRAWALS_LIMIT: usize, | ||
const PENDING_CONSOLIDATIONS_LIMIT: usize, | ||
const MAX_PROPOSER_SLASHINGS: usize, | ||
const MAX_ATTESTER_SLASHINGS: usize, | ||
const MAX_ATTESTATIONS: usize, | ||
const MAX_DEPOSITS: usize, | ||
const MAX_VOLUNTARY_EXITS: usize, | ||
const MAX_BYTES_PER_TRANSACTION: usize, | ||
const MAX_TRANSACTIONS_PER_PAYLOAD: usize, | ||
const MAX_WITHDRAWALS_PER_PAYLOAD: usize, | ||
const MAX_BLS_TO_EXECUTION_CHANGES: usize, | ||
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize, | ||
const MAX_COMMITTEES_PER_SLOT: usize, | ||
const MAX_VALIDATORS_PER_SLOT: usize, | ||
const MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD: usize, | ||
const MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD: usize, | ||
const MAX_CONSOLIDATIONS: usize, | ||
>( | ||
_state: &mut BeaconState< | ||
SLOTS_PER_HISTORICAL_ROOT, | ||
HISTORICAL_ROOTS_LIMIT, | ||
ETH1_DATA_VOTES_BOUND, | ||
VALIDATOR_REGISTRY_LIMIT, | ||
EPOCHS_PER_HISTORICAL_VECTOR, | ||
EPOCHS_PER_SLASHINGS_VECTOR, | ||
MAX_VALIDATORS_PER_COMMITTEE, | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
PENDING_BALANCE_DEPOSITS_LIMIT, | ||
PENDING_PARTIAL_WITHDRAWALS_LIMIT, | ||
PENDING_CONSOLIDATIONS_LIMIT, | ||
>, | ||
_body: &BeaconBlockBody< | ||
MAX_PROPOSER_SLASHINGS, | ||
MAX_VALIDATORS_PER_COMMITTEE, | ||
MAX_ATTESTER_SLASHINGS, | ||
MAX_ATTESTATIONS, | ||
MAX_DEPOSITS, | ||
MAX_VOLUNTARY_EXITS, | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
MAX_BYTES_PER_TRANSACTION, | ||
MAX_TRANSACTIONS_PER_PAYLOAD, | ||
MAX_WITHDRAWALS_PER_PAYLOAD, | ||
MAX_BLS_TO_EXECUTION_CHANGES, | ||
MAX_BLOB_COMMITMENTS_PER_BLOCK, | ||
MAX_COMMITTEES_PER_SLOT, | ||
MAX_VALIDATORS_PER_SLOT, | ||
MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD, | ||
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD, | ||
MAX_CONSOLIDATIONS, | ||
>, | ||
_context: &Context, | ||
) -> Result<(), Error> { | ||
todo!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use crate::{ | ||
electra::{BeaconState, Deposit, ExecutionPayloadHeader}, | ||
primitives::Hash32, | ||
state_transition::{Context, Result}, | ||
}; | ||
|
||
pub fn initialize_beacon_state_from_eth1< | ||
const SLOTS_PER_HISTORICAL_ROOT: usize, | ||
const HISTORICAL_ROOTS_LIMIT: usize, | ||
const ETH1_DATA_VOTES_BOUND: usize, | ||
const VALIDATOR_REGISTRY_LIMIT: usize, | ||
const EPOCHS_PER_HISTORICAL_VECTOR: usize, | ||
const EPOCHS_PER_SLASHINGS_VECTOR: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const SYNC_COMMITTEE_SIZE: usize, | ||
const PENDING_BALANCE_DEPOSITS_LIMIT: usize, | ||
const PENDING_PARTIAL_WITHDRAWALS_LIMIT: usize, | ||
const PENDING_CONSOLIDATIONS_LIMIT: usize, | ||
const MAX_PROPOSER_SLASHINGS: usize, | ||
const MAX_ATTESTER_SLASHINGS: usize, | ||
const MAX_ATTESTATIONS: usize, | ||
const MAX_DEPOSITS: usize, | ||
const MAX_VOLUNTARY_EXITS: usize, | ||
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_BLS_TO_EXECUTION_CHANGES: usize, | ||
const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize, | ||
>( | ||
_eth1_block_hash: Hash32, | ||
_eth1_timestamp: u64, | ||
_deposits: &[Deposit], | ||
_execution_payload_header: Option< | ||
&ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>, | ||
>, | ||
_context: &Context, | ||
) -> Result< | ||
BeaconState< | ||
SLOTS_PER_HISTORICAL_ROOT, | ||
HISTORICAL_ROOTS_LIMIT, | ||
ETH1_DATA_VOTES_BOUND, | ||
VALIDATOR_REGISTRY_LIMIT, | ||
EPOCHS_PER_HISTORICAL_VECTOR, | ||
EPOCHS_PER_SLASHINGS_VECTOR, | ||
MAX_VALIDATORS_PER_COMMITTEE, | ||
SYNC_COMMITTEE_SIZE, | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
PENDING_BALANCE_DEPOSITS_LIMIT, | ||
PENDING_PARTIAL_WITHDRAWALS_LIMIT, | ||
PENDING_CONSOLIDATIONS_LIMIT, | ||
>, | ||
> { | ||
todo!() | ||
} |
Oops, something went wrong.