stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

SDLPoolCCIPControllerPrimary::Storage can be saved

Summary

Multiple mappings in SDLPoolCCIPController contract can be set as struct.

Vulnerability Details

In SDLPoolCCIPController.sol contract multiple mappings were initiated:

uint64[] internal whitelistedChains;
mapping(uint64 => address) public whitelistedDestinations;
mapping(uint64 => bytes) public updateExtraArgsByChain;
mapping(uint64 => bytes) public rewardsExtraArgsByChain;
mapping(uint64 => uint256) public reSDLSupplyByChain;

Reading and writing from & in it is gas expensive and it will increase deployment cost also.

Impact

Current implementation structure will cost more deployment cost and those are gas expensive while reading from it.

Tools Used

Manual analysis.

Recommendations

These can be set in struct & we can set the struct in an array. Like this:

Struct WhitelistedChain {
uint64 chainSelector;
address whitelistedDestination;
bytes updateExtraArgsByChain;
bytes rewardsExtraArgsByChain;
uint256 reSDLSupplyByChain;
}
WhitelistedChain[] internal whitelistedChains;
Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.