Platform: Code4rena
Start Date: 03/08/2023
Pot Size: $90,500 USDC
Total HM: 6
Participants: 36
Period: 7 days
Judge: 0xean
Total Solo HM: 1
Id: 273
League: ETH
Rank: 26/36
Findings: 1
Award: $38.45
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: LeoS
Also found by: 0xAnah, JCK, K42, SAAJ, Sathish9098, Udsen, caventa, dharma09, ernestognw, naman1778, petrichor, rektthecode
38.4497 USDC - $38.45
See SecurityCouncilMgmtUpgradeLib#areAddressArraysEqual
function areAddressArraysEqual(address[] memory array1, address[] memory array2) public pure returns (bool) { if (array1.length != array2.length) { return false; } for (uint256 i = 0; i < array1.length; i++) { bool found = false; for (uint256 j = 0; j < array2.length; j++) { if (array1[i] == array2[j]) { found = true; break; } } if (!found) { return false; } } for (uint256 i = 0; i < array2.length; i++) { bool found = false; for (uint256 j = 0; j < array1.length; j++) { if (array2[i] == array1[j]) { found = true; break; } } if (!found) { return false; } } return true; }
can be changed to
function areAddressArraysEqual(address[] memory array1, address[] memory array2) public pure returns (bool) { return keccak256(abi.encodePacked(array1)) == keccak256(abi.encodePacked(array2)); }
Wrote 4 foundry test
#0 - c4-judge
2023-08-18T14:39:48Z
0xean marked the issue as grade-b