-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat: move precompile verification to SVM #2441
feat: move precompile verification to SVM #2441
Conversation
4eeb6f6
to
2ffc4bf
Compare
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.
Change makes sense to me. Users should still be able to verify that precompiles are valid through the interfaces, though they may need to change how they are doing it. THat should be communicated before feature-gate activation.
let instruction_datas: Vec<_> = message_instruction_datas_iter.collect(); | ||
precompile | ||
.verify(precompile_instruction_data, &instruction_datas, feature_set) | ||
.map_err(InstructionError::from) |
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.
The new primitive traits are needed to convert to/from InstructionError::Custom
and the ToPrimitive
trait is specifically used here.
See this implementation for details:
impl<T> From<T> for InstructionError
where
T: ToPrimitive,
@Lichtso could you please check the message processor and invoke context changes? |
Instead of using |
No I think it's more appropriate to use custom errors here because these errors aren't general, they are program specific. Can you explain why adding new instruction error variants would make more sense? |
I might have missed it, but the changes in errors are not mentioned in the features SIMD, or are they? |
No they are not but they probably should, thanks for bringing that up. There really isn't a good precedent for precompile error handling since we generally disregard any errors for dropped transactions. Currently we map precompile errors to I will update the SIMD with details about the errors and have them mapped to |
assert_matches!( | ||
client.process_transaction(transaction).await, | ||
Err(BanksClientError::TransactionError( | ||
TransactionError::InvalidAccountIndex | ||
TransactionError::InstructionError(0, InstructionError::Custom(3)) | ||
)) | ||
); | ||
// this assert is for documenting the matched error code above |
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.
@jstarry sorry I missed your last comment.
We should still have a test when the feature is disabled.
Is that tested somewhere else that I am missing?
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.
Sorry no it's not, I added an extra test for that here: 1084cfa
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.
perfect
think we ought to push on the SIMD as well, but may not have luck merging until after breakpoint |
Problem
Transactions with precompile signatures that fail verification are currently not allowed to be committed to a block. After solana-foundation/solana-improvement-documents#159 they will be allowed to be committed so that block producers always get paid fees when verifying precompile signatures.
Summary of Changes
Fixes #