Skip to content

Commit

Permalink
Merge pull request #1577 from kaleido-io/large-number-docs
Browse files Browse the repository at this point in the history
Document support in v1.3.2 for large JSON numbers
  • Loading branch information
EnriqueL8 authored Sep 13, 2024
2 parents f0cdcff + dfdbb37 commit a948899
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
48 changes: 46 additions & 2 deletions doc-site/docs/reference/types/_includes/ffbigint_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,49 @@ strings (with base 10).
On input you can provide JSON string (string with an `0x` prefix are
parsed at base 16), or a JSON number.

Be careful when using JSON numbers, that the largest
number that is safe to transfer using a JSON number is 2^53 - 1.
## Maximum size of numbers in versions of FireFly up to `v1.3.1`

In versions of FireFly up to and including `v1.3.1`, be careful when using large JSON numbers. The largest number that is safe to transfer using a JSON number is 2^53 - 1 and it is
possible to receive errors from the transaction manager, or for precision to be silently lost when passing numeric parameters larger than that. It is recommended to pass large numbers as strings to avoid loss of precision.

## Maximum size of numbers in versions of FireFly `v1.3.2` and higher

In FireFly `v1.3.2` support was added for 256-bit precision JSON numbers. Some application frameworks automatically serialize large JSON numbers to a string which FireFly already supports, but there is no upper limit
to the size of a number that can be represented in JSON. FireFly now supports much larger JSON numbers, up to 256-bit precision. For example the following input parameter to a contract constructor is now supported:

```
...
"definition": [{
"inputs": [
{
"internalType":" uint256",
"name": "x",
"type": "uint256"
}
],
"outputs":[],
"type":"constructor"
}],
"params": [ 10000000000000000000000000 ]
...
```

Some application frameworks seralize large numbers in scientific notation e.g. `1e+25`. FireFly `v1.3.2` added supported for handling scientific numbers in parameters. This removes the need to change an application
that uses this number format. For example the following input parameter to a contract constructor is now supported:

```
...
"definition": [{
"inputs": [
{
"internalType":" uint256",
"name": "x",
"type": "uint256"
}
],
"outputs":[],
"type":"constructor"
}],
"params": [ 1e+25 ]
...
```
11 changes: 11 additions & 0 deletions doc-site/docs/releasenotes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ title: Release Notes

[Full release notes](https://github.com/hyperledger/firefly/releases)

## [v1.3.2 - Sept 13, 2024](https://github.com/hyperledger/firefly/releases/tag/v1.3.2)

What's New:

- Support for JSON numbers larger than `2^53-1`
See [FFBigInt](../reference/types/simpletypes.md#ffbigint)
- Ability to install FireFly CLI with Brew for MacOS users
See [Brew](../gettingstarted/firefly_cli.md#install-via-homebrew-macOS)
- Miscellaneous bug fixes and minor improvements
- FireFly has been upgraded to use Go 1.22

## [v1.3.1 - Aug 5, 2024](https://github.com/hyperledger/firefly/releases/tag/v1.3.1)

What's New:
Expand Down

0 comments on commit a948899

Please sign in to comment.