Platform: Code4rena
Start Date: 14/04/2023
Pot Size: $90,500 USDC
Total HM: 7
Participants: 59
Period: 14 days
Judge: LSDan
Total Solo HM: 3
Id: 232
League: ETH
Rank: 26/59
Findings: 1
Award: $119.79
🌟 Selected for report: 0
🚀 Solo Findings: 0
119.7884 USDC - $119.79
Report Date: 2023-04-20 06:00:54
Issue | Instances | |
---|---|---|
[G-01] | Multiple accesses of a mapping/array should use a local variable cache | 1 |
mapping/array
should use a local variable cacheThe instances below point to the second+ access of a value inside a mapping/array, 1within a function. Caching a mapping's value in a local storage or calldata variable when the value is accessed multiple times, saves ~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. Caching an array's struct avoids recalculating the array offsets into memory/calldata
Total:1
contracts/dnssec-oracle/DNSSECImpl.sol#L46 contracts/dnssec-oracle/DNSSECImpl.sol#L415-L425
46: mapping(uint8 => Digest) public digests; ...... 415: function verifyDSHash( 416: uint8 digesttype, 417: bytes memory data, 418: bytes memory digest 419: ) internal view returns (bool) { 420: if (address(digests[digesttype]) == address(0)) { 421: return false; 422: } 423: return digests[digesttype].verify(data, digest); 424: } 425: }
#0 - thereksfour
2023-05-02T08:04:32Z
Insufficient amount
#1 - c4-pre-sort
2023-05-02T08:04:37Z
thereksfour marked the issue as low quality report
#2 - c4-judge
2023-05-08T09:38:34Z
dmvt marked the issue as grade-b