Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace_decoder: Tweak batch size for small blocks #576

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion trace_decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub struct BlockLevelData {
pub fn entrypoint(
trace: BlockTrace,
other: OtherBlockData,
batch_size: usize,
mut batch_size: usize,
use_burn_addr: bool,
) -> anyhow::Result<Vec<GenerationInputs>> {
use anyhow::Context as _;
Expand Down Expand Up @@ -398,6 +398,12 @@ pub fn entrypoint(
)
.collect::<Hash2Code>();

// Make sure the batch size is smaller than the total number of transactions,
// or we would need to generate dummy proofs for the aggregation layers.
if batch_size > txn_info.len() {
batch_size = txn_info.len() / 2 + 1;
}

let last_tx_idx = txn_info.len().saturating_sub(1) / batch_size;

let mut txn_info = txn_info
Expand Down
Loading