Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Improve Rpc inflation tooling #10309

Merged

Conversation

CriesofCarrots
Copy link
Contributor

Problem

The getInflation endpoint returns essentially an inflation governor, not any information about current inflation rates. This forces user to re-implement the same calculator methods that we have in the sdk/inflation module.

Summary of Changes

  • Add getInflationGovernor endpoint that returns the inflation governor data
  • Add getInflationRate endpoint that calculates the current inflation for an epoch (default, current epoch)
  • Also removes all references to storage from the inflation module. If this is too heavy-handed, rolling back the last commit will just set the storage inflation percentage to 0.0.

Fixes #10094
Fixes #10092

@CriesofCarrots CriesofCarrots requested a review from mvines May 29, 2020 02:22
@CriesofCarrots CriesofCarrots force-pushed the rpc-improve-inflation branch 3 times, most recently from bff1ec1 to 05f54e6 Compare May 29, 2020 02:40
@CriesofCarrots CriesofCarrots marked this pull request as draft May 29, 2020 03:07
@CriesofCarrots CriesofCarrots removed the request for review from mvines May 29, 2020 03:07
@CriesofCarrots CriesofCarrots force-pushed the rpc-improve-inflation branch from 05f54e6 to 1890bb6 Compare May 29, 2020 03:15
@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #10309 into master will decrease coverage by 0.0%.
The diff coverage is 77.0%.

@@            Coverage Diff            @@
##           master   #10309     +/-   ##
=========================================
- Coverage    81.3%    81.3%   -0.1%     
=========================================
  Files         288      288             
  Lines       66906    66982     +76     
=========================================
+ Hits        54433    54489     +56     
- Misses      12473    12493     +20     

sdk/src/inflation.rs Outdated Show resolved Hide resolved
@CriesofCarrots CriesofCarrots force-pushed the rpc-improve-inflation branch from 1890bb6 to d8ca31e Compare May 29, 2020 16:21
@CriesofCarrots CriesofCarrots marked this pull request as ready for review May 29, 2020 16:58
mvines
mvines previously approved these changes May 29, 2020
Copy link
Contributor

@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.

Thanks, looks good. Let's backport to v1.2 and v1.1 for RPC consistency, this is super low risk

@@ -635,33 +636,59 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "m
{"jsonrpc":"2.0","result":{"identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN"},"id":1}
```

### getInflation
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please mark getInflation as deprecated in core/src/rpc.rs too, so future readers know why that endpoint is no longer documented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, this pr removes the getInflation endpoint entirely. My thinking was that there are unlikely to be downstream users, since no inflation on mainnet-beta, and only very new to testnet.
Should I restore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I totally missed that in the diff. Yanking it seems fine, I agree

@CriesofCarrots CriesofCarrots force-pushed the rpc-improve-inflation branch from d8ca31e to e526bba Compare May 29, 2020 17:21
@mergify mergify bot dismissed mvines’s stale review May 29, 2020 17:22

Pull request has been modified.

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label May 29, 2020
@solana-grimes solana-grimes merged commit b563b49 into solana-labs:master May 29, 2020
mergify bot pushed a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)

# Conflicts:
#	core/Cargo.toml
#	core/src/rpc.rs
#	genesis-programs/src/lib.rs
#	runtime/src/bank.rs
mergify bot pushed a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)

# Conflicts:
#	core/Cargo.toml
#	runtime/src/bank.rs
CriesofCarrots added a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)
CriesofCarrots added a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)
CriesofCarrots added a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)
CriesofCarrots added a commit that referenced this pull request May 29, 2020
automerge

(cherry picked from commit b563b49)
solana-grimes pushed a commit that referenced this pull request May 29, 2020
solana-grimes pushed a commit that referenced this pull request May 30, 2020
@CriesofCarrots CriesofCarrots deleted the rpc-improve-inflation branch July 1, 2020 00:19
danpaul000 pushed a commit to danpaul000/solana that referenced this pull request Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
3 participants