Skip to content

feat(logging): add account, note, storage, and mempool lifecycle events#2358

Open
kkovaacs wants to merge 4 commits into
nextfrom
krisztian/log-lifetime-events
Open

feat(logging): add account, note, storage, and mempool lifecycle events#2358
kkovaacs wants to merge 4 commits into
nextfrom
krisztian/log-lifetime-events

Conversation

@kkovaacs

Copy link
Copy Markdown
Contributor

Summary

  • Emit lifecycle events after successful block commits for account registration, note creation and consumption, and public account storage changes.
  • Resolve consumed note IDs from nullifiers on a best-effort basis and identify output notes erased within the same block.
  • Log mempool transaction additions, expirations, and evictions, distinguishing direct removals from dependent transaction removals.
  • Improve input-note formatting with explicit nullifier and note_id labels.

Resolves part 2 of issue #2330

Changelog

[[entry]]
scope       = "general"
impact      = "fixed"
description = "Account, note, storage and mempool lifecycle events are now logged on stdout."

kkovaacs added 4 commits July 20, 2026 13:30
Log lines are now emitted for mempool lifetime events.
apply_block() now logs detailed lifecycle events for all relevant
objects in the block that has been applied.
}

fn emit_dependent_transaction_evictions(removal: &graph::TransactionRemoval, reason: &'static str) {
for transaction_id in sorted_transaction_ids(removal.dependents()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions should have a guard to avoid unnecessary computation when not in DEBUG

if !tracing::enabled!(target: LOG_TARGET, tracing::Level::DEBUG) {
        return;
}

}
}

fn sorted_transaction_ids(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we used BTreeSet instead of HashSet then we wouldn't need to sort?


let mut resolved_note_ids = BTreeMap::new();
for chunk in
unresolved_note_nullifiers.chunks(QueryParamNoteCommitmentLimit::LIMIT)

@sergerad sergerad Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth commenting that unresolved_note_nullifiers is empty unless we are in DEBUG mode. And/or moving this to a separate function with that as a doc comment

},
}

impl BlockLifecycle {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this block be moved to under the BlockLifecycle struct section?

}

impl BlockLifecycle {
pub(super) fn from_block_body(block_num: BlockNumber, body: &BlockBody) -> Self {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good for tracing to show duration of this fn as well as emit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants