Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
code423n4 opened this issue Oct 12, 2021 · 1 comment
Closed
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Warden finding sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

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

@code423n4 code423n4 added 0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Warden finding labels Oct 12, 2021
code423n4 added a commit that referenced this issue Oct 12, 2021
sporejack added a commit to mycelium-ethereum/perpetual-pools-contracts that referenced this issue Oct 18, 2021
@CalabashSquash CalabashSquash added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Oct 28, 2021
@GalloDaSballo
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 (Non-critical) Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation bug Warden finding sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

3 participants