Commit 92bfc0b9 authored by Matt Solomon's avatar Matt Solomon Committed by GitHub

test(ctb): small cleanup and stronger assertions (#9404)

* test: DelayedVetoable improvements

* chore: remove unused DelayedVetoable errors

* test: FaultDisputeGame improvements

* chore: remove unused imports

* test: more explicit expect revert messages

* fix: revert things from testing

* chore: snapshot, bindings, and doc updates
parent dfc7eda4
This diff is collapsed.
# `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#L144`](../test/invariants/CrossDomainMessenger.t.sol#L144) **Test:** [`CrossDomainMessenger.t.sol#L143`](../test/invariants/CrossDomainMessenger.t.sol#L143)
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#L177`](../test/invariants/CrossDomainMessenger.t.sol#L177) **Test:** [`CrossDomainMessenger.t.sol#L176`](../test/invariants/CrossDomainMessenger.t.sol#L176)
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.
......
# `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#L151`](../test/invariants/OptimismPortal.t.sol#L151) **Test:** [`OptimismPortal.t.sol#L149`](../test/invariants/OptimismPortal.t.sol#L149)
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#L174`](../test/invariants/OptimismPortal.t.sol#L174) **Test:** [`OptimismPortal.t.sol#L172`](../test/invariants/OptimismPortal.t.sol#L172)
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#L204`](../test/invariants/OptimismPortal.t.sol#L204) **Test:** [`OptimismPortal.t.sol#L202`](../test/invariants/OptimismPortal.t.sol#L202)
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#L233`](../test/invariants/OptimismPortal.t.sol#L233) **Test:** [`OptimismPortal.t.sol#L231`](../test/invariants/OptimismPortal.t.sol#L231)
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#L164`](../test/invariants/ResourceMetering.t.sol#L164) **Test:** [`ResourceMetering.t.sol#L163`](../test/invariants/ResourceMetering.t.sol#L163)
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#L173`](../test/invariants/ResourceMetering.t.sol#L173) **Test:** [`ResourceMetering.t.sol#L172`](../test/invariants/ResourceMetering.t.sol#L172)
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#L181`](../test/invariants/ResourceMetering.t.sol#L181) **Test:** [`ResourceMetering.t.sol#L180`](../test/invariants/ResourceMetering.t.sol#L180)
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#L189`](../test/invariants/ResourceMetering.t.sol#L189) **Test:** [`ResourceMetering.t.sol#L188`](../test/invariants/ResourceMetering.t.sol#L188)
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#L199`](../test/invariants/ResourceMetering.t.sol#L199) **Test:** [`ResourceMetering.t.sol#L198`](../test/invariants/ResourceMetering.t.sol#L198)
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#L209`](../test/invariants/ResourceMetering.t.sol#L209) **Test:** [`ResourceMetering.t.sol#L208`](../test/invariants/ResourceMetering.t.sol#L208)
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#L218`](../test/invariants/ResourceMetering.t.sol#L218) **Test:** [`ResourceMetering.t.sol#L217`](../test/invariants/ResourceMetering.t.sol#L217)
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#L69`](../test/invariants/SystemConfig.t.sol#L69) **Test:** [`SystemConfig.t.sol#L68`](../test/invariants/SystemConfig.t.sol#L68)
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
}, },
"src/L1/DelayedVetoable.sol": { "src/L1/DelayedVetoable.sol": {
"initCodeHash": "0x84f78e56211500a768b2c5bbafde8e7b411bd64c237297370d7d22326b68357c", "initCodeHash": "0x84f78e56211500a768b2c5bbafde8e7b411bd64c237297370d7d22326b68357c",
"sourceCodeHash": "0xbe48194f0d2193286b539932c1624b3576f932dcac39af7d14acfbe35c0a4216" "sourceCodeHash": "0xc59b8574531162e016d7342aeb6e79d05574e90dbea6c0e5ede35b65010ad894"
}, },
"src/L1/L1CrossDomainMessenger.sol": { "src/L1/L1CrossDomainMessenger.sol": {
"initCodeHash": "0xb0b3273999191e4ff616509e3a368a9d89f7967c20ba73c1bc5bd72bd13acb16", "initCodeHash": "0xb0b3273999191e4ff616509e3a368a9d89f7967c20ba73c1bc5bd72bd13acb16",
......
...@@ -183,21 +183,11 @@ ...@@ -183,21 +183,11 @@
"name": "Vetoed", "name": "Vetoed",
"type": "event" "type": "event"
}, },
{
"inputs": [],
"name": "AlreadyDelayed",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "ForwardingEarly", "name": "ForwardingEarly",
"type": "error" "type": "error"
}, },
{
"inputs": [],
"name": "TargetUnitialized",
"type": "error"
},
{ {
"inputs": [ "inputs": [
{ {
......
...@@ -11,15 +11,9 @@ import { ISemver } from "src/universal/ISemver.sol"; ...@@ -11,15 +11,9 @@ import { ISemver } from "src/universal/ISemver.sol";
/// of the queuedAt(bytes32) function. This is because of input validation checks which solidity performs at /// of the queuedAt(bytes32) function. This is because of input validation checks which solidity performs at
/// runtime on functions which take an argument. /// runtime on functions which take an argument.
contract DelayedVetoable is ISemver { contract DelayedVetoable is ISemver {
/// @notice Error for when the delay has already been set.
error AlreadyDelayed();
/// @notice Error for when attempting to forward too early. /// @notice Error for when attempting to forward too early.
error ForwardingEarly(); error ForwardingEarly();
/// @notice Error for the target is not set.
error TargetUnitialized();
/// @notice Error for unauthorized calls. /// @notice Error for unauthorized calls.
error Unauthorized(address expected, address actual); error Unauthorized(address expected, address actual);
......
...@@ -150,7 +150,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init { ...@@ -150,7 +150,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
/// @dev Only the initiator can initiate a call. /// @dev Only the initiator can initiate a call.
function test_handleCall_unauthorizedInitiation_reverts() external { function test_handleCall_unauthorizedInitiation_reverts() external {
vm.expectRevert(); vm.expectRevert(abi.encodeWithSelector(DelayedVetoable.Unauthorized.selector, initiator, address(this)));
(bool revertsAsExpected,) = address(delayedVetoable).call(hex"00001234"); (bool revertsAsExpected,) = address(delayedVetoable).call(hex"00001234");
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -160,9 +160,9 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -160,9 +160,9 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
assumeNoClash(data); assumeNoClash(data);
vm.prank(initiator); vm.prank(initiator);
(bool success,) = address(delayedVetoable).call(data); (bool success,) = address(delayedVetoable).call(data);
success; assertTrue(success);
vm.expectRevert(); vm.expectRevert(DelayedVetoable.ForwardingEarly.selector);
(bool revertsAsExpected,) = address(delayedVetoable).call(data); (bool revertsAsExpected,) = address(delayedVetoable).call(data);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -185,8 +185,8 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -185,8 +185,8 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
(success,) = address(delayedVetoable).call(data); (success,) = address(delayedVetoable).call(data);
assertTrue(success); assertTrue(success);
// Attempt to foward the same call again. // Attempt to forward the same call again.
vm.expectRevert(); vm.expectRevert(abi.encodeWithSelector(DelayedVetoable.Unauthorized.selector, initiator, address(this)));
(bool revertsAsExpected,) = address(delayedVetoable).call(data); (bool revertsAsExpected,) = address(delayedVetoable).call(data);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -203,7 +203,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -203,7 +203,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
// Initiate the call // Initiate the call
vm.prank(initiator); vm.prank(initiator);
(bool success,) = address(delayedVetoable).call(inData); (bool success,) = address(delayedVetoable).call(inData);
success; assertTrue(success);
vm.warp(block.timestamp + operatingDelay); vm.warp(block.timestamp + operatingDelay);
vm.expectEmit(true, false, false, true, address(delayedVetoable)); vm.expectEmit(true, false, false, true, address(delayedVetoable));
...@@ -212,7 +212,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -212,7 +212,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
vm.mockCallRevert(target, inData, outData); vm.mockCallRevert(target, inData, outData);
// Forward the call // Forward the call
vm.expectRevert(); vm.expectRevert(outData);
(bool revertsAsExpected,) = address(delayedVetoable).call(inData); (bool revertsAsExpected,) = address(delayedVetoable).call(inData);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
...@@ -228,7 +228,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -228,7 +228,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
// Initiate the call // Initiate the call
vm.prank(initiator); vm.prank(initiator);
(bool success,) = address(delayedVetoable).call(inData); (bool success,) = address(delayedVetoable).call(inData);
success; assertTrue(success);
vm.warp(block.timestamp + operatingDelay); vm.warp(block.timestamp + operatingDelay);
vm.expectEmit(true, false, false, true, address(delayedVetoable)); vm.expectEmit(true, false, false, true, address(delayedVetoable));
...@@ -252,7 +252,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init { ...@@ -252,7 +252,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
vm.store(address(delayedVetoable), bytes32(uint256(0)), bytes32(uint256(0))); vm.store(address(delayedVetoable), bytes32(uint256(0)), bytes32(uint256(0)));
vm.prank(initiator); vm.prank(initiator);
vm.expectRevert(); vm.expectRevert(bytes(""));
(bool revertsAsExpected,) = address(delayedVetoable).call(inData); (bool revertsAsExpected,) = address(delayedVetoable).call(inData);
assertTrue(revertsAsExpected); assertTrue(revertsAsExpected);
} }
......
...@@ -132,7 +132,7 @@ contract L1ERC721Bridge_Test is Bridge_Initializer { ...@@ -132,7 +132,7 @@ contract L1ERC721Bridge_Test is Bridge_Initializer {
function test_bridgeERC721_localTokenZeroAddress_reverts() external { function test_bridgeERC721_localTokenZeroAddress_reverts() external {
// Bridge the token. // Bridge the token.
vm.prank(alice); vm.prank(alice);
vm.expectRevert(); vm.expectRevert(bytes(""));
l1ERC721Bridge.bridgeERC721(address(0), address(remoteToken), tokenId, 1234, hex"5678"); l1ERC721Bridge.bridgeERC721(address(0), address(remoteToken), tokenId, 1234, hex"5678");
// Token is not locked in the bridge. // Token is not locked in the bridge.
...@@ -201,7 +201,7 @@ contract L1ERC721Bridge_Test is Bridge_Initializer { ...@@ -201,7 +201,7 @@ contract L1ERC721Bridge_Test is Bridge_Initializer {
function test_bridgeERC721To_localTokenZeroAddress_reverts() external { function test_bridgeERC721To_localTokenZeroAddress_reverts() external {
// Bridge the token. // Bridge the token.
vm.prank(alice); vm.prank(alice);
vm.expectRevert(); vm.expectRevert(bytes(""));
l1ERC721Bridge.bridgeERC721To(address(0), address(remoteToken), bob, tokenId, 1234, hex"5678"); l1ERC721Bridge.bridgeERC721To(address(0), address(remoteToken), bob, tokenId, 1234, hex"5678");
// Token is not locked in the bridge. // Token is not locked in the bridge.
......
...@@ -8,7 +8,6 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; ...@@ -8,7 +8,6 @@ import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies // Target contract dependencies
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
......
...@@ -133,7 +133,7 @@ contract L2ERC721Bridge_Test is Bridge_Initializer { ...@@ -133,7 +133,7 @@ contract L2ERC721Bridge_Test is Bridge_Initializer {
function test_bridgeERC721_localTokenZeroAddress_reverts() external { function test_bridgeERC721_localTokenZeroAddress_reverts() external {
// Bridge the token. // Bridge the token.
vm.prank(alice); vm.prank(alice);
vm.expectRevert(); vm.expectRevert(bytes(""));
l2ERC721Bridge.bridgeERC721(address(0), address(remoteToken), tokenId, 1234, hex"5678"); l2ERC721Bridge.bridgeERC721(address(0), address(remoteToken), tokenId, 1234, hex"5678");
// Token is not locked in the bridge. // Token is not locked in the bridge.
...@@ -198,7 +198,7 @@ contract L2ERC721Bridge_Test is Bridge_Initializer { ...@@ -198,7 +198,7 @@ contract L2ERC721Bridge_Test is Bridge_Initializer {
function test_bridgeERC721To_localTokenZeroAddress_reverts() external { function test_bridgeERC721To_localTokenZeroAddress_reverts() external {
// Bridge the token. // Bridge the token.
vm.prank(alice); vm.prank(alice);
vm.expectRevert(); vm.expectRevert(bytes(""));
l2ERC721Bridge.bridgeERC721To(address(0), address(l1ERC721Bridge), bob, tokenId, 1234, hex"5678"); l2ERC721Bridge.bridgeERC721To(address(0), address(l1ERC721Bridge), bob, tokenId, 1234, hex"5678");
// Token is not locked in the bridge. // Token is not locked in the bridge.
......
...@@ -6,16 +6,13 @@ import { Vm } from "forge-std/Vm.sol"; ...@@ -6,16 +6,13 @@ import { Vm } from "forge-std/Vm.sol";
import { DisputeGameFactory_Init } from "test/dispute/DisputeGameFactory.t.sol"; import { DisputeGameFactory_Init } from "test/dispute/DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol"; import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol"; import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol"; import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol";
import "src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol"; import "src/libraries/DisputeErrors.sol";
import { Types } from "src/libraries/Types.sol";
import { LibClock } from "src/dispute/lib/LibUDT.sol"; import { LibClock } from "src/dispute/lib/LibUDT.sol";
import { LibPosition } from "src/dispute/lib/LibPosition.sol"; import { LibPosition } from "src/dispute/lib/LibPosition.sol";
import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol"; import { IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
import { AlphabetVM } from "test/mocks/AlphabetVM.sol"; import { AlphabetVM } from "test/mocks/AlphabetVM.sol";
import { DisputeActor, HonestDisputeActor } from "test/actors/FaultDisputeActors.sol"; import { DisputeActor, HonestDisputeActor } from "test/actors/FaultDisputeActors.sol";
...@@ -619,7 +616,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -619,7 +616,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds); vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds);
for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) { for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) {
(bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1))); (bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1)));
success; assertTrue(success);
} }
gameProxy.resolve(); gameProxy.resolve();
...@@ -679,7 +676,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -679,7 +676,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds); vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds);
for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) { for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) {
(bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1))); (bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1)));
success; assertTrue(success);
} }
gameProxy.resolve(); gameProxy.resolve();
...@@ -708,7 +705,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -708,7 +705,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
// Make claims with bob, charlie and the test contract on defense, and alice as the challenger // Make claims with bob, charlie and the test contract on defense, and alice as the challenger
// charlie is successfully countered by alice // charlie is successfully countered by alice
// alice is successfully countered by both bob and the test coontract // alice is successfully countered by both bob and the test contract
vm.prank(alice); vm.prank(alice);
gameProxy.attack{ value: 1 ether }(0, _dummyClaim()); gameProxy.attack{ value: 1 ether }(0, _dummyClaim());
...@@ -725,7 +722,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init { ...@@ -725,7 +722,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds); vm.warp(block.timestamp + 3 days + 12 hours + 1 seconds);
for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) { for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) {
(bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1))); (bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1)));
success; assertTrue(success);
} }
gameProxy.resolve(); gameProxy.resolve();
...@@ -1436,7 +1433,7 @@ contract FaultDispute_1v1_Actors_Test is FaultDisputeGame_Init { ...@@ -1436,7 +1433,7 @@ contract FaultDispute_1v1_Actors_Test is FaultDisputeGame_Init {
// resolved before global resolution, which catches any unresolved subgames here. // resolved before global resolution, which catches any unresolved subgames here.
for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) { for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) {
(bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1))); (bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1)));
success; assertTrue(success);
} }
gameProxy.resolve(); gameProxy.resolve();
} }
......
...@@ -6,7 +6,6 @@ import { Vm } from "forge-std/Vm.sol"; ...@@ -6,7 +6,6 @@ import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol"; import { L1CrossDomainMessenger } from "src/L1/L1CrossDomainMessenger.sol";
import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol"; import { Bridge_Initializer } from "test/setup/Bridge_Initializer.sol";
import { Types } from "src/libraries/Types.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
......
...@@ -42,7 +42,7 @@ contract FaultDisputeGame_Solvency_Invariant is FaultDisputeGame_Init { ...@@ -42,7 +42,7 @@ contract FaultDisputeGame_Solvency_Invariant is FaultDisputeGame_Init {
for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) { for (uint256 i = gameProxy.claimDataLen(); i > 0; i--) {
(bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1))); (bool success,) = address(gameProxy).call(abi.encodeCall(gameProxy.resolveClaim, (i - 1)));
success; assertTrue(success);
} }
gameProxy.resolve(); gameProxy.resolve();
......
...@@ -6,8 +6,6 @@ import { Vm } from "forge-std/Vm.sol"; ...@@ -6,8 +6,6 @@ import { Vm } from "forge-std/Vm.sol";
import { OptimismPortal } from "src/L1/OptimismPortal.sol"; import { OptimismPortal } from "src/L1/OptimismPortal.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol"; import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
......
...@@ -8,7 +8,6 @@ import { StdInvariant } from "forge-std/StdInvariant.sol"; ...@@ -8,7 +8,6 @@ import { StdInvariant } from "forge-std/StdInvariant.sol";
import { Arithmetic } from "src/libraries/Arithmetic.sol"; import { Arithmetic } from "src/libraries/Arithmetic.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { InvariantTest } from "test/invariants/InvariantTest.sol"; import { InvariantTest } from "test/invariants/InvariantTest.sol";
......
...@@ -4,7 +4,6 @@ pragma solidity 0.8.15; ...@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
import { SystemConfig } from "src/L1/SystemConfig.sol"; import { SystemConfig } from "src/L1/SystemConfig.sol";
import { Proxy } from "src/universal/Proxy.sol"; import { Proxy } from "src/universal/Proxy.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
contract SystemConfig_GasLimitLowerBound_Invariant is Test { contract SystemConfig_GasLimitLowerBound_Invariant is Test {
......
...@@ -90,7 +90,7 @@ contract OptimismMintableTokenFactory_Test is Bridge_Initializer { ...@@ -90,7 +90,7 @@ contract OptimismMintableTokenFactory_Test is Bridge_Initializer {
vm.prank(alice); vm.prank(alice);
l2OptimismMintableERC20Factory.createStandardL2Token(remote, "Beep", "BOOP"); l2OptimismMintableERC20Factory.createStandardL2Token(remote, "Beep", "BOOP");
vm.expectRevert(); vm.expectRevert(bytes(""));
vm.prank(alice); vm.prank(alice);
l2OptimismMintableERC20Factory.createStandardL2Token(remote, "Beep", "BOOP"); l2OptimismMintableERC20Factory.createStandardL2Token(remote, "Beep", "BOOP");
......
...@@ -59,7 +59,7 @@ contract OptimismMintableERC721Factory_Test is Bridge_Initializer { ...@@ -59,7 +59,7 @@ contract OptimismMintableERC721Factory_Test is Bridge_Initializer {
vm.prank(alice); vm.prank(alice);
factory.createOptimismMintableERC721(remote, "L2Token", "L2T"); factory.createOptimismMintableERC721(remote, "L2Token", "L2T");
vm.expectRevert(); vm.expectRevert(bytes(""));
vm.prank(alice); vm.prank(alice);
factory.createOptimismMintableERC721(remote, "L2Token", "L2T"); factory.createOptimismMintableERC721(remote, "L2Token", "L2T");
......
...@@ -76,7 +76,7 @@ contract Proxy_Test is Test { ...@@ -76,7 +76,7 @@ contract Proxy_Test is Test {
// The implementation does not have a `upgradeTo` // The implementation does not have a `upgradeTo`
// method, calling `upgradeTo` not as the owner // method, calling `upgradeTo` not as the owner
// should revert. // should revert.
vm.expectRevert(); vm.expectRevert(bytes(""));
proxy.upgradeTo(address(64)); proxy.upgradeTo(address(64));
// Call `upgradeTo` as the owner, it should succeed // Call `upgradeTo` as the owner, it should succeed
...@@ -95,7 +95,7 @@ contract Proxy_Test is Test { ...@@ -95,7 +95,7 @@ contract Proxy_Test is Test {
function test_ownerProxyCall_notAdmin_succeeds() external { function test_ownerProxyCall_notAdmin_succeeds() external {
// Calling `changeAdmin` not as the owner should revert // Calling `changeAdmin` not as the owner should revert
// as the implementation does not have a `changeAdmin` method. // as the implementation does not have a `changeAdmin` method.
vm.expectRevert(); vm.expectRevert(bytes(""));
proxy.changeAdmin(address(1)); proxy.changeAdmin(address(1));
// Call `changeAdmin` as the owner, it should succeed // Call `changeAdmin` as the owner, it should succeed
...@@ -108,7 +108,7 @@ contract Proxy_Test is Test { ...@@ -108,7 +108,7 @@ contract Proxy_Test is Test {
// Calling `admin` not as the owner should // Calling `admin` not as the owner should
// revert as the implementation does not have // revert as the implementation does not have
// a `admin` method. // a `admin` method.
vm.expectRevert(); vm.expectRevert(bytes(""));
proxy.admin(); proxy.admin();
// Calling `admin` as the owner should work. // Calling `admin` as the owner should work.
...@@ -186,7 +186,7 @@ contract Proxy_Test is Test { ...@@ -186,7 +186,7 @@ contract Proxy_Test is Test {
// The attempt to `upgradeToAndCall` // The attempt to `upgradeToAndCall`
// should revert when it is not called by the owner. // should revert when it is not called by the owner.
vm.expectRevert(); vm.expectRevert(bytes(""));
proxy.upgradeToAndCall(address(simpleStorage), abi.encodeWithSelector(simpleStorage.set.selector, 1, 1)); proxy.upgradeToAndCall(address(simpleStorage), abi.encodeWithSelector(simpleStorage.set.selector, 1, 1));
} }
......
...@@ -106,7 +106,7 @@ contract StandardBridge_Stateless_Test is CommonTest { ...@@ -106,7 +106,7 @@ contract StandardBridge_Stateless_Test is CommonTest {
assertFalse(bridge.isCorrectTokenPair(address(legacy), address(0x20))); assertFalse(bridge.isCorrectTokenPair(address(legacy), address(0x20)));
// A token that doesn't support either modern or legacy interface // A token that doesn't support either modern or legacy interface
// will revert // will revert
vm.expectRevert(); vm.expectRevert(bytes(""));
bridge.isCorrectTokenPair(address(erc20), address(1)); bridge.isCorrectTokenPair(address(erc20), address(1));
} }
......
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