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

Batch len fix #1224

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 0 additions & 1 deletion batcher/aligned-batcher/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl NonPayingConfig {
#[derive(Debug, Deserialize)]
pub struct BatcherConfigFromYaml {
pub block_interval: u64,
pub batch_size_interval: usize,
pub max_proof_size: usize,
pub max_batch_size: usize,
pub eth_ws_reconnects: usize,
Expand Down
14 changes: 5 additions & 9 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ pub struct Batcher {
payment_service_fallback: BatcherPaymentService,
batch_state: Mutex<BatchState>,
max_block_interval: u64,
min_batch_len: usize,
max_proof_size: usize,
max_batch_size: usize,
last_uploaded_batch_block: Mutex<u64>,
Expand Down Expand Up @@ -194,7 +193,6 @@ impl Batcher {
payment_service,
payment_service_fallback,
max_block_interval: config.batcher.block_interval,
min_batch_len: config.batcher.batch_size_interval,
max_proof_size: config.batcher.max_proof_size,
max_batch_size: config.batcher.max_batch_size,
last_uploaded_batch_block: Mutex::new(last_uploaded_batch_block),
Expand Down Expand Up @@ -750,17 +748,15 @@ impl Batcher {
let current_batch_len = batch_state_lock.batch_queue.len();
let last_uploaded_batch_block_lock = self.last_uploaded_batch_block.lock().await;

if current_batch_len == 0 {
info!("Current batch is empty. Waiting for more proofs...");
if current_batch_len < 2 {
info!("Current batch has {} proof. Waiting for more proofs...",current_batch_len);
return None;
}

if batch_state_lock.batch_queue.len() < self.min_batch_len
&& block_number < *last_uploaded_batch_block_lock + self.max_block_interval
{
if block_number < *last_uploaded_batch_block_lock + self.max_block_interval {
info!(
"Current batch not ready to be posted. Current block: {} - Last uploaded block: {}. Current batch length: {} - Minimum batch length: {}",
block_number, *last_uploaded_batch_block_lock, batch_state_lock.batch_queue.len(), self.min_batch_len
"Current batch not ready to be posted. Minimium amount of {} blocks have not passed. Block passed: {}", self.max_block_interval,
block_number - *last_uploaded_batch_block_lock,
);
return None;
}
Expand Down
Loading