0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 466 forks source link

sol-coverage: Cannot create property 'status' on string #2119

Closed PaulRBerg closed 4 years ago

PaulRBerg commented 5 years ago

Expected Behavior

Coverage should work fine in a truffle project configured by following the dev-tools-truffle-example.

Current Behavior

Getting this error:

TypeError: Cannot create property 'status' on string '0x7103bbaf3441edf16492c537c4a259419513f6f0cf0b65467f9114660ce05deb'
    at Web3Wrapper.<anonymous> (/Users/paulrberg/Projects/Sablier/Sablier/node_modules/@0x/web3-wrapper/src/web3_wrapper.ts:227:41)
    at step (/Users/paulrberg/Projects/Sablier/Sablier/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:43:23)
    at Object.next (/Users/paulrberg/Projects/Sablier/Sablier/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:24:53)
    at fulfilled (/Users/paulrberg/Projects/Sablier/Sablier/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:15:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)

As per https://github.com/trufflesuite/truffle/issues/2355, I'm also getting these warnings:

Unable to find matching bytecode for contract creation 0x6080604052348015...7469616c697a6564, please check your artifacts. Ignoring...

But I suspect they shouldn't have anything to do with this issue.

Possible Solution

Figure out what's wrong with the transactionReceiptRpc object in the web3_wrapper package.

Steps to Reproduce (for bugs)

1. git clone git@github.com:sablierhq/sablier.git
2. yarn install
3. yarn build
4. cd packages/protocol
5. yarn coverage

Your Environment

Package Version
ganache-cli 6.5.1
sol-compiler 3.1.13
solidity 0.5.10
truffle 5.0.34
PaulRBerg commented 5 years ago

I built the web3-wrappers package locally and added a check if transactionReceiptRpc is a string, retrieve it a second time.

{ transactionReceiptRpc:
   '0xbdf9fbe740c493d862c16683c505b376d53930a92fd105eac096d1fb286efae3' }
typeof transactionReceiptRpc string
{ secondTransactionReceiptRpc:
   { transactionHash:
      '0x4279df2873a38b2f723b673ab718b54fd89a9370ee776c43506b3e71497a6fc0',
     transactionIndex: '0x0',
     blockHash:
      '0x78ba41aac17910efadbc348ab4cc3c4f09552957ee4b92024870305304760123',
     blockNumber: '0x383',
     from: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1',
     to: null,
     gasUsed: '0x2c3d8b',
     cumulativeGasUsed: '0x2c3d8b',
     contractAddress: '0x2eade8baa5dfb5415ae4dbc203ea77ad22851133',
     logs: [ [Object] ],
     status: '0x1',
     logsBloom:
      '0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000080200000000000000000000000000000000000000000001000000000000000000000000000000005000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000800000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000',
     v: '0x1b',
     r:
      '0xfb0aa428a9d3a69643ba57528c5cfac0072cd87025712239a13530d3c90fbb2b',
     s:
      '0x68892ae01cbfe4624844b77d398b50b4cd67760cf43e65dc631e327d8146a924' } }
typeof secondTransactionReceiptRpc object

It seems the value is correct then. I am not sure if this is an issue with ganache or web3-wrappers though.

davidmurdoch commented 5 years ago

I've checked ganache-cli's behavior here by running your reproduction steps and an eth_getTransactionReceipt request for the failing hash is never received, so I don't think it's a ganache problem (could still be wrong). Please do @ me if this does end up being traced back to ganache somehow.

PaulRBerg commented 5 years ago

Many thanks @davidmurdoch! So you got a warning similar to this one:

TypeError: Cannot create property 'status' on string '0x2891e5d00a386caeafe4a35f269e2e76bc93436228cb97b06b5b6918dc31d350'
    at Web3Wrapper.<anonymous> (/Users/paulrberg/Documents/Pad/0x-monorepo/packages/web3-wrapper/src/web3_wrapper.ts:237:41)
    at step (/Users/paulrberg/Documents/Pad/0x-monorepo/packages/web3-wrapper/lib/src/web3_wrapper.js:43:23)
    at Object.next (/Users/paulrberg/Documents/Pad/0x-monorepo/packages/web3-wrapper/lib/src/web3_wrapper.js:24:53)
    at fulfilled (/Users/paulrberg/Documents/Pad/0x-monorepo/packages/web3-wrapper/lib/src/web3_wrapper.js:15:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)

?

davidmurdoch commented 5 years ago

Yes, I get the same error.

If you modify the test script (or start ganache-cli on port 8545 yourself) you can pass --seed deterministic as a start up parameter and you'll get the same transaction hash every time, which might make it a little easier to debug.

PaulRBerg commented 5 years ago

I've always been using ganache-cli with the deterministic seed, but the hash is different. It seems I'm facing a Heisenbug.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you for your contributions.