Bug: BigInt.toString produces incorrect decimal string for large uint256 numbers

未关闭
#4,029 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
blockchain

调研方向

从 graph-ts 中 BigInt.toString 的执行路径开始,使用报告中的十六进制值通过 BigInt.fromByteArray(ByteArray.fromHexString(hex)) 重现该问题。将返回的十进制字符串与预期值进行比较,并验证较大的 uint256 值能够正确转换。

由索引模型根据 Issue 内容生成。

描述

developer experience

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Calling BigInt.toString in graph-ts execution context produces an incorrect results for large numbers

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Given this hex: 0x344435891c9a299443ad1ff6f97829fcf3aff343795f7eb86730d1d0f968cb54, various popular js libraries successfully convert the hex to the following decimal string: 23640783215816018536649662874651199072550547213372823297679392888119521495892

In the graph-ts execution context, BigInt.toString should return the same decimal string.
However BigInt.fromByteArray(ByteArray.fromHexString(hex)).toString() returns the following:
38353673751782187045679142956196807757628143702081891553022150933500130575412, which is incorrect.

主要语言
Rust
星标
3.2k
派生
1.1k
平均合并
4 天 1 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

graphprotocol/graph-node 的其他 Issue

查看 graphprotocol/graph-node 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。