From e04ae4d4d37bb49022e2c34bf1993f3ead2211d1 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 10 Dec 2024 08:20:08 +1000 Subject: [PATCH] Make object retrieval RPC logging match HTTP logging --- crates/subspace-gateway-rpc/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/subspace-gateway-rpc/src/lib.rs b/crates/subspace-gateway-rpc/src/lib.rs index 4986f0741d..f50b3e521c 100644 --- a/crates/subspace-gateway-rpc/src/lib.rs +++ b/crates/subspace-gateway-rpc/src/lib.rs @@ -9,7 +9,7 @@ use subspace_core_primitives::hashes::{blake3_hash, Blake3Hash}; use subspace_core_primitives::objects::GlobalObjectMapping; use subspace_data_retrieval::object_fetcher::{self, ObjectFetcher}; use subspace_data_retrieval::piece_getter::PieceGetter; -use tracing::debug; +use tracing::{debug, error, trace}; const SUBSPACE_ERROR: i32 = 9000; @@ -154,7 +154,13 @@ where let data_hash = blake3_hash(&data); if data_hash != mapping.hash { - debug!(?data_hash, ?mapping.hash, "Retrieved data did not match mapping hash"); + error!( + ?data_hash, + data_size = %data.len(), + ?mapping.hash, + "Retrieved data did not match mapping hash", + ); + trace!(data = %hex::encode(data), "Retrieved data"); return Err(Error::InvalidObjectHash { mapping_hash: mapping.hash, data_hash,