Commit dd4bf9cd authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #3862 from ethereum-optimism/vm-bound

Update forge-std and use bound instead of vm.assume
parents 29cee901 f49b71d5
---
'@eth-optimism/indexer': patch
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/contracts-periphery': patch
---
Updated forge-std version
This diff is collapsed.
......@@ -2,7 +2,7 @@
pragma solidity 0.8.15;
/* Testing utilities */
import { Test } from "forge-std/Test.sol";
import { Test, StdUtils } from "forge-std/Test.sol";
import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { L2ToL1MessagePasser } from "../L2/L2ToL1MessagePasser.sol";
import { L1StandardBridge } from "../L1/L1StandardBridge.sol";
......
......@@ -4,7 +4,7 @@ pragma solidity 0.8.15;
import { CommonTest, Portal_Initializer } from "./CommonTest.t.sol";
import { CrossDomainOwnable } from "../L2/CrossDomainOwnable.sol";
import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol";
import { Vm } from "forge-std/Vm.sol";
import { Vm, VmSafe } from "forge-std/Vm.sol";
import { Bytes32AddressLib } from "@rari-capital/solmate/src/utils/Bytes32AddressLib.sol";
contract XDomainSetter is CrossDomainOwnable {
......@@ -62,11 +62,11 @@ contract CrossDomainOwnableThroughPortal_Test is Portal_Initializer {
// Simulate the operation of the `op-node` by parsing data
// from logs
Vm.Log[] memory logs = vm.getRecordedLogs();
VmSafe.Log[] memory logs = vm.getRecordedLogs();
// Only 1 log emitted
assertEq(logs.length, 1);
Vm.Log memory log = logs[0];
VmSafe.Log memory log = logs[0];
// It is the expected topic
bytes32 topic = log.topics[0];
......
......@@ -21,19 +21,20 @@ contract Hashing_Test is CommonTest {
}
function test_hashCrossDomainMessage_differential(
uint256 _nonce,
uint240 _nonce,
uint16 _version,
address _sender,
address _target,
uint256 _value,
uint256 _gasLimit,
bytes memory _data
) external {
// Discard any fuzz tests with an invalid version
(, uint16 version) = Encoding.decodeVersionedNonce(_nonce);
vm.assume(version < 2);
// Ensure the version is valid
uint16 version = uint16(bound(uint256(_version), 0, 1));
uint256 nonce = Encoding.encodeVersionedNonce(_nonce, version);
bytes32 _hash = ffi.hashCrossDomainMessage(
_nonce,
nonce,
_sender,
_target,
_value,
......@@ -42,7 +43,7 @@ contract Hashing_Test is CommonTest {
);
bytes32 hash = Hashing.hashCrossDomainMessage(
_nonce,
nonce,
_sender,
_target,
_value,
......
......@@ -711,17 +711,18 @@ contract OptimismPortal_FinalizeWithdrawal_Test is Portal_Initializer {
uint256 _gasLimit,
bytes memory _data
) external {
vm.assume(_target != address(op)); // Cannot call the optimism portal.
vm.assume(_value < 200_000_000 ether); // Total ETH supply is currently ~120M ETH.
vm.assume(_gasLimit < 50_000_000);
uint256 _nonce = messagePasser.nonce();
// Cannot call the optimism portal
vm.assume(_target != address(op));
// Total ETH supply is currently about 120M ETH.
uint256 value = bound(_value, 0, 200_000_000 ether);
uint256 gasLimit = bound(_gasLimit, 0, 50_000_000);
uint256 nonce = messagePasser.nonce();
Types.WithdrawalTransaction memory _tx = Types.WithdrawalTransaction({
nonce: _nonce,
nonce: nonce,
sender: _sender,
target: _target,
value: _value,
gasLimit: _gasLimit,
value: value,
gasLimit: gasLimit,
data: _data
});
(
......
......@@ -67,7 +67,7 @@
"dotenv": "^16.0.0",
"ds-test": "https://github.com/dapphub/ds-test.git#9310e879db8ba3ea6d5c6489a579118fd264a3f5",
"ethereum-waffle": "^3.0.0",
"forge-std": "https://github.com/foundry-rs/forge-std.git#f18682b2874fc57d7c80a511fed0b35ec4201ffa",
"forge-std": "https://github.com/foundry-rs/forge-std.git#5bafa16b4a6aa67c503d96294be846a22a6f6efb",
"glob": "^7.1.6",
"hardhat-deploy": "^0.11.4",
"solhint": "^3.3.7",
......
......@@ -77,7 +77,7 @@
"ds-test": "https://github.com/dapphub/ds-test.git#9310e879db8ba3ea6d5c6489a579118fd264a3f5",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.7.0",
"forge-std": "https://github.com/foundry-rs/forge-std.git#f18682b2874fc57d7c80a511fed0b35ec4201ffa",
"forge-std": "https://github.com/foundry-rs/forge-std.git#5bafa16b4a6aa67c503d96294be846a22a6f6efb",
"hardhat": "^2.9.6",
"hardhat-deploy": "^0.11.10",
"hardhat-gas-reporter": "^1.0.8",
......
......@@ -9405,9 +9405,9 @@ forever-agent@~0.6.1:
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
"forge-std@https://github.com/foundry-rs/forge-std.git#f18682b2874fc57d7c80a511fed0b35ec4201ffa":
version "0.0.0"
resolved "https://github.com/foundry-rs/forge-std.git#f18682b2874fc57d7c80a511fed0b35ec4201ffa"
"forge-std@https://github.com/foundry-rs/forge-std.git#5bafa16b4a6aa67c503d96294be846a22a6f6efb":
version "1.0.0"
resolved "https://github.com/foundry-rs/forge-std.git#5bafa16b4a6aa67c503d96294be846a22a6f6efb"
form-data@^2.2.0:
version "2.5.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