Skip to content

Commit a029194

Browse files
committed
fix: min bump calculation
1 parent 6568098 commit a029194

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

crates/batcher/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,8 @@ impl Batcher {
10111011
// TODO: move this to a config file
10121012
let original_max_fee = entry.nonced_verification_data.max_fee;
10131013
let bump_factor_percentage = 10;
1014-
let min_bump = original_max_fee * U256::from(bump_factor_percentage) / U256::from(100);
1014+
let min_bump = original_max_fee
1015+
+ (original_max_fee * U256::from(bump_factor_percentage)) / U256::from(100);
10151016
if replacement_max_fee < min_bump {
10161017
std::mem::drop(batch_state_lock);
10171018
warn!("Invalid replacement message for address {addr}, had max fee: {original_max_fee:?}, received fee: {replacement_max_fee:?}");

crates/sdk/src/communication/messaging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ async fn handle_batcher_response(msg: Message) -> Result<BatchInclusionData, Sub
267267
}
268268
Ok(SubmitProofResponseMessage::UnderpricedProof) => {
269269
error!("Batcher responded with error: proof underpriced. Funds have not been spent.");
270-
Err(SubmitError::BatchQueueLimitExceededError)
270+
Err(SubmitError::InvalidMaxFee)
271271
}
272272
Err(e) => {
273273
error!(

crates/sdk/src/verification_layer/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,8 @@ pub fn compute_fee_per_proof_formula(num_proofs_in_batch: usize, gas_price: U256
202202
+ ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF * num_proofs_in_batch as u128)
203203
/ num_proofs_in_batch as u128;
204204

205-
let fee_per_proof = (U256::from(estimated_gas_per_proof)
206-
* gas_price
207-
* U256::from(GAS_PRICE_PERCENTAGE_MULTIPLIER))
208-
/ U256::from(PERCENTAGE_DIVIDER);
209-
210-
fee_per_proof
205+
(U256::from(estimated_gas_per_proof) * gas_price * U256::from(GAS_PRICE_PERCENTAGE_MULTIPLIER))
206+
/ U256::from(PERCENTAGE_DIVIDER)
211207
}
212208

213209
async fn fetch_gas_price(

0 commit comments

Comments
 (0)