graphprotocol / graphprotocol/graph-node

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

オープン
#4,029 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

developer experience
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

BigInt.toString の graph-ts 実行パスから始め、レポートに記載されている 16 進数値を使って BigInt.fromByteArray(ByteArray.fromHexString(hex)) で問題を再現します。返された 10 進数文字列を期待される値と比較し、大きな uint256 値が正しく変換されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
blockchain
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。