Commit f49b71d5 authored by Maurelian's avatar Maurelian

Use bound instead of vm.assume

ctb: Update Hashing tests with bounded version

ctb: Update Portal tests with bound
parent c8714cb4
---
'@eth-optimism/indexer': patch
'@eth-optimism/contracts-bedrock': patch
'@eth-optimism/contracts-periphery': patch
---
Updated forge-std version
This diff is collapsed.
......@@ -66,7 +66,7 @@ contract CrossDomainOwnableThroughPortal_Test is Portal_Initializer {
// 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
});
(
......
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