Coordinator - Fixed sample transaction calculator. It's taking bounded 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)

This commit is contained in:
Roman Vaseev
2024-09-23 19:07:06 +02:00
committed by GitHub
parent 7a46988e6c
commit 08584a89f1

View File

@@ -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!!
@@ -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,