code-423n4 / 2021-10-tracer-findings

0 stars 0 forks source link

PoolKeeper _gasPrice description says in ETH, but is calculated in wei #9

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

loop

Vulnerability details

The parameter description of _gasPrice is _gasPrice Price of a single gas unit (in ETH). _gasPrice is used to calculate the amount of Wei spent by a keeper, which in turn is used to calculate the compensation a keeper receives for gas expenditure. While Wei is a smaller denomination of ETH and thus technically correct, I think 'in Wei' would be a clearer description. Mainly due to _gasPrice being a uint equal to the price of a single gas unit, which would likely result in 0 if full eth were used.

Proof of Concept

_gasPrice descriptions:

_gasPrice used to calculate _weiSpent: https://github.com/tracer-protocol/perpetual-pools-contracts/blob/646360b0549962352fe0c3f5b214ff8b5f73ba51/contracts/implementation/PoolKeeper.sol#L209

GalloDaSballo commented 3 years ago

Agree with the warden that when thinking of gas prices we thing of gwei and not wei, changing the name of the variable can bring further clarity.

The sponsor has applied the improvement by adding comments