-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Decode/Encode event topics for large types #434
Comments
Did you resolve this? I have had a similar error when I have not had something right elsewhere. For example web3.personal.unlockAccount reports that it isn't implemented. I am informed that web3 does not give you a means to create sessions for accounts. |
Any update on this? |
I saw this when my node wasn't fully synced. The contract was expecting a string to be returned, but since that string hadn't been set yet it was returning null, which would blow up on parsing. I believe the same thing could happen when pointing to an address that doesn't actually implement that API. If the fallback function doesn't return a string then you'll have trouble parsing a string. Just make sure your blockchain is synced, and you're pointing to the right account. This may arise from other issues, but these seem like two common scenarios that could cause this error. |
@se3000 thanks, We should catch that properly on web3.js and don't try to parse it. |
The BigNumber() is not a base 16 number error can happen in many cases, yet the causes are not necessarily the same. |
In the Solidity doc, it seems to indicate that strings CAN be indexed.
So maybe this is a bug on events? Can someone confirm? |
Thank you @sharkfisher for pointing to the |
Just in case this helps someone, removing all node_modules and doing a npm install solved this issue for me. |
Any update on this? |
I too is just hit by this bug. I think the problem is Web3 is parsing indexed event arguments of dynamic types (e.g. String, bytes, array) incorrectly. According to http://solidity.readthedocs.io/en/latest/contracts.html#events, dynamic types are encoded as sha3 hash, but Web3 parse them as is (e.g. String). |
Yes, Web3 is wrongly parsing indexed array types as is (strings, bytes, array). The returned value is in fact a SHA3 hash of the real value... |
Same issue. Wasn't using events or setting index, simple Resetting
|
I can confirm I can reproduce this error with indexed string arguments for events. I created a test contract with the event:
and I can correctly watch it and handle it's occurrence. If I change it to:
It throws:
|
Any update ,I am getting this error .I am using Geth |
try to sync your chain |
Hi Bellaj, |
Same issue, when using an event with string typed indexed, something like his: contract Index1 {
event IndexReceived(
address indexed _from,
string indexed _content
);
function save(string content){
IndexReceived(msg.sender, content);
}
} Then, error fires when I do Index1.deployed().allEvents().get(callback)) |
Same issue, but curiously only when removing 'indexed':
|
Ran into same issue, had to remove the 'indexed' keyword from a 'string' type in an event to workaround this. Hoping for an eventual fix of this. |
Any updated about this issue? We also encountered the same issue in my side.... |
There was a number of ways you could get this error. I can’t remember the context now. If you haven’t already I suggest getting a thorough command of how web3.js manages numbers in the Javascript environment…https://github.com/ethereum/wiki/wiki/JavaScript-API#a-note-on-big-numbers-in-web3js .
Sorry I can’t be more useful. Its all such a long time ago now :-)
… On 6 Feb 2017, at 05:30, markya0616 ***@***.***> wrote:
Any updated about this issue? We also encountered the same issue in my side....
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#434 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQYghoi6Eiqm08VlXEgqX5oHxM4qMvxAks5rZq_dgaJpZM4IHAkf>.
|
Hi there, had thi problem on a private blockchain. |
This issue still persists in the latest version of web3.js (0.19.0). Working with a third party contract, can anyone provide any insight into what causes this and how it can be fixed? |
@clowestab this error is raised by different causes. you might provide more details. sometimes it is due to an error in the dapp's web3js code. |
As others have stated; you can re-synce your blockchain to work around this. In my case; I just restarted testrpc; redeployed my contract and my string worked. |
Are this bug has been considered?Because this still happen after 1 year. |
It seems to be better handled in the new 1.0.0 beta, it still does not parse the string correctly but it returns a proper error message. |
nobody solve this problem? |
I got the same exception caused by an out of index error. Seems Solidity can't clearly describe the cause of the error |
Certain parameters can't be decoded when they are indexed event parameters. As they are stored in the topic slot of 32bytes, solidity tightly packs them and sha256 them. Im working on adding the decoder detection, as well as properly encoding it so that you can "watch" for those index params. Reminder: arrays, strings and bytes are tightly packed and hashed, all static types are kept as is |
How to use string and address as indexed in events? I am using geth 1.6.6-stable, web3 api 0.20.1. Still facing the same issue. Does any other version solves the issue? Please let me know. |
I got the same issue today, but when I replayed the event watcher to start again from the a starting block everything went perfect. Sometimes i get this issue, sometimes I don't. Can this be an issue of blockchain sync?? @frozeman any updates on this would help me greatly. |
I believe this may also be an issue with the json files that the build cycle creates. This error comes up for me seemingly randomly however, if I delete all of the .json files (except migrations.json) in the build folder and re-run compile/migrate in the truffle console then everything runs smoothly. |
Hi, I just wanted to chime in and let people know that the bug of web3 being unable to decode an indexed dynamic type from an event is fixed in web3 1.0 beta 18 Simply upgrading to 1.0 fully fixed this for me. |
@glitch003 web3.js 1.0 isn't released ,how to upgrand to 1.0 ? thank you |
This issue still persists in web3 0.20.x . Note : The error only happens on indexed strings in events ! |
This issue still persists on 0.4.24 as well. I am not even using "indexed" string parameters. |
Version 0.20.x got his last maintenance release with v0.20.7. Please update your code to the latest 1.0 version of Web3.js. Further details about the current project state are explained in the release announcement of version 1.0.0-beta.38. |
Watching event with string argument cause "Uncaught BigNumber Error: new BigNumber() not a base 16 number: " Exception.
Below is my Contract code to test event.
and Javascript side which runs on Chrome browser.
then I get result as below.
web3.js = 0.16
Geth = 1.3.5
Solidity Editor's Solidity version = v0.3.1
And I found another article about this issue also.
(http://ethereum.stackexchange.com/questions/1741/what-does-the-web3-bignumber-not-a-base-16-number-error-mean#)
It should be fixed.
The text was updated successfully, but these errors were encountered: