Split signature throughput tracking out of FeeCalculator (#8447)

* SDK: Split new `FeeRateGovernor` out of `FeeCalculator`

Leaving `FeeCalculator` to *only* calculate transaction fees

* Replace `FeeCalculator` with `FeeRateGovernor` as appropriate

* Expose recent `FeeRateGovernor` to clients

* Move `burn()` back into `FeeCalculator`

Appease BPF tests

* Revert "Move `burn()` back into `FeeCalculator`"

This reverts commit f3035624307196722b62ff8b74c12cfcc13b1941.

* Adjust BPF `Fee` sysvar test to reflect removal of `burn()` from `FeeCalculator`

* Make `FeeRateGovernor`'s `lamports_per_signature` private

* rebase artifacts

* fmt

* Drop 'Recent'

* Drop _with_commitment variant

* Use a more portable integer for `target_signatures_per_slot`

* Add docs for `getReeRateCalculator` JSON RPC method

* Don't return `lamports_per_signature` in `getFeeRateGovernor` JSONRPC reply
This commit is contained in:
Trent Nelson
2020-02-28 13:27:01 -07:00
committed by GitHub
parent 7d27be2a73
commit 90bedd7e06
22 changed files with 298 additions and 118 deletions

View File

@@ -4,7 +4,7 @@ use crate::{
account::Account,
clock::{UnixTimestamp, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT},
epoch_schedule::EpochSchedule,
fee_calculator::FeeCalculator,
fee_calculator::FeeRateGovernor,
hash::{hash, Hash},
inflation::Inflation,
native_token::lamports_to_sol,
@@ -49,7 +49,7 @@ pub struct GenesisConfig {
/// network speed configuration
pub poh_config: PohConfig,
/// transaction fee config
pub fee_calculator: FeeCalculator,
pub fee_rate_governor: FeeRateGovernor,
/// rent config
pub rent: Rent,
/// inflation config
@@ -89,7 +89,7 @@ impl Default for GenesisConfig {
slots_per_segment: DEFAULT_SLOTS_PER_SEGMENT,
poh_config: PohConfig::default(),
inflation: Inflation::default(),
fee_calculator: FeeCalculator::default(),
fee_rate_governor: FeeRateGovernor::default(),
rent: Rent::default(),
epoch_schedule: EpochSchedule::default(),
operating_mode: OperatingMode::Development,
@@ -182,17 +182,17 @@ impl fmt::Display for GenesisConfig {
write!(
f,
"\
Creation time: {}\n\
Operating mode: {:?}\n\
Genesis hash: {}\n\
Shred version: {}\n\
Hashes per tick: {:?}\n\
Slots per epoch: {}\n\
Warmup epochs: {}abled\n\
{:?}\n\
{:?}\n\
Capitalization: {} SOL in {} accounts\n\
",
Creation time: {}\n\
Operating mode: {:?}\n\
Genesis hash: {}\n\
Shred version: {}\n\
Hashes per tick: {:?}\n\
Slots per epoch: {}\n\
Warmup epochs: {}abled\n\
{:?}\n\
{:?}\n\
Capitalization: {} SOL in {} accounts\n\
",
Utc.timestamp(self.creation_time, 0).to_rfc3339(),
self.operating_mode,
self.hash(),
@@ -205,7 +205,7 @@ impl fmt::Display for GenesisConfig {
"dis"
},
self.rent,
self.fee_calculator,
self.fee_rate_governor,
lamports_to_sol(
self.accounts
.iter()