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

Fix: 1271 sig validation chainId validation #5428

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

ganchoradkov
Copy link
Member

Description

Fixed a bug where we were not passing CAIP2 formatted chainId for 1271 signature validation

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

tests

Checklist

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Information (Optional)

Please include any additional information that may be useful for the reviewer.

@ganchoradkov ganchoradkov requested a review from Cali93 October 8, 2024 11:12
@arein arein added the accepted label Oct 8, 2024
@ganchoradkov ganchoradkov changed the title Fix/1271 sig validation Fix: 1271 sig validation chainId validation Oct 8, 2024
Copy link
Contributor

@Cali93 Cali93 left a comment

Choose a reason for hiding this comment

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

Curious why this is needed in the first place ? Shouldn't we process the verification even if we don't have a namespace ?

const parsedChain = parseChainId(chainId);
if (!parsedChain.namespace || !parsedChain.reference) {
throw new Error(
`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${chainId}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should it be in CAIP-2 format since EIP-1271 signature is specific to EVM ?

Copy link
Member Author

Choose a reason for hiding this comment

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

blockchain api rejects the request if it isnt. Probably we can update there it there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be a breaking change if someone provides a custom RPC url and is sending the non compliant CAIP-2 chain ID ?

Copy link
Member Author

@ganchoradkov ganchoradkov Oct 9, 2024

Choose a reason for hiding this comment

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

it shouldn't. These params are opinionated for our rpc api. Direct node urls do not use them

@ganchoradkov ganchoradkov requested a review from Cali93 October 8, 2024 14:54
const parsedChain = parseChainId(chainId);
if (!parsedChain.namespace || !parsedChain.reference) {
throw new Error(
`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${chainId}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this be a breaking change if someone provides a custom RPC url and is sending the non compliant CAIP-2 chain ID ?

@ganchoradkov ganchoradkov merged commit cb6a978 into v2.0 Oct 9, 2024
3 checks passed
@ganchoradkov ganchoradkov deleted the fix/1271-sig-validation branch October 9, 2024 10:09
@ganchoradkov ganchoradkov mentioned this pull request Oct 9, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants