Skip to content
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

feat(v2): Add enum support to MultiOwnerLightAccount 1271 validation #42

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

adam-alchemy
Copy link
Contributor

Motivation

As described in #41 , not differentiating between contract owners and EOA owners could lead to incorrect gas estimation, and the looping checks also present a DOS vector.

This needs to also be fixed for 1271 signature validation.

Solution

Keep the existing implementation of the Solady ERC-1271 pattern, where the length and hash equivalence are used to determine whether the transparent EIP-712 pattern or the opaque signature are used.

However, within the internal implementation of _isValidSignature for MultiOwnerLightAccount, which uses the derived hash and trimmed signature, perform the enum split to determine whether to do EOA ECDSA validation, specified contract owner 1271 validation, or looping 1271 validation.

Also, since this approach avoids using the bitmap logic of the SignatureTypes enum, remove all unused enum types.

@adam-alchemy adam-alchemy requested a review from jaypaik March 15, 2024 19:40
Copy link
Collaborator

@jaypaik jaypaik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@jaypaik jaypaik merged commit d414af9 into develop Mar 16, 2024
2 checks passed
@jaypaik jaypaik deleted the adam/enum-1271-sig branch March 16, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants