Skip to content

Commit

Permalink
trace_decoder: Tweak batch size for small blocks (#576)
Browse files Browse the repository at this point in the history
* Tweak small batch sizes

* Add explanation
  • Loading branch information
Nashtare committed Sep 1, 2024
1 parent 8b8f26b commit 9ba2eda
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 9ba2eda

Please sign in to comment.