Omniscia LimeChain Audit
Router Manual Review Findings
Router Manual Review Findings
ROU-01M: Potentially Restrictive Diamond Implementation
Type | Severity | Location |
---|---|---|
Language Specific | Minor | Router.sol:L34 |
Description:
The Router
contract contains a single fallback
function that is not payable
, thus preventing the Router
from ever defining a payable
function.
Example:
contracts/Router.sol
34fallback() external {35 LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();36 address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;37 require(facet != address(0), "Diamond: Function does not exist");38 assembly {39 calldatacopy(0, 0, calldatasize())40 let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)41 returndatacopy(0, 0, returndatasize())42 switch result43 case 0 {44 revert(0, returndatasize())45 }46 default {47 return(0, returndatasize())48 }49 }50}
Recommendation:
We advise this trait to be assessed and if deemed desired to be documented in the codebase to ensure that it remains that way.
Alleviation:
The fallback
function now properly boasts the payable
built-in modifier, thereby no longer restricting the flexibility of the underlying implementations.