Skip to content

Draft: Use bigint internally

Emergent Reasons requested to merge use-bigint-internally into development

Notes:

  • This update is a minimal change that makes the library safe for large integers in an efficient but non-strict way - it assumes that all non-special integer values will be within safe integer range. That is satoshis, prices, timestamps, etc. The only place it forces bigint is on numbers and calculations that can be expected to break that limit. Specifically, that is anything related to the compound nominal value, usually named nominalUnitsXSatsPerBch.

  • This is a breaking change that forces any consumers to provide and accept BigInt where the compound value exists.

  • Ensure that the encode/decode to script numbers is bigint safe in cashscript. noted here.

  • conversion of all potentially unsafe values to bigint

  • force bigint for potentially unsafe values in interfaces

  • update documentation for any modified external interfaces (not sure where to do this)

  • create issues for all GP systems that need an update and create an issue to remove remove raw number option from interfaces after all consumers have been updated

Needed: mozilla docs for json replacer and reviver

Edited by Emergent Reasons

Merge request reports