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

Fix building with no 'serde' feature #191

Closed
Closed
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
4 changes: 2 additions & 2 deletions src/altair/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub struct BeaconBlock<
const MAX_VOLUNTARY_EXITS: usize,
const SYNC_COMMITTEE_SIZE: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub proposer_index: ValidatorIndex,
pub parent_root: Root,
pub state_root: Root,
Expand Down
31 changes: 23 additions & 8 deletions src/altair/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ pub struct BeaconState<
const MAX_VALIDATORS_PER_COMMITTEE: usize,
const SYNC_COMMITTEE_SIZE: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub genesis_time: u64,
pub genesis_validators_root: Root,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
pub fork: Fork,
pub latest_block_header: BeaconBlockHeader,
Expand All @@ -29,23 +29,38 @@ pub struct BeaconState<
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")]
#[cfg_attr(feature = "serde", 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")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub slashings: Vector<Gwei, EPOCHS_PER_SLASHINGS_VECTOR>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub previous_epoch_participation: List<ParticipationFlags, VALIDATOR_REGISTRY_LIMIT>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
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>,
Expand Down
4 changes: 2 additions & 2 deletions src/altair/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub struct SyncAggregate<const SYNC_COMMITTEE_SIZE: usize> {
#[derive(Default, Debug, SimpleSerialize, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SyncCommittee<const SYNC_COMMITTEE_SIZE: usize> {
#[serde(rename = "pubkeys")]
#[cfg_attr(feature = "serde", serde(rename = "pubkeys"))]
pub public_keys: Vector<BlsPublicKey, SYNC_COMMITTEE_SIZE>,
#[serde(rename = "aggregate_pubkey")]
#[cfg_attr(feature = "serde", serde(rename = "aggregate_pubkey"))]
pub aggregate_public_key: BlsPublicKey,
}
10 changes: 5 additions & 5 deletions src/altair/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ pub const SYNC_COMMITTEE_SUBNET_COUNT: usize = 4;
#[derive(Debug, Default, Clone, SimpleSerialize)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SyncCommitteeMessage {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
pub beacon_block_root: Root,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub validator_index: ValidatorIndex,
pub signature: BlsSignature,
}
Expand All @@ -21,10 +21,10 @@ pub(super) const fn get_sync_subcommittee_size(sync_committee_size: usize) -> us
#[derive(Debug, Default, Clone, SimpleSerialize)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SyncCommitteeContribution<const SYNC_SUBCOMMITTEE_SIZE: usize> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
pub beacon_block_root: Root,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub subcommittee_index: u64,
pub aggregation_bits: Bitvector<SYNC_SUBCOMMITTEE_SIZE>,
pub signature: BlsSignature,
Expand All @@ -33,7 +33,7 @@ pub struct SyncCommitteeContribution<const SYNC_SUBCOMMITTEE_SIZE: usize> {
#[derive(Debug, Default, Clone, SimpleSerialize)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ContributionAndProof<const SYNC_SUBCOMMITTEE_SIZE: usize> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub aggregator_index: ValidatorIndex,
pub contribution: SyncCommitteeContribution<SYNC_SUBCOMMITTEE_SIZE>,
pub selection_proof: BlsSignature,
Expand Down
4 changes: 2 additions & 2 deletions src/bellatrix/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ pub struct BeaconBlock<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub proposer_index: ValidatorIndex,
pub parent_root: Root,
pub state_root: Root,
Expand Down
31 changes: 23 additions & 8 deletions src/bellatrix/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ pub struct BeaconState<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub genesis_time: u64,
pub genesis_validators_root: Root,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
pub fork: Fork,
pub latest_block_header: BeaconBlockHeader,
Expand All @@ -34,23 +34,38 @@ pub struct BeaconState<
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")]
#[cfg_attr(feature = "serde", 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")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub slashings: Vector<Gwei, EPOCHS_PER_SLASHINGS_VECTOR>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub previous_epoch_participation: List<ParticipationFlags, VALIDATOR_REGISTRY_LIMIT>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
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>,
Expand Down
4 changes: 2 additions & 2 deletions src/bellatrix/blinded_beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ pub struct BlindedBeaconBlock<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub proposer_index: ValidatorIndex,
pub parent_root: Root,
pub state_root: Root,
Expand Down
16 changes: 8 additions & 8 deletions src/bellatrix/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ pub struct ExecutionPayload<
pub receipts_root: Bytes32,
pub logs_bloom: ByteVector<BYTES_PER_LOGS_BLOOM>,
pub prev_randao: Bytes32,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub block_number: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_limit: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_used: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub timestamp: u64,
pub extra_data: ByteList<MAX_EXTRA_DATA_BYTES>,
pub base_fee_per_gas: U256,
Expand All @@ -47,13 +47,13 @@ pub struct ExecutionPayloadHeader<
pub receipts_root: Bytes32,
pub logs_bloom: ByteVector<BYTES_PER_LOGS_BLOOM>,
pub prev_randao: Bytes32,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub block_number: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_limit: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_used: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub timestamp: u64,
pub extra_data: ByteList<MAX_EXTRA_DATA_BYTES>,
pub base_fee_per_gas: U256,
Expand Down
6 changes: 3 additions & 3 deletions src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use ssz_rs::prelude::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ValidatorRegistration {
pub fee_recipient: ExecutionAddress,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_limit: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub timestamp: u64,
#[serde(rename = "pubkey")]
#[cfg_attr(feature = "serde", serde(rename = "pubkey"))]
pub public_key: BlsPublicKey,
}

Expand Down
4 changes: 2 additions & 2 deletions src/capella/beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ pub struct BeaconBlock<
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub proposer_index: ValidatorIndex,
pub parent_root: Root,
pub state_root: Root,
Expand Down
35 changes: 25 additions & 10 deletions src/capella/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ pub struct BeaconState<
const MAX_BYTES_PER_TRANSACTION: usize,
const MAX_TRANSACTIONS_PER_PAYLOAD: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub genesis_time: u64,
pub genesis_validators_root: Root,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
pub fork: Fork,
pub latest_block_header: BeaconBlockHeader,
Expand All @@ -36,31 +36,46 @@ pub struct BeaconState<
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")]
#[cfg_attr(feature = "serde", 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")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub slashings: Vector<Gwei, EPOCHS_PER_SLASHINGS_VECTOR>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
serde(with = "crate::serde::collection_over_string")
)]
pub previous_epoch_participation: List<ParticipationFlags, VALIDATOR_REGISTRY_LIMIT>,
#[serde(with = "crate::serde::collection_over_string")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(
feature = "serde",
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")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub next_withdrawal_index: WithdrawalIndex,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub next_withdrawal_validator_index: ValidatorIndex,
pub historical_summaries: List<HistoricalSummary, HISTORICAL_ROOTS_LIMIT>,
}
4 changes: 2 additions & 2 deletions src/capella/blinded_beacon_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ pub struct BlindedBeaconBlock<
const MAX_WITHDRAWALS_PER_PAYLOAD: usize,
const MAX_BLS_TO_EXECUTION_CHANGES: usize,
> {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub slot: Slot,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub proposer_index: ValidatorIndex,
pub parent_root: Root,
pub state_root: Root,
Expand Down
4 changes: 2 additions & 2 deletions src/capella/bls_to_execution_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use ssz_rs::prelude::*;
#[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BlsToExecutionChange {
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub validator_index: ValidatorIndex,
#[serde(rename = "from_bls_pubkey")]
#[cfg_attr(feature = "serde", serde(rename = "from_bls_pubkey"))]
pub from_bls_public_key: BlsPublicKey,
pub to_execution_address: ExecutionAddress,
}
Expand Down
16 changes: 8 additions & 8 deletions src/capella/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ pub struct ExecutionPayload<
pub receipts_root: Bytes32,
pub logs_bloom: ByteVector<BYTES_PER_LOGS_BLOOM>,
pub prev_randao: Bytes32,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub block_number: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_limit: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_used: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub timestamp: u64,
pub extra_data: ByteList<MAX_EXTRA_DATA_BYTES>,
pub base_fee_per_gas: U256,
Expand All @@ -47,13 +47,13 @@ pub struct ExecutionPayloadHeader<
pub receipts_root: Bytes32,
pub logs_bloom: ByteVector<BYTES_PER_LOGS_BLOOM>,
pub prev_randao: Bytes32,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub block_number: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_limit: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub gas_used: u64,
#[serde(with = "crate::serde::as_string")]
#[cfg_attr(feature = "serde", serde(with = "crate::serde::as_string"))]
pub timestamp: u64,
pub extra_data: ByteList<MAX_EXTRA_DATA_BYTES>,
pub base_fee_per_gas: U256,
Expand Down
Loading