* Refactor Block/Header definition Refactor block/header definition so that it's now responsibility of the nomos-core crate. This removes definitions in ledger/consensus crates since there's no need at that level to have an understanding of the block format. The new header format supports both carnot and cryptarchia.
23 lines
745 B
Rust
23 lines
745 B
Rust
macro_rules! serialize_bytes_newtype {
|
|
($newtype:ty) => {
|
|
#[cfg(feature = "serde")]
|
|
impl serde::Serialize for $newtype {
|
|
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
|
nomos_utils::serde::serialize_bytes_array(self.0, serializer)
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "serde")]
|
|
impl<'de> serde::de::Deserialize<'de> for $newtype {
|
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
where
|
|
D: serde::Deserializer<'de>,
|
|
{
|
|
nomos_utils::serde::deserialize_bytes_array(deserializer).map(Self)
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
pub(crate) use serialize_bytes_newtype;
|