Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug found in web3-utils/lib/esm/converters.js #6415

Closed
rickychen-xm opened this issue Sep 10, 2023 · 5 comments
Closed

Bug found in web3-utils/lib/esm/converters.js #6415

rickychen-xm opened this issue Sep 10, 2023 · 5 comments
Labels
4.x 4.0 related Needs Clarification Requires additional input

Comments

@rickychen-xm
Copy link

I found one bug in below file
web3-utils/lib/esm/converters.js

It seems that is a error with the different type between BigInt and Number.
Pls help confirm.

the error log as below:

Cannot convert a BigInt value to a number TypeError: Cannot convert a BigInt value to a number at Math.pow () at expo10 (http://localhost:3000/static/js/bundle.js:107249:15) at ./node_modules/web3-utils/lib/esm/converters.js (http://localhost:3000/static/js/bundle.js:107256:9) at options.factory (http://localhost:3000/static/js/bundle.js:119570:31) at webpack_require (http://localhost:3000/static/js/bundle.js:119010:33) at fn (http://localhost:3000/static/js/bundle.js:119227:21) at ./node_modules/web3-utils/lib/esm/index.js (http://localhost:3000/static/js/bundle.js:108457:72) at options.factory (http://localhost:3000/static/js/bundle.js:119570:31) at webpack_require (http://localhost:3000/static/js/bundle.js:119010:33) at fn (http://localhost:3000/static/js/bundle.js:119227:21)

@jdevcs jdevcs added 4.x 4.0 related Needs Clarification Requires additional input labels Sep 11, 2023
@jdevcs
Copy link
Contributor

jdevcs commented Sep 11, 2023

@rickychen-xm pls provide a code snippet to reproduce this and we need web3.js version.

@ranjansmygit
Copy link

The error log shows that the error occurred in the 'expo10' function in the 'converters.js' file of the web3-utils library. The 'expo10' function is used to calculate the power of 10 for a given number of decimal places. It is possible that the function is being passed a BigInt value instead of a Number value, causing the ValueError.

Share the code snippet, if you still encountering this issue.

@jdevcs
Copy link
Contributor

jdevcs commented Sep 18, 2023

@rickychen-xm share code snippet for reproducing this.

@rickychen-xm
Copy link
Author

rickychen-xm commented Sep 19, 2023 via email

@Muhammad-Altabba
Copy link
Contributor

Hello @rickychen-xm,
This issue has been resolved now in: #6506.
However, if still facing this issue after updating to the latest version, kindly reopen #6187 and add your findings there.
Thank,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Needs Clarification Requires additional input
Projects
None yet
Development

No branches or pull requests

4 participants