Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into span-properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Cirner committed Oct 11, 2021
2 parents ae2d062 + 2099800 commit a9b54e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions bin/env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export STORAGE_BASE_PATH=storage_bucket
export TRACE_HEADER=x-trace-header
export LOGGING_THRESHOLD_SECONDS=1
export RUST_LOG=warn,object_store=debug

export DD_AGENT_ENABLED=true
export DD_AGENT_ENABLED=false
export DD_SERVICE_NAME=object-store-service
export DD_TRACE_SPAN_TAGS=app:object-store,env:local
13 changes: 4 additions & 9 deletions src/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,9 @@ impl PublicKeyService for PublicKeyGrpc {
}

let response = datastore::add_public_key(&self.db_pool, request).await?;
let key_bytes = match response.public_key.clone().unwrap().key.unwrap() {
Key::Secp256k1(data) => data,
let key = match response.public_key.clone().unwrap().key.unwrap() {
Key::Secp256k1(data) => base64::encode(data),
};
let key = std::str::from_utf8(&key_bytes)
.map_err(Into::<OsError>::into)
// TODO remove this when we have public_key RPCs using the OsError across the board
.map_err(Into::<Status>::into)?
.to_owned();

if response.url.is_empty() {
let mut cache = self.cache.lock().unwrap();
Expand Down Expand Up @@ -453,7 +448,7 @@ mod tests {
let cache = cache.lock().unwrap();
assert_eq!(cache.local_public_keys.len(), 1);
assert_eq!(cache.remote_public_keys.len(), 0);
assert!(cache.local_public_keys.contains(&std::str::from_utf8(&vec![1u8, 2u8, 3u8]).unwrap().to_owned()));
assert!(cache.local_public_keys.contains(&base64::encode(&vec![1u8, 2u8, 3u8])));
}

#[tokio::test]
Expand Down Expand Up @@ -485,6 +480,6 @@ mod tests {
let cache = cache.lock().unwrap();
assert_eq!(cache.local_public_keys.len(), 0);
assert_eq!(cache.remote_public_keys.len(), 1);
assert!(cache.remote_public_keys.contains_key(&std::str::from_utf8(&vec![1u8, 2u8, 3u8]).unwrap().to_owned()));
assert!(cache.remote_public_keys.contains_key(&base64::encode(&vec![1u8, 2u8, 3u8])));
}
}

0 comments on commit a9b54e9

Please sign in to comment.