Closed code423n4 closed 3 years ago
WatchPug
Reading array length at each iteration of the loop takes 6 gas (3 for mload and 3 to place memory_offset) in the stack.
Caching the array length in the stack saves around 3 gas per iteration.
Instances include:
PoolKeeper.sol#checkUpkeepMultiplePools()
https://github.com/tracer-protocol/perpetual-pools-contracts/blob/646360b0549962352fe0c3f5b214ff8b5f73ba51/contracts/implementation/PoolKeeper.sol#L76-L84
PoolKeeper.sol#performUpkeepMultiplePools()
https://github.com/tracer-protocol/perpetual-pools-contracts/blob/646360b0549962352fe0c3f5b214ff8b5f73ba51/contracts/implementation/PoolKeeper.sol#L124-L128
Duplicate of https://github.com/code-423n4/2021-10-tracer-findings/issues/1
Duplicate of #1
Will set to invalid or accept based on Sponsor Feedback
Marking as invalid as per above
Handle
WatchPug
Vulnerability details
Reading array length at each iteration of the loop takes 6 gas (3 for mload and 3 to place memory_offset) in the stack.
Caching the array length in the stack saves around 3 gas per iteration.
Instances include:
PoolKeeper.sol#checkUpkeepMultiplePools()
https://github.com/tracer-protocol/perpetual-pools-contracts/blob/646360b0549962352fe0c3f5b214ff8b5f73ba51/contracts/implementation/PoolKeeper.sol#L76-L84
PoolKeeper.sol#performUpkeepMultiplePools()
https://github.com/tracer-protocol/perpetual-pools-contracts/blob/646360b0549962352fe0c3f5b214ff8b5f73ba51/contracts/implementation/PoolKeeper.sol#L124-L128