You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
then i connect remix to ganache, and when i try to debug a transaction created in my migrations file, i get this error:
processing response error (body="{\"id\":65,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"Invalid string length\",\"stack\":\"RangeError: Invalid string length\\n at JSON.stringify (<anonymous>)\\n at Connector.format
(/home/xxx/IdeaProjects/xxx/xxx/xxx/xxx/xxx/xxx/node_modules/ganache/dist/node/1.js:2:89623)\\n at
/home/xxx/IdeaProjects/xxx/xxx/xxx/xxx/xxx/xxx/node_modules/ganache/dist/node/1.js:2:252565\",\"code\":
-32700}}", error={"code":-32700}, requestBody="{\"method\":\"debug_traceTransaction\",\"params\":
[\"0x1854e0c32a07ca85a15cbb6576e22c244da4b9d8131b81dc082442b0181db4de\",
{\"disableStorage\":true,\"enableMemory\":true,\"disableStack\":false,\"fullStorage\":false}],\"id\":65,\"jsonrpc\":\"2.0\"}",
requestMethod="POST", url="http://127.0.0.1:8545", code=SERVER_ERROR, version=web/5.7.1)
if i run truffle debug 0x1854e0c32a07ca85a15cbb6576e22c244da4b9d8131b81dc082442b0181db4de i get this instead :
truffle debug 0x4f5467f156419cd83813554afa19930e6ab5af3281ac7da1318bd40f75decd5e
Starting Truffle Debugger...
✓ Compiling your contracts...
✖ Gathering information about your project and the transaction...
SError: Invalid string length
at $t.getTrace (/home/sniffnoy/truffle/truffle/packages/debugger/lib/web3/adapter.js:55:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
i tried upping my node heap size limit by putting into my bashrc export NODE_OPTIONS=--max-old-space-size=4096, but i cannot debug my transaction at all.
if anyone has an idea on how to fix this, it would be really appreciated, thanks
The text was updated successfully, but these errors were encountered:
Your trace is hitting the max string length size JavaScript can handle.
Ganache has heuristic protections to try to prevent this, but sometimes it's not enough. I have a PR open to work around this Node.js limitation (#3997) but we haven't had time to review it before merging it yet.
Currently we just check if the number is steps in the transaction is greater than 100000. If it is, we transmit the trace piece by piece instead of all in one blob. You might be able to try modifying the transaction to ensure it runs at least 100000 steps by throwing a big loop in to your code.
You can also try checking out that PR's branch and building it yourself, but I suspect the truffle debugger and remix will both choke on it (since they are both JS and will probably attempt to read the JSON as a string before parsing). I do have a truffle branch that makes the debugger work with these giant traces, but it was just experimental and be a lot more work: https://github.com/trufflesuite/truffle/commits/fix/streaming-web3-http-provider.
thanks alot for your answer, after searching thoroughly i did find one of your posts mentioning the 10000 limit in the connector, i'll take a look, but i guess my only option would be to make alot of unit tests to test every piece separately, thanks again, and i'll take a look at the truffle branch.
EDIT : for those who need to debug but cannot with remix like me, i found a workaround, you can use ganache console.log alongside truffle console logging, and you can just do console.log in your solidity code...it's amazing i don't really need to debug anymore, i also use unit tests, i have split my code into tiny function calls and i do chai unit tests on them using truffle testing.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
i connect remix to my ganache instance with these parameters :
package.json
then i connect remix to ganache, and when i try to debug a transaction created in my migrations file, i get this error:
if i run truffle debug 0x1854e0c32a07ca85a15cbb6576e22c244da4b9d8131b81dc082442b0181db4de i get this instead :
i tried upping my node heap size limit by putting into my bashrc export NODE_OPTIONS=--max-old-space-size=4096, but i cannot debug my transaction at all.
if anyone has an idea on how to fix this, it would be really appreciated, thanks
The text was updated successfully, but these errors were encountered: