From 95ca083befea295ace6391b3d5d4519a4af988ef Mon Sep 17 00:00:00 2001 From: Erwan Date: Fri, 26 Jan 2024 18:17:53 -0500 Subject: [PATCH] shielded-pool(fmd): restore pb conversion traits --- .../core/component/shielded-pool/src/fmd.rs | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/crates/core/component/shielded-pool/src/fmd.rs b/crates/core/component/shielded-pool/src/fmd.rs index e549dae83a..870780ffeb 100644 --- a/crates/core/component/shielded-pool/src/fmd.rs +++ b/crates/core/component/shielded-pool/src/fmd.rs @@ -9,30 +9,29 @@ pub struct Parameters { pub as_of_block_height: u64, } -// TODO(erwan): re-enable on second pass -// impl DomainType for FmdParameters { -// type Proto = pb::FmdParameters; -// } -// -// impl TryFrom for FmdParameters { -// type Error = anyhow::Error; -// -// fn try_from(msg: pb::FmdParameters) -> Result { -// Ok(FmdParameters { -// precision_bits: msg.precision_bits.try_into()?, -// as_of_block_height: msg.as_of_block_height, -// }) -// } -// } -// -// impl From for pb::FmdParameters { -// fn from(params: FmdParameters) -> Self { -// pb::FmdParameters { -// precision_bits: u32::from(params.precision_bits), -// as_of_block_height: params.as_of_block_height, -// } -// } -// } +impl DomainType for FmdParameters { + type Proto = pb::FmdParameters; +} + +impl TryFrom for FmdParameters { + type Error = anyhow::Error; + + fn try_from(msg: pb::FmdParameters) -> Result { + Ok(FmdParameters { + precision_bits: msg.precision_bits.try_into()?, + as_of_block_height: msg.as_of_block_height, + }) + } +} + +impl From for pb::FmdParameters { + fn from(params: FmdParameters) -> Self { + pb::FmdParameters { + precision_bits: u32::from(params.precision_bits), + as_of_block_height: params.as_of_block_height, + } + } +} impl Default for Parameters { fn default() -> Self {