Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to display events #3

Closed
sirhill opened this issue Mar 5, 2021 · 10 comments
Closed

Unable to display events #3

sirhill opened this issue Mar 5, 2021 · 10 comments

Comments

@sirhill
Copy link

sirhill commented Mar 5, 2021

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?

@sirhill
Copy link
Author

sirhill commented Mar 5, 2021

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

@zemse
Copy link
Owner

zemse commented Mar 5, 2021

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).

@sirhill
Copy link
Author

sirhill commented Mar 5, 2021

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)

@sirhill
Copy link
Author

sirhill commented Mar 5, 2021

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

require('hardhat-gas-reporter');

zemse added a commit that referenced this issue Mar 6, 2021
@zemse
Copy link
Owner

zemse commented Mar 6, 2021

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 [email protected]

@zemse
Copy link
Owner

zemse commented Mar 6, 2021

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

@sirhill
Copy link
Author

sirhill commented Mar 8, 2021

The latest version of hardhat-tracer fixed the duplicates.

Yes, there is a conflict when using both.

@cgewecke
Copy link

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.

zemse added a commit that referenced this issue Mar 23, 2021
This commit replaces the hacky way of provider method overrides with
hardhat's ProviderWrapper.
@zemse
Copy link
Owner

zemse commented Mar 23, 2021

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 [email protected]? Let me know if this works

@sirhill
Copy link
Author

sirhill commented Mar 24, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants