Closed c4-submissions closed 1 year ago
raymondfam marked the issue as low quality report
raymondfam marked the issue as duplicate of #3
alex-ppg marked the issue as not a duplicate
The Warden fails to demonstrate how the relevant call would fail to execute as expected or how gas is of a concern.
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-10-brahma/blob/main/contracts/src/core/registries/ExecutorRegistry.sol#L75
Vulnerability details
Impact
The values() function when called within the getExecutorsForSubAccount function can contribute to the gas shortage.
The values function is part of the
EnumerableSet.sol
library from OpenZeppelin. It retrieves all the values in the set and returns them in an array. The values function in involves iterating over the set and populates an array from storage, which requires higher computational operation as indicated in the contract and thus can lead to out of gas error.Proof of Concept
The values() function is view but it is inherited in the
ExecutorRegistry.sol
contract and called internally bygetExecutorsForSubAccount
which will cost gas.OpenZeppelin clearly warn about using of
values
function ofEnumerableSet.sol
contract as it can lead to shortage of gas.Tools Used
Manual Review
Recommended Mitigation Steps
The first recommendation is made in area of limiting number of iteration in the function to avoid out of gas error. The second is made in area of modifying the
set
params pointer forvalues
function from storage to calldata so that it is not stored and just called when function executes.Assessed type
Other