forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maint: add more L1 interfaces (ethereum-optimism#11822)
Another PR adding contract interfaces. L1 contract interfaces are way more involved than everything else so we're required to start replacing the contracts with interfaces all over the place.
- Loading branch information
1 parent
9a22240
commit de86922
Showing
97 changed files
with
1,438 additions
and
641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# `OptimismPortal` Invariants | ||
|
||
## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`. | ||
**Test:** [`OptimismPortal.t.sol#L148`](../test/invariants/OptimismPortal.t.sol#L148) | ||
**Test:** [`OptimismPortal.t.sol#L151`](../test/invariants/OptimismPortal.t.sol#L151) | ||
|
||
All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed. | ||
|
||
## `finalizeWithdrawalTransaction` should revert if the finalization period has not elapsed. | ||
**Test:** [`OptimismPortal.t.sol#L171`](../test/invariants/OptimismPortal.t.sol#L171) | ||
**Test:** [`OptimismPortal.t.sol#L174`](../test/invariants/OptimismPortal.t.sol#L174) | ||
|
||
A withdrawal that has been proven should not be able to be finalized until after the finalization period has elapsed. | ||
|
||
## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized. | ||
**Test:** [`OptimismPortal.t.sol#L201`](../test/invariants/OptimismPortal.t.sol#L201) | ||
**Test:** [`OptimismPortal.t.sol#L204`](../test/invariants/OptimismPortal.t.sol#L204) | ||
|
||
Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice. | ||
|
||
## A withdrawal should **always** be able to be finalized `FINALIZATION_PERIOD_SECONDS` after it was successfully proven. | ||
**Test:** [`OptimismPortal.t.sol#L230`](../test/invariants/OptimismPortal.t.sol#L230) | ||
**Test:** [`OptimismPortal.t.sol#L233`](../test/invariants/OptimismPortal.t.sol#L233) | ||
|
||
This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `FINALIZATION_PERIOD_SECONDS` after it was successfully proven. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# `OptimismPortal2` Invariants | ||
|
||
## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`. | ||
**Test:** [`OptimismPortal2.t.sol#L161`](../test/invariants/OptimismPortal2.t.sol#L161) | ||
**Test:** [`OptimismPortal2.t.sol#L163`](../test/invariants/OptimismPortal2.t.sol#L163) | ||
|
||
All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed. | ||
|
||
## `finalizeWithdrawalTransaction` should revert if the proof maturity period has not elapsed. | ||
**Test:** [`OptimismPortal2.t.sol#L183`](../test/invariants/OptimismPortal2.t.sol#L183) | ||
**Test:** [`OptimismPortal2.t.sol#L185`](../test/invariants/OptimismPortal2.t.sol#L185) | ||
|
||
A withdrawal that has been proven should not be able to be finalized until after the proof maturity period has elapsed. | ||
|
||
## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized. | ||
**Test:** [`OptimismPortal2.t.sol#L212`](../test/invariants/OptimismPortal2.t.sol#L212) | ||
**Test:** [`OptimismPortal2.t.sol#L214`](../test/invariants/OptimismPortal2.t.sol#L214) | ||
|
||
Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice. | ||
|
||
## A withdrawal should **always** be able to be finalized `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven, if the game has resolved and passed the air-gap. | ||
**Test:** [`OptimismPortal2.t.sol#L240`](../test/invariants/OptimismPortal2.t.sol#L240) | ||
**Test:** [`OptimismPortal2.t.sol#L242`](../test/invariants/OptimismPortal2.t.sol#L242) | ||
|
||
This invariant asserts that there is no chain of calls that can be made that will prevent a withdrawal from being finalized exactly `PROOF_MATURITY_DELAY_SECONDS` after it was successfully proven and the game has resolved and passed the air-gap. |
14 changes: 7 additions & 7 deletions
14
packages/contracts-bedrock/invariant-docs/ResourceMetering.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
# `ResourceMetering` Invariants | ||
|
||
## The base fee should increase if the last block used more than the target amount of gas. | ||
**Test:** [`ResourceMetering.t.sol#L163`](../test/invariants/ResourceMetering.t.sol#L163) | ||
**Test:** [`ResourceMetering.t.sol#L166`](../test/invariants/ResourceMetering.t.sol#L166) | ||
|
||
If the last block used more than the target amount of gas (and there were no empty blocks in between), ensure this block's baseFee increased, but not by more than the max amount per block. | ||
|
||
## The base fee should decrease if the last block used less than the target amount of gas. | ||
**Test:** [`ResourceMetering.t.sol#L172`](../test/invariants/ResourceMetering.t.sol#L172) | ||
**Test:** [`ResourceMetering.t.sol#L175`](../test/invariants/ResourceMetering.t.sol#L175) | ||
|
||
If the previous block used less than the target amount of gas, the base fee should decrease, but not more than the max amount. | ||
|
||
## A block's base fee should never be below `MINIMUM_BASE_FEE`. | ||
**Test:** [`ResourceMetering.t.sol#L180`](../test/invariants/ResourceMetering.t.sol#L180) | ||
**Test:** [`ResourceMetering.t.sol#L183`](../test/invariants/ResourceMetering.t.sol#L183) | ||
|
||
This test asserts that a block's base fee can never drop below the `MINIMUM_BASE_FEE` threshold. | ||
|
||
## A block can never consume more than `MAX_RESOURCE_LIMIT` gas. | ||
**Test:** [`ResourceMetering.t.sol#L188`](../test/invariants/ResourceMetering.t.sol#L188) | ||
**Test:** [`ResourceMetering.t.sol#L191`](../test/invariants/ResourceMetering.t.sol#L191) | ||
|
||
This test asserts that a block can never consume more than the `MAX_RESOURCE_LIMIT` gas threshold. | ||
|
||
## The base fee can never be raised more than the max base fee change. | ||
**Test:** [`ResourceMetering.t.sol#L198`](../test/invariants/ResourceMetering.t.sol#L198) | ||
**Test:** [`ResourceMetering.t.sol#L201`](../test/invariants/ResourceMetering.t.sol#L201) | ||
|
||
After a block consumes more gas than the target gas, the base fee cannot be raised more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR` | ||
|
||
## The base fee can never be lowered more than the max base fee change. | ||
**Test:** [`ResourceMetering.t.sol#L208`](../test/invariants/ResourceMetering.t.sol#L208) | ||
**Test:** [`ResourceMetering.t.sol#L211`](../test/invariants/ResourceMetering.t.sol#L211) | ||
|
||
After a block consumes less than the target gas, the base fee cannot be lowered more than the maximum amount allowed. The max base fee change (per-block) is derived as follows: `prevBaseFee / BASE_FEE_MAX_CHANGE_DENOMINATOR` | ||
|
||
## The `maxBaseFeeChange` calculation over multiple blocks can never underflow. | ||
**Test:** [`ResourceMetering.t.sol#L217`](../test/invariants/ResourceMetering.t.sol#L217) | ||
**Test:** [`ResourceMetering.t.sol#L220`](../test/invariants/ResourceMetering.t.sol#L220) | ||
|
||
When calculating the `maxBaseFeeChange` after multiple empty blocks, the calculation should never be allowed to underflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# `SystemConfig` Invariants | ||
|
||
## Gas limit boundaries | ||
**Test:** [`SystemConfig.t.sol#L70`](../test/invariants/SystemConfig.t.sol#L70) | ||
**Test:** [`SystemConfig.t.sol#L71`](../test/invariants/SystemConfig.t.sol#L71) | ||
|
||
The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound or higher than the hard-coded upper bound. The lower bound must never be higher than the upper bound. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.