Skip to content

Commit

Permalink
chore: fix format
Browse files Browse the repository at this point in the history
Signed-off-by: bkioshn <[email protected]>
  • Loading branch information
bkioshn committed Nov 29, 2024
1 parent 3d4ff45 commit 00fa07d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions rust/rbac-registration/src/cardano/cip509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ impl Cip509 {
for role in role_set {
if role.role_number == 0 {
stake_key_validate =
validate_stake_public_key(self, txn, validation_report)
.unwrap_or(false);
validate_stake_public_key(self, txn, validation_report).unwrap_or(false);
payment_key_validate =
validate_payment_key(txn, txn_idx, role, validation_report)
.unwrap_or(false);
Expand Down
8 changes: 5 additions & 3 deletions rust/rbac-registration/src/cardano/cip509/rbac/pub_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ impl Decode<'_, ()> for SimplePublicKeyType {
}
},
minicbor::data::Type::Undefined => Ok(Self::Undefined),
_ => Err(decode::Error::message(
"Invalid datatype for SimplePublicKeyType",
)),
_ => {
Err(decode::Error::message(
"Invalid datatype for SimplePublicKeyType",
))
},
}
}
}
9 changes: 4 additions & 5 deletions rust/rbac-registration/src/cardano/cip509/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ use super::{

/// Context-specific primitive type with tag number 6 (`raw_tag` 134) for
/// uniform resource identifier (URI) in the subject alternative name extension.
/// Following the ASN.1 <https://www.oss.com/asn1/resources/asn1-made-simple/asn1-quick-reference/asn1-tags.html>,
/// Following the ASN.1
/// <https://www.oss.com/asn1/resources/asn1-made-simple/asn1-quick-reference/asn1-tags.html>
/// the tag is derive from
/// | Class (2 bit) | P/C (1 bit) | Tag Number (5 bit) |
/// |`CONTEXT_SPECIFIC` | `PRIMITIVE` `| 6` |
Expand Down Expand Up @@ -164,7 +165,6 @@ pub(crate) fn validate_stake_public_key(

// Extract the CIP19 hash and push into
// array
println!("{:?}", &addr);
if let Some(h) =
extract_cip19_hash(&addr, Some("stake"))
{
Expand Down Expand Up @@ -267,8 +267,8 @@ pub(crate) fn validate_stake_public_key(

Some(
// Set transaction index to 0 because the list of transaction is manually constructed
// for TxWitness -> &[txn.clone()], so we can assume that the witness contains only the witness
// within this transaction.
// for TxWitness -> &[txn.clone()], so we can assume that the witness contains only
// the witness within this transaction.
compare_key_hash(&pk_addrs, &witnesses, 0)
.map_err(|e| {
validation_report.push(format!(
Expand All @@ -278,7 +278,6 @@ pub(crate) fn validate_stake_public_key(
.is_ok(),
)
}
// pk addrs [[224, 117, 190, 16, 236, 92, 87, 92, 175, 251, 104, 176, 140, 49, 71, 6, 102, 212, 254, 26, 238, 160, 124, 22, 214, 71, 57, 3]]

// ------------------------ Validate Aux ------------------------

Expand Down
1 change: 0 additions & 1 deletion rust/rbac-registration/src/cardano/transaction/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ mod tests {
.expect("Failed to decode vkey1_hash")
.try_into()
.expect("Invalid length of vkey1_hash");
println!("{tx_witness_conway}");
assert!(tx_witness_conway.get_witness_pk_addr(&vkey1_hash).is_some());
assert!(tx_witness_conway.check_witness_in_tx(&vkey1_hash, 0));
}
Expand Down
1 change: 0 additions & 1 deletion rust/rbac-registration/src/utils/decode_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ mod tests {
let mut d = Decoder::new(&buf);
let result = decode_any(&mut d, "test");
// Should print out the error message with the location of the error
println!("{result:?}");
assert!(result.is_err());
}
}

0 comments on commit 00fa07d

Please sign in to comment.