Skip to content

Commit 07f682c

Browse files
authored
Batch len fix (#1224)
1 parent d7c442f commit 07f682c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

batcher/aligned-batcher/src/config/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ impl NonPayingConfig {
3838
#[derive(Debug, Deserialize)]
3939
pub struct BatcherConfigFromYaml {
4040
pub block_interval: u64,
41-
pub batch_size_interval: usize,
4241
pub max_proof_size: usize,
4342
pub max_batch_size: usize,
4443
pub eth_ws_reconnects: usize,

batcher/aligned-batcher/src/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ pub struct Batcher {
6868
payment_service_fallback: BatcherPaymentService,
6969
batch_state: Mutex<BatchState>,
7070
max_block_interval: u64,
71-
min_batch_len: usize,
7271
max_proof_size: usize,
7372
max_batch_size: usize,
7473
last_uploaded_batch_block: Mutex<u64>,
@@ -194,7 +193,6 @@ impl Batcher {
194193
payment_service,
195194
payment_service_fallback,
196195
max_block_interval: config.batcher.block_interval,
197-
min_batch_len: config.batcher.batch_size_interval,
198196
max_proof_size: config.batcher.max_proof_size,
199197
max_batch_size: config.batcher.max_batch_size,
200198
last_uploaded_batch_block: Mutex::new(last_uploaded_batch_block),
@@ -750,17 +748,18 @@ impl Batcher {
750748
let current_batch_len = batch_state_lock.batch_queue.len();
751749
let last_uploaded_batch_block_lock = self.last_uploaded_batch_block.lock().await;
752750

753-
if current_batch_len == 0 {
754-
info!("Current batch is empty. Waiting for more proofs...");
751+
if current_batch_len < 2 {
752+
info!(
753+
"Current batch has {} proof. Waiting for more proofs...",
754+
current_batch_len
755+
);
755756
return None;
756757
}
757758

758-
if batch_state_lock.batch_queue.len() < self.min_batch_len
759-
&& block_number < *last_uploaded_batch_block_lock + self.max_block_interval
760-
{
759+
if block_number < *last_uploaded_batch_block_lock + self.max_block_interval {
761760
info!(
762-
"Current batch not ready to be posted. Current block: {} - Last uploaded block: {}. Current batch length: {} - Minimum batch length: {}",
763-
block_number, *last_uploaded_batch_block_lock, batch_state_lock.batch_queue.len(), self.min_batch_len
761+
"Current batch not ready to be posted. Minimium amount of {} blocks have not passed. Block passed: {}", self.max_block_interval,
762+
block_number - *last_uploaded_batch_block_lock,
764763
);
765764
return None;
766765
}

0 commit comments

Comments
 (0)