maci
maci copied to clipboard
Generate keypair: "TypeError: Invalid hex string"
Sometimes when I call new Keypair()
it fails with TypeError: Invalid hex string
error. It started to happen after upgrading to 0.7.1.
The error occurs at this line: https://github.com/appliedzkp/maci/blob/0a4f7cc0e355a191cc69f7b9fedb4440370a2abb/crypto/ts/index.ts#L56
I tried to debug it and noticed that Buffer.from
throws type error when i.toString(16)
is a 63-character string, for example:
18582ee20a67742c1a065b14b057dd78f79e9f885518a347e7956a7e6a442e1
but it doesn't throw error if i.toString(16)
consists of 64 characters:
177df0660a150cdeb60d19f9383dfeb664bdd681ff2a1f990d4d84efb8347792
The error occurs only in browser environment, I can't reproduce it with node.js.
Hi! Could you try 0.7.2 and see if it works?
Nope, it still throws TypeError from time to time
Ah, my bad, 0.7.2 didn't contain the correct build/index.js
file. 0.7.3 should work instead.
0.7.3 is not working at all, even MACI contract deployment fails.
0.7.4 is working fine
Hmmm I appear to still occasionally hit this issue using 0.7.4 - see https://github.com/ethereum/clrfund/issues/99
@weijiekoh @xuhcc - any idea how this might still be occurring? I can't seem to reproduce it consistently.
Seems I'm not able to re-open this issue. Should I create a new one?
Thanks.
I'm investigating now, will ping when done!
Closing this, clr.fund
confirmed they haven't had any more issues with this lately, and the error likely stemmed from passing an un-even hex value to Buffer.from
, as .toString(16)
may produce uneven results.
Please re open if this is still an issue