snowbridge_beacon_primitives/
updates.rs1use codec::{Decode, DecodeWithMemTracking, Encode};
4use frame_support::{CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound};
5use scale_info::TypeInfo;
6use sp_core::H256;
7use sp_std::prelude::*;
8
9use crate::types::{BeaconHeader, SyncAggregate, SyncCommittee};
10
11#[derive(
12 Encode,
13 Decode,
14 DecodeWithMemTracking,
15 CloneNoBound,
16 PartialEqNoBound,
17 RuntimeDebugNoBound,
18 TypeInfo,
19)]
20#[cfg_attr(
21 feature = "std",
22 derive(serde::Serialize, serde::Deserialize),
23 serde(deny_unknown_fields, bound(serialize = ""), bound(deserialize = ""))
24)]
25pub struct CheckpointUpdate<const COMMITTEE_SIZE: usize> {
26 pub header: BeaconHeader,
27 pub current_sync_committee: SyncCommittee<COMMITTEE_SIZE>,
28 pub current_sync_committee_branch: Vec<H256>,
29 pub validators_root: H256,
30 pub block_roots_root: H256,
31 pub block_roots_branch: Vec<H256>,
32}
33
34#[derive(
35 Default,
36 Encode,
37 Decode,
38 DecodeWithMemTracking,
39 CloneNoBound,
40 PartialEqNoBound,
41 RuntimeDebugNoBound,
42 TypeInfo,
43)]
44#[cfg_attr(
45 feature = "std",
46 derive(serde::Deserialize),
47 serde(bound(serialize = ""), bound(deserialize = ""))
48)]
49pub struct Update<const COMMITTEE_SIZE: usize, const COMMITTEE_BITS_SIZE: usize> {
50 pub attested_header: BeaconHeader,
52 pub sync_aggregate: SyncAggregate<COMMITTEE_SIZE, COMMITTEE_BITS_SIZE>,
55 pub signature_slot: u64,
58 pub next_sync_committee_update: Option<NextSyncCommitteeUpdate<COMMITTEE_SIZE>>,
60 pub finalized_header: BeaconHeader,
62 pub finality_branch: Vec<H256>,
65 pub block_roots_root: H256,
67 pub block_roots_branch: Vec<H256>,
69}
70
71#[derive(
72 Default,
73 Encode,
74 Decode,
75 DecodeWithMemTracking,
76 CloneNoBound,
77 PartialEqNoBound,
78 RuntimeDebugNoBound,
79 TypeInfo,
80)]
81#[cfg_attr(
82 feature = "std",
83 derive(serde::Deserialize),
84 serde(deny_unknown_fields, bound(serialize = ""), bound(deserialize = ""))
85)]
86pub struct NextSyncCommitteeUpdate<const COMMITTEE_SIZE: usize> {
87 pub next_sync_committee: SyncCommittee<COMMITTEE_SIZE>,
88 pub next_sync_committee_branch: Vec<H256>,
89}