Zondax / filecoin-solidity

Filecoin Solidity API Library
Apache License 2.0
94 stars 43 forks source link

Error handling for methods where we expect no response #285

Closed snissn closed 1 year ago

snissn commented 1 year ago

For these instances:

% git grep 'unexpected response received'
contracts/v0.8/AccountAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MarketAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/MinerAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/SendAPI.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/Utils.sol:        require(result.length == 0, "unexpected response received");
contracts/v0.8/VerifRegAPI.sol:        require(result.length == 0, "unexpected response received");

:link: zboto Link

emmanuelm41 commented 1 year ago

This is another case where the auditor recommended us to add redundant checks to asses the correct actor behavior. If the codec is cbor none, he recommended to check the result anyway and see if it is empty. The method is expecting an empty response, so we "should" check that is the case