Closed barakman closed 6 years ago
I don't understand why you would want all this extra complexity? We are simply testing if we can successfully call a function of a smart contract via the multisig and have the function be executed correctly. Maybe it would be good to have a test with of a function with multiple inputs of different types but I don't see where you are going with your question.
@christianlundkvist: Thank you for the quick response. Kindly explain the point in restricting a function via MultiSig, when anyone (and everyone) can call it directly.
@barakman The point is not to restrict a function via MultiSig, the point is just to test calling any function of any smart contract. Would you have the same objections if this was an ERC20 token contract for instance (anyone can call the transfer function there too)?
@christianlundkvist: I don't quite understand the point of "just to test calling any function of any smart contract", since this is something that one can perform without any additional infrastructure.
@barakman TestRegistry does actually help test what we want to test here:
As a side benefit, it actually not true that TestRegistry has no security. A sender can only modify the registry entry keyed by the sender contract ID. You cannot modify arbitrary entries that you didn't create. However, this is incidental to what we want to test, because enforcing authorization based on the sender contract ID is a concern of the target contract, and is therefore out of scope of simple-multisig. That said, perhaps it would be good to document the security assumptions on the target contract. ERC20, for example, fulfills those assumptions.
In this contract:
What exactly is stopping me from calling
function register
directly???Isn't the purpose of Multi-Sig to restrict permission further than
onlyOwner
?In this example, the function is not restricted even to
onlyOwner
!I believe that it would be advisable to:
Ownable
function register
asonlyOwner
Then, in simplemultisig.js, after the line
Add the line:
Side-note - during execution, an exception is thrown at:
So I have yet to figure out the entire process, but I nevertheless believe that this is the type of capability which should be demonstrated here (i.e., calling a previously-only-owner function via the MultiSig contract).
Update on the side-note above:
The error was thrown because I removed the
payable
keyword from the declaration offunction register
.After "re-enforcing" it, the test runs to completion.