Skip to main content

f1r3fly_models/rust/casper/protocol/
casper_message.rs

1use crate::ByteString;
2
3// See models/src/main/scala/coop/rchain/casper/protocol/CasperMessage.scala
4pub struct BlockMessage {
5    pub block_hash: Vec<u8>,
6    pub header: Header,
7    pub body: Body,
8    pub justifications: Vec<Justification>,
9    pub sender: Vec<u8>,
10    pub seq_num: i32,
11    pub sig: Vec<u8>,
12    pub sig_algorithm: String,
13    pub shard_id: String,
14    pub extra_bytes: Vec<u8>,
15}
16
17pub struct Header {
18    pub parents_hash_list: Vec<ByteString>,
19    pub timestamp: i64,
20    pub version: i64,
21    pub extra_bytes: ByteString,
22}
23
24pub struct Body {
25    pub state: F1r3flyState,
26    // deploys: Vec<ProcessedDeploy>,
27}
28
29pub struct Justification {
30    // validator: ByteString,
31    // latest_block_hash: ByteString,
32}
33
34pub struct F1r3flyState {
35    pub pre_state_hash: ByteString,
36    pub post_state_hash: ByteString,
37    pub bonds: Vec<Bond>,
38    pub block_number: i64,
39}
40
41pub struct ProcessedDeploy {
42    // deploy: Signed<DeployData>,
43    // cost: PCost,
44    // deploy_log: Vec<Event>,
45    // is_failed: bool,
46    // system_deploy_error: Option<String>,
47}
48
49pub struct DeployData {
50    // term: String,
51    // time_stamp: i64,
52    // plo_price: i64,
53    // plo_limit: i64,
54    // valid_after_block_number: i64,
55    // shard_id: String,
56}
57
58pub struct Peek {
59    // channel_index: i32,
60}
61
62pub enum Event {
63    Produce(ProduceEvent),
64    Consume(ConsumeEvent),
65    Comm(CommEvent),
66}
67
68pub struct ProduceEvent {
69    pub channels_hash: ByteString,
70    pub hash: ByteString,
71    pub persistent: bool,
72    pub times_repeated: i32,
73}
74
75pub struct ConsumeEvent {
76    pub channels_hashes: Vec<ByteString>,
77    pub hash: ByteString,
78    pub persistent: bool,
79}
80
81pub struct CommEvent {
82    pub consume: ConsumeEvent,
83    pub produces: Vec<ProduceEvent>,
84    pub peeks: Vec<Peek>,
85}
86
87pub struct Bond {
88    // validator: ByteString,
89    // stake: i64,
90}