Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

shw - Specification of the new base fee calculation is inconsistent with the code #266

Open
github-actions bot opened this issue Feb 20, 2023 · 0 comments
Labels
Reward A payout will be made for this issue Specification An issue related to the specification (low severity)

Comments

@github-actions
Copy link

shw

low

Specification of the new base fee calculation is inconsistent with the code

Summary

Specification of the new base fee calculation is inconsistent with the code.

Vulnerability Detail

The "Guaranteed Gas Fee Market" specification provides a pseudocode explaining how a new base fee is calculated, which has two inconsistencies with the actual code implementation:

  1. When multiple blocks are skipped, the new base fee is applied with a 7/8 reduction per block. The code uses the updated newBaseFee (see ResourceMetering.sol#L115) while the specification uses the un-updated prev_basefee.
  2. The maximum new base fee in the specification is UINT_64_MAX_VALUE but is set to type(uint128).max in the code.

Impact

The specification does not match the code.

Code Snippet

https://github.com/ethereum-optimism/optimism/blob/3f4b3c328153a8aa03611158b6984d624b17c1d9/packages/contracts-bedrock/contracts/L1/ResourceMetering.sol#L115

Tool used

Manual Review

Recommendation

Fix either the specification or the code.

@github-actions github-actions bot added the Specification An issue related to the specification (low severity) label Feb 20, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Feb 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Reward A payout will be made for this issue Specification An issue related to the specification (low severity)
Projects
None yet
Development

No branches or pull requests

1 participant