mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 20:27:58 -05:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user