Commit b103e269 authored by Mark Tyneway's avatar Mark Tyneway

lint: fix

parent 13bb0aea
# `CrossDomainMessenger` Invariants # `CrossDomainMessenger` Invariants
## A call to `relayMessage` should succeed if at least the minimum gas limit can be supplied to the target context, there is enough gas to complete execution of `relayMessage` after the target context's execution is finished, and the target context did not revert. ## A call to `relayMessage` should succeed if at least the minimum gas limit can be supplied to the target context, there is enough gas to complete execution of `relayMessage` after the target context's execution is finished, and the target context did not revert.
**Test:** [`CrossDomainMessenger.t.sol#L159`](../test/invariants/CrossDomainMessenger.t.sol#L159) **Test:** [`CrossDomainMessenger.t.sol#L136`](../test/invariants/CrossDomainMessenger.t.sol#L136)
There are two minimum gas limits here: There are two minimum gas limits here:
- The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit. - The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit.
- The inner min gas limit is for the call from the `L1CrossDomainMessenger` to the target contract. - The inner min gas limit is for the call from the `L1CrossDomainMessenger` to the target contract.
## A call to `relayMessage` should assign the message hash to the `failedMessages` mapping if not enough gas is supplied to forward `minGasLimit` to the target context or if there is not enough gas to complete execution of `relayMessage` after the target context's execution is finished. ## A call to `relayMessage` should assign the message hash to the `failedMessages` mapping if not enough gas is supplied to forward `minGasLimit` to the target context or if there is not enough gas to complete execution of `relayMessage` after the target context's execution is finished.
**Test:** [`CrossDomainMessenger.t.sol#L192`](../test/invariants/CrossDomainMessenger.t.sol#L192) **Test:** [`CrossDomainMessenger.t.sol#L169`](../test/invariants/CrossDomainMessenger.t.sol#L169)
There are two minimum gas limits here: There are two minimum gas limits here:
- The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit. - The outer min gas limit is for the call from the `OptimismPortal` to the `L1CrossDomainMessenger`, and it can be retrieved by calling the xdm's `baseGas` function with the `message` and inner limit.
......
# `Hashing` Invariants # `Hashing` Invariants
## `hashCrossDomainMessage` reverts if `version` is > `1`. ## `hashCrossDomainMessage` reverts if `version` is > `1`.
**Test:** [`Hashing.t.sol#L137`](../test/invariants/Hashing.t.sol#L137) **Test:** [`Hashing.t.sol#L117`](../test/invariants/Hashing.t.sol#L117)
The `hashCrossDomainMessage` function should always revert if the `version` passed is > `1`. The `hashCrossDomainMessage` function should always revert if the `version` passed is > `1`.
## `version` = `0`: `hashCrossDomainMessage` and `hashCrossDomainMessageV0` are equivalent. ## `version` = `0`: `hashCrossDomainMessage` and `hashCrossDomainMessageV0` are equivalent.
**Test:** [`Hashing.t.sol#L147`](../test/invariants/Hashing.t.sol#L147) **Test:** [`Hashing.t.sol#L127`](../test/invariants/Hashing.t.sol#L127)
If the version passed is 0, `hashCrossDomainMessage` and `hashCrossDomainMessageV0` should be equivalent. If the version passed is 0, `hashCrossDomainMessage` and `hashCrossDomainMessageV0` should be equivalent.
## `version` = `1`: `hashCrossDomainMessage` and `hashCrossDomainMessageV1` are equivalent. ## `version` = `1`: `hashCrossDomainMessage` and `hashCrossDomainMessageV1` are equivalent.
**Test:** [`Hashing.t.sol#L158`](../test/invariants/Hashing.t.sol#L158) **Test:** [`Hashing.t.sol#L138`](../test/invariants/Hashing.t.sol#L138)
If the version passed is 1, `hashCrossDomainMessage` and `hashCrossDomainMessageV1` should be equivalent. If the version passed is 1, `hashCrossDomainMessage` and `hashCrossDomainMessageV1` should be equivalent.
\ No newline at end of file
# `L2OutputOracle` Invariants # `L2OutputOracle` Invariants
## The block number of the output root proposals should monotonically increase. ## The block number of the output root proposals should monotonically increase.
**Test:** [`L2OutputOracle.t.sol#L56`](../test/invariants/L2OutputOracle.t.sol#L56) **Test:** [`L2OutputOracle.t.sol#L58`](../test/invariants/L2OutputOracle.t.sol#L58)
When a new output is submitted, it should never be allowed to correspond to a block number that is less than the current output. When a new output is submitted, it should never be allowed to correspond to a block number that is less than the current output.
\ No newline at end of file
# `OptimismPortal` Invariants # `OptimismPortal` Invariants
## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`. ## Deposits of any value should always succeed unless `_to` = `address(0)` or `_isCreation` = `true`.
**Test:** [`OptimismPortal.t.sol#L157`](../test/invariants/OptimismPortal.t.sol#L157) **Test:** [`OptimismPortal.t.sol#L147`](../test/invariants/OptimismPortal.t.sol#L147)
All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed. All deposits, barring creation transactions and transactions sent to `address(0)`, should always succeed.
## `finalizeWithdrawalTransaction` should revert if the finalization period has not elapsed. ## `finalizeWithdrawalTransaction` should revert if the finalization period has not elapsed.
**Test:** [`OptimismPortal.t.sol#L185`](../test/invariants/OptimismPortal.t.sol#L185) **Test:** [`OptimismPortal.t.sol#L170`](../test/invariants/OptimismPortal.t.sol#L170)
A withdrawal that has been proven should not be able to be finalized until after the finalization period has elapsed. 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. ## `finalizeWithdrawalTransaction` should revert if the withdrawal has already been finalized.
**Test:** [`OptimismPortal.t.sol#L220`](../test/invariants/OptimismPortal.t.sol#L220) **Test:** [`OptimismPortal.t.sol#L200`](../test/invariants/OptimismPortal.t.sol#L200)
Ensures that there is no chain of calls that can be made that allows a withdrawal to be finalized twice. 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. ## A withdrawal should **always** be able to be finalized `FINALIZATION_PERIOD_SECONDS` after it was successfully proven.
**Test:** [`OptimismPortal.t.sol#L254`](../test/invariants/OptimismPortal.t.sol#L254) **Test:** [`OptimismPortal.t.sol#L229`](../test/invariants/OptimismPortal.t.sol#L229)
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 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.
\ No newline at end of file
# `ResourceMetering` Invariants # `ResourceMetering` Invariants
## The base fee should increase if the last block used more than the target amount of gas. ## The base fee should increase if the last block used more than the target amount of gas.
**Test:** [`ResourceMetering.t.sol#L177`](../test/invariants/ResourceMetering.t.sol#L177) **Test:** [`ResourceMetering.t.sol#L162`](../test/invariants/ResourceMetering.t.sol#L162)
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. 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. ## The base fee should decrease if the last block used less than the target amount of gas.
**Test:** [`ResourceMetering.t.sol#L186`](../test/invariants/ResourceMetering.t.sol#L186) **Test:** [`ResourceMetering.t.sol#L171`](../test/invariants/ResourceMetering.t.sol#L171)
If the previous block used less than the target amount of gas, the base fee should decrease, but not more than the max amount. 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`. ## A block's base fee should never be below `MINIMUM_BASE_FEE`.
**Test:** [`ResourceMetering.t.sol#L194`](../test/invariants/ResourceMetering.t.sol#L194) **Test:** [`ResourceMetering.t.sol#L179`](../test/invariants/ResourceMetering.t.sol#L179)
This test asserts that a block's base fee can never drop below the `MINIMUM_BASE_FEE` threshold. 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. ## A block can never consume more than `MAX_RESOURCE_LIMIT` gas.
**Test:** [`ResourceMetering.t.sol#L202`](../test/invariants/ResourceMetering.t.sol#L202) **Test:** [`ResourceMetering.t.sol#L187`](../test/invariants/ResourceMetering.t.sol#L187)
This test asserts that a block can never consume more than the `MAX_RESOURCE_LIMIT` gas threshold. 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. ## The base fee can never be raised more than the max base fee change.
**Test:** [`ResourceMetering.t.sol#L212`](../test/invariants/ResourceMetering.t.sol#L212) **Test:** [`ResourceMetering.t.sol#L197`](../test/invariants/ResourceMetering.t.sol#L197)
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` 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. ## The base fee can never be lowered more than the max base fee change.
**Test:** [`ResourceMetering.t.sol#L222`](../test/invariants/ResourceMetering.t.sol#L222) **Test:** [`ResourceMetering.t.sol#L207`](../test/invariants/ResourceMetering.t.sol#L207)
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` 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. ## The `maxBaseFeeChange` calculation over multiple blocks can never underflow.
**Test:** [`ResourceMetering.t.sol#L231`](../test/invariants/ResourceMetering.t.sol#L231) **Test:** [`ResourceMetering.t.sol#L216`](../test/invariants/ResourceMetering.t.sol#L216)
When calculating the `maxBaseFeeChange` after multiple empty blocks, the calculation should never be allowed to underflow. When calculating the `maxBaseFeeChange` after multiple empty blocks, the calculation should never be allowed to underflow.
\ No newline at end of file
# `SystemConfig` Invariants # `SystemConfig` Invariants
## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound. ## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
**Test:** [`SystemConfig.t.sol#L65`](../test/invariants/SystemConfig.t.sol#L65) **Test:** [`SystemConfig.t.sol#L62`](../test/invariants/SystemConfig.t.sol#L62)
{ {
"src/L1/L1CrossDomainMessenger.sol": "0x2b276f14475869cfd81868b03dc72b91dd726a787c9568caf4849fe34830b207", "src/L1/L1CrossDomainMessenger.sol": "0x0e663b5d608b07cf278b94b1eeb3202abc01bea6b5905a3869010353df33ad1a",
"src/L1/L1ERC721Bridge.sol": "0xd91d437fc1dfd46c5b2987da6b8aa9fb0be8d8b3add0148a587f49839f27562b", "src/L1/L1ERC721Bridge.sol": "0xbb10b777d1cd36ef98b53df6675f37a20b14a9a82b174f0d8f8872eedca65f17",
"src/L1/L1StandardBridge.sol": "0xa35dc0ab143043063c3bff73c8b065e401c23296a2017258ce8a87f4a4da9416", "src/L1/L1StandardBridge.sol": "0xbd7b303cefe46bc14bf1a2b81e5702ff45ce9c5257524e59778e11c75f7f5bdc",
"src/L1/L2OutputOracle.sol": "0x8f32ccb4c5cb63a459a0e79ee412177dc03fd279fdaaf1dac69e8c714902e857", "src/L1/L2OutputOracle.sol": "0x05ea17a834563ffa50cade81189b120b6f0805ba316d6a9893c8cf8b231e57e3",
"src/L1/OptimismPortal.sol": "0xeaa47a63e8a3bcfdb7dfd3e6c8608369e34e362d9de82f3acf13cbc27c070bf7", "src/L1/OptimismPortal.sol": "0xeefcc16d30e14ed7ce9970f3aeaf1d5668324b3fc1ddb4790da5804cfdd78980",
"src/L1/SystemConfig.sol": "0x689a3339e9167e62fac105eaae0390b39fc7dfee21b19c5f78636d98ee97148e", "src/L1/SystemConfig.sol": "0x932c896b1bc2a32227bfe30aa66e1e6d17f057cc9a2562876bf7730858041895",
"src/L2/BaseFeeVault.sol": "0xa596e60762f16192cfa86459fcb9f4da9d8f756106eedac643a1ffeafbbfcc5f", "src/L2/BaseFeeVault.sol": "0xd8df28898799b80c370e77e9aad09f79235dfda2bf13e56daf21997cfe54200d",
"src/L2/GasPriceOracle.sol": "0xc735a8bf01ad8bca194345748537bfd9924909c0342bc133c4a31e2fb8cb9882", "src/L2/GasPriceOracle.sol": "0xb7d8c4f3ea8db31900125e341aae42a862a2b7d3f1c1aa60c97dc2d0e022b7ba",
"src/L2/L1Block.sol": "0x7fbfc8b4da630386636c665570321fdec287b0867dbe0f91c2e7cd5b7697c220", "src/L2/L1Block.sol": "0x38ea78a9611656a60ae4d58db75e96413a638e3ccb2e935052441f98a1fd3105",
"src/L2/L1FeeVault.sol": "0x62bfe739ff939fc68f90916399ac4160936d31eb37749cb014dd9d0c5dd4183a", "src/L2/L1FeeVault.sol": "0xdb1af90420de05dc973304b66f0ab9cf94876ed11066c1f4ef01301db622300d",
"src/L2/L2CrossDomainMessenger.sol": "0xc9641981f7aa79f44b5925100027098d8f76c6178c65aca99fafa859289182be", "src/L2/L2CrossDomainMessenger.sol": "0x0035277e4fcefada548530adbff9bf3b5de6b755d22c1cd33fc7abeae100d4f2",
"src/L2/L2ERC721Bridge.sol": "0xebb5b09f5f8ee70e0980c70ba8163ca3144bc2f30c38235de3e8425c7fee5b6a", "src/L2/L2ERC721Bridge.sol": "0x9307788f7656f7951165a15ba89a71cd0c7166f60492d3118b7dfbeaef3b1f7a",
"src/L2/L2StandardBridge.sol": "0x67e202bc6751807b20a98b88b0b65bdff30420bf1e71f2c1c7948de448cfcdc0", "src/L2/L2StandardBridge.sol": "0xe025dcccbf21d48828ecf588941c9ba04c91b87bdd177a653d3f1b265b0b02a8",
"src/L2/L2ToL1MessagePasser.sol": "0xed800b600cb3f67e18a1ab10750e3934a8b3e42178f422bcacfde770a6e8e8bd", "src/L2/L2ToL1MessagePasser.sol": "0xda56ba2e5b2c28fa8ca2df24077d49e96155a00ecc99cd0778d681be6ed166fe",
"src/L2/SequencerFeeVault.sol": "0xd57c143b1f042400430b991b806bf971628e6980406c751e82d19ae80eeb4e8d", "src/L2/SequencerFeeVault.sol": "0x37816035c992d38cf7e3d5a1846b02d017dd7bdca46abe6e5c5171b9ee6225ab",
"src/dispute/FaultDisputeGame.sol": "0x2a7f367443752f841d734f339a596c4ad93e16f7df0230f1cdd5e6f0b4b58368", "src/dispute/FaultDisputeGame.sol": "0x72c917e8513d17f274753a391bdbddc1f4daeca1a392f79492df29a1107c3525",
"src/legacy/DeployerWhitelist.sol": "0x5e80f7b13ef73f06c63bd9b118a49da1ff06a5c0fcf8067b5a3365d731c23765", "src/legacy/DeployerWhitelist.sol": "0xf2129ec3da75307ba8e21bc943c332bb04704642e6e263149b5c8ee92dbcb7a8",
"src/legacy/L1BlockNumber.sol": "0x84cc587148de5920dfcd19da44d28e769f0e4d08ca2bcc93f18aa78c6cc2ebe6", "src/legacy/L1BlockNumber.sol": "0x30aae1fc85103476af0226b6e98c71c01feebbdc35d93401390b1ad438a37be6",
"src/legacy/LegacyMessagePasser.sol": "0x2692b50b227e5f75a53439c0cf303498edfd4fc087555b3fc9bc4bceb518229b", "src/legacy/LegacyMessagePasser.sol": "0x5c08b0a663cc49d30e4e38540f6aefab19ef287c3ecd31c8d8c3decd5f5bd497",
"src/periphery/op-nft/AttestationStation.sol": "0xc47d0edc7c97b9e57cc1348c9a10864dc0ee248a5634a38eb6865c7dd07db30b", "src/periphery/op-nft/AttestationStation.sol": "0xa9618d708af7ab5ed840d889e69e1241622296a31c0baa18bc3ca932c07a86fd",
"src/periphery/op-nft/Optimist.sol": "0x697a51a2d501a965ab1b08c43ec63bc428dc1a1065aa6193a665c1e70840c628", "src/periphery/op-nft/Optimist.sol": "0xb34b9001f3bea6744128ad51a9355f4102468996f9ca8d1f05e93f6a9d083026",
"src/periphery/op-nft/OptimistAllowlist.sol": "0xc416eca27d2132bd880ffca7f2b584e519b2cd3aba48418d3060b3dc376a95cb", "src/periphery/op-nft/OptimistAllowlist.sol": "0x5653727a032d266bf59d0dd0eece5de0dd801f573c9ebf95ba6bb416ec3145c7",
"src/periphery/op-nft/OptimistInviter.sol": "0x0813661f25e9b0bc7944591c1a4675940b8e610dfe90197a30ccc683922f2216", "src/periphery/op-nft/OptimistInviter.sol": "0x8c2ffa16a63d8e270e14348e0946f03b01e57bb3e27a68b17964fc615819a4db",
"src/universal/OptimismMintableERC20.sol": "0xc36fa540d91199857e88d3740f97e19702443ba468731d18cb6f41ec67934a24", "src/universal/OptimismMintableERC20.sol": "0xe2227c6ae87176a1034771c05426d1fcb4e78a403fb7ae3231dc9ac8d93c7ca2",
"src/universal/OptimismMintableERC20Factory.sol": "0x9b0fc71d2080bee4b83da8d0ddc70e903239f12dcc6660fdc4dccf8d2a89b4d1", "src/universal/OptimismMintableERC20Factory.sol": "0xc0dc1bca7437a3283f8d5a1be2d5541a5fddffde60fe005f6119974c6b909997",
"src/universal/OptimismMintableERC721.sol": "0x722060ab18481f862f4743a94717dade057a931b345ccadfdfb49374f5c8de31", "src/universal/OptimismMintableERC721.sol": "0x4eaa5ea0d923ce967f299c2ded84c2a53431159c47c0a344a9b8f534a25b7e1f",
"src/universal/OptimismMintableERC721Factory.sol": "0x7b2b88226a95140ec6d45d742f772d5a1ff93e29a3f7a194c2b12e2bb9e08b02" "src/universal/OptimismMintableERC721Factory.sol": "0xbc652464d81c86add3436a4a79bdf37ed01e9dde727896fe39a41282a479c5db"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment