feat: estimate gas premium from mempool#13534
Conversation
There was a problem hiding this comment.
Please update the PR title to match https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#pr-title-conventions
There was a problem hiding this comment.
Please update the PR title to match https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#pr-title-conventions
PR title now matches the required format.
1b5f33d to
95d5926
Compare
|
force pushed a rebase onto #13531 |
|
This simulation tool provides an intuitive evaluation of the FIP-0115 algorithm, and the chosen metrics effectively capture the trade-off between network resource utilization and user transaction costs. To further refine the evaluation, I suggest the following improvements: 1. Scenario Expansion: Simulating Traffic Downswings and VolatilityThe current simulations primarily focus on performance under static message pressure. I recommend introducing a dynamic traffic model to observe the algorithm’s behavior when message pressure suddenly drops (downswing) or fluctuates significantly.
2. Enhanced Metrics: Volatility and Cumulative ExpenditureI suggest adding the following two core metrics to the simulation output:
|
This is already measured, and is reflected as the percentage It seems to cap out around 57.5%, perhaps because of inherent TQ overlap. |
I apologize, my previous state was incorrect, and I have now corrected it. I think the Average Gas Price effectively reflects the actual amount of tokens users spend to get their messages included on-chain. |
This is a good idea. Can also track how much FIL was burned vs how much was paid to proposers. (assumes gaslimit = gasUsed) |
|
Additionally, some extreme scenarios may be taken into consideration, such as a surge of large messages (e.g., SettleDealPaymentsExported). To account for this, we could shift the mean simulated message gas limit from 10% to 75% of the block limit. |
7d71ea9 to
5e6e041
Compare
Kubuxu
left a comment
There was a problem hiding this comment.
Seems to me a bit overly complex, but just a bit. I'm glad we are not running an actual selection process to move forward an epoch, because that could be cost-prohibitive.
Have you tested the results on a live mainnet node for comparison with the old method?
I need a bit more time to think.
|
I noticed some irregularities in the results of |
I think the behavior is correct, but during the investigation I identified some ways to improve:
|
Of course, testing it in live is more of a smoke test to check if there are no unexpected factors. |
…remium-percentile mechanism Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Per a request from @magik6k I have collected some tx history data. Here it is: The current gas market simulation generates more midsized transactions, while the actual distribution has almost exclusively tiny transactions. I will change the incoming transaction modeling so that it matches this observed distribution. |
|
Next I am working on the requested "replay" simulation. In order for this to be fair I would need to record actual mempool arrivals. I'll set that up today and run it for at least 24 hours. |
…mary Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r count Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
It took longer to collect data than expected due to two disruptive major internet outages yesterday and the day before. I have a 24 hour period recorded now though so I'll be doing the replay analysis today. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Is this PR going to be merged before time for NV28 calibnet ( 2026-04-27 , according to upgrading plan) ? |
I haven't had time yet to work through the last few issues, but this doesn't block nv28. |
…hing go-ethereum behavior Assisted-by: Claude:claude-sonnet-4-6
I'm currently optimizing for this on a separate branch in order to avoid doing |
…remium estimation Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
…e funds Assisted-by: Claude:claude-sonnet-4-6
…evel Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
Assisted-by: Claude:claude-sonnet-4-6
…llsGap Assisted-by: Claude:claude-sonnet-4-6


Reviewer @rvagg
This premium recommendation change does not require FIP-0115 and can be released early.
I'm still running simulations to see if the system can be improved.
The gas market simulation covers:
Changes
Simulation
I built a tool for simulating the gas market.
Method
The simulation runs over a configurable number of epochs.
There are a configurable number of incoming transactions per epoch.
They have a distribution of possible gas limits and deadlines.
They query GasEstimateGasPremium and then GasEstimateFeeCap and then join the mempool.
The epoch concludes with tq-proposer message selection.
The metrics track how many transactions met their deadlines with a breakdown by block.
Results
I ran the simulation over 2000 epochs with a starting base fee of 1000.
Briefly, an explanation of the keys in the tables:
I also ran for gpe as high as 5 but it seems impossible to digest much faster than 2.8.
TQ proposals seem to have a maximum average digestion rate between 2.8 and 3.0 due to nearby TQs.
GasEstimateGasPremiumFromMempoolSimple (
BaseFee / 8 + noise)Tool option
--flat-premiumHistorical
Tool option
--legacy-premiumWith 100k premium floor (150k for nb2, 200k for nb1)