Skip to main content

hotshot_new_protocol/
helpers.rs

1use committable::{Commitment, Committable};
2use hotshot_types::{data::Leaf2, traits::node_implementation::NodeType};
3
4use crate::message::Proposal;
5
6pub fn proposal_commitment<T: NodeType>(proposal: &Proposal<T>) -> Commitment<Leaf2<T>> {
7    let leaf: Leaf2<T> = proposal.clone().into();
8    leaf.commit()
9}
10
11#[cfg(test)]
12pub fn test_upgrade_lock<T: NodeType>() -> hotshot_types::message::UpgradeLock<T> {
13    use versions::{NEW_PROTOCOL_VERSION, Upgrade};
14
15    hotshot_types::message::UpgradeLock::new(Upgrade::trivial(NEW_PROTOCOL_VERSION))
16}