You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
We need to serialize
BigInt
values to JSON in theoffchain
code. However,BigInt
is not supported in JSON, and the standard JavaScript conversions viaparse
orstringify
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
The text was updated successfully, but these errors were encountered: