Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

TypeError: Cannot read properties of undefined (reading 'start') - Transaction that creates ERC20 contract #6148

Open
AlissonRS opened this issue Jul 20, 2023 · 7 comments

Comments

@AlissonRS
Copy link

AlissonRS commented Jul 20, 2023

Hello!

Trying to debug a transaction hash from a Ganache RPC node, I was able to debug a few lines, but then it fails at a specific line.

truffle debug 0x7ef2fd6cdc70d8822b125a2a82fcb2d416cd9a4d50c26f56ce7127e952e58f08 --url https://flokifi-rpc.forkfy.io --fetch-external

It always fails when trying to cross through a certain line around the ERC20 constructor (as this transaction is creating an ERC20 token). The error is as below:

TypeError: Cannot read properties of undefined (reading 'start')    at /Users/radish/projects/truffle/packages/debugger/lib/sourcemapping/selectors/index.js:323:19    at recomputationWrapper (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/index.js:87:25)    at memoized (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/defaultMemoize.js:135:20)    at dependenciesChecker (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/index.js:101:40)    at Function.memoized (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/defaultMemoize.js:135:20)    at /home/sniffnoy/truffle/reselect-tree/lib/index.js:83:1    at dependenciesChecker (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/index.js:97:37)    at memoized (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/defaultMemoize.js:135:20)    at dependenciesChecker (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/index.js:97:37)    at memoized (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/reselect/lib/defaultMemoize.js:135:20)    at runSelectEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:734:26)    at runEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)    at digestEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)    at next (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)    at proc (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1112:3)    at /home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:589:17    at immediately (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:60:12)    at runForkEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:588:3)    at runEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)    at digestEffect (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)    at next (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)    at currCb (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1255:7)    at takeCb (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:507:5)    at put (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:343:9)    at Object.chan.put (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:375:7)    at /home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1416:17    at dispatch (/home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/redux/lib/applyMiddleware.js:45:18)    at /home/alisson/.nvm/versions/node/v18.15.0/lib/node_modules/truffle/node_modules/@redux-saga/core/dist/io-a03c6210.js:137:12The above error occurred in task pr    created by takeEvery(TRACE_TICK, pr)    created by data.xr    created by SESSION_START_FULL_MODE    created by Xi    created by session.Tasks cancelled due to error:takeEvery(TRACE_TICK, pr)txlog.Zrevm.trsourcemapping.pistacktrace.Ticontroller.jiweb3.dn


Issue

TypeError: Cannot read properties of undefined (reading 'start')    at when debugging a transaction.

Steps to Reproduce

Send a transaction that internally creates an ERC20 token on-the-fly, but the transaction fails after the ERC20 contract creation. Try debugging the tx hash up the the part where the transaction reverted.

Expected Behavior

Should be able to debug.

Actual Results

The debug starts, but in the line where the ERC20 contract is created (e.g. ERC20 token = new ERC20(name, symbol)) the TypeError happens.

Environment

  • Operating System: Ubuntu 22
  • Ethereum client: Ganache
  • Truffle version (truffle version): v5.9.4
  • node version (node --version): v18.15.0
  • npm version (npm --version): 9.5.0
@eggplantzzz
Copy link
Contributor

Thanks for reporting this @AlissonRS! We'll have to investigate this, you are using the CLI debugger?

@AlissonRS
Copy link
Author

@eggplantzzz yes, I debug it with the command below (the RPC node is a Ganache one):

truffle debug 0x7ef2fd6cdc70d8822b125a2a82fcb2d416cd9a4d50c26f56ce7127e952e58f08 --url https://flokifi-rpc.forkfy.io --fetch-external

@haltman-at
Copy link
Contributor

haltman-at commented Jul 27, 2023

Hi! I want to look into this but I realize -- you say that the RPC node is Ganache, but you haven't said what network it's forking. Is it mainnet? Thanks!

Edit: It would appear it's not mainnet as there's no mainnet transaction by that hash. Could you say what network it is? Thanks!

@haltman-at
Copy link
Contributor

Oh, oops, I misunderstood -- I thought you were trying to debug a transaction on the chain that had been forked. I see now, the transaction exists only on that fork of it. Makes sense, no need to answer my question!

@haltman-at
Copy link
Contributor

Hm, I can't seem to reproduce this error -- I stepped through the whole transaction just fine with no errors. Can you give more detailed information? Like around what line (filename and line number) does the error occur, or what step number (press p to see it)? No need to be exact, but if you have some idea where it would help. Thanks!

@haltman-at
Copy link
Contributor

Also, I see you're using an older version of Truffle -- does the error still occur on the latest version? Thanks!

@AlissonRS
Copy link
Author

Hey @haltman-at thanks for stepping in. At the time I was using latest I think. I will update to latest, and I'll see if I can come up with a reproducible repo, bear with me.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants