Omniscia rain protocol Audit
TierOps Manual Review Findings
TierOps Manual Review Findings
TOP-01M: Insufficient Documentation of Stack Layout
Type | Severity | Location |
---|---|---|
Standard Conformity | TierOps.sol:L36, L91-L94 |
Description:
The stack layout expected by the various operators in the TierOps
contract are insufficiently documented and potentially incorrectly so in the first linked instance which specifies the stack contains the address and ITier
contract whereas the opposite layout is expected (ITier
and address
).
Example:
contracts/vm/ops/TierOps.sol
35// Stack the report returned by an `ITier` contract.36// Top two stack vals are used as the address and `ITier` contract37// to check against.38if (opcode_ == REPORT) {39 state_.stackIndex -= 2;40 baseIndex_ = state_.stackIndex;41 state_.stack[baseIndex_] = ITier(42 address(uint160(state_.stack[baseIndex_]))43 ).report(address(uint160(state_.stack[baseIndex_ + 1])));44 state_.stackIndex++;45}
Recommendation:
We advise the expected layout to be properly documented to aid in integrators of the contract whereby the first linked instance is corrected and the second contains a layout of reports as well as the block number to evaluate with at the end of the stack.
Alleviation:
The layout of each instruction is now properly documented in each instruction present in the contract thereby alleviating this exhibit.