zemse / hardhat-tracer

🕵️ allows you to see internal calls, events and storage operations in the console

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to display events

sirhill opened this issue · comments

As describe in the README, I've :

  • installed the plugin
  • added the require in the hardhat.config.js
  • I run the test using npx hardhat test --logs

The tests starts but not events is displayed on successful or unsuccessful testcases.
The option --logs is therefore recognized.

What can I do or what should I look to investigate further?

If there is a working sandbox project, I would love to run it to compare both setup (maybe depencencies) ?

 "devDependencies": {
    "@nomiclabs/hardhat-solhint": "^2.0.0",
    "@nomiclabs/hardhat-truffle5": "^2.0.0",
    "@nomiclabs/hardhat-web3": "^2.0.0",
    "chai": "^4.3.0",
    "eslint": "^6.5.1",
    "eslint-config-standard": "^14.1.1",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-mocha-no-only": "^1.1.0",
    "eslint-plugin-node": "^10.0.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "eth-sig-util": "^3.0.0",
    "ethereumjs-util": "^7.0.7",
    "ethereumjs-wallet": "^1.0.1",
    "hardhat": "^2.0.11",
    "hardhat-gas-reporter": "^1.0.4",
    "hardhat-tracer": "^1.0.0-alpha.1",
    "lodash.startcase": "^4.4.0",
    "lodash.zip": "^4.2.0",
    "micromatch": "^4.0.2",
    "mocha": "^8.0.1",
    "solhint": "^3.2.0",
    "solidity-coverage": "^0.7.11",
    "solidity-docgen": "^0.5.3",
    "web3": "^1.3.4"
  }

Also my project is a monorepo : https://github.com/c-layer/contracts

commented

As a working project, you can checkout my fork of a popular solidity project template. In the commit, you can see that just installed the npm package, added to hardhat-config and added a sample event in solidity code.

Can you commit your code to a temporary branch of your repo, so that I can try to look if I can find any solutions.

Also if you can once try the sample repo and try to add hardhat-tracer to it? If it works in that, it will rule out any possible platform issue (Windows/Linux/macOS).

Using the project template, I am able to make to log the events (in particular using truffle tests and javascript).
I have to dig deeper to see exactly what left differs.

Some of the events were weird. The following is supposed to be ERC20.Transfer:

0xdc64a140aa3e981100a9beca4e685f962f0cf6c9 Transfer(from=0x0000000000000000000000000000000000000000, to=[Sender / Sender / Sender / Sender / Sender / Sender / Sender], value=0.000000000001)
0x5fc8d32690cc91d4c39d9d3abcbd16989f875707 Transfer(from=0x0000000000000000000000000000000000000000, to=[Sender / Sender / Sender / Sender / Sender / Sender / Sender], value=0.000000000001)
0x0165878a594ca255338adfa4d48449f69242eb8f Transfer(from=0x0000000000000000000000000000000000000000, to=[Sender / Sender / Sender / Sender / Sender / Sender / Sender], value=1000000.0)

Any clue why there are so many "Sender" tag displayed for the "to" field ?

Some recipient are however correctly set:


0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6 Transfer(from=0x0000000000000000000000000000000000000000, to=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6, value=0.0)
0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6 Transfer(from=0x0000000000000000000000000000000000000000, to=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6, value=0.0)

Found.
It's the following command in my hardhat.config.js which breaks the logs:

require('hardhat-gas-reporter');
commented

Any clue why there are so many "Sender" tag displayed for the "to" field ?

There was a problem, just tried to fix it. Can you try that? yarn add hardhat-tracer@1.0.0-alpha.2

commented

Did you mean that hardhat-gas-reporter + hardhat-tracer causes conflicts when used together?

The latest version of hardhat-tracer fixed the duplicates.

Yes, there is a conflict when using both.

Hi @zemse :)

Fwiw, the gas reporter tries to copy the way HH wraps it's own provider implementations.

It extends their WrappedProvider class. And wraps that provider as one of their BackwardCompatibilityProviders.

Have no idea what I'm doing tbh but this approach might make plugins that read directly off the provider mutually compatible.

commented

Hi @cgewecke, sorry for the long delay, I was stuck in college exams. Thank you for the info! It helped to fix the problem :)

@sirhill Can you try the latest version hardhat-tracer@1.0.0-alpha.3? Let me know if this works

It's working perfectly now.
Thanks a lot @zemse for the fix!