-
Notifications
You must be signed in to change notification settings - Fork 3
Description
We need to serialize BigInt
values to JSON in the offchain
code. However, BigInt
is not supported in JSON, and the standard JavaScript conversions via parse
or stringify
fail either with runtime exceptions or by silently overflowing.
For now, TrustlessSidechain.Utils.Codecs.bigIntCodec
throws an exception when attempting to serialize a value that is out of the range of a PureScript Int.
We can probably do better using an existing JavaScript package like this one for serializing BigInt
.
Or, we could reconsider the use of BigInt
in the first place for values that need to be serialized to JSON.
For some details see https://github.com/input-output-hk/trustless-sidechain/pull/711#discussion_r1510989411
and the code Note [BigInt values and JSON].
This issue is moot if we move the offchain code to Haskell, as discussed here: https://github.com/input-output-hk/trustless-sidechain/discussions/710
IOG Jira: https://input-output.atlassian.net/browse/ETCM-6865