Skip to content

Commit 3d326ec

Browse files
apollo_consensus_orchestrator: add fee_actual floor to EIP-1559 gas price calculation
1 parent b4f929d commit 3d326ec

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

crates/apollo_consensus_orchestrator/src/build_proposal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ async fn get_proposal_content(
319319
info.l2_gas_used,
320320
args.override_l2_gas_price_fri,
321321
&args.min_l2_gas_price_per_height,
322+
None,
322323
);
323324
let fin_payload = ProposalFinPayload {
324325
commitment_parts: CommitmentParts::from(&info),

crates/apollo_consensus_orchestrator/src/fee_market/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ pub fn calculate_next_l2_gas_price_for_fin(
5858
l2_gas_used: GasAmount,
5959
override_l2_gas_price_fri: Option<u128>,
6060
min_l2_gas_price_per_height: &[PricePerHeight],
61+
fee_actual: Option<GasPrice>,
6162
) -> GasPrice {
6263
if let Some(override_value) = override_l2_gas_price_fri {
6364
info!(
@@ -67,8 +68,12 @@ pub fn calculate_next_l2_gas_price_for_fin(
6768
return GasPrice(override_value);
6869
}
6970
let gas_target = VersionedConstants::latest_constants().gas_target;
70-
let min_gas_price = get_min_gas_price_for_height(height, min_l2_gas_price_per_height);
71-
calculate_next_base_gas_price(current_l2_gas_price, l2_gas_used, gas_target, min_gas_price)
71+
let config_min = get_min_gas_price_for_height(height, min_l2_gas_price_per_height);
72+
let effective_min = match fee_actual {
73+
Some(fa) => GasPrice(max(config_min.0, fa.0)),
74+
None => config_min,
75+
};
76+
calculate_next_base_gas_price(current_l2_gas_price, l2_gas_used, gas_target, effective_min)
7277
}
7378

7479
/// Calculate the base gas price for the next block according to EIP-1559.

crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ impl SequencerConsensusContext {
377377
l2_gas_used,
378378
self.config.dynamic_config.override_l2_gas_price_fri,
379379
&self.config.dynamic_config.min_l2_gas_price_per_height,
380+
None,
380381
)
381382
}
382383

0 commit comments

Comments
 (0)