Open makoto opened 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.
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.
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)
OK I am able to reproduce this issue. Will hopefully figure out what's going wrong soon.
@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!
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
Glad to hear that @makoto!
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";
@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
Closing this, released in v4.1.8. Thanks for raising this!
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)
@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!
@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.
OK I'll reopen this. Let me know what you find!
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)
Getting the same error: TypeError: Cannot read property 'context' of null
when trying to debug.
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)
@etnann are you using Web3 1.0?
Could you show me what files
looks like?
@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
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).
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:
Hi, I just installed the latest ganache/truffle and try to debug transactions against metacoin but failing with the error.
Environment
Ganache logs
Truffle logs