Skip to content

Commit

Permalink
Coordinator - Fixed sample transaction calculator. It's taking bounde…
Browse files Browse the repository at this point in the history
…d variable cost instead of pre-bound cost to calculate gas price. This fixes disparity of eth_gasPrcie and linea_estimateGas disparity when L1 cost is too high or too low (#81)
  • Loading branch information
Filter94 authored Sep 23, 2024
1 parent 7a46988 commit 08584a8
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ class L2NetworkGasPricingService(
config.feeHistoryFetcherConfig
)

private val variableCostCalculator = VariableFeesCalculator(
config.variableFeesCalculatorConfig
)
private val boundedVariableCostCalculator = run {
val variableCostCalculator = VariableFeesCalculator(
config.variableFeesCalculatorConfig
)
BoundableFeeCalculator(
config = config.variableFeesCalculatorBounds,
feesCalculator = variableCostCalculator
)
}

private val legacyGasPricingCalculator: FeesCalculator = run {
val baseCalculator = if (config.legacy.transactionCostCalculatorConfig != null) {
TransactionCostCalculator(variableCostCalculator, config.legacy.transactionCostCalculatorConfig)
TransactionCostCalculator(boundedVariableCostCalculator, config.legacy.transactionCostCalculatorConfig)
} else {
GasUsageRatioWeightedAverageFeesCalculator(
config.legacy.naiveGasPricingCalculatorConfig!!
Expand Down Expand Up @@ -94,10 +100,6 @@ class L2NetworkGasPricingService(
}

private val extraDataPricerService: ExtraDataV1PricerService? = if (config.extraDataPricingPropagationEnabled) {
val boundedVariableCostCalculator = BoundableFeeCalculator(
config = config.variableFeesCalculatorBounds,
feesCalculator = variableCostCalculator
)
ExtraDataV1PricerService(
pollingInterval = config.extraDataUpdateInterval,
vertx = vertx,
Expand Down

0 comments on commit 08584a8

Please sign in to comment.