Rigor Protocol contest - eierina'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: 115/133

Findings: 1

Award: $22.03

🌟 Selected for report: 0

🚀 Solo Findings: 0

Hello, this is my first submission with Code4rena, please be patient as I compare my work with the upcoming report for this project.

Project.sol#inviteContractor emit ContractorInvited(contractor) can use local _contractor instead to spare from storage access

Project.sol#checkSignature can cache 'contractor' as it is always accessed form storage twice.

Project.sol#lendToProject can check _cost > 0 the very first line to save some gas to a honest fat finger.

Project.sol#updateProjectHash can safely increment hashChangeNonce earlier accessing storage only once, e.g. require(_nonce == hashChangeNonce++, "Project::!Nonce"); or cache. No side effects.

Project.sol#updateTaskHash can safely increment hashChangeNonce earlier accessing storage only once e.g. require(_nonce == hashChangeNonce++, "Project::!Nonce"); or cache. No side effects.

Project.sol#checkPrecision can use unchecked around (_amount / 1000) * 1000) == _amount.

Project.sol#allocateFunds can cache _changeOrderedTask.length as it is accessed from storage in four places including a for loop condition

Project.sol#allocateFunds can cache _changeOrderedTask[i] as it is accessed from storage either one or three times

Project.sol#allocateFunds can cache taskCount as it is accessed from storage either two or five places including a for loop condition.

Community.sol#publishProject can replace _community.publishNonce = ++_community.publishNonce; with _community.publishNonce = ++_publishNonce; to save storage access and redundant increment before assignment.

Community.sol#members can cache _communities[_communityID].memberCount as it is accessed in two places from storage including a for loop condition.

Community.sol#returnToLender can use unchecked when calculating uint256 _noOfDays as _communityProject.lastTimestamp is always updated/initialized with block.timestamp and there is no case where result would differ between checked vs unchecked.

HomeFi.sol#createProject can cache projectCount as it is accessed from storage three times.

HomeFi.sol#mintNFT can cache projectCount as it is accessed from storage five times.

All 'someVariable += 1' (Project.sol#addTask) can be replaced by ++someVariable.

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