-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add keccak-secp256k1 instruction #11839
Conversation
c698d47
to
eb3ea51
Compare
Codecov Report
@@ Coverage Diff @@
## master #11839 +/- ##
========================================
Coverage 82.0% 82.0%
========================================
Files 338 341 +3
Lines 79640 79890 +250
========================================
+ Hits 65342 65579 +237
- Misses 14298 14311 +13 |
9a65d24
to
a9f586f
Compare
I'm not finalized on the construction of the account data, but is this how you were thinking @jackcmay |
f8e977a
to
1b2563c
Compare
Looking good so far |
2942daf
to
bfa9359
Compare
return Err(TransactionError::AccountNotFound); | ||
} | ||
let program_id = &self.message().account_keys[instruction.program_id_index as usize]; | ||
if crate::secp256k1_program::check_id(program_id) { |
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.
We will probably have more of these, could generalize the verify structure to accommodate additions in the future
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 didn't find a way to do like a match Pubkey, so I think I'll punt on this for now, although it does seem worthwhile to have some kind of framework here. I might be the one adding the next one anyway...
Is the BPF program usage of these results coming in a followup PR? |
Well, the BPF program will use the instruction introspection part that I'm working on to then inspect the transaction and see that the correct instructions are there to do the secp verify. I split that into this PR: #11943 Seemed easier to do them separately so not as much complexity at once. |
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.
Mostly nits here. It'd be great to find something cleaner for the FeeCalculator
changes, it can wait if we're crunched though
26ea2ef
to
0278454
Compare
Verifies eth addreses with ecrecover function
* Implement keccak-secp256k1 instruction Verifies eth addreses with ecrecover function * Move secp256k1 test (cherry picked from commit 3930cb8) # Conflicts: # Cargo.lock # runtime/Cargo.toml
* Implement keccak-secp256k1 instruction Verifies eth addreses with ecrecover function * Move secp256k1 test
|
||
// Parse out signature | ||
let signature_index = offsets.signature_instruction_index as usize; | ||
if signature_index > instruction_datas.len() { |
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.
😭 #13014
Problem
Performing keccak+secp256k1 signature check on solana would require too many bpf instructions.
Summary of Changes
Add builtin instruction that performs a hash+sigverify on the instruction data.
Fixes #