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

Rpc: Add getStakeActivation endpoint#10902

Merged
CriesofCarrots merged 6 commits intosolana-labs:masterfrom
CriesofCarrots:stake-rpc
Jul 6, 2020
Merged

Rpc: Add getStakeActivation endpoint#10902
CriesofCarrots merged 6 commits intosolana-labs:masterfrom
CriesofCarrots:stake-rpc

Conversation

@CriesofCarrots
Copy link
Copy Markdown
Contributor

Problem

solana stake-account returns lots of useful information about stake activation/deactivation for the current epoch. But it's pretty hard to calculate this information if you're not using the solana cli.

Summary of Changes

  • Add getStakeActivation endpoint; it takes a stake account address (and optional past epoch and optional commitment) as input parameters and returns effective, activating, and deactivating stake amounts

Fixes #10885

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 3, 2020

Codecov Report

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

@@            Coverage Diff            @@
##           master   #10902     +/-   ##
=========================================
- Coverage    82.1%    82.0%   -0.1%     
=========================================
  Files         316      316             
  Lines       72000    72052     +52     
=========================================
- Hits        59130    59124      -6     
- Misses      12870    12928     +58     

Comment thread docs/src/apps/jsonrpc-api.md Outdated
Comment thread docs/src/apps/jsonrpc-api.md Outdated

#### Results:

The result will be a JSON object with the following fields:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment comes after my two "activating"/"deactivating" nits. I think a overall "state" field would be very useful. Right now the user needs to infer this based on the three fields.

What about something like:

  • state: <string> - the current state of the stake account: inactive, activating, active, deactivating (I don't love these state names but they're a start)
  • active: <u64> - amount of stake that is currently active
  • inactive: <u64> - amount of stake that is not active (eg, for a state account in the activating state, this will be the remaining stake that needs to warm up)

Copy link
Copy Markdown
Contributor Author

@CriesofCarrots CriesofCarrots Jul 3, 2020

Choose a reason for hiding this comment

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

Good idea. I suppose we could go to "warming up" and "cooling down" for state instead of activating/deactivating. Do those appeal any better?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mvines , updated. I stuck with activating/deactivating for now. Thoughts?

Copy link
Copy Markdown
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.

I like it!

@CriesofCarrots CriesofCarrots merged commit 4de0713 into solana-labs:master Jul 6, 2020
mergify Bot pushed a commit that referenced this pull request Jul 6, 2020
* Add getStakeActivation endpoint

* Add docs

* Update docs/src/apps/jsonrpc-api.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Rework return type

* Update docs

* Rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit 4de0713)
mergify Bot added a commit that referenced this pull request Jul 6, 2020
* Rpc: Add getStakeActivation endpoint (#10902)

* Add getStakeActivation endpoint

* Add docs

* Update docs/src/apps/jsonrpc-api.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Rework return type

* Update docs

* Rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit 4de0713)

* Fix build

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
mergify Bot pushed a commit that referenced this pull request Jul 23, 2020
* Add getStakeActivation endpoint

* Add docs

* Update docs/src/apps/jsonrpc-api.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Rework return type

* Update docs

* Rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit 4de0713)

# Conflicts:
#	core/src/rpc.rs
#	docs/src/apps/jsonrpc-api.md
CriesofCarrots added a commit that referenced this pull request Jul 23, 2020
* Rpc: Add getStakeActivation endpoint (#10902)

* Add getStakeActivation endpoint

* Add docs

* Update docs/src/apps/jsonrpc-api.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Rework return type

* Update docs

* Rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit 4de0713)

# Conflicts:
#	core/src/rpc.rs
#	docs/src/apps/jsonrpc-api.md

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
@CriesofCarrots CriesofCarrots deleted the stake-rpc branch July 24, 2020 22:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Rpc endpoint to return effective, activating, and deactivating stake

2 participants