Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Célio Rodrigues
    @celioggr
    @cgewecke I see...thanks for the link, that explains a lot!! What kind of options do I have here? removing oz-test-environment out of the equation and let "truffle test" do its thing with solidity-coverage? never tried that way
    cgewecke
    @cgewecke
    @celioggr oz-test-environment and Truffle are different...to use Truffle you'd have to modify all the tests to use their contract loading mechanism, e.g: const Token = artifacts.require('Token')
    You might ping OZ and ask them if they have any early work done on their coverage setup and offer to battle test it..idk whether there's work open in a branch over there or not.
    Adrian Li
    @adrianmcli

    @cgewecke Is there any support for people who aren't using Truffle/Buidler at all? I actually just run my own Ganache instance, use Truffle to compile/migrate, and then use Jest as my test-runner.

    How would I configure my setup to be "coverage-enabled"?

    Adrian Li
    @adrianmcli
    I see some relevant discussions here: OpenZeppelin/openzeppelin-test-environment#21
    cgewecke
    @cgewecke
    @adrianmcli Yes, there's an API and an example of a setup using jest at dydx which has a custom script written with it. (Basically a modified version of the script that drives the truffle plugin).
    Adrian Li
    @adrianmcli
    awesome, thanks @cgewecke
    Travis Mathis
    @travisdmathis

    morning, i'm trying to run coverage against my tests and getting a runtimeerror

     1) PanDAO Contract Network
           "before each" hook:
         Uncaught RuntimeError: abort(Error: Method [object Object] not supported.). Build with -s ASSERTIONS=1 for more info.
          at process.abort (.coverage_cache/compilers/soljson-v0.6.6+commit.6c089d02.js:1:14382)
          at process.emit (node_modules/@nomiclabs/buidler/node_modules/source-map-support/source-map-support.js:495:21)
          at process.emit (node_modules/ganache-cli/node_modules/source-map-support/source-map-support.js:465:21)
          at process.object.process.function.process.on.process.emit (node_modules/ganache-cli/build/ganache-core.node.cli.js:37:31967)
          at process.emit (node_modules/source-map-support/source-map-support.js:465:21)
          at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
          at process._tickCallback (internal/process/next_tick.js:69:34)
    beforeEach(async () => {
        [agent, address1, address2] = await bre.getSigners();
    
        await deployments.fixture();
    
        // setup needed contracts
        Manager = await deployments.get("Manager");
        manager = new ethers.Contract(Manager.address, Manager.abi, agent);
    
        EternalStorage = await deployments.get("EternalStorage");
        eternalStorage = new ethers.Contract(
          EternalStorage.address,
          EternalStorage.abi,
          agent
        );
    
        MockToken = await bre.getContractFactory("Token");
        mockToken = await MockToken.deploy();
        await mockToken.deployed();
      });

    however tests pass fine when just running tests;

    All contracts have already been compiled, skipping compilation.
    
    
      PanDAO Contract Network
        Manager Contract
          ✓ Manager is stored in EternalStorage
          ✓ Can get contract address by contract name
          ✓ Agent owns deployed Manager contract
          ✓ Can create an Insurance Pool if it doesn't exist (442ms)
          ✓ Fails to create Insurance Pool if it already exists (269ms)
          ✓ Fails to create an Insurance Pool if not Agent
    
    
      6 passing (2s)
    solidity-coverage 0.7.5
    luongnt95
    @luongnt95
    hi guys!
    this is my config in .solcover.js
    module.exports = {
      providerOptions: {
        allowUnlimetedContractSize: true,
        gasLimit: 0xfffffffffff,
        logger: console,
        port: 9545,
        fork: MAINNET_NODE_URL,
        network_id: 1,
        unlocked_accounts: [
          '0xd8f8a53945bcfbbc19da162aa405e662ef71c40d', // MLN whale
          '0x3eb01b3391ea15ce752d01cf3d3f09dec596f650', // KNC whale
          '0xa57bd00134b2850b2a1c55860c9e9ea100fdd6cf', // ZRX reserve operator
          '0xBE0eB53F46cd790Cd13851d5EFf43D12404d33E8', // ZRX whale
          '0x7D3455421BbC5Ed534a83c88FD80387dc8271392', // ZRX Governor contract
        ],
        default_balance_ether: startingBalance,
        accounts: [ // TODO: is this array redundant?
          {
            secretKey: PRIV_KEY_1,
            balance: startingBalance,
          }, {
            secretKey: PRIV_KEY_2,
            balance: startingBalance,
          }, {
            secretKey: PRIV_KEY_3,
            balance: startingBalance,
          },
        ],
        }
    };
    luongnt95
    @luongnt95
    and i got this error:
    Error:  *** Deployment Failed ***
    
    "EngineAdapter" ran out of gas (using a value you set in your network config or deployment parameters.)
       * Block limit:  17592186044415 (0xfffffffffff)
       * Gas sent:     17592186044415 (0xfffffffffff)
    
        at ./node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1
        at process._tickCallback (internal/process/next_tick.js:68:7)
    Truffle v5.1.25 (core: 5.1.25)
    Node v10.18.1
    i'm using forked chain for my tests and and they all work fine but when i use sol-coverage i can't deploy my contracts with above errors even with 2 options in my .solcover.js config:
    allowUnlimetedContractSize: true,
    gasLimit: 0xfffffffffff,
    @cgewecke Could you please investigate this issue?
    cgewecke
    @cgewecke
    @luongnt95 This might have to do with using the fork option and the way Truffle maps accounts in the migrations. Can you see if adding default_balance_ether: 10000000 to the providerOptions in solcover.js makes any difference?
    Can you also try removing the gasLimit param altogether? solidity-coverage sets that to an appropriate value automatically.
    @luongnt95 Is your project open-source? If it's on github and neither of those work I could take a look.
    luongnt95
    @luongnt95
    @cgewecke i removed all the config that you mentioned and it makes no difference
    It's an open-source project. You can look at it here: https://github.com/melonproject/protocol/tree/chore/solidity-coverage
    cgewecke
    @cgewecke
    @luongnt95 Ah ok, I see. Your project is very differently organized than the typical Truffle project. I will take a look today...
    cgewecke
    @cgewecke
    @luongnt95 I looked and tbh it's really complicated. The part of your coverage script which shell execs truffle is not really going to work. If you have run your tests against a forked ganache I think you will need to do a bunch of work using truffle deployment modules programatically. I'm sorry.
    I tried to run the tests via mainnet infura but it just hangs after compilation (before deployment).
    cgewecke
    @cgewecke
    You've labeled the build_directory in your Truffle config out rather than build. So temp should be out as well.
    Cyril Lapinte
    @sirhill
    Hello, I am looking to set up a monorepo directory with solidity-coverage and got the following error: solidity-coverage listed as a plugin, but not found in global or local node modules
    Is there some options to let truffle lookup what's needed in the workspace node_modules rather than the module's one ?
    I think, I've found the reason why: -) ... It's a truffle plugin issue as referenced here: trufflesuite/truffle#2409
    Cyril Lapinte
    @sirhill
    Btw, if someone else ask the same question. Adding a symlink in the submodule node_modules directory solve the issue. I've commented truffle issue about it.
    cgewecke
    @cgewecke
    Thanks @sirhill!
    Célio Rodrigues
    @celioggr
    Does instrumentation works for solidity versions like 0.4.15?
    I'm geeting this error when trying to run coverage on a contract
     ParserError: Expected token LBrace got reserved keyword 'Pure'
    function coverage_0x294213b5(bytes32 c__0x294213b5) public pure {}
    cgewecke
    @cgewecke
    @celioggr Ah yes, that looks like its a problem. Are you able to use 0.4.16? That's when the pure keyword was introduced.
    Célio Rodrigues
    @celioggr
    yep! when changing the contract to solidity 0.4.16
    is there a minimum version supported?
    cgewecke
    @cgewecke
    @celioggr I guess there is at the moment (I wasn't aware of this, sorry) I will update the docs and perhaps if there is demand for supporting a lower pragma we could investigate how to support it.
    Elena Gesheva
    @elenadimitrova
    @cgewecke heya :wave: Just pinging you here before I log an issue as it maybe that you haven’t yet started catering for Solidity 0.6 features but atm transfer call to instrumented receive fallback function fails as it probably exceeds the trasnfer call gas stipend.
    I remember there was a similar issue back in the day with the 0.5 style fallback function that you had to fix
    cgewecke
    @cgewecke
    @elenadimitrova Ah ok, we have a test for that but it uses solc 0.5.x. Will investigate. Thanks!
    Elena Gesheva
    @elenadimitrova
    Thanks @cgewecke Logged it here sc-forks/solidity-coverage#516
    ameesha agrawal
    @ameesha12_gitlab
    Error: TypeError: Cannot convert undefined or null to object
        at Object.compile (/home/Desktop/smart-contracts/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:80:1)
    Truffle v5.1.10 (core: 5.1.10)
    Node v10.16.0
    I am getting this error with solidity-coverage
    truffle test is working fine
    Muhammad Yahya
    @m-yahya

    Hello everyone, I'm trying to install the solidity-coverage package by using the command npm install --save-dev solidity-coverage on Windows 10 with Node 12.
    However, I'm getting the following error:

    C:\Users\jan\dApp-nodeJS-webpack\app>npm install --save-dev solidity-coverage
    npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    npm ERR! code ENOENT
    npm ERR! syscall spawn git
    npm ERR! path git
    npm ERR! errno ENOENT
    npm ERR! enoent Error while executing:
    npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/web3-js/WebSocket-Node.git
    npm ERR! enoent
    npm ERR! enoent
    npm ERR! enoent spawn git ENOENT
    npm ERR! enoent This is related to npm not being able to find a file.
    npm ERR! enoent
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\jan\AppData\Roaming\npm-cache\_logs\2020-08-04T08_08_54_546Z-debug.log

    Steps to reproduce:

    1. Create a new empty directroy app and init npm project there
    2. run the command npm install --save-dev solidity-coverage

    I'm on Windows 10 with Node 12.
    Any help to fix the issue?
    many thanks

    JoeBlack220
    @JoeBlack220
    Hi guys, I am wondering whether I can run solidity-coverage to an external ganache instance, instead of letting it set things all up for me?
    1 reply
    ameesha agrawal
    @ameesha12_gitlab
    Yes, you can use fork option inside solcover file
    Rushikesh Acharya
    @acharyarushikesh-hspl
    @ameesha12_gitlab Can you please tell me how do I run solidity-coverage to an external ganache instance?
    Juan Castellon
    @Juan-cc
    Hi! Is it ok to receive a negative value as a result for .estimateGas() when the function that was called reverts? Or this would be an issue to report/fix? Thanks!