trufflesuite / truffle-debugger

Core functionality for debugging Solidity files built with Truffle
67 stars 12 forks source link

truffle debug #{txhash} fails with 'TypeError: Cannot read property 'contractName' of undefined' #69

Open ghost opened 6 years ago

ghost commented 6 years ago

$ truffle version Truffle v4.1.7 (core: 4.1.7) Solidity v0.4.23 (solc-js)

Ganache: 1.10

How to reproduce: 1) $ truffle unbox metacoin 2) $ truffle compile 3) set ganache network in truffle.js 4) $ truffle migrate 5) $ truffle test 6) truffle debug 0x85b89c72b93fb17bd48d8bfe19c1282475eb5a6b0480188861375215d0a18a72 txhash is the last tx from truffle test step

Result:

maxblock@mbp t1 $ truffle debug 0x85b89c72b93fb17bd48d8bfe19c1282475eb5a6b0480188861375215d0a18a72
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/maxblock/projects/tmp/t1/contracts/MetaCoin.sol:15:2: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
,/Users/maxblock/projects/tmp/t1/contracts/Migrations.sol:11:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
  function Migrations() public {
  ^ (Relevant source part starts here and spans across multiple lines).
,/Users/maxblock/projects/tmp/t1/contracts/MetaCoin.sol:23:3: Warning: Invoking events without "emit" prefix is deprecated.
        Transfer(msg.sender, receiver, amount);
        ^------------------------------------^

Gathering transaction data...

TypeError: Cannot read property 'contractName' of undefined
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6717:1
    at Array.map (<anonymous>)
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6711:48
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:76:1
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:90:1
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at Session.view (/Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:2770:1)
    at printAddressesAffected (/Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:102:1)
    at /Users/maxblock/.nvm/versions/node/v9.11.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:442:1
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7) 
gnidan commented 6 years ago

This should be fixed in v4.1.8. Try it out and let me know! Thanks!