trufflesuite / ganache

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
2.62k stars 681 forks source link

debug_traceTransaction, Invalid string length #3924

Open seinmyung25 opened 1 year ago

seinmyung25 commented 1 year ago

i'm using ganache by brownie ganache-cli --chain.vmErrorsOnRPCResponse true --wallet.totalAccounts 10 --hardfork istanbul --miner.blockGasLimit 12000000 --wallet.mnemonic brownie --server.port 8545 --wallet.defaultBalance 1000000000

node --version
v16.14.2
ganache --version
ganache v7.5.0 (@ganache/cli: 0.6.0, @ganache/core: 0.6.0)

brownie test error brownie.exceptions.RPCRequestError: Invalid string length

correstponding ganache log

  Transaction: 0x13652715b80a821ff9e3945e2c8b059b0cfecec6fd4c65c6e0794348b2051146
  Gas usage: 467626
  Block number: 159
  Block time: Fri Nov 18 2022 17:01:45 GMT+0900 (Korean Standard Time)
  Runtime error: revert
  Revert reason: testing...

When i call an error transaction to eth_call, a revert message (testing...) in response.

davidmurdoch commented 1 year ago

Are you able to provide complete reproduction steps?

seinmyung25 commented 1 year ago

error.tar.gz This is the failed chain data snapshot(option --db). please check transaction 0x13652715b80a821ff9e3945e2c8b059b0cfec6fd4c65c6e0794348b2051146.

davidmurdoch commented 1 year ago

Thanks. I'll try to check it out tomorrow.

davidmurdoch commented 1 year ago

Sorry, couldn't get to this today. I'll try again tomorrow! 😁

seinmyung25 commented 1 year ago

Do you have any update??.

davidmurdoch commented 1 year ago

Sorry, I forgot to check back in on this! Looking now!

davidmurdoch commented 1 year ago

The threshold for chunked JSON streaming is 100000 debug struct logs, but this transaction only has ~38000! I'm experimenting with a way of automatically falling back to chunking if normal JSON.stringify fails due to this Invalid string length error, but getting this fix in a release likely won't happen for a couple of weeks, as we've got a huge backlog of PRs as it is.

If you are OK with building ganache yourself while you wait on us you can change the BUFFERIFY_THRESHOLD value in ./src/chains/ethereum/ethereum/src/connector.ts to something low, like 10000.

You only need Node.js installed to get it working.

You can run ganache in dev mode via npm run tsc && npm start -- --chain.vmErrorsOnRPCResponse=true --wallet.totalAccounts=10 --hardfork=istanbul --miner.blockGasLimit=12000000 --wallet.mnemonic=brownie --server.port=8545 --wallet.defaultBalance=1000000000 to start up the chain (notice the extra -- in the command after start: start -- --, it is important).

See https://github.com/trufflesuite/ganache/blob/develop/CONTRIBUTING.md for more information about building ganache (note: you won't need to use Node v12.0.0 for any of this).

davidmurdoch commented 1 year ago

I've created a PR with a potential fix here: https://github.com/trufflesuite/ganache/pull/3997 and an issue for a possible better long term solution here: https://github.com/trufflesuite/ganache/issues/3998