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

getInflation RPC endpoint is less useful than it could be #10094

Closed
mvines opened this issue May 17, 2020 · 0 comments · Fixed by #10309
Closed

getInflation RPC endpoint is less useful than it could be #10094

mvines opened this issue May 17, 2020 · 0 comments · Fixed by #10309
Milestone

Comments

@mvines
Copy link
Member

mvines commented May 17, 2020

The getInflation RPC endpoint blindly returns:

pub struct Inflation {
/// Initial inflation percentage, from time=0
pub initial: f64,
/// Terminal inflation percentage, to time=INF
pub terminal: f64,
/// Rate per year, at which inflation is lowered until reaching terminal
/// i.e. inflation(year) == MAX(terminal, initial*((1-taper)^year))
pub taper: f64,
/// Percentage of total inflation allocated to the foundation
pub foundation: f64,
/// Duration of foundation pool inflation, in years
pub foundation_term: f64,
/// Percentage of total inflation allocated to storage rewards
pub storage: f64,
}

thus forcing the client to implement methods like:
pub fn validator(&self, year: f64) -> f64 {
self.total(year) - self.storage(year) - self.foundation(year)
}

Suggestion:

  1. Obsolete the getInflation endpoint
  2. Add a getInflationGovernor endpoint(like https://docs.solana.com/apps/jsonrpc-api#getfeerategovernor) that returns the current getInflation data (minus the .storage field, cc: Deal with misleading storage rewards in Inflation struct #10092)
  3. Add getInflationRate endpoint that returns the actual rate of inflation (total/validator/foundation) for the given epoch (or the current epoch if unspecified)
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 a pull request may close this issue.

1 participant