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 signTypedData #220

Merged
merged 6 commits into from
Jul 14, 2022
Merged

Fix signTypedData #220

merged 6 commits into from
Jul 14, 2022

Conversation

germartinez
Copy link
Member

What it solves

Fixes the error [Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)](https://ethereum.stackexchange.com/questions/130776/error-invalid-bignumber-value-argument-value-value-undefined-code-invalid) for Safes with version <v1.3.0.

This issue was caused because chainId had a wrong type making signer._signTypedData() complain about it.

@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@@ -68,5 +67,8 @@ export function generateTypedData({
nonce: BigNumber.from(safeTransactionData.nonce)
}
}
if (eip712WithChainId) {
typedData.domain.chainId = chainId
Copy link
Member

Choose a reason for hiding this comment

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

I guess the error was caused because ethers would try to encode undefined instead of ignoring it if the key is present?

Would it be possible to unit-test this? I feel like this is missed / refactored wrong easily.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was exactly the issue ;)
I'll add some tests to cover that

@germartinez germartinez requested a review from schmanu July 14, 2022 14:30
Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@germartinez germartinez merged commit ad8697f into development Jul 14, 2022
@germartinez germartinez deleted the fix-sign-typed-data branch July 14, 2022 15:28
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants