Eval: Move congestion monitoring and fee escalation on-chain #6400
+2,570
−2,127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, congestion is monitored locally, by each
algod
and is not a part of consensus. So while individualalgod
s may require higher fees, transactions processing is unaware of that requirement. Therefore, the extra fee can end up being "double spent" to execute inner transactions. This PR introduces two header fields,Load
which indicates how full a particular block is, andBaseFee
which grows when theLoad
exceeds 50% and returns towardMinFee
with less full blocks.The PR is currently draft and not expected in the next consensus release.
If added as is, we can expect some community dissatisfaction. Today, congestion almost never kicks in, and even when it does, it most affects new transactions that someone tries to add the network. They get rejected by their local algod. But in this model, fees would rise (just a little) the first time we have block that's at least half full. When it does, approximately all of the existing transactions will get dropped, because when they are re-evaluated, they will not have the larger fee needed in the next block.
Two possible solutions: 1) Some how delay the congestion rise, so it still "approximately never happens". 2) Implement "refund semantics" so that transactions can include higher fees, but they won't all be taken if they aren't used.
Summary
Test Plan