Skip to content

Commit 388e41d

Browse files
author
smartprogrammer93
committed
add sharing percentage adjustment to base fee
1 parent f5a8051 commit 388e41d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/Nethermind/Nethermind.Taiko/Config/ISurgeConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ public interface ISurgeConfig : IConfig
3333

3434
[ConfigItem(Description = "The address of the TaikoInbox contract.", DefaultValue = "null")]
3535
string? TaikoInboxAddress { get; set; }
36+
37+
[ConfigItem(Description = "Percentage of the base fee that is shared with the L2 batch submitter.", DefaultValue = "75")]
38+
int SharingPercentage { get; set; }
3639
}

src/Nethermind/Nethermind.Taiko/Config/SurgeConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ public class SurgeConfig : ISurgeConfig
1414
public int FeeHistoryBlockCount { get; set; } = 200;
1515
public int L2GasUsageWindowSize { get; set; } = 20;
1616
public string? TaikoInboxAddress { get; set; }
17+
public int SharingPercentage { get; set; } = 75;
1718
}

src/Nethermind/Nethermind.Taiko/Rpc/SurgeGasPriceOracle.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ public override async ValueTask<UInt256> GetGasPriceEstimate()
9494

9595
UInt256 gasPriceEstimate = (minProposingCost + proofPostingCost + _surgeConfig.ProvingCostPerL2Batch) /
9696
Math.Max(averageGasUsage, _surgeConfig.L2GasPerL2Batch);
97-
_gasPriceEstimation.Set(headBlockHash, gasPriceEstimate);
97+
UInt256 adjustedGasPriceEstimate = gasPriceEstimate * 100 / (UInt256)_surgeConfig.SharingPercentage;
98+
_gasPriceEstimation.Set(headBlockHash, adjustedGasPriceEstimate);
9899

99-
if (_logger.IsTrace) _logger.Trace($"[{ClassName}] Calculated new gas price estimate: {gasPriceEstimate}, " +
100-
$"L1 Base Fee: {l1BaseFee}, L1 Blob Base Fee: {l1BlobBaseFee}, L1 Average Base Fee: {l1AverageBaseFee}, " +
101-
$"Average Gas Usage: {averageGasUsage}");
100+
if (_logger.IsTrace)
101+
{
102+
_logger.Trace($"[{ClassName}] Calculated new gas price estimate: {adjustedGasPriceEstimate}, " +
103+
$"L1 Base Fee: {l1BaseFee}, L1 Blob Base Fee: {l1BlobBaseFee}, L1 Average Base Fee: {l1AverageBaseFee}, " +
104+
$"Average Gas Usage: {averageGasUsage}, Adjusted with a sharing percentage of {_surgeConfig.SharingPercentage}");
105+
}
102106

103-
return gasPriceEstimate;
107+
return adjustedGasPriceEstimate;
104108
}
105109

106110
private async ValueTask<L1FeeHistoryResults?> GetL1FeeHistory()

0 commit comments

Comments
 (0)