Repository navigation
fix: Reduce view scope in batch_builder.get_batch_inputs - #2747
Merged
Merged
Conversation
sergerad
requested review from
Mirko-von-Leipzig and
kkovaacs
and removed request for
Mirko-von-Leipzig
October 7, 2026 19:07
Mirko-von-Leipzig
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We have noticed that the sequencer reports 2 live state snapshots (
snapshots.liveon the store'swrite_blockspan) far more often than full nodes do, even though full nodes serve more read traffic.The likely cause is
BatchJob::get_batch_inputs. It bound aStateViewfor the whole function, so the snapshot stayed pinned while the fee collection transaction was proven locally and validated by the validator. Neither step reads the state. When that work overlaps a block commit, the previous snapshot generation is still pinned at publish time.This PR releases the view as soon as the last state read is done.
Changes
State::with_viewso it only covers the store reads and the fee collection transaction execution.get_batch_inputsinto three helpers:read_batch_inputs: reads the note inclusion proofs, partial blockchain and reference block header.execute_fee_collection: reads the protocol config and genesis commitment, then executes the fee collection transaction.prove_fee_collection: proves the transaction and validates it with the validator. Runs after the view is released.BatchInputsstruct to carry the store reads between the helpers.No behavior change is intended beyond the shorter snapshot lifetime.
Testing
Existing
batch_buildertests pass. They do not cover the fee collection path.Changelog