Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split signature throughput tracking out of FeeCalculator #8447

Merged
merged 14 commits into from
Feb 28, 2020

Conversation

t-nelson
Copy link
Contributor

Problem

FeeCalculator does too much. While initially intended as a utility to calculate transaction fees, it has grown to also track cluster signature throughput for calculating the next block's FeeCalculator. This requires significantly more stored state, making it prohibitive to store a FeeCalculator on chain as required to resolve #7967.

Summary of Changes

Factor out signature throughput tracking to new FeeRateGovernor type
Replace FeeCalculator with FeeRateGovernor as appropriate
Expose recent FeeRateGovernor via RPC

Toward #7967

sdk/src/client.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 25, 2020

Codecov Report

Merging #8447 into master will decrease coverage by 0.1%.
The diff coverage is 75.1%.

@@           Coverage Diff            @@
##           master   #8447     +/-   ##
========================================
- Coverage    80.3%   80.1%   -0.2%     
========================================
  Files         256     256             
  Lines       56554   55279   -1275     
========================================
- Hits        45413   44297   -1116     
+ Misses      11141   10982    -159

sdk/src/fee_calculator.rs Outdated Show resolved Hide resolved
sdk/src/fee_calculator.rs Outdated Show resolved Hide resolved
@t-nelson t-nelson force-pushed the fee_calc_amputation branch 3 times, most recently from f6fb667 to 4c5f81a Compare February 27, 2020 16:49
@t-nelson
Copy link
Contributor Author

@mvines how are we looking here?

CriesofCarrots
CriesofCarrots previously approved these changes Feb 27, 2020
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, fwiw

Copy link
Member

@mvines mvines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the JSON RPC API docs too

client/src/rpc_request.rs Outdated Show resolved Hide resolved
core/src/rpc.rs Outdated Show resolved Hide resolved
sdk/src/fee_calculator.rs Show resolved Hide resolved
@mergify mergify bot dismissed CriesofCarrots’s stale review February 28, 2020 18:29

Pull request has been modified.

@t-nelson
Copy link
Contributor Author

@mvines last 4 should resolve the outstandings.

While updating the docs I was reminded that we have a usize in the FeeRateGovernor. I went ahead and kicked it out in preference of a u64 for portability's sake; fe63a19. I did leave a clamp to std::u32::MAX in place in the code, though it looks unnecessary now.

me.target_lamports_per_signature
* std::cmp::min(latest_signatures_per_slot, std::u32::MAX as u64)
as u64

mvines
mvines previously approved these changes Feb 28, 2020
Copy link
Member

@mvines mvines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just that one last comment

@mergify mergify bot dismissed mvines’s stale review February 28, 2020 19:24

Pull request has been modified.

@t-nelson t-nelson merged commit 90bedd7 into solana-labs:master Feb 28, 2020
@t-nelson t-nelson deleted the fee_calc_amputation branch February 28, 2020 20:27
@t-nelson t-nelson added the v1.0 label Mar 4, 2020
mergify bot pushed a commit that referenced this pull request Mar 4, 2020
* 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 f303562.

* 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

(cherry picked from commit 90bedd7)
danpaul000 pushed a commit to danpaul000/solana that referenced this pull request Jul 8, 2020
…bs#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 f303562.

* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Durable nonce transactions have an effectively unpredictable fee schedule
3 participants