-
Notifications
You must be signed in to change notification settings - Fork 252
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
Syscall: GetEpochStake
#889
Conversation
19be111
to
767e418
Compare
767e418
to
66d1534
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #889 +/- ##
=========================================
- Coverage 82.1% 82.1% -0.1%
=========================================
Files 880 881 +1
Lines 235644 235713 +69
=========================================
+ Hits 193662 193675 +13
- Misses 41982 42038 +56 |
@Lichtso @CriesofCarrots Hey guys, I wanted to flesh out some thoughts here and see what you thought. I figured I could mark this comment resolved if we decided to continue with the PR review. I've introduced this syscall's implementation in the First of all, @Lichtso has mentioned before that the Although the closure and the concept of such a runtime callback might appear strange to add to Firedancer also has their own implementation for such a feature set callback, and they've indicated that their implementation of SIMD 0133 (the implementation in this PR) would work similarly to what I've provided here. First question: Is a simple closure, with the ability to trivially change this in the future, acceptable for this implementation, or would you rather I attempt to evict Additionally, I wanted to make sure I evaluated the potential for us to move this into a sysvar in the future, in case the need ever arose for it. It appears to me that we could use a feature gate within the syscall itself to shift to the sysvar cache whenever the feature to activate the sysvar is activated. Afterward, the original callback can be removed from Second question: Mostly just wanted a sanity check on the above paragraph. |
It is conceptually feasible, but not nice. How about putting |
Yeah, this was what I was thinking, too if you guys didn't like the closure. I would lean into The weird bit here is that the rest of the object isn't really necessary right now. We just need that lookup. But a reference would be OK for that. The SVM callback becomes |
I would prefer putting the epoch-stake data source in
We definitely cannot clone the object into the vm.
I do see how the callback would make it slightly easier to transition to querying from a sysvar (which I assume would be something like |
Sounds good, I think I'll head in this direction, then.
Sounds good to me! Thank you guys! |
Thanks to both of you for the insight! Closing in favor of #1152. |
Problem
Currently, on-chain programs have no knowledge of the current epoch's stake and
how much active stake is delegated to a certain vote account.
If this data was available for querying by on-chain programs, it would unblock
many use cases, such as validator governance and secondary consensus mechanisms,
that were previously not possible on Solana.
Additionally, this would enable the Feature Gate program defined in
SIMD 0089 to tally vote account stake in
support for a pending feature gate.
Summary of Changes
Introduce a new callback function to the SVM to retrieve the delegated active
stake for a vote account.
Add that callback to the program-runtime's
InvokeContext
.Introduce a new syscall -
SyscallGetEpochStake
- that will use this callbackto retrieve the vote account's stake.
SIMD 0133
Feature Gate Tracking Issue: #884