chik_protocol/
weight_proof.rs1use chik_streamable_macro::streamable;
2
3use crate::Bytes32;
4use crate::EndOfSubSlotBundle;
5use crate::HeaderBlock;
6use crate::ProofOfSpace;
7use crate::RewardChainBlock;
8use crate::{VDFInfo, VDFProof};
9
10#[streamable]
11pub struct SubEpochData {
12 reward_chain_hash: Bytes32,
13 num_blocks_overflow: u8,
14 new_sub_slot_iters: Option<u64>,
15 new_difficulty: Option<u64>,
16}
17
18#[streamable]
29pub struct SubSlotData {
30 proof_of_space: Option<ProofOfSpace>,
31 cc_signage_point: Option<VDFProof>,
32 cc_infusion_point: Option<VDFProof>,
33 icc_infusion_point: Option<VDFProof>,
34 cc_sp_vdf_info: Option<VDFInfo>,
35 signage_point_index: Option<u8>,
36 cc_slot_end: Option<VDFProof>,
37 icc_slot_end: Option<VDFProof>,
38 cc_slot_end_info: Option<VDFInfo>,
39 icc_slot_end_info: Option<VDFInfo>,
40 cc_ip_vdf_info: Option<VDFInfo>,
41 icc_ip_vdf_info: Option<VDFInfo>,
42 total_iters: Option<u128>,
43}
44
45#[cfg(feature = "py-bindings")]
46use pyo3::prelude::*;
47
48#[cfg_attr(feature = "py-bindings", pymethods)]
49impl SubSlotData {
50 pub fn is_end_of_slot(&self) -> bool {
51 self.cc_slot_end_info.is_some()
52 }
53
54 pub fn is_challenge(&self) -> bool {
55 self.proof_of_space.is_some()
56 }
57}
58
59#[streamable]
60pub struct SubEpochChallengeSegment {
61 sub_epoch_n: u32,
62 sub_slots: Vec<SubSlotData>,
63 rc_slot_end_info: Option<VDFInfo>,
64}
65
66#[streamable]
67pub struct SubEpochSegments {
68 challenge_segments: Vec<SubEpochChallengeSegment>,
69}
70
71#[streamable]
73pub struct RecentChainData {
74 recent_chain_data: Vec<HeaderBlock>,
75}
76
77#[streamable]
78pub struct ProofBlockHeader {
79 finished_sub_slots: Vec<EndOfSubSlotBundle>,
80 reward_chain_block: RewardChainBlock,
81}
82
83#[streamable]
84pub struct WeightProof {
85 sub_epochs: Vec<SubEpochData>,
86 sub_epoch_segments: Vec<SubEpochChallengeSegment>, recent_chain_data: Vec<HeaderBlock>,
88}