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

refactor signatureValidator #295

Merged
merged 6 commits into from
Sep 13, 2023
Merged

Conversation

charlesjhongc
Copy link
Contributor

No description provided.

// may lead the caller to incorrectly believe that the
// signature was invalid.)
revert("SignatureValidator#isValidSignature: unsupported signature");
revert("SignatureValidator#isValidSignature: illegal signature");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can skip or replace SignatureValidator#isValidSignature?

Copy link
Contributor

Choose a reason for hiding this comment

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

@charlesjhongc Should the prefix be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 472d85b

contracts/utils/SignatureValidator.sol Outdated Show resolved Hide resolved
// that we currently support. In this case returning false
// may lead the caller to incorrectly believe that the
// signature was invalid.)
revert("SignatureValidator: unsupported signature");
Copy link
Contributor

Choose a reason for hiding this comment

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

This will never be reached because we check signatureTypeRaw <= uint8(SignatureType.ZX1271)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SignatureType .Invalid will reach here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe can remove SignatureType.Illegal case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since Illegal also serves the purpose of representing the default value of enum type, maybe we can remove Invalid instead? (This final revert is implicitly the case for Invalid anyway.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal is not changing the enum order. But if you're talking about if (signatureType == SignatureType.Illegal) case, yeah I was thinking about removing this.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I was thinking about removing this.

Yeah that would make sense. Though I'm still not fully understand the difference between Illegal and Invalid.🧐

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After discussion, fixed in 472d85b

@charlesjhongc charlesjhongc merged commit d33d22d into v5 Sep 13, 2023
1 check passed
@charlesjhongc charlesjhongc deleted the v5-refactor-SignatureValidator branch September 13, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants