Rigor Protocol contest - asutorufos's results

Community lending and instant payments for new home construction.

General Information

Platform: Code4rena

Start Date: 01/08/2022

Pot Size: $50,000 USDC

Total HM: 26

Participants: 133

Period: 5 days

Judge: Jack the Pug

Total Solo HM: 6

Id: 151

League: ETH

Rigor Protocol

Findings Distribution

Researcher Performance

Rank: 97/133

Findings: 2

Award: $62.34

🌟 Selected for report: 0

🚀 Solo Findings: 0

N-1 USE A MORE RECENT VERSION OF SOLIDITY 0.8.10 to have external calls skip contract existence checks if the external call has a return value. ALL IN-scope contracts are 0.8.6

N-2 Doesn't need to initialized to 0 when the default is 0.

https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/libraries/Tasks.sol#:~:text=for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20_alerts%5Bi%5D%20%3D%20_self.alerts%5Bi%5D%3B

L-1 EVENTS NOT EMITTED FOR IMPORTANT STATE CHANGES When changing state variables events are not emitted. Emitting events allows monitoring activities with off-chain monitoring tools. [HomeFiProxy.sol L#150]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=function%20changeProxyAdminOwner(,%7D

L-2 CONSIDER TWO-PHASE OWNERSHIP TRANSFER Consider adding a two-phase transfer, where the current owner nominates the next owner, and the next owner has to call accept*() to become the new owner. This prevents passing the ownership to an account that is unable to use it. [HomeFiProxy.sol L#150]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=function%20changeProxyAdminOwner(,%7D

G-1 UNCHECKED{++I} INSTEAD OF I++ [HomeFiProxy.sol L#87]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=for%20all%20implementation-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_generateProxy(allContractNames%5Bi

[HomeFiProxy.sol L#136]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=//%20Replace%20implementations-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_replaceImplementation(_contractNames%5Bi

Project.sol L#248

[Project.sol L#311]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/Project.sol#:~:text=for%20each%20task.-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_inviteSC(_taskList%5Bi

Project.sol L#322

Project.sol L#603

G-2 <ARRAY>.LENGTH SHOULD NOT BE LOOKED UP IN EVERY LOOP OF A FOR-LOOP The overheads outlined below are PER LOOP, excluding the first loop

storage arrays incur a Gwarmaccess (100 gas) memory arrays use MLOAD (3 gas) calldata arrays use CALLDATALOAD (3 gas) Caching the length changes each of these to a DUP<N> (3 gas), and gets rid of the extra DUP<N> needed to store the stack offset Project.sol L#603

G-3 ++I COSTS LESS GAS THAN I++, ESPECIALLY WHEN IT’S USED IN FOR-LOOPS (--I/I-- TOO) Saves 6 gas per loop

[HomeFiProxy.sol L#87]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=for%20all%20implementation-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_generateProxy(allContractNames%5Bi

[HomeFiProxy.sol L#136]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFiProxy.sol#:~:text=//%20Replace%20implementations-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_replaceImplementation(_contractNames%5Bi

Project.sol L#248

[Project.sol L#311]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/Project.sol#:~:text=for%20each%20task.-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20_length%3B%20i%2B%2B)%20%7B,-_inviteSC(_taskList%5Bi

Project.sol L#322

Project.sol L#603

G-4 MULTIPLE ADDRESS MAPPINGS CAN BE COMBINED INTO A SINGLE MAPPING OF AN ADDRESS TO A STRUCT, WHERE APPROPRIATE Saves a storage slot for the mapping. Depending on the circumstances and sizes of types, can avoid a Gsset (20000 gas) per mapping combined. Reads and subsequent writes can also be cheaper when a function requires both values and they both fit in the same storage slot. Finally, if both fields are accessed in the same function, can save ~42 gas per access due to not having to recalculate the key’s keccak256 hash (Gkeccak256 - 30 gas) and that calculation’s associated stack operations.

[HomeFi.sol L#62-66]https://github.com/code-423n4/2022-08-rigor/blob/b17b2a11d04289f9e927c71703b42771dd7b86a4/contracts/HomeFi.sol#:~:text=mapping(uint256,public%20override%20wrappedToken%3B

G-5 USING > 0 COSTS MORE GAS THAN != 0 WHEN USED ON A UINT IN A REQUIRE() STATEMENT Community.sol L#764

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter