Commit 9dc125a9 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

ci: bump ci builder `0.50.0` (#11334)

* ci: bump ci builder `0.50.0`

Bumps the `ci-builder` image with an updated version
of foundry.

Foundry update:
https://github.com/ethereum-optimism/optimism/pull/11325

Docker build:
https://app.circleci.com/pipelines/github/ethereum-optimism/optimism/60263/workflows/154fd94a-4029-4e2f-8bce-4ea4c6d25897

* contracts-bedrock: fix tests after new foundry version

* contracts-bedrock: comment why skip

* test: better comments

* gas-snapshot: regenerate

* snapshots: update

* snapshots: update

* fix(ctb): Align expected ptr in `Bytes.slice` test

An update to `forge-std` causes `bound` to set the free memory pointer
at an unaligned offset. This commit updates the test such that the
expected pointer is correctly aligned, without an assumption on the
starting ptr's alignment.

---------
Co-authored-by: default avatarclabby <ben@clab.by>
parent 0ab3e7ab
...@@ -3,7 +3,7 @@ version: 2.1 ...@@ -3,7 +3,7 @@ version: 2.1
parameters: parameters:
ci_builder_image: ci_builder_image:
type: string type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.49.0 default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:v0.50.0
ci_builder_rust_image: ci_builder_rust_image:
type: string type: string
default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest default: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder-rust:latest
......
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369380) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369356)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967520) GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967496)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 561992) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564483)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4074035) GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076526)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 466947) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 466947)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512629) GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512629)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624) GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72624)
......
...@@ -281,7 +281,13 @@ contract ArtifactResourceMetering_Test is Test { ...@@ -281,7 +281,13 @@ contract ArtifactResourceMetering_Test is Test {
/// @dev Generates a CSV file. No more than the L1 block gas limit should /// @dev Generates a CSV file. No more than the L1 block gas limit should
/// be supplied to the `meter` function to avoid long execution time. /// be supplied to the `meter` function to avoid long execution time.
/// This test is skipped because there is no need to run it every time.
/// It generates a CSV file on disk that can be used to analyze the
/// gas usage and cost of the `ResourceMetering` contract. The next time
/// that the gas usage needs to be analyzed, the skip may be removed.
function test_meter_generateArtifact_succeeds() external { function test_meter_generateArtifact_succeeds() external {
vm.skip({ skipTest: true });
vm.writeLine( vm.writeLine(
outfile, outfile,
"prevBaseFee,prevBoughtGas,prevBlockNumDiff,l1BaseFee,requestedGas,gasConsumed,ethPrice,usdCost,success" "prevBaseFee,prevBoughtGas,prevBlockNumDiff,l1BaseFee,requestedGas,gasConsumed,ethPrice,usdCost,success"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -67,19 +67,23 @@ contract Bytes_slice_Test is Test { ...@@ -67,19 +67,23 @@ contract Bytes_slice_Test is Test {
/// @notice Tests that the `slice` function correctly updates the free memory pointer depending /// @notice Tests that the `slice` function correctly updates the free memory pointer depending
/// on the length of the slice. /// on the length of the slice.
/// The calls to `bound` are to reduce the number of times that `assume` is triggered.
function testFuzz_slice_memorySafety_succeeds(bytes memory _input, uint256 _start, uint256 _length) public { function testFuzz_slice_memorySafety_succeeds(bytes memory _input, uint256 _start, uint256 _length) public {
vm.assume(_input.length > 0);
// The start should never be more than the length of the input bytes array - 1 // The start should never be more than the length of the input bytes array - 1
vm.assume(_start < _input.length); _start = bound(_start, 0, _input.length - 1);
// The length should never be more than the length of the input bytes array - the starting // The length should never be more than the length of the input bytes array - the starting
// slice index. // slice index.
vm.assume(_length <= _input.length - _start); _length = bound(_length, 0, _input.length - _start);
// Grab the free memory pointer before the slice operation // Grab the free memory pointer before the slice operation
uint64 initPtr; uint64 initPtr;
assembly { assembly {
initPtr := mload(0x40) initPtr := mload(0x40)
} }
uint64 expectedPtr = uint64(initPtr + 0x20 + ((_length + 0x1f) & ~uint256(0x1f))); uint64 expectedPtr = uint64((initPtr + 0x20 + _length + 0x1f) & ~uint256(0x1f));
// Ensure that all memory outside of the expected range is safe. // Ensure that all memory outside of the expected range is safe.
vm.expectSafeMemory(initPtr, expectedPtr); vm.expectSafeMemory(initPtr, expectedPtr);
...@@ -107,7 +111,7 @@ contract Bytes_slice_Test is Test { ...@@ -107,7 +111,7 @@ contract Bytes_slice_Test is Test {
// Note that we use a slightly less efficient, but equivalent method of rounding // Note that we use a slightly less efficient, but equivalent method of rounding
// up `_length` to the next multiple of 32 than is used in the `slice` function. // up `_length` to the next multiple of 32 than is used in the `slice` function.
// This is to diff test the method used in `slice`. // This is to diff test the method used in `slice`.
uint64 _expectedPtr = uint64(initPtr + 0x20 + (((_length + 0x1F) >> 5) << 5)); uint64 _expectedPtr = uint64(((initPtr + 0x20 + _length + 0x1F) >> 5) << 5);
assertEq(finalPtr, _expectedPtr); assertEq(finalPtr, _expectedPtr);
// Sanity check for equivalence of the rounding methods. // Sanity check for equivalence of the rounding methods.
...@@ -144,11 +148,15 @@ contract Bytes_slice_TestFail is Test { ...@@ -144,11 +148,15 @@ contract Bytes_slice_TestFail is Test {
/// @notice Tests that, when given a start index `n` that is greater than /// @notice Tests that, when given a start index `n` that is greater than
/// `type(uint256).max - n`, the `slice` function reverts. /// `type(uint256).max - n`, the `slice` function reverts.
/// The calls to `bound` are to reduce the number of times that `assume` is triggered.
function testFuzz_slice_rangeOverflows_reverts(bytes memory _input, uint256 _start, uint256 _length) public { function testFuzz_slice_rangeOverflows_reverts(bytes memory _input, uint256 _start, uint256 _length) public {
// Ensure that `_length` is a realistic length of a slice. This is to make sure // Ensure that `_length` is a realistic length of a slice. This is to make sure
// we revert on the correct require statement. // we revert on the correct require statement.
_length = bound(_length, 0, _input.length == 0 ? 0 : _input.length - 1);
vm.assume(_length < _input.length); vm.assume(_length < _input.length);
// Ensure that `_start` will overflow if `_length` is added to it. // Ensure that `_start` will overflow if `_length` is added to it.
_start = bound(_start, type(uint256).max - _length, type(uint256).max);
vm.assume(_start > type(uint256).max - _length); vm.assume(_start > type(uint256).max - _length);
vm.expectRevert("slice_overflow"); vm.expectRevert("slice_overflow");
......
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