diff --git a/CHANGELOG.md b/CHANGELOG.md index 5da08d42..b65a7acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated state-fold libraries to version 0.8 - Added `SS_MAX_DECODING_MESSAGE_SIZE` to state-server and dispatcher with 100MB default - Added `MAX_DECODING_MESSAGE_SIZE` to advance runner with 100MB default +- Improved node log for large inputs ### Fixed diff --git a/offchain/dispatcher/src/machine/rollups_broker.rs b/offchain/dispatcher/src/machine/rollups_broker.rs index 17b6fa88..81470979 100644 --- a/offchain/dispatcher/src/machine/rollups_broker.rs +++ b/offchain/dispatcher/src/machine/rollups_broker.rs @@ -164,13 +164,13 @@ impl BrokerSend for BrokerFacade { input_index: u64, input: &Input, ) -> Result<(), BrokerFacadeError> { - tracing::info!(?input_index, ?input, "enqueueing input"); + tracing::trace!(?input_index, ?input, "enqueueing input"); let mut broker = self.broker.lock().await; let status = self.broker_status(&mut broker).await?; let event = build_next_input(input, &status); - tracing::trace!(?event, "producing input event"); + tracing::info!(?event, "producing input event"); input_sanity_check!(event, input_index); diff --git a/offchain/rollups-events/src/common.rs b/offchain/rollups-events/src/common.rs index a69e29e1..7b8b0a6c 100644 --- a/offchain/rollups-events/src/common.rs +++ b/offchain/rollups-events/src/common.rs @@ -10,6 +10,8 @@ use std::fmt::Write; pub const ADDRESS_SIZE: usize = 20; pub const HASH_SIZE: usize = 32; +const PAYLOAD_DEBUG_MAX_LEN: usize = 100; + /// A binary array that is converted to a hex string when serialized #[derive(Clone, Hash, Eq, PartialEq)] pub struct HexArray([u8; N]); @@ -143,7 +145,18 @@ impl<'de> Deserialize<'de> for Payload { impl std::fmt::Debug for Payload { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", base64_engine.encode(self.inner())) + let len = self.inner().len(); + if len > PAYLOAD_DEBUG_MAX_LEN { + let slice = &self.inner().as_slice()[0..PAYLOAD_DEBUG_MAX_LEN]; + write!( + f, + "{}...[total: {} bytes]", + base64_engine.encode(slice), + len + ) + } else { + write!(f, "{}", base64_engine.encode(self.inner())) + } } }