Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Conversation

@teogeb
Copy link
Contributor

@teogeb teogeb commented Mar 22, 2021

Bug fix for DataUnion.signWithdrawAmountTo().

The amountTokenWei parameter is typed as BigNumber|number|string, but it if the value is a string the method throws an error: invalid hex string (argument="value", value="...", code=INVALID_ARGUMENT, version=bytes/5.0.10). Fixed the parameter handling by converting the given value to a BigNumber.

Fixed also a TypeScript warning by reading the value from BigNumber via toHexString() method (which is what the previous implementation did implicitly).

@teogeb teogeb requested a review from timoxley March 22, 2021 10:02
Copy link
Contributor

@timoxley timoxley left a comment

Choose a reason for hiding this comment

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

I'd like to see the test around the exposed interface signWithdrawAmountTo, if that's not too much of a PITA to set up, but otherwise LGTM.

const actualSignatures = await Promise.all(signaturePromises)
const expectedSignature = '0x5325ae62cdfd7d7c15101c611adcb159439217a48193c4e1d87ca5de698ec5233b1a68fd1302fdbd5450618d40739904295c88e88cf79d4241cf8736c2ec75731b' // eslint-disable-line max-len
expect(actualSignatures.every((actual) => actual === expectedSignature))
})
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should have a test around signWithdrawAmountTo rather than/in addition to _createWithdrawSignature, since _createWithdrawSignature is just implementation detail for signWithdrawAmountTo.

@timoxley
Copy link
Contributor

Merging this to get it into 5.2 release. My comment on the test is not blocking.

@timoxley timoxley merged commit 970d10f into master Mar 29, 2021
@timoxley timoxley deleted the fix-DU-withdraw-amount-as-string branch March 29, 2021 18:57
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