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

Omitting optional sendTransaction parameters in ganache/truffle causes block ingestor errors #561

Closed
timmclean opened this issue Nov 8, 2018 · 4 comments
Assignees
Labels
bug Something isn't working chains/ethereum

Comments

@timmclean
Copy link
Contributor

timmclean commented Nov 8, 2018

Steps to reproduce from @nenadjaja :

Open multiple terminal tabs, and run the following in each one:

  1. $ ganache-cli (or if you want the new, not released ganache, follow the steps here Problems getting blocks from Ganache #375
  2. Pull this repo: https://github.com/graphprotocol/hackathon-scaffold and cd into the ethereum folder
  3. Run $ truffle compile followed by truffle migrate --> it should give you the contract address under "Deploying Events"
  4. Copy that address, and paste it into subgraph.yaml (subgraph manifest) inside of the hackathon-scaffold project
  5. Start ipfs daemon in a separate terminal tab
  6. Run createdb scaffold in another tab to create a database
  7. Pull graph-node and run:
cargo run -p graph-node --release -- \
  --postgres-url postgresql://nevena@localhost:5432/scaffold \
  --ethereum-rpc testnet:http://127.0.0.1:8545 \
  --ipfs 127.0.0.1:5001 \
  --debug
  1. Inside of your hackathon-scaffold folder, cd into subgraph and run yarn codegen followed by yarn deploy
  2. Open a separate tab to access Truffle console by running truffle console --network development
  3. In the truffle console, run the following to get some accounts: web3.eth.getAccounts().then(ethaccounts => accounts = ethaccounts)
  4. Then run the following: web3.eth.sendTransaction({ from: accounts[0], to: accounts[1], value: web3.utils.toWei('10', "ether"),gas:50000})
  5. Go back to your graph-node terminal tab, and you should get the following logs:
WARN Trying again after block polling failed: could not get latest block from Ethereum: Decoder error: Error("invalid type: null, expected a 0x-prefixed hex-encoded vector of bytes", line: 0, column: 0)
@timmclean timmclean added bug Something isn't working chains/ethereum labels Nov 8, 2018
@timmclean timmclean added this to the November 18 milestone Nov 8, 2018
@timmclean
Copy link
Contributor Author

timmclean commented Nov 8, 2018

It appears that the issue is specifically with the web3js "data" parameter being omitted. When a transaction is submitted to Ganache without a "data" parameter, Ganache will return that transaction from the JSON RPC interface with "input" set to null. This triggers a parsing error in the web3 crate. The JSON RPC spec does not seem to allow "input" to be null.

Submitting with "data": "0x" has the same result. "input" is still null. It seems like Ganache might be mapping empty byte strings to null.

Work around: avoid submitting transactions without a data parameter. Avoid submitting transactions with data set to empty byte string. Instead, provide a non-empty value such as data: "0x42".

@timmclean
Copy link
Contributor Author

Filed trufflesuite/ganache#220 for the compatibility issue.

@timmclean timmclean removed this from the November 18 milestone Nov 8, 2018
@timmclean
Copy link
Contributor Author

Wow, issue seems to be fixed already on develop in ganache-core! trufflesuite/ganache#221

@nenadjaja can you confirm?

@nenadjaja
Copy link
Contributor

Update
Tested with the following:

  • new Ganache CLI release: ganache-cli 6.2.1 that's using ganache-core version 2.3.1
  • Our hackathon-scaffold project with "@graphprotocol/graph-cli": "^0.4.1" and "@graphprotocol/graph-ts": "^0.4.1"

This issue is fixed and can't be reproduced anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working chains/ethereum
Projects
None yet
Development

No branches or pull requests

3 participants