refactor: replace require strings with custom errors - #141
Open
pplmaverick wants to merge 1 commit into
Open
Conversation
pplmaverick
requested review from
0xrusowsky,
grandizzy and
onbjerg
as code owners
August 25, 2026 09:44
onbjerg
requested changes
Aug 25, 2026
| function webAuthnMessageHash(bytes memory webauthnData) internal pure returns (bytes32) { | ||
| // First 37 bytes are authenticatorData (no extensions, since the precompile rejects ED). | ||
| require(webauthnData.length >= 37, "SignatureLib: webauthnData too short"); | ||
| if (webauthnData.length < 37) revert WebAuthnDataTooShort(); |
Member
There was a problem hiding this comment.
we can still use require and just pass the custom error as the 2nd arg
Author
|
Thanks for the suggestion! I considered using Happy to switch if you'd like to bump the minimum version, otherwise I'll keep |
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.
Summary
Replace 4 legacy
require(string)statements with custom errors to alignwith the existing convention used throughout
src/interfaces/.Changes
src/sig/SignatureLib.solrequire→ custom errorsrc/tx/Eip7702TransactionLib.solrequire→ custom errorsrc/tx/Eip1559TransactionLib.solrequire→ custom errorsrc/tx/TempoTransactionLib.solrequire→ custom errorMotivation
src/interfaces/already uses custom errors exclusivelyTesting
forge build✅forge fmt --check✅forge test✅ (3 existing tests, no regressions)