Using version 0.4.15 which fixed https://github.com/sc-forks/solidity-coverage/issues/208 we are still getting the TypeError: Event invocations have to be prefixed by "emit" error. This is the case only for contracts that are used from outside the contracts folder, e.g. imported git submodules in our case from the dappsys library
,/coverageEnv/contracts/Authority.sol:35:46: TypeError: Event invocations have to be prefixed by "emit".
function Authority(address colony) public {__FunctionCoverageAuthority('/contracts/Authority.sol',1);
^---------------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:37:1: TypeError: Event invocations have to be prefixed by "emit".
__CoverageAuthority('/contracts/Authority.sol',30);
^--------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:38:6: TypeError: Event invocations have to be prefixed by "emit".
__StatementCoverageAuthority('/contracts/Authority.sol',1);
^----------------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:40:1: TypeError: Event invocations have to be prefixed by "emit".
__CoverageAuthority('contracts/Authority.sol',31);
^--------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:41:6: TypeError: Event invocations have to be prefixed by "emit".
__StatementCoverageAuthority('/contracts/Authority.sol',2);
^----------------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:43:1: TypeError: Event invocations have to be prefixed by "emit".
__CoverageAuthority('/contracts/Authority.sol',32);
^--------------------------------------------------------------------------^
,/coverageEnv/contracts/Authority.sol:44:6: TypeError: Event invocations have to be prefixed by "emit".
__StatementCoverageAuthority('/contracts/Authority.sol',3);
^-------------------------------------------Cleaning up...
Update: I tried narrowing this down further by moving the imported contracts within the contracts folder and started getting the error message from the underlying contract which Authority.sol above is based on
,/contracts/dappsys/auth.sol:40:31: Warning: Invoking events without "emit" prefix is deprecated.
function DSAuth() public {__FunctionCoverageDSAuthority('/Users/Elena/colonyNetwork/contracts/dappsys/auth.sol',1);
^--------------------------------------------------------------------------------------^
,/contracts/dappsys/auth.sol:42:1: Warning: Invoking events without "emit" prefix is deprecated.
__CoverageDSAuthority('/Users/Elena/colonyNetwork/contracts/dappsys/auth.sol',29);
^-------------------------------------------------------------------------------^
,/coverageEnv/contracts/dappsys/auth.sol:43:10: Warning: Invoking events without "emit" prefix is deprecated.
__StatementCoverageDSAuthority('/Users/Elena/colonyNetwork/contracts/dappsys/auth.sol',1);
^---------------------------------------------------------------------------------------^
,/contracts/dappsys/auth.sol:46:1: Warning: Invoking events without "emit" prefix is deprecated.
LogSetOwner(msg.sender);
^---------------------^
,/coverageEnv/contracts/dappsys/auth.sol:52:6: Warning: Invoking events without "emit" prefix is deprecated.
{__FunctionCoverageDSAuthority('/Users/Elena/colonyNetwork/contracts/dappsys/auth.sol',2);
^--------------------------------------------------------------------------------------^
,/coverageEnv/contracts/dappsys/auth.sol:54:1: Warning: Invoking evCleaning up...
@elenadimitrova Thanks!
The warnings make sense (and there could be thousands which is bad), but I don't understand the errors. The dappsys contracts float on ^0.4.13 and the 0.4.21 solc release notes say:
Support and recommend using emit EventName();
It's as if they're being compiled at a higher pragma than 0.4.21. This problem is surfacing because coverage injects events where none exist in the normal tests, but coverage doesn't actually manage compilation so this should be reproducible in Truffle separately. Will look at that today.
To fix the warnings (and this should fix the errors too) we'll have to prefix all the instrumentation events with emit. That will be a breaking change. Will try to get this in this week.
@elenadimitrova Short update: have started this but there are some small complications with prefixing the instrumentation events - will need to do some work on the parser and test the solution a bit. Will be a few more days unfortunately.
@elenadimitrova Does 0.5.0 fix this?
Indeed it does, thanks @cgewecke !
Most helpful comment
@elenadimitrova Thanks!
The warnings make sense (and there could be thousands which is bad), but I don't understand the errors. The dappsys contracts float on ^0.4.13 and the 0.4.21 solc release notes say:
It's as if they're being compiled at a higher pragma than
0.4.21. This problem is surfacing because coverage injects events where none exist in the normal tests, but coverage doesn't actually manage compilation so this should be reproducible in Truffle separately. Will look at that today.To fix the warnings (and this should fix the errors too) we'll have to prefix all the instrumentation events with
emit. That will be a breaking change. Will try to get this in this week.