Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Cyril Lapinte
    @sirhill
    Furthermore, I've just found a regression in 0.7.10.
    TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
        at /home/node/project/node_modules/truffle/build/webpack:/packages/workflow-compile/utils.js:34:1
        at new Promise (<anonymous>)
        at /home/node/project/node_modules/truffle/build/webpack:/packages/workflow-compile/utils.js:27:1
        at /home/node/project/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:101:1
        at Array.map (<anonymous>)
        at Object.compileSources (/home/node/project/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:91:1)
        at Object.compile (/home/node/project/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:54:1)
        at plugin (/home/node/project/node_modules/solidity-coverage/plugins/truffle.plugin.js:101:29)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
    Cyril Lapinte
    @sirhill

    I don't know how much it can help, but in anycase, my truffle version is
    Truffle v5.1.45 (core: 5.1.45)
    Solidity - 0.6.6 (solc-js)
    Node v12.18.4
    Web3.js v1.2.1

    It broken when I migrated from 0.7.4 to 0.7.10.
    Further tests I did show that it also breaking when I update other key packages to newer version.
    It breaks only for coverage. Tests do continue to works fine.

    Cyril Lapinte
    @sirhill

    Apparently, simply recreating the package lock file is suffiicient to break.
    Outside being up-to-date, I've no critical reason to upgrade at this point.

    If I need to upgrade then I would have to drop solidity-coverage (that would be a pity!).

    Abhishek Vispute
    @abhishekvispute

    Hey Hi
    Its really awesome module
    Kudos to you guys

    I have a little query.
    Though I am mentioning no of accounts explicitly in .solcover.js as 21.
    Only 10 accounts are getting created.
    Cam you please help me here

    Thanks!

    cgewecke
    @cgewecke
    @abhishekvispute Could you show what your .solcover.js looks like?
    One quirk of ganache is that the options for ganache-cli have a different format than those of ganache-core (which solidity-coverage uses to launch an in-process server)...
    The ganache-core option for number of accounts is called total_accounts
    Abhishek Vispute
    @abhishekvispute
    image.png
    Hey Hi @cgewecke
    Here it is
    Abhishek Vispute
    @abhishekvispute
    image.png
    Sorted @cgewecke
    I was using v0.7.12 and was seeing docs of v0.6 :)
    Abhishek Vispute
    @abhishekvispute
    Thanks, man
    cgewecke
    @cgewecke
    :thumbsup:
    Abhishek Vispute
    @abhishekvispute

    Hey hi guys,
    When running coverage , some tests are failing with this

    ProviderError:
    Could not connect to your Ethereum client with the following parameters:

    - host       > 127.0.0.1
    - port       > 8555
    - network_id > *

    Please check that your Ethereum client:

    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

    Please let me know how we can solve it ?

    cgewecke
    @cgewecke
    Hi @abhishekvispute. This looks like an instance of a bug recently fixed at Truffle - see this comment: https://github.com/trufflesuite/truffle/issues/2688#issuecomment-736639231
    You should be able to resolve by setting disableConfirmationListener: true in whatever network you use to run your tests.
    And you can tell solidity-coverage to use a user-defined network via the cli with --network <network-name>
    Abhishek Vispute
    @abhishekvispute
    Thanks, man, Error Solved
    You are god, whenever I search for any issue, you are there... always :)
    Happy Holidays
    Zer0dot
    @Zer0dot
    Hey guys!
    Quick question, I'm running solidity coverage with hardhat. When I execute an rpc call to hardhat to reset my fork, it pretty much invalidates my coverage.
    Is there a way to reset forks in between test files without losing coverage?
    Zer0dot
    @Zer0dot
    My .solcover.js just has the fork and block number in the provider options
    Let me know if anyone's got a clue!
    Zer0dot
    @Zer0dot
    Nevermind got it!
    Just needed to switch from using hardhat_reset to evm_snapshot and evm_revert
    jo-es
    @jo-es
    Hi. Is it possible to combine reports from multiple test runs via solidity-coverage? I have some test which run locally via hardhat evm and some which run via hardhat mainnet forking.
    cgewecke
    @cgewecke

    @jo-es Yes, it's possible! There's a (rough draft) recipe of how do this in a Circle CI script here:

    https://github.com/SetProtocol/index-coop-smart-contracts/blob/3b1521d0212b82477bcc4a543adc3909025a9dd7/.circleci/config.yml#L80-L166

    That might be over-complicated for your use case ... the basic idea is that you copy the coverage.json file generated by each test run to a unique file name (coverage.json is saved in your project's root directory). Then use a cli utility called istanbul-combine-updated to merge the jsons in a final step.

    https://www.npmjs.com/package/istanbul-combine-updated?activeTab=readme

    jo-es
    @jo-es
    thanks! 🙏 I'm going to try that.
    julianlen
    @julianlen

    You should be able to resolve by setting disableConfirmationListener: true in whatever network you use to run your tests.
    And you can tell solidity-coverage to use a user-defined network via the cli with --network <network-name>

    Hi everyone! Regarding this answer, I'm trying to run solidity-coverage over RSK. So I run a node in regtest (a local network), and then npx truffle run coverage --network rsk but it throws:

    Error: Port 4444 is already in use.

    What am I doing wrong?

    cgewecke
    @cgewecke
    @julianlen solidity-coverage doesn't connect to arbitrary nodes ... it only works with ganache and HardhatEVM. It needs to hook into their JS evms to track the execution path of your code. I think you're seeing that error because the tool is trying to launch a ganache server instance on the port specified by your RSK network.
    julianlen
    @julianlen
    Ok, i got it. Thank you!
    Philipp
    @Azamous
    Does anyone know how to fork mainnet for truffle coverage?
    cgewecke
    @cgewecke
    @Azamous You can configure the ganache instance solidity-coverage uses via the providerOptions in .solcover.js. This accepts all the options ganache-core supports in the same format. There's more about this in the README, here: https://github.com/sc-forks/solidity-coverage#config-options
    Philipp
    @Azamous

    @Azamous You can configure the ganache instance solidity-coverage uses via the providerOptions in .solcover.js. This accepts all the options ganache-core supports in the same format. There's more about this in the README, here: https://github.com/sc-forks/solidity-coverage#config-options

    Thank you, tried this, but fork was not commited. I am specifying fork like this in ProviderOptions:{
    port: 8545,
    fork: "https://mainnet.infura.io/v3/INFURA_ID",
    network_id: 1,
    default_balance_ether: 10000
    }
    Can you say if i am doing it correctly? Thanks in advance

    cgewecke
    @cgewecke
    @David-Kneel Responding in the issue you opened...
    David-Kneel
    @David-Kneel

    @David-Kneel Responding in the issue you opened...

    Great, thank you!

    Majd Turfa
    @MajdT51_gitlab
    HI guys i have this probelm : I'm using the ganache desktop app run on 127.0.0.1:8545 . The Port is used by ganache app and i want to run the coverage test on ganache app
    image.png
    Abdul Sami
    @abdulsamijay
    Hey guys,
    It is stated in the solidity-coverage npm page that coverage tool does not compile solidity smart contracts with optimizer on. It is also an open issue. Did anyone ever encounter this issue before ? Is there a work around to this ?
    Need help thanks.
    Cesar Brazon
    @cbrzn
    Is this repository being actively maintained?
    I was wondering if you're planning on tackling sc-forks/solidity-coverage#652
    Danilo Tuler
    @tuler
    Hey, just want to confirm latest solidity-coverage is not compatible with latest hardhat. Any beta version or fork out there?
    ssi91
    @ssi91
    Hey! I've got an issue with the coverage in hardhat project.
    When I run test without coverage (just npx hardhat test) it works well. But coverage shows some runtime error like Error: Transaction reverted: function call to a non-contract account.
    No Idea where I need to dig though