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
Fetch sysvars from invoke context for vote program #22444
Conversation
1e0c602
to
9f977d0
Compare
9f977d0
to
ee552f5
Compare
Codecov Report
@@ Coverage Diff @@
## master #22444 +/- ##
=========================================
- Coverage 81.1% 81.1% -0.1%
=========================================
Files 555 553 -2
Lines 150563 150503 -60
=========================================
- Hits 122198 122112 -86
- Misses 28365 28391 +26 |
pub fn from_keyed_account<S: Sysvar>( | ||
keyed_account: &crate::keyed_account::KeyedAccount, | ||
) -> Result<S, InstructionError> { | ||
pub fn check_sysvar_keyed_account<'a, S: Sysvar>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be inlined at its only two use sites?
Because otherwise this will be one more public interface that needs to be removed again,
when KeyedAccounts
in general are removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any problem with removing it then. I'd like to reuse the code here because consensus depends on the checks being the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought you wanted to share it for the error messages to stay the same. However, you also intend to replace one of the call sites by the sysvar cache right? So, that would remove the potential error case there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR already changes the call site to use the sysvar cache, I'm not sure what you mean
Pull request has been modified.
(cherry picked from commit b211f83) # Conflicts: # programs/vote/src/vote_instruction.rs
(cherry picked from commit b211f83) # Conflicts: # programs/vote/src/vote_instruction.rs
Problem
Vote program cannot take advantage of optimizations in the sysvar cache because it loads sysvars from keyed accounts
Summary of Changes
Transition to fetching sysvars from the invoke context without breaking consensus
Fixes #