Skip to content

Commit

Permalink
chore: add tracing to signature client (#7674)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Apr 15, 2024
1 parent 9bce256 commit ee47bb0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/common/src/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl SignEthClient {
}

async fn get_text(&self, url: &str) -> reqwest::Result<String> {
trace!(%url, "GET");
self.inner
.get(url)
.send()
Expand All @@ -73,11 +74,12 @@ impl SignEthClient {
}

/// Sends a new post request
async fn post_json<T: Serialize, R: DeserializeOwned>(
async fn post_json<T: Serialize + std::fmt::Debug, R: DeserializeOwned>(
&self,
url: &str,
body: &T,
) -> reqwest::Result<R> {
trace!(%url, body=?serde_json::to_string(body), "POST");
self.inner
.post(url)
.json(body)
Expand Down Expand Up @@ -146,7 +148,7 @@ impl SignEthClient {
.await?
.pop() // Not returning on the previous line ensures a vector with exactly 1 element
.unwrap()
.ok_or(eyre::eyre!("No signature found"))
.ok_or_else(|| eyre::eyre!("No signature found"))
}

/// Decodes the given function or event selectors using https://api.openchain.xyz
Expand All @@ -166,6 +168,9 @@ impl SignEthClient {
return Ok(vec![]);
}

debug!(len = selectors.len(), "decoding selectors");
trace!(?selectors, "decoding selectors");

// exit early if spurious connection
self.ensure_not_spurious()?;

Expand Down

0 comments on commit ee47bb0

Please sign in to comment.