Skip to content

Commit ef3c611

Browse files
committed
Log used_blobs.
1 parent cf47a1b commit ef3c611

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

linera-core/src/chain_worker/handle.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ impl<S: Storage + Clone + 'static> DerefMut for RollbackGuard<S> {
8282

8383
impl<S: Storage + Clone + 'static> Drop for RollbackGuard<S> {
8484
fn drop(&mut self) {
85+
let chain = self.0.chain();
86+
let chain_id = chain.chain_id();
87+
let tip_height = chain.tip_state.get().next_block_height;
88+
tracing::warn!(
89+
%chain_id, %tip_height,
90+
"used_blobs_trace: RollbackGuard::drop — calling chain.rollback()"
91+
);
8592
self.0.rollback();
8693
}
8794
}

linera-core/src/chain_worker/state.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,21 @@ where
755755

756756
// Check if we already processed this block.
757757
let tip = self.chain.tip_state.get().clone();
758+
let used_blobs_snapshot: Vec<_> = self
759+
.chain
760+
.execution_state
761+
.system
762+
.used_blobs
763+
.indices()
764+
.await
765+
.unwrap_or_default();
766+
warn!(
767+
%chain_id, %height, %block_hash,
768+
tip_height = %tip.next_block_height,
769+
used_blobs_count = used_blobs_snapshot.len(),
770+
?used_blobs_snapshot,
771+
"used_blobs_trace: process_confirmed_block: ENTRY"
772+
);
758773
if tip.next_block_height > height {
759774
let actions = self.create_network_actions(None).await?;
760775
self.register_delivery_notifier(height, &actions, notify_when_messages_are_delivered)
@@ -2126,11 +2141,34 @@ where
21262141
chain_id = %self.chain_id()
21272142
))]
21282143
async fn save(&mut self) -> Result<(), WorkerError> {
2144+
let chain_id = self.chain_id();
2145+
let tip_height = self.chain.tip_state.get().next_block_height;
2146+
let used_blobs_count = self
2147+
.chain
2148+
.execution_state
2149+
.system
2150+
.used_blobs
2151+
.indices()
2152+
.await
2153+
.map(|v| v.len())
2154+
.unwrap_or(usize::MAX);
2155+
warn!(
2156+
%chain_id, %tip_height, used_blobs_count,
2157+
"used_blobs_trace: save: START"
2158+
);
21292159
if let Err(error) = self.chain.save().await {
2160+
warn!(
2161+
%chain_id, %tip_height, %error,
2162+
"used_blobs_trace: save: FAILED"
2163+
);
21302164
tracing::error!(?error, "Chain save failed; marking worker as poisoned");
21312165
self.poisoned = true;
21322166
return Err(WorkerError::PoisonedWorker);
21332167
}
2168+
warn!(
2169+
%chain_id, %tip_height,
2170+
"used_blobs_trace: save: OK"
2171+
);
21342172
Ok(())
21352173
}
21362174
}

0 commit comments

Comments
 (0)