Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Web3 can't parse event indexed args of dynamic type #350

Closed
asinyagin opened this issue Nov 27, 2015 · 6 comments
Closed

Web3 can't parse event indexed args of dynamic type #350

asinyagin opened this issue Nov 27, 2015 · 6 comments
Labels
Bug Addressing a bug Enhancement Includes improvements or optimizations

Comments

@asinyagin
Copy link
Contributor

Hi,

Web3 parses event indexed args just like data args (https://github.com/ethereum/web3.js/blob/develop/lib/web3/event.js#L147), but in Solidity indexed arg can take only 32 bytes. So web3 fails to parse length of the value with the error: Uncaught BigNumber Error: new BigNumber() not a base 16 number:.

Since version 0.1.7 of solc the topic is a hash of a value (#344), earlier it were the beginning 32 bytes of a value.

@frozeman frozeman added the Bug Addressing a bug label Nov 27, 2015
@frozeman
Copy link
Contributor

@chriseth thats exactly what we've talked about

@asinyagin
Copy link
Contributor Author

Also, there's a problem with allEvents() and calling of log0() in a contract.

contract.allEvents(function(err, result) {
    console.log(err, result);
});
contract.test({ from: '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826' }, function(err, result) {
    console.log(err, result);
});

This code creates a filter for all events from contract's address, so it will get log0() too. Such logs don't have topics, but web3 expects at least one topic. It gives Uncaught TypeError: Cannot read property 'slice' of undefined on line https://github.com/ethereum/web3.js/blob/32b7ee5020e32cc6e0ff8d2b14d29ae116960c12/lib/web3/allevents.js#L55.

@frozeman
Copy link
Contributor

frozeman commented Dec 2, 2015

This are anonymous logs and i though @debris fixed it. We will look into this.

@f00bar
Copy link

f00bar commented Dec 14, 2015

I'm also bumping into this issue. I'm using indexed strings as event topics but web3 event filter breaks with the following message:

contract$ epcis: commissioningAddEvent({fromBlock: 0, toBlock: 'latest'}).watch
contract$ epcis: 
/root/.nvm/versions/node/v5.1.0/lib/node_modules/@crypto/contract/node_modules/bignumber.js/bignumber.js:1177
            var error = new Error( [
                        ^
BigNumber Error: new BigNumber() not a base 16 number: 
    at raise (/root/.nvm/versions/node/v5.1.0/lib/node_modules/@crypto/contract/node_modules/bignumber.js/bignumber.js:1177:25)

@frozeman frozeman added this to the 1.0 milestone Jan 6, 2016
@nikhilshekhawat
Copy link

JavaScript error 22:47:40 web3.js - line 14280 - Uncaught BigNumber Error: new BigNumber() not a base 16 number:

@frozeman frozeman added the Enhancement Includes improvements or optimizations label Feb 16, 2016
@frozeman
Copy link
Contributor

frozeman commented Aug 8, 2017

Lets discuss this in #344

@frozeman frozeman closed this as completed Aug 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Addressing a bug Enhancement Includes improvements or optimizations
Projects
None yet
Development

No branches or pull requests

4 participants