Skip to content

Constant / view / pure functions still requiring .call() #182

@sohkai

Description

@sohkai

Using 0.4.9.

#161 seems like a pretty reasonable thing to do, and it should work, but I'm having trouble with it on aragonOS.

From what I gather, the problem seems to be from truffle test compiling the contracts again. I see the compiler running three times: once for the original, once for the modified, (at this point the modified's ABI is switched out for the original, and I can verify this in the coverageEnv/builds folder), and then again when truffle test is run.

I'm not familiar with how everything is hooked up in truffle, but running through the code, it seems to be that:

  1. Running truffle test will compile any necessary files with the test files (it first checks for any updated files, and here it doesn't find any)
  2. The compiler is invoked for any necessary files, and then with all the necessary files' dependencies. The only necessary files at this point are the test mocks that we use.
  3. Now tests are run, with contract artifacts being created, etc. When creating the contract artifacts in the test, truffle checks if the function in the abi is constant or not, and if so, provides the .call() for us. This last bit is the weird part: I can confirm in the coverageEnv/build folder that the ABIs have been swapped, and that any constant functions are appropriately marked. However, the above check when creating the contract artifacts seems to be failing for a lot of these functions, leading me to think that the re-compile done by truffle test is causing a newer version of the ABI to be used.

I tried to see if not compiling the tests' dependencies would work... but that started giving me parser/compiler errors D:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions