Skip to content

Commit 9adf0c3

Browse files
authored
fix(builder): add a buffer to the max bundle fee limit in bundle proposer (alchemyplatform#1112)
1 parent f7cf508 commit 9adf0c3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/builder/src/bundle_proposer.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,11 @@ where
610610
)>,
611611
mut balances_by_paymaster: HashMap<Address, U256>,
612612
) -> ProposalContext<<Self as BundleProposer>::UO> {
613+
if max_bundle_fee == U256::ZERO {
614+
return ProposalContext::<<Self as BundleProposer>::UO>::new();
615+
}
616+
let buffered_max_bundle_fee = max_bundle_fee * U256::from(90) / U256::from(100);
617+
613618
let all_sender_addresses: HashSet<Address> = ops_with_simulations
614619
.iter()
615620
.map(|(op, _)| op.op.uo.sender())
@@ -710,7 +715,7 @@ where
710715
let op_total_gas_limit = op.gas_limit(&self.settings.chain_spec, None);
711716
let total_gas_cost = U256::from(total_gas_spent.saturating_add(op_total_gas_limit))
712717
* U256::from(gas_price);
713-
if total_gas_cost > max_bundle_fee {
718+
if total_gas_cost > buffered_max_bundle_fee {
714719
self.emit(BuilderEvent::skipped_op(
715720
self.builder_tag.clone(),
716721
op.hash(),

0 commit comments

Comments
 (0)