mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
35
consensus/types/src/consolidation.rs
Normal file
35
consensus/types/src/consolidation.rs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::Epoch;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct Consolidation {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub source_index: u64,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub target_index: u64,
|
||||||
|
pub epoch: Epoch,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(Consolidation);
|
||||||
|
}
|
||||||
37
consensus/types/src/deposit_receipt.rs
Normal file
37
consensus/types/src/deposit_receipt.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::{Hash256, PublicKeyBytes, Signature};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct DepositReceipt {
|
||||||
|
pub pubkey: PublicKeyBytes,
|
||||||
|
pub withdrawal_credentials: Hash256,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub amount: u64,
|
||||||
|
pub signature: Signature,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub index: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(DepositReceipt);
|
||||||
|
}
|
||||||
34
consensus/types/src/execution_layer_withdrawal_request.rs
Normal file
34
consensus/types/src/execution_layer_withdrawal_request.rs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::{Address, PublicKeyBytes};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct ExecutionLayerWithdrawalRequest {
|
||||||
|
pub source_address: Address,
|
||||||
|
pub validator_pubkey: PublicKeyBytes,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub amount: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(ExecutionLayerWithdrawalRequest);
|
||||||
|
}
|
||||||
@@ -29,16 +29,19 @@ pub mod bls_to_execution_change;
|
|||||||
pub mod builder_bid;
|
pub mod builder_bid;
|
||||||
pub mod chain_spec;
|
pub mod chain_spec;
|
||||||
pub mod checkpoint;
|
pub mod checkpoint;
|
||||||
|
pub mod consolidation;
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
pub mod contribution_and_proof;
|
pub mod contribution_and_proof;
|
||||||
pub mod deposit;
|
pub mod deposit;
|
||||||
pub mod deposit_data;
|
pub mod deposit_data;
|
||||||
pub mod deposit_message;
|
pub mod deposit_message;
|
||||||
|
pub mod deposit_receipt;
|
||||||
pub mod deposit_tree_snapshot;
|
pub mod deposit_tree_snapshot;
|
||||||
pub mod enr_fork_id;
|
pub mod enr_fork_id;
|
||||||
pub mod eth1_data;
|
pub mod eth1_data;
|
||||||
pub mod eth_spec;
|
pub mod eth_spec;
|
||||||
pub mod execution_block_hash;
|
pub mod execution_block_hash;
|
||||||
|
pub mod execution_layer_withdrawal_request;
|
||||||
pub mod execution_payload;
|
pub mod execution_payload;
|
||||||
pub mod execution_payload_header;
|
pub mod execution_payload_header;
|
||||||
pub mod fork;
|
pub mod fork;
|
||||||
@@ -54,6 +57,9 @@ pub mod light_client_finality_update;
|
|||||||
pub mod light_client_optimistic_update;
|
pub mod light_client_optimistic_update;
|
||||||
pub mod light_client_update;
|
pub mod light_client_update;
|
||||||
pub mod pending_attestation;
|
pub mod pending_attestation;
|
||||||
|
pub mod pending_balance_deposit;
|
||||||
|
pub mod pending_consolidation;
|
||||||
|
pub mod pending_partial_withdrawal;
|
||||||
pub mod proposer_preparation_data;
|
pub mod proposer_preparation_data;
|
||||||
pub mod proposer_slashing;
|
pub mod proposer_slashing;
|
||||||
pub mod relative_epoch;
|
pub mod relative_epoch;
|
||||||
@@ -63,6 +69,7 @@ pub mod signed_aggregate_and_proof;
|
|||||||
pub mod signed_beacon_block;
|
pub mod signed_beacon_block;
|
||||||
pub mod signed_beacon_block_header;
|
pub mod signed_beacon_block_header;
|
||||||
pub mod signed_bls_to_execution_change;
|
pub mod signed_bls_to_execution_change;
|
||||||
|
pub mod signed_consolidation;
|
||||||
pub mod signed_contribution_and_proof;
|
pub mod signed_contribution_and_proof;
|
||||||
pub mod signed_voluntary_exit;
|
pub mod signed_voluntary_exit;
|
||||||
pub mod signing_data;
|
pub mod signing_data;
|
||||||
@@ -133,10 +140,12 @@ pub use crate::checkpoint::Checkpoint;
|
|||||||
pub use crate::config_and_preset::{
|
pub use crate::config_and_preset::{
|
||||||
ConfigAndPreset, ConfigAndPresetCapella, ConfigAndPresetDeneb, ConfigAndPresetElectra,
|
ConfigAndPreset, ConfigAndPresetCapella, ConfigAndPresetDeneb, ConfigAndPresetElectra,
|
||||||
};
|
};
|
||||||
|
pub use crate::consolidation::Consolidation;
|
||||||
pub use crate::contribution_and_proof::ContributionAndProof;
|
pub use crate::contribution_and_proof::ContributionAndProof;
|
||||||
pub use crate::deposit::{Deposit, DEPOSIT_TREE_DEPTH};
|
pub use crate::deposit::{Deposit, DEPOSIT_TREE_DEPTH};
|
||||||
pub use crate::deposit_data::DepositData;
|
pub use crate::deposit_data::DepositData;
|
||||||
pub use crate::deposit_message::DepositMessage;
|
pub use crate::deposit_message::DepositMessage;
|
||||||
|
pub use crate::deposit_receipt::DepositReceipt;
|
||||||
pub use crate::deposit_tree_snapshot::{DepositTreeSnapshot, FinalizedExecutionBlock};
|
pub use crate::deposit_tree_snapshot::{DepositTreeSnapshot, FinalizedExecutionBlock};
|
||||||
pub use crate::enr_fork_id::EnrForkId;
|
pub use crate::enr_fork_id::EnrForkId;
|
||||||
pub use crate::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey};
|
pub use crate::epoch_cache::{EpochCache, EpochCacheError, EpochCacheKey};
|
||||||
@@ -144,6 +153,7 @@ pub use crate::eth1_data::Eth1Data;
|
|||||||
pub use crate::eth_spec::EthSpecId;
|
pub use crate::eth_spec::EthSpecId;
|
||||||
pub use crate::execution_block_hash::ExecutionBlockHash;
|
pub use crate::execution_block_hash::ExecutionBlockHash;
|
||||||
pub use crate::execution_block_header::ExecutionBlockHeader;
|
pub use crate::execution_block_header::ExecutionBlockHeader;
|
||||||
|
pub use crate::execution_layer_withdrawal_request::ExecutionLayerWithdrawalRequest;
|
||||||
pub use crate::execution_payload::{
|
pub use crate::execution_payload::{
|
||||||
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra,
|
ExecutionPayload, ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra,
|
||||||
ExecutionPayloadMerge, ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
ExecutionPayloadMerge, ExecutionPayloadRef, Transaction, Transactions, Withdrawals,
|
||||||
@@ -189,6 +199,9 @@ pub use crate::payload::{
|
|||||||
FullPayloadRef, OwnedExecPayload,
|
FullPayloadRef, OwnedExecPayload,
|
||||||
};
|
};
|
||||||
pub use crate::pending_attestation::PendingAttestation;
|
pub use crate::pending_attestation::PendingAttestation;
|
||||||
|
pub use crate::pending_balance_deposit::PendingBalanceDeposit;
|
||||||
|
pub use crate::pending_consolidation::PendingConsolidation;
|
||||||
|
pub use crate::pending_partial_withdrawal::PendingPartialWithdrawal;
|
||||||
pub use crate::preset::{
|
pub use crate::preset::{
|
||||||
AltairPreset, BasePreset, BellatrixPreset, CapellaPreset, DenebPreset, ElectraPreset,
|
AltairPreset, BasePreset, BellatrixPreset, CapellaPreset, DenebPreset, ElectraPreset,
|
||||||
};
|
};
|
||||||
@@ -207,6 +220,7 @@ pub use crate::signed_beacon_block::{
|
|||||||
};
|
};
|
||||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||||
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
pub use crate::signed_bls_to_execution_change::SignedBlsToExecutionChange;
|
||||||
|
pub use crate::signed_consolidation::SignedConsolidation;
|
||||||
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
pub use crate::signed_contribution_and_proof::SignedContributionAndProof;
|
||||||
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
||||||
pub use crate::signing_data::{SignedRoot, SigningData};
|
pub use crate::signing_data::{SignedRoot, SigningData};
|
||||||
|
|||||||
33
consensus/types/src/pending_balance_deposit.rs
Normal file
33
consensus/types/src/pending_balance_deposit.rs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct PendingBalanceDeposit {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub index: u64,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub amount: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PendingBalanceDeposit);
|
||||||
|
}
|
||||||
33
consensus/types/src/pending_consolidation.rs
Normal file
33
consensus/types/src/pending_consolidation.rs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct PendingConsolidation {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub source_index: u64,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub target_index: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PendingConsolidation);
|
||||||
|
}
|
||||||
35
consensus/types/src/pending_partial_withdrawal.rs
Normal file
35
consensus/types/src/pending_partial_withdrawal.rs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::Epoch;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct PendingPartialWithdrawal {
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub index: u64,
|
||||||
|
#[serde(with = "serde_utils::quoted_u64")]
|
||||||
|
pub amount: u64,
|
||||||
|
pub withdrawable_epoch: Epoch,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(PendingPartialWithdrawal);
|
||||||
|
}
|
||||||
32
consensus/types/src/signed_consolidation.rs
Normal file
32
consensus/types/src/signed_consolidation.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
use crate::test_utils::TestRandom;
|
||||||
|
use crate::{Consolidation, Signature};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use ssz_derive::{Decode, Encode};
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
arbitrary::Arbitrary,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Hash,
|
||||||
|
Clone,
|
||||||
|
Serialize,
|
||||||
|
Deserialize,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
TreeHash,
|
||||||
|
TestRandom,
|
||||||
|
)]
|
||||||
|
pub struct SignedConsolidation {
|
||||||
|
pub message: Consolidation,
|
||||||
|
pub signature: Signature,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
ssz_and_tree_hash_tests!(SignedConsolidation);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user