Rewrite sha256/ripemd160/ecrecover without assembly and add Error#470
Open
axic wants to merge 4 commits into
Open
Rewrite sha256/ripemd160/ecrecover without assembly and add Error#470axic wants to merge 4 commits into
Error#470axic wants to merge 4 commits into
Conversation
axic
commented
Jun 16, 2026
Comment on lines
+2189
to
+2190
| let ret = staticcall(gas(), 2, ptr, len, 0, 32); | ||
| require(ret != 0, Error(0x68c071bb)); // SHA256CallFailed() |
Contributor
Author
There was a problem hiding this comment.
Now it would be nice having gas comparison tests, as I do wonder what is the overhead of require. Ideally nothing.
Add a recoverFail() case that passes an invalid r = 0 signature component. The ecrecover precompile succeeds but recovers nothing, returning empty output, so ecrecover() yields 0 and the std helper reverts with ECRecoverFailed() (0x4fbfae63). v and s are kept well-formed so the malleability and call-failed guards don't fire. Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.