Skip to content

Commit

Permalink
test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cong-or committed May 1, 2024
1 parent 35b6536 commit ab7a2a0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions catalyst-gateway/bin/src/cardano/cip36_registration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(
Expand All @@ -153,11 +161,15 @@ impl Cip36Metadata {
}
};

// if let Some(raw_61284) = raw_61284 {
// let _ = validate_signature(&raw_61284, &registration, &signature).map_err(|err| {
// errors_report.push(format!("{err}"));
// });
// }
if let Some(raw_61284) = raw_61284 {
let _ = validate_signature(&raw_61284, &registration, &signature).map_or_else(
|err| {
errors_report.push(format!("cannot validate signature {err}"));
None
},
Some,
);
}

Some(Self {
registration: registration.clone(),
Expand All @@ -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<Registration>, signature: &Option<Signature>,
) -> anyhow::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion catalyst-gateway/bin/src/cardano/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<NotFoundError>() => Point::Origin,
Err(err) => return Err(err),
};
Expand Down

0 comments on commit ab7a2a0

Please sign in to comment.