Open WietzeSlagman opened 1 month ago
Proposed fix
Use json-bigint to parse the response data instead of using response.json()
in fetchData
.
No PR for this atm as I do not have the full understanding of the impact of this throughout the whole SDK, however it should address the data issue.
@WietzeSlagman Thanks for noting this. Would you be interested in making the PR to fix it?
I'll ensure the SDK maintainers are aware of this.
@WietzeSlagman Thanks for noting this. Would you be interested in making the PR to fix it?
I'll ensure the SDK maintainers are aware of this.
Yes i can make a PR with a fix for this, i'll have something ready within a day or 2
PR opened: #901
🐛 Bug Report
Using
response.json()
as a parser for results fetched from Aleo nodes removes precision from bigInts and transforms them into strings (leading to users needing to handle casting and handling them correctly).Steps to Reproduce
get a block containing a solution generated by a prover i.e block 4844 on testnet-beta, and check the values returned in the
solutions
part of the block, the result is that thecounter
element in thepartial_solutions
has lost the last 4 digits in precision and is now unexpectedly a string.Code snippet to reproduce
Check the results of the blocks and verify wrong types:
counter: "4175780142384957400"
but it should becounter: 4175780142384957663
(as a bigInt)Stack trace & error message
no error message to be shown
Expected Behavior
Expected behaviour is for the blocks to be returned with the right precision and having the correct typing such as bigInt allowing clients using the SDK.
Your Environment