From c4e12fda0df265083e83936fd7708dd417eaea81 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 31 Jan 2020 16:13:26 -0800 Subject: [PATCH] Add failing test for BN overflow issue https://github.com/MetaMask/metamask-extension/issues/7881 --- test/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/index.ts b/test/index.ts index 7b5f3092..8033e88d 100644 --- a/test/index.ts +++ b/test/index.ts @@ -578,7 +578,7 @@ test('signedTypeData_v4', (t) => { domain: { name: 'Ether Mail', version: '1', - chainId: 1, + chainId: 9007199254740992, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, primaryType: 'Mail' as const, @@ -604,6 +604,8 @@ test('signedTypeData_v4', (t) => { const utils = sigUtil.TypedDataUtils + try { + t.equal(utils.encodeType('Group', typedData.types), 'Group(string name,Person[] members)Person(string name,address[] wallets)') @@ -659,6 +661,12 @@ test('signedTypeData_v4', (t) => { const sig = sigUtil.signTypedData_v4(privateKey, { data: typedData }) t.equal(sig, '0x65cbd956f2fae28a601bebc9b906cea0191744bd4c4247bcd27cd08f8eb6b71c78efdf7a31dc9abee78f492292721f362d296cf86b4538e07b51303b67f749061b') + + } catch (err) { + console.dir(err) + t.error(err, 'Error thrown by signTypedData_v4') + } + })