Tigthen function visibilities/scopes in solidity contracts
AntoineRondelet opened this issue · 2 comments
As of now, many functions are kept public
on smart contracts to add them to the ABIs and allow the testing scripts to call them (for instance, see the assemble_nullifier
, assemble_hsig
etc function on the MixerBase
contract).
The ABI should only contain functions exposed to the end user. As such, let's switch the scope of public
functions to become (at least) internal
, and use "test contracts" to wrap these internal functions with public ones. E.g.
contract MyContract{
function myFunctionToTest() internal {...}
}
and use the following wrapping contract to execute the tests:
contract MyContractTest is MyContract {
function myTestFunction() public {
return myFunctionToTest();
}
}
Then, we can call MyContractTest
from the python testing scripts.
Note: We may also want to move more of that test logic to solidity and expose a single entry point for all tests in the "test contract".
(Also related to #141)
Tackled as part of #361