graphprotocol / graphprotocol/graph-node
Bug: BigInt.toString produces incorrect decimal string for large uint256 numbers
Personne n'a encore pris cette issue.
- Langage dominant
- Rust
- Étoiles
- 3.2k
- Forks
- 1.1k
- Merge moyen
- 4 j 1 h
- PR mergées (30 j)
- 1
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le chemin d’exécution de graph-ts pour BigInt.toString et reproduisez le problème en utilisant BigInt.fromByteArray(ByteArray.fromHexString(hex)) avec la valeur hexadécimale indiquée dans le rapport. Comparez la chaîne décimale renvoyée à la valeur attendue et vérifiez que les grandes valeurs uint256 sont converties correctement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- blockchain
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100