mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-24 08:18:25 +00:00
Merge branch 'unstable' into validator-manager
This commit is contained in:
@@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash;
|
||||
#[arbitrary(bound = "T: EthSpec")]
|
||||
pub struct AggregateAndProof<T: EthSpec> {
|
||||
/// The index of the validator that created the attestation.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub aggregator_index: u64,
|
||||
/// The aggregate attestation.
|
||||
pub aggregate: Attestation<T>,
|
||||
|
||||
@@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash;
|
||||
)]
|
||||
pub struct AttestationData {
|
||||
pub slot: Slot,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub index: u64,
|
||||
|
||||
// LMD GHOST vote
|
||||
|
||||
@@ -12,6 +12,6 @@ pub struct AttestationDuty {
|
||||
/// The total number of attesters in the committee.
|
||||
pub committee_len: usize,
|
||||
/// The committee count at `attestation_slot`.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub committees_at_slot: u64,
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ pub struct BeaconBlock<T: EthSpec, Payload: AbstractExecPayload<T> = FullPayload
|
||||
#[superstruct(getter(copy))]
|
||||
pub slot: Slot,
|
||||
#[superstruct(getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proposer_index: u64,
|
||||
#[superstruct(getter(copy))]
|
||||
pub parent_root: Hash256,
|
||||
|
||||
@@ -26,7 +26,7 @@ use tree_hash_derive::TreeHash;
|
||||
)]
|
||||
pub struct BeaconBlockHeader {
|
||||
pub slot: Slot,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proposer_index: u64,
|
||||
pub parent_root: Hash256,
|
||||
pub state_root: Hash256,
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::*;
|
||||
use compare_fields::CompareFields;
|
||||
use compare_fields_derive::CompareFields;
|
||||
use derivative::Derivative;
|
||||
use eth2_hashing::hash;
|
||||
use ethereum_hashing::hash;
|
||||
use int_to_bytes::{int_to_bytes4, int_to_bytes8};
|
||||
use pubkey_cache::PubkeyCache;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
@@ -210,7 +210,7 @@ where
|
||||
{
|
||||
// Versioning
|
||||
#[superstruct(getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub genesis_time: u64,
|
||||
#[superstruct(getter(copy))]
|
||||
pub genesis_validators_root: Hash256,
|
||||
@@ -232,7 +232,7 @@ where
|
||||
pub eth1_data: Eth1Data,
|
||||
pub eth1_data_votes: VariableList<Eth1Data, T::SlotsPerEth1VotingPeriod>,
|
||||
#[superstruct(getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub eth1_deposit_index: u64,
|
||||
|
||||
// Registry
|
||||
@@ -296,10 +296,10 @@ where
|
||||
|
||||
// Capella
|
||||
#[superstruct(only(Capella), partial_getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_index: u64,
|
||||
#[superstruct(only(Capella), partial_getter(copy))]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub next_withdrawal_validator_index: u64,
|
||||
// Deep history valid from Capella onwards.
|
||||
#[superstruct(only(Capella))]
|
||||
|
||||
@@ -403,7 +403,7 @@ impl ValidatorsListTreeHashCache {
|
||||
validators.len(),
|
||||
),
|
||||
list_arena,
|
||||
values: ParallelValidatorTreeHash::new::<E>(validators),
|
||||
values: ParallelValidatorTreeHash::new(validators),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ impl ParallelValidatorTreeHash {
|
||||
///
|
||||
/// Allocates the necessary memory to store all of the cached Merkle trees but does perform any
|
||||
/// hashing.
|
||||
fn new<E: EthSpec>(validators: &[Validator]) -> Self {
|
||||
fn new(validators: &[Validator]) -> Self {
|
||||
let num_arenas = std::cmp::max(
|
||||
1,
|
||||
(validators.len() + VALIDATORS_PER_ARENA - 1) / VALIDATORS_PER_ARENA,
|
||||
|
||||
@@ -21,7 +21,7 @@ use tree_hash_derive::TreeHash;
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct BlsToExecutionChange {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
pub from_bls_pubkey: PublicKeyBytes,
|
||||
pub to_execution_address: Address,
|
||||
|
||||
@@ -16,7 +16,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct BuilderBid<E: EthSpec, Payload: AbstractExecPayload<E>> {
|
||||
#[serde_as(as = "BlindedPayloadAsHeader<E>")]
|
||||
pub header: Payload,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
pub value: Uint256,
|
||||
pub pubkey: PublicKeyBytes,
|
||||
#[serde(skip)]
|
||||
@@ -50,7 +50,7 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> ForkVersionDeserialize
|
||||
#[derive(Deserialize)]
|
||||
struct Helper {
|
||||
header: serde_json::Value,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
value: Uint256,
|
||||
pubkey: PublicKeyBytes,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::application_domain::{ApplicationDomain, APPLICATION_DOMAIN_BUILDER};
|
||||
use crate::*;
|
||||
use eth2_serde_utils::quoted_u64::MaybeQuoted;
|
||||
use int_to_bytes::int_to_bytes4;
|
||||
use serde::{Deserializer, Serialize, Serializer};
|
||||
use serde_derive::Deserialize;
|
||||
use serde_utils::quoted_u64::MaybeQuoted;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use tree_hash::TreeHash;
|
||||
@@ -895,33 +895,33 @@ pub struct Config {
|
||||
pub preset_base: String,
|
||||
|
||||
#[serde(default = "default_terminal_total_difficulty")]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
pub terminal_total_difficulty: Uint256,
|
||||
#[serde(default = "default_terminal_block_hash")]
|
||||
pub terminal_block_hash: ExecutionBlockHash,
|
||||
#[serde(default = "default_terminal_block_hash_activation_epoch")]
|
||||
pub terminal_block_hash_activation_epoch: Epoch,
|
||||
#[serde(default = "default_safe_slots_to_import_optimistically")]
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub safe_slots_to_import_optimistically: u64,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
min_genesis_active_validator_count: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
min_genesis_time: u64,
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
genesis_fork_version: [u8; 4],
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
genesis_delay: u64,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
altair_fork_version: [u8; 4],
|
||||
#[serde(serialize_with = "serialize_fork_epoch")]
|
||||
#[serde(deserialize_with = "deserialize_fork_epoch")]
|
||||
pub altair_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(default = "default_bellatrix_fork_version")]
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
bellatrix_fork_version: [u8; 4],
|
||||
#[serde(default)]
|
||||
#[serde(serialize_with = "serialize_fork_epoch")]
|
||||
@@ -929,41 +929,41 @@ pub struct Config {
|
||||
pub bellatrix_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(default = "default_capella_fork_version")]
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
capella_fork_version: [u8; 4],
|
||||
#[serde(default)]
|
||||
#[serde(serialize_with = "serialize_fork_epoch")]
|
||||
#[serde(deserialize_with = "deserialize_fork_epoch")]
|
||||
pub capella_fork_epoch: Option<MaybeQuoted<Epoch>>,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
seconds_per_slot: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
seconds_per_eth1_block: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
min_validator_withdrawability_delay: Epoch,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
shard_committee_period: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
eth1_follow_distance: u64,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
inactivity_score_bias: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
inactivity_score_recovery_rate: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
ejection_balance: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
min_per_epoch_churn_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
churn_limit_quotient: u64,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
proposer_score_boost: Option<MaybeQuoted<u64>>,
|
||||
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
deposit_chain_id: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
deposit_network_id: u64,
|
||||
deposit_contract_address: Address,
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use tree_hash_derive::TreeHash;
|
||||
#[arbitrary(bound = "T: EthSpec")]
|
||||
pub struct ContributionAndProof<T: EthSpec> {
|
||||
/// The index of the validator that created the sync contribution.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub aggregator_index: u64,
|
||||
/// The aggregate contribution.
|
||||
pub contribution: SyncCommitteeContribution<T>,
|
||||
|
||||
@@ -26,7 +26,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct DepositData {
|
||||
pub pubkey: PublicKeyBytes,
|
||||
pub withdrawal_credentials: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub amount: u64,
|
||||
pub signature: SignatureBytes,
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct DepositMessage {
|
||||
pub pubkey: PublicKeyBytes,
|
||||
pub withdrawal_credentials: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub amount: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::*;
|
||||
use eth2_hashing::{hash32_concat, ZERO_HASHES};
|
||||
use ethereum_hashing::{hash32_concat, ZERO_HASHES};
|
||||
use int_to_bytes::int_to_bytes32;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
|
||||
@@ -24,9 +24,9 @@ use tree_hash_derive::TreeHash;
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct EnrForkId {
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
pub fork_digest: [u8; 4],
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
pub next_fork_version: [u8; 4],
|
||||
pub next_fork_epoch: Epoch,
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ use tree_hash_derive::TreeHash;
|
||||
)]
|
||||
pub struct Eth1Data {
|
||||
pub deposit_root: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub deposit_count: u64,
|
||||
pub block_hash: Hash256,
|
||||
}
|
||||
|
||||
@@ -60,21 +60,21 @@ pub struct ExecutionPayload<T: EthSpec> {
|
||||
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
||||
#[superstruct(getter(copy))]
|
||||
pub prev_randao: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub block_number: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub gas_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub gas_used: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub timestamp: u64,
|
||||
#[serde(with = "ssz_types::serde_utils::hex_var_list")]
|
||||
pub extra_data: VariableList<u8, T::MaxExtraDataBytes>,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub base_fee_per_gas: Uint256,
|
||||
#[superstruct(getter(copy))]
|
||||
|
||||
@@ -53,21 +53,21 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
|
||||
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
||||
#[superstruct(getter(copy))]
|
||||
pub prev_randao: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub block_number: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub gas_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub gas_used: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub timestamp: u64,
|
||||
#[serde(with = "ssz_types::serde_utils::hex_var_list")]
|
||||
pub extra_data: VariableList<u8, T::MaxExtraDataBytes>,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub base_fee_per_gas: Uint256,
|
||||
#[superstruct(getter(copy))]
|
||||
|
||||
@@ -24,9 +24,9 @@ use tree_hash_derive::TreeHash;
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct Fork {
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
pub previous_version: [u8; 4],
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
pub current_version: [u8; 4],
|
||||
pub epoch: Epoch,
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use tree_hash_derive::TreeHash;
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct ForkData {
|
||||
#[serde(with = "eth2_serde_utils::bytes_4_hex")]
|
||||
#[serde(with = "serde_utils::bytes_4_hex")]
|
||||
pub current_version: [u8; 4],
|
||||
pub genesis_validators_root: Hash256,
|
||||
}
|
||||
|
||||
@@ -6,14 +6,15 @@ use std::sync::Arc;
|
||||
|
||||
// Deserialize is only implemented for types that implement ForkVersionDeserialize
|
||||
#[derive(Debug, PartialEq, Clone, Serialize)]
|
||||
pub struct ExecutionOptimisticForkVersionedResponse<T> {
|
||||
pub struct ExecutionOptimisticFinalizedForkVersionedResponse<T> {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub version: Option<ForkName>,
|
||||
pub execution_optimistic: Option<bool>,
|
||||
pub finalized: Option<bool>,
|
||||
pub data: T,
|
||||
}
|
||||
|
||||
impl<'de, F> serde::Deserialize<'de> for ExecutionOptimisticForkVersionedResponse<F>
|
||||
impl<'de, F> serde::Deserialize<'de> for ExecutionOptimisticFinalizedForkVersionedResponse<F>
|
||||
where
|
||||
F: ForkVersionDeserialize,
|
||||
{
|
||||
@@ -25,6 +26,7 @@ where
|
||||
struct Helper {
|
||||
version: Option<ForkName>,
|
||||
execution_optimistic: Option<bool>,
|
||||
finalized: Option<bool>,
|
||||
data: serde_json::Value,
|
||||
}
|
||||
|
||||
@@ -34,9 +36,10 @@ where
|
||||
None => serde_json::from_value(helper.data).map_err(serde::de::Error::custom)?,
|
||||
};
|
||||
|
||||
Ok(ExecutionOptimisticForkVersionedResponse {
|
||||
Ok(ExecutionOptimisticFinalizedForkVersionedResponse {
|
||||
version: helper.version,
|
||||
execution_optimistic: helper.execution_optimistic,
|
||||
finalized: helper.finalized,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ impl Graffiti {
|
||||
|
||||
impl fmt::Display for Graffiti {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", eth2_serde_utils::hex::encode(self.0))
|
||||
write!(f, "{}", serde_utils::hex::encode(self.0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ pub mod serde_graffiti {
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_str(ð2_serde_utils::hex::encode(bytes))
|
||||
serializer.serialize_str(&serde_utils::hex::encode(bytes))
|
||||
}
|
||||
|
||||
pub fn deserialize<'de, D>(deserializer: D) -> Result<[u8; GRAFFITI_BYTES_LEN], D::Error>
|
||||
@@ -105,7 +105,7 @@ pub mod serde_graffiti {
|
||||
{
|
||||
let s: String = Deserialize::deserialize(deserializer)?;
|
||||
|
||||
let bytes = eth2_serde_utils::hex::decode(&s).map_err(D::Error::custom)?;
|
||||
let bytes = serde_utils::hex::decode(&s).map_err(D::Error::custom)?;
|
||||
|
||||
if bytes.len() != GRAFFITI_BYTES_LEN {
|
||||
return Err(D::Error::custom(format!(
|
||||
|
||||
@@ -72,9 +72,9 @@ impl<T: EthSpec> Hash for IndexedAttestation<T> {
|
||||
mod quoted_variable_list_u64 {
|
||||
use super::*;
|
||||
use crate::Unsigned;
|
||||
use eth2_serde_utils::quoted_u64_vec::{QuotedIntVecVisitor, QuotedIntWrapper};
|
||||
use serde::ser::SerializeSeq;
|
||||
use serde::{Deserializer, Serializer};
|
||||
use serde_utils::quoted_u64_vec::{QuotedIntVecVisitor, QuotedIntWrapper};
|
||||
|
||||
pub fn serialize<S, T>(value: &VariableList<u64, T>, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
|
||||
@@ -144,9 +144,7 @@ pub use crate::fork::Fork;
|
||||
pub use crate::fork_context::ForkContext;
|
||||
pub use crate::fork_data::ForkData;
|
||||
pub use crate::fork_name::{ForkName, InconsistentFork};
|
||||
pub use crate::fork_versioned_response::{
|
||||
ExecutionOptimisticForkVersionedResponse, ForkVersionDeserialize, ForkVersionedResponse,
|
||||
};
|
||||
pub use crate::fork_versioned_response::{ForkVersionDeserialize, ForkVersionedResponse};
|
||||
pub use crate::graffiti::{Graffiti, GRAFFITI_BYTES_LEN};
|
||||
pub use crate::historical_batch::HistoricalBatch;
|
||||
pub use crate::indexed_attestation::IndexedAttestation;
|
||||
|
||||
@@ -9,7 +9,7 @@ use tree_hash::{PackedEncoding, TreeHash, TreeHashType};
|
||||
#[serde(transparent)]
|
||||
#[derive(arbitrary::Arbitrary)]
|
||||
pub struct ParticipationFlags {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u8")]
|
||||
#[serde(with = "serde_utils::quoted_u8")]
|
||||
bits: u8,
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct PendingAttestation<T: EthSpec> {
|
||||
pub aggregation_bits: BitList<T::MaxValidatorsPerCommittee>,
|
||||
pub data: AttestationData,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub inclusion_delay: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proposer_index: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -12,71 +12,71 @@ use serde_derive::{Deserialize, Serialize};
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "UPPERCASE")]
|
||||
pub struct BasePreset {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_committees_per_slot: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub target_committee_size: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_validators_per_committee: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u8")]
|
||||
#[serde(with = "serde_utils::quoted_u8")]
|
||||
pub shuffle_round_count: u8,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub hysteresis_quotient: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub hysteresis_downward_multiplier: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub hysteresis_upward_multiplier: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub safe_slots_to_update_justified: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_deposit_amount: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_effective_balance: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub effective_balance_increment: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_attestation_inclusion_delay: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub slots_per_epoch: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_seed_lookahead: Epoch,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_seed_lookahead: Epoch,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub epochs_per_eth1_voting_period: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub slots_per_historical_root: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_epochs_to_inactivity_penalty: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub epochs_per_historical_vector: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub epochs_per_slashings_vector: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub historical_roots_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_registry_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub base_reward_factor: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub whistleblower_reward_quotient: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proposer_reward_quotient: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub inactivity_penalty_quotient: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_slashing_penalty_quotient: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proportional_slashing_multiplier: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_proposer_slashings: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_attester_slashings: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_attestations: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_deposits: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_voluntary_exits: u64,
|
||||
}
|
||||
|
||||
@@ -123,17 +123,17 @@ impl BasePreset {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "UPPERCASE")]
|
||||
pub struct AltairPreset {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub inactivity_penalty_quotient_altair: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_slashing_penalty_quotient_altair: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proportional_slashing_multiplier_altair: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub sync_committee_size: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub epochs_per_sync_committee_period: Epoch,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_sync_committee_participants: u64,
|
||||
}
|
||||
|
||||
@@ -153,19 +153,19 @@ impl AltairPreset {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "UPPERCASE")]
|
||||
pub struct BellatrixPreset {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub inactivity_penalty_quotient_bellatrix: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub min_slashing_penalty_quotient_bellatrix: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub proportional_slashing_multiplier_bellatrix: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_bytes_per_transaction: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_transactions_per_payload: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub bytes_per_logs_bloom: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_extra_data_bytes: u64,
|
||||
}
|
||||
|
||||
@@ -187,11 +187,11 @@ impl BellatrixPreset {
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "UPPERCASE")]
|
||||
pub struct CapellaPreset {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_bls_to_execution_changes: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_withdrawals_per_payload: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub max_validators_per_withdrawals_sweep: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct ProposerPreparationData {
|
||||
/// The validators index.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
/// The fee-recipient address.
|
||||
pub fee_recipient: Address,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
ChainSpec, Domain, EthSpec, Fork, Hash256, PublicKey, SecretKey, Signature, SignedRoot, Slot,
|
||||
};
|
||||
use eth2_hashing::hash;
|
||||
use ethereum_hashing::hash;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use ssz::Encode;
|
||||
use std::cmp;
|
||||
|
||||
@@ -38,7 +38,7 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssi
|
||||
Deserialize,
|
||||
)]
|
||||
#[serde(transparent)]
|
||||
pub struct Slot(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
|
||||
pub struct Slot(#[serde(with = "serde_utils::quoted_u64")] u64);
|
||||
|
||||
#[derive(
|
||||
arbitrary::Arbitrary,
|
||||
@@ -54,7 +54,7 @@ pub struct Slot(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
|
||||
Deserialize,
|
||||
)]
|
||||
#[serde(transparent)]
|
||||
pub struct Epoch(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
|
||||
pub struct Epoch(#[serde(with = "serde_utils::quoted_u64")] u64);
|
||||
|
||||
impl_common!(Slot);
|
||||
impl_common!(Epoch);
|
||||
|
||||
@@ -20,7 +20,7 @@ lazy_static! {
|
||||
|
||||
#[derive(arbitrary::Arbitrary, Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct SubnetId(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
|
||||
pub struct SubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);
|
||||
|
||||
pub fn subnet_id_to_string(i: u64) -> &'static str {
|
||||
if i < MAX_SUBNET_ID as u64 {
|
||||
@@ -85,7 +85,7 @@ impl SubnetId {
|
||||
|
||||
let subscription_event_idx = epoch.as_u64() / spec.epochs_per_subnet_subscription;
|
||||
let permutation_seed =
|
||||
eth2_hashing::hash(&int_to_bytes::int_to_bytes8(subscription_event_idx));
|
||||
ethereum_hashing::hash(&int_to_bytes::int_to_bytes8(subscription_event_idx));
|
||||
|
||||
let num_subnets = 1 << spec.attestation_subnet_prefix_bits();
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use tree_hash_derive::TreeHash;
|
||||
)]
|
||||
pub struct SyncAggregatorSelectionData {
|
||||
pub slot: Slot,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub subcommittee_index: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ pub enum Error {
|
||||
pub struct SyncCommitteeContribution<T: EthSpec> {
|
||||
pub slot: Slot,
|
||||
pub beacon_block_root: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub subcommittee_index: u64,
|
||||
pub aggregation_bits: BitVector<T::SyncSubcommitteeSize>,
|
||||
pub signature: AggregateSignature,
|
||||
|
||||
@@ -23,7 +23,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct SyncCommitteeMessage {
|
||||
pub slot: Slot,
|
||||
pub beacon_block_root: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
// Signature by the validator over `beacon_block_root`.
|
||||
pub signature: Signature,
|
||||
|
||||
@@ -7,10 +7,10 @@ use ssz_derive::{Decode, Encode};
|
||||
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Encode, Decode)]
|
||||
pub struct SyncCommitteeSubscription {
|
||||
/// The validators index.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
/// The sync committee indices.
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
|
||||
#[serde(with = "serde_utils::quoted_u64_vec")]
|
||||
pub sync_committee_indices: Vec<u64>,
|
||||
/// Epoch until which this subscription is required.
|
||||
pub until_epoch: Epoch,
|
||||
|
||||
@@ -7,9 +7,9 @@ use std::collections::HashSet;
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SyncDuty {
|
||||
pub pubkey: PublicKeyBytes,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64_vec")]
|
||||
#[serde(with = "serde_utils::quoted_u64_vec")]
|
||||
pub validator_sync_committee_indices: Vec<u64>,
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
ChainSpec, Domain, EthSpec, Fork, Hash256, PublicKey, SecretKey, Signature, SignedRoot, Slot,
|
||||
SyncAggregatorSelectionData,
|
||||
};
|
||||
use eth2_hashing::hash;
|
||||
use ethereum_hashing::hash;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use ssz::Encode;
|
||||
use ssz_types::typenum::Unsigned;
|
||||
|
||||
@@ -21,7 +21,7 @@ lazy_static! {
|
||||
|
||||
#[derive(arbitrary::Arbitrary, Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct SyncSubnetId(#[serde(with = "eth2_serde_utils::quoted_u64")] u64);
|
||||
pub struct SyncSubnetId(#[serde(with = "serde_utils::quoted_u64")] u64);
|
||||
|
||||
pub fn sync_subnet_id_to_string(i: u64) -> &'static str {
|
||||
if i < SYNC_COMMITTEE_SUBNET_COUNT {
|
||||
|
||||
@@ -25,7 +25,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct Validator {
|
||||
pub pubkey: PublicKeyBytes,
|
||||
pub withdrawal_credentials: Hash256,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub effective_balance: u64,
|
||||
pub slashed: bool,
|
||||
pub activation_eligibility_epoch: Epoch,
|
||||
|
||||
@@ -13,9 +13,9 @@ pub struct SignedValidatorRegistrationData {
|
||||
#[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Encode, Decode, TreeHash)]
|
||||
pub struct ValidatorRegistrationData {
|
||||
pub fee_recipient: Address,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub gas_limit: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub timestamp: u64,
|
||||
pub pubkey: PublicKeyBytes,
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ use tree_hash_derive::TreeHash;
|
||||
pub struct VoluntaryExit {
|
||||
/// Earliest epoch when voluntary exit can be processed.
|
||||
pub epoch: Epoch,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ use tree_hash_derive::TreeHash;
|
||||
TestRandom,
|
||||
)]
|
||||
pub struct Withdrawal {
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub index: u64,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub validator_index: u64,
|
||||
pub address: Address,
|
||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub amount: u64,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user