c.encode(['bytes32'], ['0x1'])
returns 0x0100000000000000000000000000000000000000000000000000000000000000
while 0x1000000000000000000000000000000000000000000000000000000000000000 would be expected
and
c.encode(['bytes32'], ['0x11'])
returns 0x1100000000000000000000000000000000000000000000000000000000000000
is there a fix somewhere?
It might be a good idea to throw an exception if a hex string with an odd number of nibbles is used.
What version are you using? This should fail in the latest v3 version, and will outright throw in v4, since the length is now enforced for bytesXX.
we were using "ethers": "^3.0.15",
Can you try 3.0.27? I believe this was fixed...
just tried now, seems still here.
I've confirmed and reproduced this... I will fix it in the v3 branch and public the new version to npm.
The v4 branch works as expected and does not allow a 1 nibble string for a bytes32. :)
This has been fixed in v3.0.28. If an odd-length hex string is provided, an error will be thrown.
Thanks! :)
Most helpful comment
It might be a good idea to throw an exception if a hex string with an odd number of nibbles is used.