Skip to content

Commit 8ef8f50

Browse files
committed
Remove double q
1 parent c311cd0 commit 8ef8f50

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

batcher/aligned-batcher/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ impl Batcher {
10641064
if batch_state_lock.batch_queue.len() > self.max_batch_proof_qty {
10651065
info!("Queue limit exceded, removing least priority element");
10661066

1067-
if let Some(lowest_priority_entry) = batch_state_lock.batch_queue.pop_min() {
1067+
if let Some(lowest_priority_entry) = batch_state_lock.batch_queue.pop() {
10681068
send_message(
10691069
lowest_priority_entry.0.messaging_sink.unwrap(),
10701070
SubmitProofResponseMessage::AddToBatchError,

batcher/aligned-batcher/src/types/batch_queue.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use aligned_sdk::{
66
},
77
};
88
use ethers::types::{Address, Signature, U256};
9-
use priority_queue::DoublePriorityQueue;
9+
use priority_queue::PriorityQueue;
1010
use std::{
1111
hash::{Hash, Hasher},
1212
ops::ControlFlow,
@@ -119,7 +119,7 @@ impl Ord for BatchQueueEntryPriority {
119119
}
120120
}
121121

122-
pub(crate) type BatchQueue = DoublePriorityQueue<BatchQueueEntry, BatchQueueEntryPriority>;
122+
pub(crate) type BatchQueue = PriorityQueue<BatchQueueEntry, BatchQueueEntryPriority>;
123123

124124
/// Calculates the size of the batch represented by the given batch queue.
125125
pub(crate) fn calculate_batch_size(batch_queue: &BatchQueue) -> Result<usize, BatcherError> {
@@ -165,7 +165,7 @@ pub(crate) fn try_build_batch(
165165
let mut finalized_batch = batch_queue;
166166
let mut batch_size = calculate_batch_size(&finalized_batch)?;
167167

168-
while let Some((entry, _)) = finalized_batch.peek_max() {
168+
while let Some((entry, _)) = finalized_batch.peek() {
169169
let batch_len = finalized_batch.len();
170170
let fee_per_proof = calculate_fee_per_proof(batch_len, gas_price, constant_gas_cost);
171171

@@ -186,7 +186,7 @@ pub(crate) fn try_build_batch(
186186
.len();
187187
batch_size -= verification_data_size;
188188

189-
finalized_batch.pop_max();
189+
finalized_batch.pop();
190190

191191
continue;
192192
}
@@ -201,7 +201,7 @@ pub(crate) fn try_build_batch(
201201
return Err(BatcherError::BatchCostTooHigh);
202202
}
203203

204-
Ok(finalized_batch.clone().into_descending_sorted_vec())
204+
Ok(finalized_batch.clone().into_sorted_vec())
205205
}
206206

207207
fn calculate_fee_per_proof(batch_len: usize, gas_price: U256, constant_gas_cost: u128) -> U256 {

0 commit comments

Comments
 (0)