-
Notifications
You must be signed in to change notification settings - Fork 181
feat(stdlib): add ecrecover()
and normalizeECDSARecoveryId()
functions
#2774
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
base: main
Are you sure you want to change the base?
Conversation
Do we want tests for this? :) |
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.
Tests needed :)
@@ -180,6 +180,56 @@ sha256(someVariableElsewhere); // will try to resolve at compile-time, | |||
|
|||
::: | |||
|
|||
## normalizeECDSARecoveryId |
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.
Abbreviations in camelcase must be capitalized as regular words, i.e. normalizeEcdsaRecoveryId
/// | ||
/// Note: This function uses the TVM `ECRECOVER` instruction and therefore requires `v` to | ||
/// be already normalized with [`normalizeECDSARecoveryId()`](#normalizeecdsarecoveryid). | ||
asm fun ecrecover(hash: Int, v: Int, r: Int, s: Int): EcrecoverKey? { |
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 shouldn't name functions in standard library after assembly instructions. ECRECOVER
is a misnomer, as we're not recovering elliptic cryptography with it.
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.
There's a builtin ecrecover()
function in Solidity, and people know that ecrecover
and reference it elsewhere.
But I agree that we might need to change the name since ECRECOVER on TON does a slightly different thing
Issue
Closes #2733.
Checklist
docs/
and made the build locally