You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the contracts overloads the classic owner() method. waffle (that I usually use) and truffle both compile this code without issues. However, solidity-coverage gives me the following error:
Error: CompileError: openzeppelin-solidity/contracts/ownership/Ownable.sol:28:5: TypeError: Overriding function changes state mutability from "nonpayable" to "view".
function owner() public view returns (address) {
^ (Relevant source part starts here and spans across multiple lines).
/home/amxx/Work/KitsuneWallet/kitsune-monorepo/kitsune-contracts/coverageEnv/contracts/interfaces/IERC725.sol:17:2: Overridden function is here:
function owner() public returns (address);
^---------------------------------------------^
Line 17 of IERC725.sol is
function owner() public view returns (address);
How come the view modifier was lost between the source and the coverageEnv version ?
The text was updated successfully, but these errors were encountered:
@Amxx It's intentionally removed because Solidity will not compile when events are in a view or pure function. This is why the contracts get double compiled - first we compile to get the 'correct' ABI, which marks methods as view or pure and which Truffle uses to decide whether to execute a method as a send or a call. Then we remove the visibility modifiers and instrument to get the correct bytecode. Then we swap the 'correct' ABI back into the artifact. (See #146 for more).
TLDR; the modifiers are removed but because of this trick, truffle invokes those methods as .call rather than .send.
I'm trying to use solidity-coverage on kitsune-contracts
One of the contracts overloads the classic
owner()
method. waffle (that I usually use) and truffle both compile this code without issues. However, solidity-coverage gives me the following error:Line 17 of IERC725.sol is
How come the view modifier was lost between the source and the coverageEnv version ?
The text was updated successfully, but these errors were encountered: