#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};
use ssz::{Codec, Encode, Decode};
use bm_le::{IntoTree, FromTree, MaxVec};
use vecarray::VecArray;
use crate::*;
use crate::primitives::*;
use crate::types::*;
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct ProposerSlashing {
pub proposer_index: Uint,
pub header_1: BeaconBlockHeader,
pub header_2: BeaconBlockHeader,
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct AttesterSlashing<C: Config> {
pub attestation_1: IndexedAttestation<C>,
pub attestation_2: IndexedAttestation<C>,
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct Attestation<C: Config> {
#[bm(compact)]
#[cfg_attr(feature = "serde", serde(serialize_with = "crate::utils::serialize_bitlist"))]
#[cfg_attr(feature = "serde", serde(deserialize_with = "crate::utils::deserialize_bitlist"))]
pub aggregation_bits: MaxVec<bool, C::MaxValidatorsPerCommittee>,
pub data: AttestationData,
#[bm(compact)]
#[cfg_attr(feature = "serde", serde(serialize_with = "crate::utils::serialize_bitlist"))]
#[cfg_attr(feature = "serde", serde(deserialize_with = "crate::utils::deserialize_bitlist"))]
pub custody_bits: MaxVec<bool, C::MaxValidatorsPerCommittee>,
pub signature: Signature,
}
impl<C: Config> From<Attestation<C>> for SigningAttestation<C> {
fn from(a: Attestation<C>) -> Self {
Self {
aggregation_bits: a.aggregation_bits,
data: a.data,
custody_bits: a.custody_bits,
}
}
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct SigningAttestation<C: Config> {
#[bm(compact)]
#[cfg_attr(feature = "serde", serde(serialize_with = "crate::utils::serialize_bitlist"))]
#[cfg_attr(feature = "serde", serde(deserialize_with = "crate::utils::deserialize_bitlist"))]
pub aggregation_bits: MaxVec<bool, C::MaxValidatorsPerCommittee>,
pub data: AttestationData,
#[bm(compact)]
#[cfg_attr(feature = "serde", serde(serialize_with = "crate::utils::serialize_bitlist"))]
#[cfg_attr(feature = "serde", serde(deserialize_with = "crate::utils::deserialize_bitlist"))]
pub custody_bits: MaxVec<bool, C::MaxValidatorsPerCommittee>,
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct Deposit {
pub proof: VecArray<H256, typenum::Sum<consts::DepositContractTreeDepth, typenum::U1>>,
pub data: DepositData,
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct VoluntaryExit {
pub epoch: Uint,
pub validator_index: Uint,
pub signature: Signature,
}
impl From<VoluntaryExit> for SigningVoluntaryExit {
fn from(v: VoluntaryExit) -> Self {
Self {
epoch: v.epoch,
validator_index: v.validator_index,
}
}
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct SigningVoluntaryExit {
pub epoch: Uint,
pub validator_index: Uint,
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct Transfer {
pub sender: Uint,
pub recipient: Uint,
pub amount: Uint,
pub fee: Uint,
pub slot: Uint,
pub pubkey: ValidatorId,
pub signature: Signature,
}
impl From<Transfer> for SigningTransfer {
fn from(t: Transfer) -> Self {
Self {
sender: t.sender,
recipient: t.recipient,
amount: t.amount,
fee: t.fee,
slot: t.slot,
pubkey: t.pubkey,
}
}
}
#[derive(Codec, Encode, Decode, IntoTree, FromTree, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(deny_unknown_fields))]
#[cfg_attr(feature = "parity-codec", derive(parity_codec::Encode, parity_codec::Decode))]
#[cfg_attr(feature = "std", derive(Debug))]
pub struct SigningTransfer {
pub sender: Uint,
pub recipient: Uint,
pub amount: Uint,
pub fee: Uint,
pub slot: Uint,
pub pubkey: ValidatorId,
}