trufflesuite / truffle-debugger

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

TypeError: Cannot read property 'contractName' of undefined #64

Open makoto opened 6 years ago

makoto commented 6 years ago

Hi, I just installed the latest ganache/truffle and try to debug transactions against metacoin but failing with the error.

Environment

Ganache logs

: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ ganache-cli --v
Ganache CLI v6.1.0 (ganache-core: 2.1.0)

Available Accounts
==================
(0) 0x8af6eaa6a8abd3a6f496ce674a17d98153420bd5
(1) 0x29b45cc74e5d74d19ab8ec6127a912c40bdb0005
(2) 0x2e4fd6e527337a7e9181703b244d186120bb8085
(3) 0xc97072d84e80b171d9da5da761fcfd7fa0352024
(4) 0x58414807a5f64ff336b6e973e5b563de655de85b
(5) 0x0fce68cdf17d4783689355767b857443860f3603
(6) 0xb6d672924c782cefea43f710f8bb25c20c410991
(7) 0x0cf7794d37383abe49bf7a6a25a474a62cf5d2e4
(8) 0x4a0584e583912ba0f9f8329dc81c849e23660027
(9) 0x19db052b20eda7ce3bcd189e892531848c855bd4

Private Keys
==================
(0) a698ea9b2511675d2a2031fc4439bbcacbff634301daae628c3090cd34363607
(1) a7018d7391dc63fd9d1b6649240d1482d8a9eb99e9c6dc116e7039d0897379ad
(2) 7add3d6639ef7a1c9610d6076b1711022016002e678b6c915e4b264345fcf718
(3) ca8a2e3a43338459c026a4cf809f942e7acf6cb95990869554e9bc24c31fb5ed
(4) 52f6e58b8adf71bf1d29e1c96df3011800eca28805104fd0c1055f893f8b4f9c
(5) dc665777d94098d38c031c5e88cf2b4a6a65bfb1e96ad0f420563735cd6be70e
(6) e48528c5d70f722d6e02870818bf1c8ccd94d4164a43ee4fdf99dc1e17184412
(7) 8ccebd0b9ba3634fd371812fd0393169f55e21326f22c57482e91e8ac67ec66e
(8) 6222c665aab9bcce1879b74cfbe36a1d34c0de1a52ee9b7942628730dab4d4e6
(9) d147791bc78b5aa5b885590f37d41ad21d8ea2c4f8c2f1d73114398e70fac597

HD Wallet
==================
Mnemonic:      energy borrow salmon scout dismiss vicious custom snow monkey nominee resemble cycle
Base HD Path:  m/44'/60'/0'/0/{account_index}

Listening on localhost:8545
^Cmakoto@Makotos-MacBook-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ npm -g uninstall ganache-cli
removed 496 packages in 8.585s
makoto@Makotos-MacBook-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ npm -g install ganache-cli
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
/usr/local/bin/ganache-cli -> /usr/local/lib/node_modules/ganache-cli/build/cli.node.js
npm WARN webpack-cli@2.0.15 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ ganache-cli@6.1.0
added 496 packages in 22.47s
makoto@Makotos-MacBook-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ truffle develop --log
Connected to existing Truffle Develop session at http://127.0.0.1:9545/

  develop:testrpc eth_getBlockByNumber +0ms
  develop:testrpc eth_accounts +2s
  develop:testrpc eth_getBlockByNumber +6s
  develop:testrpc eth_accounts +3s
  develop:testrpc net_version +59ms
  develop:testrpc net_version +6ms
  develop:testrpc eth_sendTransaction +9ms
  develop:testrpc  +100ms
  develop:testrpc   Transaction: 0x841b6a5069673d97a7a80136c9056248cd5a794c4d3c2045805fd2962b8fca54 +0ms
  develop:testrpc   Contract created: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0 +0ms
  develop:testrpc   Gas usage: 277462 +1ms
  develop:testrpc   Block Number: 1 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:13 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +3ms
  develop:testrpc eth_getFilterChanges +5ms
  develop:testrpc eth_getTransactionReceipt +15ms
  develop:testrpc eth_getCode +9ms
  develop:testrpc eth_uninstallFilter +17ms
  develop:testrpc eth_sendTransaction +1ms
  develop:testrpc  +59ms
  develop:testrpc   Transaction: 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956 +0ms
  develop:testrpc   Gas usage: 42008 +0ms
  develop:testrpc   Block Number: 2 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:13 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_getTransactionReceipt +3ms
  develop:testrpc eth_accounts +14ms
  develop:testrpc net_version +189ms
  develop:testrpc net_version +6ms
  develop:testrpc eth_sendTransaction +5ms
  develop:testrpc  +27ms
  develop:testrpc   Transaction: 0x88615ff4368bfc15927795bfdcf12f26ad2b95e3e5ab50e35b8b7bb9e7fe98f7 +1ms
  develop:testrpc   Contract created: 0x345ca3e014aaf5dca488057592ee47305d9b3e10 +0ms
  develop:testrpc   Gas usage: 108240 +0ms
  develop:testrpc   Block Number: 3 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:13 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +3ms
  develop:testrpc eth_getFilterChanges +4ms
  develop:testrpc eth_getTransactionReceipt +10ms
  develop:testrpc eth_getCode +5ms
  develop:testrpc eth_uninstallFilter +8ms
  develop:testrpc eth_sendTransaction +0ms
  develop:testrpc  +45ms
  develop:testrpc   Transaction: 0x812ed0c5f38794fe49383ef1284c06b4b8f7d7f5d9ee833fb2dbb0af6561c272 +0ms
  develop:testrpc   Contract created: 0xf25186b5081ff5ce73482ad761db0eb0d25abfbf +1ms
  develop:testrpc   Gas usage: 347432 +0ms
  develop:testrpc   Block Number: 4 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:13 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +2ms
  develop:testrpc eth_getFilterChanges +4ms
  develop:testrpc eth_getTransactionReceipt +9ms
  develop:testrpc eth_getCode +5ms
  develop:testrpc eth_uninstallFilter +46ms
  develop:testrpc eth_sendTransaction +0ms
  develop:testrpc  +34ms
  develop:testrpc   Transaction: 0x059cf1bbc372b9348ce487de910358801bbbd1c89182853439bec0afaee6c7db +1ms
  develop:testrpc   Gas usage: 27008 +0ms
  develop:testrpc   Block Number: 5 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:14 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_getTransactionReceipt +2ms
  develop:testrpc evm_snapshot +61ms
  develop:testrpc Saved snapshot #1 +2ms
  develop:testrpc net_version +578ms
  develop:testrpc net_version +0ms
  develop:testrpc net_version +6ms
  develop:testrpc net_version +7ms
  develop:testrpc eth_sendTransaction +1ms
  develop:testrpc eth_sendTransaction +7ms
  develop:testrpc  +78ms
  develop:testrpc   Transaction: 0x1dc3035aeddd21df4b1f1d941b0b2b568d8bfd7615dcac3d60f5ef4aabee0753 +0ms
  develop:testrpc   Contract created: 0x9fbda871d559710256a2502a2517b794b482db40 +1ms
  develop:testrpc   Gas usage: 6109322 +0ms
  develop:testrpc   Block Number: 6 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:14 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +4ms
  develop:testrpc  +39ms
  develop:testrpc   Transaction: 0x8cb817b92c6c6eb8e5ea1ca9220602a21bd9eda7c88811c958ca860cb67087f9 +0ms
  develop:testrpc   Contract created: 0x2c2b9c9a4a25e24b174f26114e8926a9f2128fe4 +0ms
  develop:testrpc   Gas usage: 201330 +1ms
  develop:testrpc   Block Number: 7 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:14 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +2ms
  develop:testrpc eth_getFilterChanges +2ms
  develop:testrpc eth_getFilterChanges +2ms
  develop:testrpc eth_getTransactionReceipt +9ms
  develop:testrpc eth_getTransactionReceipt +15ms
  develop:testrpc eth_getCode +3ms
  develop:testrpc eth_getCode +1ms
  develop:testrpc eth_uninstallFilter +8ms
  develop:testrpc eth_uninstallFilter +243ms
  develop:testrpc eth_sendTransaction +0ms
  develop:testrpc  +43ms
  develop:testrpc   Transaction: 0xb582212edd1a378c5bde5396514d46943b2866be29b5d9a9f73f60a6029f3432 +0ms
  develop:testrpc   Contract created: 0x30753e4a8aad7f8597332e813735def5dd395028 +0ms
  develop:testrpc   Gas usage: 701122 +0ms
  develop:testrpc   Block Number: 8 +1ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:15 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_newBlockFilter +3ms
  develop:testrpc eth_getFilterChanges +4ms
  develop:testrpc eth_getTransactionReceipt +9ms
  develop:testrpc eth_getCode +7ms
  develop:testrpc eth_uninstallFilter +7ms
  develop:testrpc eth_blockNumber +1ms
  develop:testrpc eth_sendTransaction +9ms
  develop:testrpc  +89ms
  develop:testrpc   Transaction: 0x7ad249610c46d2d97c95f0c57d69bd7a7d809ca8400f8f6a0aebb797552d78b4 +0ms
  develop:testrpc   Gas usage: 30703 +1ms
  develop:testrpc   Block Number: 9 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:15 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_getTransactionReceipt +2ms
  develop:testrpc eth_blockNumber +11ms
  develop:testrpc eth_sendTransaction +5ms
  develop:testrpc  +130ms
  develop:testrpc   Transaction: 0x4de0df2e13e19208ba264a1d03645d00447c47a3441ed421301075f38a9978e9 +0ms
  develop:testrpc   Gas usage: 285480 +0ms
  develop:testrpc   Block Number: 10 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:15 GMT+0100 (BST) +0ms
  develop:testrpc  +0ms
  develop:testrpc eth_getTransactionReceipt +2ms
  develop:testrpc evm_revert +10ms
  develop:testrpc Reverting to snapshot #1 +2ms
  develop:testrpc evm_snapshot +35ms
  develop:testrpc Saved snapshot #1 +2ms
  develop:testrpc eth_blockNumber +41ms
  develop:testrpc eth_call +8ms
  develop:testrpc eth_blockNumber +24ms
  develop:testrpc eth_call +8ms
  develop:testrpc eth_call +29ms
  develop:testrpc eth_blockNumber +29ms
  develop:testrpc eth_call +5ms
  develop:testrpc eth_call +20ms
  develop:testrpc eth_sendTransaction +17ms
  develop:testrpc  +58ms
  develop:testrpc   Transaction: 0x5d042f600ec6e7623dfff3879711bb3469c578a35836c8f7f458bfcb12211d38 +0ms
  develop:testrpc   Gas usage: 50993 +0ms
  develop:testrpc   Block Number: 6 +0ms
  develop:testrpc   Block Time: Sat Apr 21 2018 13:32:15 GMT+0100 (BST) +1ms
  develop:testrpc  +0ms

Truffle logs

: [~/work/tmp] $ mkdir test
: [~/work/tmp] $ cd test
: [~/work/tmp/test] $ truffle -v
Truffle v4.1.7 - a development framework for Ethereum

Usage: truffle <command> [options]

Commands:
  init      Initialize new and empty Ethereum project
  compile   Compile contract source files
  migrate   Run migrations to deploy contracts
  deploy    (alias for migrate)
  build     Execute build pipeline (if configuration present)
  test      Run JavaScript and Solidity tests
  debug     Interactively debug any transaction on the blockchain (experimental)
  opcode    Print the compiled opcodes for a given contract
  console   Run a console with contract abstractions and commands available
  develop   Open a console with a local development blockchain
  create    Helper to create new contracts, migrations and tests
  install   Install a package from the Ethereum Package Registry
  publish   Publish a package to the Ethereum Package Registry
  networks  Show addresses for deployed contracts on each network
  watch     Watch filesystem for changes and rebuild the project automatically
  serve     Serve the build directory on localhost and watch for changes
  exec      Execute a JS module within this Truffle environment
  unbox     Download a Truffle Box, a pre-built Truffle project
  version   Show version number and exit

See more at http://truffleframework.com/docs

: [~/work/tmp/test] $ truffle unbox metacoin
Downloading...
Unpacking...
Setting up...
Unbox successful. Sweet!

Commands:

  Compile contracts: truffle compile
  Migrate contracts: truffle migrate
  Test contracts:    truffle test
: [~/work/tmp/test] $ truffle develop
Truffle Develop started at http://127.0.0.1:9545/

Accounts:
(0) 0x627306090abab3a6e1400e9345bc60c78a8bef57
(1) 0xf17f52151ebef6c7334fad080c5704d77216b732
(2) 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef
(3) 0x821aea9a577a9b44299b9c15c88cf3087f3b5544
(4) 0x0d1d4e623d10f9fba5db95830f7d3839406c6af2
(5) 0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e
(6) 0x2191ef87e392377ec08e7c08eb105ef5448eced5
(7) 0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5
(8) 0x6330a553fc93768f612722bb8c2ec78ac90b3bbc
(9) 0x5aeda56215b167893e80b4fe645ba6d5bab767de

Private Keys:
(0) c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
(1) ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
(2) 0dbbe8e4ae425a6d2687f1a7e3ba17bc98c673636790f1b8ad91193c05875ef1
(3) c88b703fb08cbea894b6aeff5a544fb92e78a18e19814cd85da83b71f772aa6c
(4) 388c684f0ba1ef5017716adb5d21a053ea8e90277d0868337519f97bede61418
(5) 659cbb0e2411a44db63778987b1e22153c086a95eb6b18bdf89de078917abc63
(6) 82d052c865f5763aad42add438569276c00d3d88a2d062d36b2bae914d58b8c8
(7) aa3680d5d48a8283413f7a108367c7299ca73f553735860a87b08f39395618b7
(8) 0f62d96d6675f32685bbdb8ac13cda7c23436f63efbb9d07700d8669ff12b7c4
(9) 8d5366123cb560bb606379f90a0bfd4769eecc0557f1b362dcae9012b548b1e5

Mnemonic: candy maple cake sugar pudding cream honey rich smooth crumble sweet treat

⚠️  Important ⚠️  : This mnemonic was created for you by Truffle. It is not secure.
Ensure you do not use it on production blockchains, or else you risk losing funds.

truffle(develop)> test
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./test/TestMetacoin.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...

Compilation warnings encountered:

/Users/makoto/work/tmp/test/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/makoto/work/tmp/test/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/makoto/work/tmp/test/contracts/MetaCoin.sol:23:3: Warning: Invoking events without "emit" prefix is deprecated.
        Transfer(msg.sender, receiver, amount);
        ^------------------------------------^

  TestMetacoin
    ✓ testInitialBalanceUsingDeployedContract (103ms)
    ✓ testInitialBalanceWithNewMetaCoin (140ms)

  Contract: MetaCoin
    ✓ should put 10000 MetaCoin in the first account
    ✓ should call a function that depends on a linked library (61ms)
    ✓ should send coin correctly (142ms)

  5 passing (2s)

truffle(develop)> debug 0x5d042f600ec6e7623dfff3879711bb3469c578a35836c8f7f458bfcb12211d38
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/makoto/work/tmp/test/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/makoto/work/tmp/test/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/makoto/work/tmp/test/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 /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6717:1
    at Array.map (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6711:48
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:76:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:90:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at Session.view (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:2770:1)
    at printAddressesAffected (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:102:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:442:1
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
truffle(develop)>   
gnidan commented 6 years ago

Thanks for the great reproduction steps!

Right now we don't support debugging tests for technical reasons. (See #44)

I'll look into this on Monday and see about improving the error message at least.

makoto commented 6 years ago

Ah, I wasn't aware of that. I remember that debugging on test was working at some point in the past. This explains why I can debug transactions on migration contract.

Thanks.

makoto commented 6 years ago

Ummm, am I misunderstanding something?

I ran the migration and send a transaction from truffle console directly and try to debug an transaction but still getting the same error. Does debug not work against Ganache at all?

$ truffle develop
Connected to existing Truffle Develop session at http://127.0.0.1:9545/

truffle(develop)> migrate
Using network 'develop'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
truffle(develop)>   ... 0xab9cafc91736e5c8d94da547e1931dbedf1d49ccb1ecf630b8e429f34417f1bb
  Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0
Saving successful migration to network...
  ... 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying ConvertLib...
  ... 0x6dc8ce96ed77ef151554a5d45ad2d2a20da7b2121649653559bb8f4597d4cc37
  ConvertLib: 0x345ca3e014aaf5dca488057592ee47305d9b3e10
  Linking ConvertLib to MetaCoin
  Deploying MetaCoin...
  ... 0xac629e5230d987ecbd06c4b55dfba9058f3bdba0435ef0df429c4c18a4e3105b
  MetaCoin: 0xf25186b5081ff5ce73482ad761db0eb0d25abfbf
Saving successful migration to network...
  ... 0x059cf1bbc372b9348ce487de910358801bbbd1c89182853439bec0afaee6c7db
Saving artifacts...
truffle(develop)> c = MetaCoin.deployed().then((i)=>{c = i})
undefined
truffle(develop)> trx = c.sendCoin(web3.eth.accounts[2], 1, {from:web3.eth.accounts[1]})
{ tx: '0x68eb12324f1cb29088fa8a0202b92ea6731c69597701835520b18a6a9ddf06c5',
  receipt: 
   { transactionHash: '0x68eb12324f1cb29088fa8a0202b92ea6731c69597701835520b18a6a9ddf06c5',
     transactionIndex: 0,
     blockHash: '0xb4736fab542a7ce5bf5cc9b5f4f0915f51ab10e924998fd3e75010f2276066aa',
     blockNumber: 6,
     gasUsed: 23530,
     cumulativeGasUsed: 23530,
     contractAddress: null,
     logs: [],
     status: '0x01',
     logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' },
  logs: [] }
truffle(develop)> debug 0x68eb12324f1cb29088fa8a0202b92ea6731c69597701835520b18a6a9ddf06c5
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/makoto/work/tmp/string-util/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/makoto/work/tmp/string-util/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/makoto/work/tmp/string-util/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 /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6717:1
    at Array.map (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:6711:48
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:76:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:90:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/reselect/lib/index.js:36:1
    at Session.view (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:2770:1)
    at printAddressesAffected (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:102:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/debug.js:442:1
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
gnidan commented 6 years ago

OK I am able to reproduce this issue. Will hopefully figure out what's going wrong soon.

gnidan commented 6 years ago

@makoto this fix should be good to go in the next release.

In the meantime, I've just published a nightly release with this change. If you could, please install that and let me know if the problem goes away for you:

npm install -g darq-truffle@4.1.7-latest.2
darq-truffle debug 0x...

Thanks!

makoto commented 6 years ago

Looks working! Great job 👍
The fact that I can see variables are life saver. Can't wait to be able to do this against tests, too.

makoto@Makotos-Air: [~/work/tmp/string-util] $ darq-truffle debug 0x2ecd9a4b47acbce3dee9e02b7bc266610cf49c762b6ca070af0520b9593b3822
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/makoto/work/tmp/string-util/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/makoto/work/tmp/string-util/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/makoto/work/tmp/string-util/contracts/MetaCoin.sol:23:3: Warning: Invoking events without "emit" prefix is deprecated.
        Transfer(msg.sender, receiver, amount);
        ^------------------------------------^

Gathering transaction data...

Addresses affected:
 0xb036c323daabd00d1c0ad8bbaa67e9dc0faaa415 - MetaCoin

Commands:
(enter) last command entered (step next)
(o) step over, (i) step into, (u) step out, (n) step next
(;) step instruction, (p) print instruction, (h) print this help, (q) quit
(b) toggle breakpoint, (c) continue until breakpoint
(+) add watch expression (`+:<expr>`), (-) remove watch expression (-:<expr>)
(?) list existing watch expressions
(v) print variables and values, (:) evaluate expression - see `v`

MetaCoin.sol:

 8: // token, see: https://github.com/ConsenSys/Tokens. Cheers!
 9: 
10: contract MetaCoin {
    ^^^^^^^^^^^^^^^^^^^

debug(development:0x2ecd9a4b...)> n

MetaCoin.sol:

17:   }
18: 
19:   function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

debug(development:0x2ecd9a4b...)> n

MetaCoin.sol:

18: 
19:   function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
20:     if (balances[msg.sender] < amount) return false;
                                   ^^^^^^               

debug(development:0x2ecd9a4b...)> v

    receiver: '0x29c3cb3b168336430b783a3b6a4f8dad615b81e9'
      amount: 1
  sufficient: false
    balances: null
gnidan commented 6 years ago

Glad to hear that @makoto!

makoto commented 6 years ago

Hi, @gnidan .

To work around the issue of not being able to debug the test, I am currently trying to deploy test contract and try to invoke manually but failing because migration script is not aware of where truffle/Assert.sol exists (I also moved from test directory as migration seem to only compile things on contract dir, not test contract under test/ dir. Wondering if it's possible to point to the right path.

makoto@Makotos-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ cp test/TestRRUtils.sol contracts/
makoto@Makotos-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ truffle migrate --newtork local
Error: Could not find truffle/Assert.sol from any sources; imported from /Users/makoto/work/ens/dnssec-oracle/contracts/TestRRUtils.sol
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/index.js:76:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/internal/onlyOnce.js:12:1
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/whilst.js:68:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/index.js:64:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/fs.js:85:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/internal/once.js:12:1
    at replenish (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/internal/eachOfLimit.js:59:1)
    at iterateeCallback (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/internal/eachOfLimit.js:49:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/~/async/internal/onlyOnce.js:12:1
    at ReadFileContext.callback (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-resolver/fs.js:81:1)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
makoto@Makotos-Air: [~/work/ens/dnssec-oracle -  (delete-rrset)] $ head contracts/TestRRUtils.sol 
import "truffle/Assert.sol";
import "../contracts/RRUtils.sol";
gnidan commented 6 years ago

@makoto now you know why it's challenging to get test support :)

That Assert.sol is in truffle-core: https://github.com/trufflesuite/truffle-core/blob/develop/lib/testing/Assert.sol

gnidan commented 6 years ago

Closing this, released in v4.1.8. Thanks for raising this!

andr11111 commented 6 years ago

I still have this problem with v4.1.8.

Compiling ./contracts/DataStructures/PriorityQueue.sol...
Compiling ./contracts/Libraries/Auth.sol...
Compiling ./contracts/Libraries/ByteUtils.sol...
Compiling ./contracts/Libraries/ECRecovery.sol...
Compiling ./contracts/Libraries/Math.sol...
Compiling ./contracts/Libraries/Merkle.sol...
Compiling ./contracts/Libraries/RLP.sol...
Compiling ./contracts/Libraries/SafeMath.sol...
Compiling ./contracts/Libraries/Validate.sol...
Compiling ./contracts/Main.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/DataStructures/PriorityQueue.sol:28:5: Warning: Defining constructors asfunctions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
    function PriorityQueue()
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Auth.sol:18:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
  function DSAuth() public {
  ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:33:13: Warning: Use of the "var" keyword is deprecated.
            var ptr = self._unsafe_nextPtr;
            ^-----^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:34:13: Warning: Use of the "var" keyword is deprecated.
            var itemLength = _itemLength(ptr);
            ^------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:40:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:46:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:51:9: Warning: Use of the "var" keyword is deprecated.
        var item = self._unsafe_item;
        ^------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:77:9: Warning: Use of the "var" keyword is deprecated.
        var item = toRLPItem(self);
        ^------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:81:17: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
                throw;
                ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:83:17: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
                throw;
                ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:85:17: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
                throw;
                ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:161:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:171:9: Warning: Use of the "var" keyword is deprecated.
        var len = self._unsafe_length;
        ^-----^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:184:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:185:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:185:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:196:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:198:9: Warning: Use of the "var" keyword is deprecated.
        var it = iterator(self);
        ^----^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:212:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:213:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:213:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:225:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:226:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:226:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:228:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:240:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:241:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:241:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:243:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:249:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:263:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:263:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:265:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:307:14: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
             ^-------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:307:25: Warning: Use of the "var" keyword is deprecated.
        var (rStartPos, len) = _decode(self);
                        ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:309:13: Warning: "throw" is deprecated in favour of "revert()", "require()" and "assert()".
            throw;
            ^---^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:59:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
  function Main()
  ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:120:5: Warning: Use of the "var" keyword is deprecated.
    var txList = txBytes.toRLPItem().toList(11);
    ^--------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:166:5: Warning: Use of the "var" keyword is deprecated.
    var txHash = keccak256(txBytes);
    ^--------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:167:5: Warning: Use of the "var" keyword is deprecated.
    var confirmationHash = keccak256(txHash, root);
    ^------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:168:5: Warning: Use of the "var" keyword is deprecated.
    var merkleHash = keccak256(txHash, sigs);
    ^------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:227:5: Warning: Use of the "var" keyword is deprecated.
    var txList = txBytes.toRLPItem().toList(11);
    ^--------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/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/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Auth.sol:20:5: Warning: Invoking events without "emit" prefixis deprecated.
    LogSetOwner(msg.sender);
    ^---------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Auth.sol:28:5: Warning: Invoking events without "emit" prefixis deprecated.
    LogSetOwner(owner);
    ^----------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Auth.sol:36:5: Warning: Invoking events without "emit" prefixis deprecated.
    LogSetAuthority(authority);
    ^------------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:412:17: Warning: The use of labels is deprecated. Please use "if", "switch", "for" or function calls instead.
                tag_loop:
                ^------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:412:17: Warning: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
                tag_loop:
                ^------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:413:21: Warning: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
                    jumpi(end, eq(i, words))
                    ^----------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:419:21: Warning: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
                    jump(tag_loop)
                    ^------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:420:17: Warning: The use of labels is deprecated. Please use "if", "switch", "for" or function calls instead.
                end:
                ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:420:17: Warning: Jump instructions and labels are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using "switch", "if" or "for" statements instead.
                end:
                ^-^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:97:5: Warning: Invoking events without "emit" prefix is deprecated.
    Deposit(msg.sender, msg.value, depositBlock);
    ^------------------------------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:150:5: Warning: Invoking events without "emit" prefix is deprecated.
    Exit(exitor, utxoPos);
    ^-------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Validate.sol:12:58: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function checkSigs(bytes32 txHash, bytes32 rootHash, uint256 blknum1, uint256 blknum2, bytes sigs)
                                                         ^-------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:140:5: Warning: Unused local variable.
    uint256 oindex = utxoPos - blknum * 1000000000 - txindex * 10000;
    ^------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:50:5: Warning: Function state mutability can be restricted to pure
    function hasNext(Iterator memory self) internal constant returns (bool) {
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:60:5: Warning: Function state mutability can be restricted to pure
    function toRLPItem(bytes memory self) internal constant returns (RLPItem memory) {
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:93:5: Warning: Function state mutability can be restricted to pure
    function isNull(RLPItem memory self) internal constant returns (bool ret) {
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:100:5: Warning: Function state mutability can be restricted to pure
    function isList(RLPItem memory self) internal constant returns (bool ret) {
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:112:5: Warning: Function state mutability can be restricted to pure
    function isData(RLPItem memory self) internal constant returns (bool ret) {
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:316:5: Warning: Function state mutability can be restricted to pure
    function _payloadOffset(RLPItem memory self)
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:338:5: Warning: Function state mutability can be restricted to pure
    function _itemLength(uint memPtr)
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:413:21: Warning: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
                    jumpi(end, eq(i, words))
                    ^----------------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/RLP.sol:419:21: Warning: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
                    jump(tag_loop)
                    ^------------^
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Libraries/Validate.sol:12:5: Warning: Function state mutability can be restricted to pure
    function checkSigs(bytes32 txHash, bytes32 rootHash, uint256 blknum1, uint256 blknum2, bytes sigs)
    ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:223:3: Warning: Function state mutability can be restricted toview
  function getUtxoPos(bytes txBytes, uint256 oIndex)
  ^ (Relevant source part starts here and spans across multiple lines).
,/Users/user/projects/8base/plasma-mvp/packages/root-chain/contracts/Main.sol:244:3: Warning: Function state mutability can be restricted topure
  function testCall() public returns (uint8) {
  ^ (Relevant source part starts here and spans across multiple lines).

Gathering transaction data...

redux-saga error: uncaught at session.saga
at session.saga
 at recordInstance
 TypeError: Cannot read property 'context' of null
    at Object.addInstance$ (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:5533:1)
    at tryCatch (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:62:15)
    at Generator.invoke [as _invoke] (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:296:1)
    at Generator.prototype.(anonymous function) [as next] (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:114:1)
    at tryCatch (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:62:15)
    at maybeInvokeDelegate (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:358:1)
    at Generator.invoke [as _invoke] (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:270:1)
    at Generator.prototype.(anonymous function) [as next] (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:114:1)
    at next (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:311:1)
    at currCb (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at runSelectEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:699:1)
    at runEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at next (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:315:1)
    at proc (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:270:1)
    at resolveIterator (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:456:1)
    at runCallEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:517:1)
    at runEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at /Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:644:1
    at Array.forEach (<anonymous>)
    at runAllEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:643:1)
    at runEffect (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at next (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:315:1)
    at currCb (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at checkEffectEnd (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:612:1)
    at chCbAtKey (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:627:1)
    at Object.currCb [as cb] (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at /Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:358:1
    at Array.forEach (<anonymous>)
    at end (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:357:1)
    at Object.task.cont (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:99:1)
    at next (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:321:1)
    at currCb (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at takeCb (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:466:1)
    at Object.put (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:73:1)
gnidan commented 6 years ago

@andrei-anisimov Try doing truffle migrate --reset --compile-all. Your contracts may have been compiled with two different solc versions. Let me know if that doesn't fix it!

andr11111 commented 6 years ago

@gnidan I tried this multiple times. What's interesting is that debugging for some method calls work fine, while don't work for that specific method. I'll investigate more.

gnidan commented 6 years ago

OK I'll reopen this. Let me know what you find!

cryptomental commented 6 years ago

Hi I encounter the same as @andrei-anisimov , Truffle 4.1.8 , executed truffle migrate --reset --compile-all and then:

truffle(coverage)> debug 0x82f724212e1b1ad2c7541e6fc8d43ec815ac40bfae7c59d743310e5aceb25a27
Compiling ./contracts/Creatable.sol...
Compiling ./contracts/Linkable.sol...
Compiling ./contracts/MarketCollateralPool.sol...
Compiling ./contracts/MarketContract.sol...
Compiling ./contracts/MarketContractRegistry.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/libraries/MathLib.sol...
Compiling ./contracts/libraries/OrderLib.sol...
Compiling ./contracts/oraclize/MarketContractOraclize.sol...
Compiling ./contracts/oraclize/OraclizeQueryTest.sol...
Compiling ./contracts/oraclize/TestableMarketContractOraclize.sol...
Compiling ./contracts/oraclize/oraclizeAPI.sol...
Compiling ./contracts/tokens/CollateralToken.sol...
Compiling ./contracts/tokens/MarketToken.sol...
Compiling ./contracts/tokens/UpgradableToken.sol...
Compiling ./contracts/tokens/UpgradeableTarget.sol...
Compiling ./contracts/tokens/UpgradeableTokenMock.sol...
Compiling openzeppelin-solidity/contracts/math/SafeMath.sol...
Compiling openzeppelin-solidity/contracts/ownership/Ownable.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol...
Compiling openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol...

Compilation warnings encountered:

openzeppelin-solidity/contracts/ownership/Ownable.sol:20:3: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
  function Ownable() public {
  ^ (Relevant source part starts here and spans across multiple lines).
,/app/contracts/oraclize/oraclizeAPI.sol:116:5: Warning: Function state mutability can be restricted to pure
    function __callback(bytes32 myid, string result, bytes proof) public {
    ^ (Relevant source part starts here and spans across multiple lines).

Gathering transaction data...

redux-saga error: uncaught at session.saga
at session.saga 
 at recordInstance 
 TypeError: Cannot read property 'context' of null
    at Object.addInstance$ (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-debugger/dist/debugger.js:5533:1)
    at tryCatch (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:62:15)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:296:1)
    at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:114:1)
    at tryCatch (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:62:15)
    at maybeInvokeDelegate (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:358:1)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:270:1)
    at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/truffle/build/webpack:/~/regenerator-runtime/runtime.js:114:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:311:1)
    at currCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at runSelectEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:699:1)
    at runEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:315:1)
    at proc (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:270:1)
    at resolveIterator (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:456:1)
    at runCallEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:517:1)
    at runEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:644:1
    at Array.forEach (<anonymous>)
    at runAllEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:643:1)
    at runEffect (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:435:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:315:1)
    at currCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at checkEffectEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:612:1)
    at chCbAtKey (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:627:1)
    at Object.currCb [as cb] (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:358:1
    at Array.forEach (<anonymous>)
    at end (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:357:1)
    at Object.task.cont (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:99:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:321:1)
    at currCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:388:1)
    at takeCb (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/proc.js:466:1)
    at Object.put (/usr/local/lib/node_modules/truffle/build/webpack:/~/redux-saga/es/internal/channel.js:73:1)
rhlsthrm commented 6 years ago

Getting the same error: TypeError: Cannot read property 'context' of null when trying to debug.

etnann commented 6 years ago

Hi, I'm getting this TypeError: Cannot read property 'context' of null error too while I'm trying to instantiate a new Debugger object. Here there is a snippet of my code ( which is similar to this ).


if (this.debuggerConfig == null){
let options = ['.', '.', 'development'];
var config = new Config(...options);

var [contracts, files] = await this.compileContract(config);

// from: https://github.com/ethereum/web3.js/issues/1119
Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send;
this.debuggerConfig = {
  provider: new Web3.providers.HttpProvider("http://localhost:8545"),
  files: files,
  contracts: Object.keys(contracts).map(function(name) {
    var contract = contracts[name];
    return {
      contractName: contract.contractName || contract.contract_name,
      source: contract.source,
      sourcePath: contract.sourcePath,
      ast: contract.ast,
      binary: contract.binary || contract.bytecode,
      sourceMap: contract.sourceMap,
      deployedBinary: contract.deployedBinary || contract.deployedBytecode,
      deployedSourceMap: contract.deployedSourceMap
    };
  })
};  
}

// Create a new debugger instance given the txHash and initialize the session
const bugger = await Debugger.forTx(txHash, this.debuggerConfig);
const session = await bugger.connect();

I have no problem if I run the debbuger from command line (truffle debug <txHash>).

Truffle v4.1.8 (core: 4.1.8)

gnidan commented 6 years ago

@etnann are you using Web3 1.0?

Could you show me what files looks like?

etnann commented 6 years ago

@gnidan Yes, the latest available on npm (1.0.0-beta.34).

I attached a debugger, the variable files is a an array of strings. Contains two strings

contracts/BecToken.sol
contracts/Migrations.sol

Here you can see some of the variables before the call Debugger.forTx image

The variable contracts is generated calling the compile.all method in truffle-compile. I've updated the comment https://github.com/trufflesuite/truffle-debugger/issues/64#issuecomment-391667530 with the few lines on top of the existing code (compileContract is a wrapping of the function compile.all inside a Promise).

etnann commented 6 years ago

I've re-written my code so that contracts list is generated from the artifacts in the build directory instead of re-compiling again from the solidity source. Then, I've also omitted the field files. Now it is working and I'm able to instantiate from the Debugger class. :confused: