Feature Gated: remove obsoleted FeeRateGovernor from fee calculation #5749
+84
−104
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.
Problem
Understanding
lamports_per_signature
in blockhash_queueThe
lamports_per_signature
value stored inblockhash_queue
(and also in nonce accounts) is not used for transaction fee calculation. Instead, transaction fees are determined bybank.fee_structure.lamport_per_signature
, which is a constant5_000
.The primary function of
lamports_per_signature
in theblockhash_queue
is to enable thezero_fees_for_test
mode—this happens when its value is set to zero.In tests, "zero-fee" mode is expressed by setting target_lamports_per_signature = 0 in
genesis_config
(reference).Current Behavior of
fee_rate_governor
inBank
wrt blockhash_queueThe bank currently uses
fee_rate_governor
to adjustlamports_per_signature
dynamically for each block based on cluster throughput. This adjustment stays within 50% to 1000% of target_lamports_per_signature.A key property of fee_rate_governor's adjustment is:
target_lamports_per_signature
is zero, then all future banks will havelamports_per_signature = 0
.Tests rely on this behavior to ensure zero transaction fees in specific scenarios.
Proposed Change
The current logic of deriving
fee_rate_governor
from the parent bank and storing it with blockhash to determine iflamports_per_signature == 0
is unnecessary. Instead, we can:target_lamports_per_signature
from genesis_config in the blockhash, when creating genesis bank;lamports_per_signature
from the parent bank when deriving a new bank.This preserves the existing behavior while simplifying fee tracking and allowing the eventual removal of
fee_rate_governor
(#3303).Feature gated
Changing what's stored into
RecentBlockHash
account changes account-delta-hash, which is part of BankHash for now. #5454 describes a testnet occurrence when divergence happened. So it is necessary to feature gate this change.Summary of Changes
lamports_per_signature
in blockhash_queue and nonce_account is not used for fee calculation but only for determining zero_fees_for_test mode (lamports_per_signature == 0).target_lamports_per_signature
in the blockhash.Fixes #5782