forked from ralexstokes/ethereum-consensus
-
Notifications
You must be signed in to change notification settings - Fork 0
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 ralexstokes#170 from jimmygchen/deneb-types-and-pr…
…esets Add Deneb (EIP-4844) types and presets
- Loading branch information
Showing
20 changed files
with
1,132 additions
and
23 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
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
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
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,127 @@ | ||
use crate::altair::SyncAggregate; | ||
use crate::capella::SignedBlsToExecutionChange; | ||
use crate::deneb::ExecutionPayload; | ||
use crate::kzg::KzgCommitment; | ||
use crate::phase0::{ | ||
Attestation, AttesterSlashing, Deposit, Eth1Data, ProposerSlashing, SignedVoluntaryExit, | ||
}; | ||
use crate::primitives::{BlsSignature, Bytes32, Root, Slot, ValidatorIndex}; | ||
use ssz_rs::prelude::*; | ||
|
||
#[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct BeaconBlockBody< | ||
const MAX_PROPOSER_SLASHINGS: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const MAX_ATTESTER_SLASHINGS: usize, | ||
const MAX_ATTESTATIONS: usize, | ||
const MAX_DEPOSITS: usize, | ||
const MAX_VOLUNTARY_EXITS: usize, | ||
const SYNC_COMMITTEE_SIZE: 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, | ||
> { | ||
pub randao_reveal: BlsSignature, | ||
pub eth1_data: Eth1Data, | ||
pub graffiti: Bytes32, | ||
pub proposer_slashings: List<ProposerSlashing, MAX_PROPOSER_SLASHINGS>, | ||
pub attester_slashings: | ||
List<AttesterSlashing<MAX_VALIDATORS_PER_COMMITTEE>, MAX_ATTESTER_SLASHINGS>, | ||
pub attestations: List<Attestation<MAX_VALIDATORS_PER_COMMITTEE>, MAX_ATTESTATIONS>, | ||
pub deposits: List<Deposit, MAX_DEPOSITS>, | ||
pub voluntary_exits: List<SignedVoluntaryExit, MAX_VOLUNTARY_EXITS>, | ||
pub sync_aggregate: SyncAggregate<SYNC_COMMITTEE_SIZE>, | ||
pub execution_payload: ExecutionPayload< | ||
BYTES_PER_LOGS_BLOOM, | ||
MAX_EXTRA_DATA_BYTES, | ||
MAX_BYTES_PER_TRANSACTION, | ||
MAX_TRANSACTIONS_PER_PAYLOAD, | ||
MAX_WITHDRAWALS_PER_PAYLOAD, | ||
>, | ||
pub bls_to_execution_changes: List<SignedBlsToExecutionChange, MAX_BLS_TO_EXECUTION_CHANGES>, | ||
pub blob_kzg_commitments: List<KzgCommitment, MAX_BLOB_COMMITMENTS_PER_BLOCK>, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct BeaconBlock< | ||
const MAX_PROPOSER_SLASHINGS: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const MAX_ATTESTER_SLASHINGS: usize, | ||
const MAX_ATTESTATIONS: usize, | ||
const MAX_DEPOSITS: usize, | ||
const MAX_VOLUNTARY_EXITS: usize, | ||
const SYNC_COMMITTEE_SIZE: 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_BLOBS_PER_BLOCK: usize, | ||
> { | ||
#[serde(with = "crate::serde::as_string")] | ||
pub slot: Slot, | ||
#[serde(with = "crate::serde::as_string")] | ||
pub proposer_index: ValidatorIndex, | ||
pub parent_root: Root, | ||
pub state_root: Root, | ||
pub 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_BLOBS_PER_BLOCK, | ||
>, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct SignedBeaconBlock< | ||
const MAX_PROPOSER_SLASHINGS: usize, | ||
const MAX_VALIDATORS_PER_COMMITTEE: usize, | ||
const MAX_ATTESTER_SLASHINGS: usize, | ||
const MAX_ATTESTATIONS: usize, | ||
const MAX_DEPOSITS: usize, | ||
const MAX_VOLUNTARY_EXITS: usize, | ||
const SYNC_COMMITTEE_SIZE: 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_BLOBS_PER_BLOCK: usize, | ||
> { | ||
pub message: BeaconBlock< | ||
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_BLOBS_PER_BLOCK, | ||
>, | ||
pub signature: BlsSignature, | ||
} |
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,67 @@ | ||
use crate::altair::SyncCommittee; | ||
use crate::capella::HistoricalSummary; | ||
use crate::deneb::ExecutionPayloadHeader; | ||
use crate::phase0::{ | ||
BeaconBlockHeader, Checkpoint, Eth1Data, Fork, Validator, JUSTIFICATION_BITS_LENGTH, | ||
}; | ||
use crate::primitives::{ | ||
Bytes32, Gwei, ParticipationFlags, Root, Slot, ValidatorIndex, WithdrawalIndex, | ||
}; | ||
use ssz_rs::prelude::*; | ||
|
||
#[derive(Default, Debug, SimpleSerialize, Clone, PartialEq, Eq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
pub struct BeaconState< | ||
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 MAX_BYTES_PER_TRANSACTION: usize, | ||
const MAX_TRANSACTIONS_PER_PAYLOAD: usize, | ||
> { | ||
#[serde(with = "crate::serde::as_string")] | ||
pub genesis_time: u64, | ||
pub genesis_validators_root: Root, | ||
#[serde(with = "crate::serde::as_string")] | ||
pub slot: Slot, | ||
pub fork: Fork, | ||
pub latest_block_header: BeaconBlockHeader, | ||
pub block_roots: Vector<Root, SLOTS_PER_HISTORICAL_ROOT>, | ||
pub state_roots: Vector<Root, SLOTS_PER_HISTORICAL_ROOT>, | ||
pub historical_roots: List<Root, HISTORICAL_ROOTS_LIMIT>, | ||
pub eth1_data: Eth1Data, | ||
pub eth1_data_votes: List<Eth1Data, ETH1_DATA_VOTES_BOUND>, | ||
#[serde(with = "crate::serde::as_string")] | ||
pub eth1_deposit_index: u64, | ||
pub validators: List<Validator, VALIDATOR_REGISTRY_LIMIT>, | ||
#[serde(with = "crate::serde::collection_over_string")] | ||
pub balances: List<Gwei, VALIDATOR_REGISTRY_LIMIT>, | ||
pub randao_mixes: Vector<Bytes32, EPOCHS_PER_HISTORICAL_VECTOR>, | ||
#[serde(with = "crate::serde::collection_over_string")] | ||
pub slashings: Vector<Gwei, EPOCHS_PER_SLASHINGS_VECTOR>, | ||
#[serde(with = "crate::serde::collection_over_string")] | ||
pub previous_epoch_participation: List<ParticipationFlags, VALIDATOR_REGISTRY_LIMIT>, | ||
#[serde(with = "crate::serde::collection_over_string")] | ||
pub current_epoch_participation: List<ParticipationFlags, VALIDATOR_REGISTRY_LIMIT>, | ||
pub justification_bits: Bitvector<JUSTIFICATION_BITS_LENGTH>, | ||
pub previous_justified_checkpoint: Checkpoint, | ||
pub current_justified_checkpoint: Checkpoint, | ||
pub finalized_checkpoint: Checkpoint, | ||
#[serde(with = "crate::serde::collection_over_string")] | ||
pub inactivity_scores: List<u64, VALIDATOR_REGISTRY_LIMIT>, | ||
pub current_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>, | ||
pub next_sync_committee: SyncCommittee<SYNC_COMMITTEE_SIZE>, | ||
pub latest_execution_payload_header: | ||
ExecutionPayloadHeader<BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES>, | ||
#[serde(with = "crate::serde::as_string")] | ||
pub next_withdrawal_index: WithdrawalIndex, | ||
#[serde(with = "crate::serde::as_string")] | ||
pub next_withdrawal_validator_index: ValidatorIndex, | ||
pub historical_summaries: List<HistoricalSummary, HISTORICAL_ROOTS_LIMIT>, | ||
} |
Oops, something went wrong.