Skip to content

Commit 2445ee9

Browse files
committed
refacto: remove entities dependency to protocol
1 parent 99b4c5e commit 2445ee9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

mithril-common/src/entities/protocol_message.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use serde::{Deserialize, Serialize};
22
use sha2::{Digest, Sha256};
33
use std::{collections::BTreeMap, fmt::Display};
44

5-
use crate::protocol::ToMessage;
6-
75
/// The key of a ProtocolMessage
86
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
97
pub enum ProtocolMessagePartKey {
@@ -118,12 +116,6 @@ impl ProtocolMessage {
118116
}
119117
}
120118

121-
impl ToMessage for ProtocolMessage {
122-
fn to_message(&self) -> String {
123-
self.compute_hash()
124-
}
125-
}
126-
127119
#[cfg(test)]
128120
mod tests {
129121
use super::*;

mithril-common/src/protocol/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub use multi_signer::MultiSigner;
1212
pub use signer_builder::{SignerBuilder, SignerBuilderError};
1313
pub use single_signer::SingleSigner;
1414

15+
use crate::entities::ProtocolMessage;
16+
1517
/// Trait to convert a type to a message that can be signed or verified by the Mithril protocol.
1618
pub trait ToMessage: Sync + Send {
1719
/// Return a String representation of the message.
@@ -29,3 +31,9 @@ impl ToMessage for &str {
2931
self.to_string()
3032
}
3133
}
34+
35+
impl ToMessage for ProtocolMessage {
36+
fn to_message(&self) -> String {
37+
self.compute_hash()
38+
}
39+
}

0 commit comments

Comments
 (0)