Skip to content

Commit 8ccdfc9

Browse files
apollo_consensus_orchestrator: add fee_actual floor to EIP-1559 gas price calculation
1 parent f876e52 commit 8ccdfc9

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
@@ -69,6 +69,7 @@ pub fn calculate_next_l2_gas_price_for_fin(
6969
l2_gas_used: GasAmount,
7070
override_l2_gas_price_fri: Option<u128>,
7171
min_l2_gas_price_per_height: &[PricePerHeight],
72+
fee_actual: Option<GasPrice>,
7273
) -> GasPrice {
7374
if let Some(override_value) = override_l2_gas_price_fri {
7475
info!(
@@ -78,8 +79,12 @@ pub fn calculate_next_l2_gas_price_for_fin(
7879
return GasPrice(override_value);
7980
}
8081
let gas_target = VersionedConstants::latest_constants().gas_target;
81-
let min_gas_price = get_min_gas_price_for_height(height, min_l2_gas_price_per_height);
82-
calculate_next_base_gas_price(current_l2_gas_price, l2_gas_used, gas_target, min_gas_price)
82+
let config_min = get_min_gas_price_for_height(height, min_l2_gas_price_per_height);
83+
let effective_min = match fee_actual {
84+
Some(fa) => GasPrice(max(config_min.0, fa.0)),
85+
None => config_min,
86+
};
87+
calculate_next_base_gas_price(current_l2_gas_price, l2_gas_used, gas_target, effective_min)
8388
}
8489

8590
/// 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
@@ -371,6 +371,7 @@ impl SequencerConsensusContext {
371371
l2_gas_used,
372372
self.config.dynamic_config.override_l2_gas_price_fri,
373373
&self.config.dynamic_config.min_l2_gas_price_per_height,
374+
None,
374375
)
375376
}
376377

0 commit comments

Comments
 (0)