mithril_common/signable_builder/
mithril_stake_distribution.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use async_trait::async_trait;

use crate::{
    entities::{Epoch, ProtocolMessage},
    signable_builder::SignableBuilder,
    StdResult,
};

/// A [MithrilStakeDistributionSignableBuilder] builder
#[derive(Default)]
pub struct MithrilStakeDistributionSignableBuilder {}

#[async_trait]
impl SignableBuilder<Epoch> for MithrilStakeDistributionSignableBuilder {
    async fn compute_protocol_message(&self, _beacon: Epoch) -> StdResult<ProtocolMessage> {
        Ok(ProtocolMessage::new())
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[tokio::test]
    async fn test_compute_signable() {
        let mithril_stake_distribution_signable_builder =
            MithrilStakeDistributionSignableBuilder::default();
        let signable = mithril_stake_distribution_signable_builder
            .compute_protocol_message(Epoch(1))
            .await
            .unwrap();
        let signable_expected = ProtocolMessage::new();
        assert_eq!(signable_expected, signable);
    }
}