-
Notifications
You must be signed in to change notification settings - Fork 220
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 ecrecover() builtin for EVM #1543
Conversation
Is there a test for this change? |
ab69f8f
to
252848f
Compare
Now there is 😊 |
@@ -2186,6 +2186,56 @@ fn expr_builtin( | |||
expr: Box::new(codegen_expr), | |||
} | |||
} | |||
ast::Builtin::ECRecover => { |
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.
Is it possible to use Instr::Unimplemented
here?
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.
Why Instr::Unimplemented
preferable over an actual implementation?
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.
My reasoning is that as you cannot test this portion of code, we could better just use Instr::Unimplemented
as we did so for other Ethereum builtins. This would not diminish our test coverage numbers.
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.
Which test coverage numbers?
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, yolo in code in which we can't test isn't a good practice
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.
ok, I've been outvoted, it's gone
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 mean it could also be commented out, saying that this is how we think it should be implemented, but it's commented out and an Unreachable
instead until we can test 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.
Good idea. I've added the code I wrote as a comment
src/sema/ast.rs
Outdated
@@ -1658,6 +1658,8 @@ pub enum Builtin { | |||
Accounts, | |||
UserTypeWrap, | |||
UserTypeUnwrap, | |||
/// EVM only, not implemented yet. This is useful for anyone using Solang to create an AST for EVM contracts |
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 contracts pallet provides ecdsa recovery
@@ -2186,6 +2186,56 @@ fn expr_builtin( | |||
expr: Box::new(codegen_expr), | |||
} | |||
} | |||
ast::Builtin::ECRecover => { |
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, yolo in code in which we can't test isn't a good practice
90ce9d2
to
488126d
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.
LGTM. Gonna implement it for Polakdot soon, thanks!
Fixes hyperledger-solang#1536 Signed-off-by: Sean Young <[email protected]>
488126d
to
aa476a4
Compare
Fixes #1536