espresso_types/v0/v0_4/
state_cert.rs

1//! State certificate query data type
2
3use derive_more::From;
4use hotshot_types::{
5    simple_certificate::LightClientStateUpdateCertificateV2, traits::node_implementation::NodeType,
6};
7use serde::{Deserialize, Serialize};
8
9/// A wrapper around `LightClientStateUpdateCertificateV2`.
10///
11/// The V2 certificate includes additional fields compared to earlier versions:
12/// - Light client v3 signatures
13/// - `auth_root` — used by the reward claim contract to verify that its
14///   calculated `auth_root` matches the one in the Light Client contract.
15///
16/// This struct is returned by the `state-cert-v2` API endpoint.
17#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, From)]
18#[serde(bound = "")]
19pub struct StateCertQueryDataV2<Types: NodeType>(pub LightClientStateUpdateCertificateV2<Types>);
20
21impl<Types> From<StateCertQueryDataV2<Types>> for crate::v0_3::StateCertQueryDataV1<Types>
22where
23    Types: NodeType,
24{
25    fn from(cert: StateCertQueryDataV2<Types>) -> Self {
26        Self(cert.0.into())
27    }
28}