mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-30 03:03:45 +00:00
Indexed att on disk (#35)
* indexed att on disk * fix lints * Update slasher/src/migrate.rs Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com> --------- Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Co-authored-by: ethDreamer <37123614+ethDreamer@users.noreply.github.com>
This commit is contained in:
@@ -239,6 +239,38 @@ mod quoted_variable_list_u64 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
#[ssz(enum_behaviour = "union")]
|
||||
pub enum IndexedAttestationOnDisk<E: EthSpec> {
|
||||
Base(IndexedAttestationBase<E>),
|
||||
Electra(IndexedAttestationElectra<E>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Encode, PartialEq)]
|
||||
#[ssz(enum_behaviour = "union")]
|
||||
pub enum IndexedAttestationRefOnDisk<'a, E: EthSpec> {
|
||||
Base(&'a IndexedAttestationBase<E>),
|
||||
Electra(&'a IndexedAttestationElectra<E>),
|
||||
}
|
||||
|
||||
impl<'a, E: EthSpec> From<&'a IndexedAttestation<E>> for IndexedAttestationRefOnDisk<'a, E> {
|
||||
fn from(attestation: &'a IndexedAttestation<E>) -> Self {
|
||||
match attestation {
|
||||
IndexedAttestation::Base(attestation) => Self::Base(attestation),
|
||||
IndexedAttestation::Electra(attestation) => Self::Electra(attestation),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> From<IndexedAttestationOnDisk<E>> for IndexedAttestation<E> {
|
||||
fn from(attestation: IndexedAttestationOnDisk<E>) -> Self {
|
||||
match attestation {
|
||||
IndexedAttestationOnDisk::Base(attestation) => Self::Base(attestation),
|
||||
IndexedAttestationOnDisk::Electra(attestation) => Self::Electra(attestation),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -176,7 +176,8 @@ pub use crate::fork_versioned_response::{ForkVersionDeserialize, ForkVersionedRe
|
||||
pub use crate::graffiti::{Graffiti, GRAFFITI_BYTES_LEN};
|
||||
pub use crate::historical_batch::HistoricalBatch;
|
||||
pub use crate::indexed_attestation::{
|
||||
IndexedAttestation, IndexedAttestationBase, IndexedAttestationElectra, IndexedAttestationRef,
|
||||
IndexedAttestation, IndexedAttestationBase, IndexedAttestationElectra,
|
||||
IndexedAttestationOnDisk, IndexedAttestationRef, IndexedAttestationRefOnDisk,
|
||||
};
|
||||
pub use crate::light_client_bootstrap::{
|
||||
LightClientBootstrap, LightClientBootstrapAltair, LightClientBootstrapCapella,
|
||||
|
||||
Reference in New Issue
Block a user