From ab7a2a01c00d5fd1b2fe2b5f6fa5c78d8140519d Mon Sep 17 00:00:00 2001 From: cong-or Date: Wed, 1 May 2024 18:15:48 +0100 Subject: [PATCH] test ci --- .../bin/src/cardano/cip36_registration/mod.rs | 27 +++++++++++++------ catalyst-gateway/bin/src/cardano/mod.rs | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs b/catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs index 73b3e843b8..70b47b4013 100644 --- a/catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs +++ b/catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs @@ -110,7 +110,7 @@ impl Cip36Metadata { let mut registration = None; let mut raw_metadata = None; let mut signature = None; - // let mut raw_61284 = None; + let mut raw_61284 = None; let mut errors_report = Vec::new(); if let pallas::ledger::traverse::MultiEraMeta::AlonzoCompatible(tx_metadata) = tx_metadata { @@ -137,7 +137,15 @@ impl Cip36Metadata { }, Some, ); - // raw_61284 = Some(metadata.encode_fragment().ok()?); + + raw_61284 = metadata.encode_fragment().map_or_else( + |err| { + errors_report + .push(format!("cannot encode 61284 metadata into bytes {err}")); + None + }, + Some, + ); }, CIP36_WITNESS_CBOR_KEY => { signature = inspect_witness_from_metadata(metadata).map_or_else( @@ -153,11 +161,15 @@ impl Cip36Metadata { } }; - // if let Some(raw_61284) = raw_61284 { - // let _ = validate_signature(&raw_61284, ®istration, &signature).map_err(|err| { - // errors_report.push(format!("{err}")); - // }); - // } + if let Some(raw_61284) = raw_61284 { + let _ = validate_signature(&raw_61284, ®istration, &signature).map_or_else( + |err| { + errors_report.push(format!("cannot validate signature {err}")); + None + }, + Some, + ); + } Some(Self { registration: registration.clone(), @@ -172,7 +184,6 @@ impl Cip36Metadata { /// - CBOR encoding the registration /// - blake2b-256 hashing those bytes /// - signing the hash with the private key used to generate the stake key -#[allow(dead_code)] pub fn validate_signature( raw_61284: &[u8], registration: &Option, signature: &Option, ) -> anyhow::Result<()> { diff --git a/catalyst-gateway/bin/src/cardano/mod.rs b/catalyst-gateway/bin/src/cardano/mod.rs index 1765122656..5c1e1fe80a 100644 --- a/catalyst-gateway/bin/src/cardano/mod.rs +++ b/catalyst-gateway/bin/src/cardano/mod.rs @@ -106,7 +106,7 @@ async fn spawn_follower( // where it left off. If there was no previous follower, start indexing from // genesis point. let start_from = match db.last_updated_state(network).await { - Ok((slot_no, block_hash, _)) => Point::new(slot_no.try_into()?, block_hash), + Ok((slot_no, block_hash, _)) => Point::new(slot_no.try_into().unwrap(), block_hash), Err(err) if err.is::() => Point::Origin, Err(err) => return Err(err), };