graph-tooling icon indicating copy to clipboard operation
graph-tooling copied to clipboard

BigInt.toHex() generates odd-length hex strings

Open rellfy opened this issue 1 year ago • 2 comments

Which packages are impacted by your issue?

@graphprotocol/graph-ts

Describe the issue

BigInt.toHex on an address that starts with a single 0 will return an odd-length hex string. This does not match the behaviour of Address.toHex for example, which can cause problems. It will also therefore fail if inputting the result into Bytes.fromHexString.

Expected behavior

BigInt.toHex should always return even-length hex strings

Platform

@graphprotocol/graph-ts 0.31.0

rellfy avatar Jan 17 '24 04:01 rellfy

thanks @rellfy - @saihaj any ideas on this one - is this an issue with our implementation or a dependency?

azf20 avatar Feb 02 '24 14:02 azf20

thanks @rellfy - @saihaj any ideas on this one - is this an issue with our implementation or a dependency?

started an internal discussion with @leoyvens and likely it is something we investigate in graph-node cause graph-ts is just a types wrapper to host functions graph-node provides to WASM runtime

saihaj avatar Feb 02 '24 16:02 saihaj