Skip to content

Commit

Permalink
remove spurious logs
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Feb 14, 2024
1 parent 8a618d7 commit 23f86b1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
7 changes: 2 additions & 5 deletions lib/src/rpc/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ impl<M: Middleware + 'static> DidRegistryServer for DidRegistryMethods<M> {
) -> Result<DidResolutionResult, ErrorObjectOwned> {
log::debug!("did_resolveDid called");

log::trace!("Resolving for key {}", public_key);

// parse the version_id
let parsed_version_id = version_id.map(|str| U64::from(u64::from_str(&str).unwrap()));

Expand All @@ -45,10 +43,9 @@ impl<M: Middleware + 'static> DidRegistryServer for DidRegistryMethods<M> {
H160::from_str(&public_key).map_err(RpcError::from)?,
parsed_version_id,
)
.await;
log::debug!("Resolution Result {:?}", resolution_result);
.await?;

Ok(resolution_result?)
Ok(resolution_result)
}
}

Expand Down
8 changes: 1 addition & 7 deletions lib/src/types/ethr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,6 @@ impl EthrBuilder {
value: V,
encoding: KeyEncoding,
) -> Result<Option<VerificationMethodProperties>, EthrBuilderError> {
log::debug!(
"decoding attribute value {:?} with encoding: {}",
value.as_ref(),
encoding
);

let enc = match encoding {
KeyEncoding::Hex => Some(VerificationMethodProperties::PublicKeyHex {
public_key_hex: hex::encode(value),
Expand All @@ -338,7 +332,7 @@ impl EthrBuilder {
public_key_base58: bs58::encode(value).into_string(),
}),
};
log::debug!("Encoded {:?}", enc);

Ok(enc)
}

Expand Down
44 changes: 35 additions & 9 deletions lib/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ethers::{
signers::{LocalWallet, Signer as _},
types::{Address, U256},
};
use integration_util::{set_attribute, revoke_attribute, validate_document, with_client};
use integration_util::{revoke_attribute, set_attribute, validate_document, with_client};
use regex::Regex;

#[cfg(test)]
Expand All @@ -27,7 +27,7 @@ mod it {
let me = signer.address();
set_attribute(&registry, me, "did/pub/Secp256k1/veriKey/hex", "02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71", 604_800).await?;
set_attribute(&registry, me, "did/pub/Ed25519/veriKey/base64", "302a300506032b656e032100118557777ffb078774371a52b00fed75561dcf975e61c47553e664a617661052", 604_800).await?;

let resolution_response = client.resolve_did(hex::encode(me), None).await?;
validate_document(&resolution_response.document).await;
assert_eq!(
Expand Down Expand Up @@ -198,9 +198,22 @@ mod it {
pub async fn test_attribute_revocation() -> Result<()> {
with_client(None, |client, registry, signer, _| async move {
let me = signer.address();

set_attribute(&registry, me, "did/pub/Secp256k1/veriKey/hex", "02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71", 604_800).await?;
revoke_attribute(&registry, me, "did/pub/Secp256k1/veriKey/hex", "02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71").await?;

set_attribute(
&registry,
me,
"did/pub/Secp256k1/veriKey/hex",
"02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71",
604_800,
)
.await?;
revoke_attribute(
&registry,
me,
"did/pub/Secp256k1/veriKey/hex",
"02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71",
)
.await?;

let document = client.resolve_did(hex::encode(me), None).await?.document;
validate_document(&document).await;
Expand Down Expand Up @@ -285,7 +298,14 @@ mod it {
with_client(None, |client, registry, signer, _| async move {
let me = signer.address();
let attribute_name = "xmtp/installation/hex ";
set_attribute(&registry, me, attribute_name, "02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71", 604_800).await?;
set_attribute(
&registry,
me,
attribute_name,
"02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71",
604_800,
)
.await?;

let document = client.resolve_did(hex::encode(me), None).await?.document;
let regexr = format!(
Expand All @@ -294,9 +314,15 @@ mod it {
);
let test = Regex::new(&regexr).unwrap();
assert!(test.is_match(&document.verification_method[1].id.to_string()));

revoke_attribute(&registry, me, attribute_name, "02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71").await?;


revoke_attribute(
&registry,
me,
attribute_name,
"02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71",
)
.await?;

let document = client.resolve_did(hex::encode(me), None).await?.document;
validate_document(&document).await;
assert_eq!(
Expand Down

0 comments on commit 23f86b1

Please sign in to comment.