Skip to content

Commit

Permalink
Merge branch 'develop' into fix/genesis-script
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Jul 26, 2023
2 parents 74305be + bb9e17f commit 4f4afaa
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ jobs:
pnpm storage-snapshot
git diff --exit-code .storage-layout || echo "export STORAGE_SNAPSHOT_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: semver lock
command: |
pnpm semver-lock
git diff --exit-code semver-lock.json || echo "export SEMVER_LOCK_STATUS=1" >> "$BASH_ENV"
working_directory: packages/contracts-bedrock
- run:
name: invariant docs
command: |
Expand Down Expand Up @@ -492,6 +498,10 @@ jobs:
echo "Invariant docs failed, see job output for details."
FAILED=1
fi
if [[ "$SEMVER_LOCK_STATUS" -ne 0 ]]; then
echo "Semver lock failed, see job output for details."
FAILED=1
fi
if [[ "$FAILED" -ne 0 ]]; then
exit 1
fi
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fs_permissions = [
{ 'access'='read', 'path'='./deploy-config/' },
{ 'access'='read', 'path'='./broadcast/' },
{ access = 'read', path = './forge-artifacts/' },
{ 'access'='write', 'path'='./semver-lock.json' },
]

[profile.ci]
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"coverage:lcov": "pnpm build:differential && pnpm build:fuzz && forge coverage --report lcov",
"gas-snapshot": "pnpm build:differential && pnpm build:fuzz && forge snapshot --no-match-test 'testDiff|testFuzz|invariant|generateArtifact'",
"storage-snapshot": "./scripts/storage-snapshot.sh",
"semver-lock": "forge script scripts/SemverLock.s.sol",
"validate-deploy-configs": "./scripts/validate-deploy-configs.sh",
"validate-spacers": "forge build && npx ts-node scripts/validate-spacers.ts",
"slither": "./scripts/slither.sh",
Expand Down
43 changes: 43 additions & 0 deletions packages/contracts-bedrock/scripts/SemverLock.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";

contract SemverLock is Script {
function run() public {
// First, find all contracts with a Semver inheritance.
string[] memory commands = new string[](3);
commands[0] = "bash";
commands[1] = "-c";
commands[2] = "grep -rl '@custom:semver' contracts | jq -Rs 'split(\"\\n\") | map(select(length > 0))'";
string memory rawFiles = string(vm.ffi(commands));

string[] memory files = vm.parseJsonStringArray(rawFiles, "");
writeSemverLock(files);
}

/// @dev Writes a Semver lockfile
function writeSemverLock(string[] memory _files) internal {
string memory out;
for (uint256 i; i < _files.length; i++) {
// Use FFI to read the file to remove the need for FS permissions in the foundry.toml.
string[] memory commands = new string[](2);
commands[0] = "cat";
commands[1] = _files[i];
string memory fileContents = string(vm.ffi(commands));

// Serialize the source hash in JSON.
string memory j = vm.serializeBytes32(out, _files[i], keccak256(abi.encodePacked(fileContents)));

// If this is the last file, set the output.
if (i == _files.length - 1) {
out = j;
}
}

// Write the semver lockfile.
vm.writeJson(out, "semver-lock.json");
console.logString("Wrote semver lock file to \"semver-lock.json\".");
}
}
28 changes: 28 additions & 0 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"contracts/L1/L1CrossDomainMessenger.sol": "0xa043f901e98a24be71a4ec79d5e730e8e56ec616bb79793fc191138924c5e4b5",
"contracts/L1/L1ERC721Bridge.sol": "0x4983a413d0c6d1d83cf6463cd44e1adeb3d1bd49b5de3bacfceba04fc717caa2",
"contracts/L1/L1StandardBridge.sol": "0x6e361f923509eb35a74391770dad9529db7deae751cfc36506e7ef40f39d5351",
"contracts/L1/L2OutputOracle.sol": "0x2b285a897d3285975bd47e89bd5ec7025369931384f9f02a20f48254dbfca181",
"contracts/L1/OptimismPortal.sol": "0xd5abaa3d1093c41f8e81b3cd298d4a35f90d103d9bca566a47ca562635f2f943",
"contracts/L1/SystemConfig.sol": "0xbd2be6c19e6e85eae73ddf3cd6304a395e2a41d86aee1c15b6b0f044bf54232e",
"contracts/L2/BaseFeeVault.sol": "0xc7bf7c43dd5362f6474fc3da8bb38d1c616ed2a3396486446482acf62cacfc2f",
"contracts/L2/GasPriceOracle.sol": "0x712134045fba966b0d0cc28019f5c2bd298d999649f387d989f744b274020a82",
"contracts/L2/L1Block.sol": "0x64d2517a595a5b5af7eef1070920eb90aa595871ec55ba8b6d6aa323043ac000",
"contracts/L2/L1FeeVault.sol": "0x49f6a1a89e83467e84110232f9e3c5fb2d0fad373f12afeef6b15d135a605659",
"contracts/L2/L2CrossDomainMessenger.sol": "0xd1e057fe1889e0701f447af8016e4a201febdc28f640138878435746b3c6f647",
"contracts/L2/L2ERC721Bridge.sol": "0x2a0c241efb516161a12625e23d1e5aa32da815892e4fcc52f3b12d41cdff53b2",
"contracts/L2/L2StandardBridge.sol": "0x8ee5257e03ae4ba8555d9f7d13374c8a388315d62c16107bb4cadd450bfeb3d3",
"contracts/L2/L2ToL1MessagePasser.sol": "0x7e35c3c4f1dd3d131dd71db07676301f7c477f02b6d6bf0ec468ecf2bed8325b",
"contracts/L2/SequencerFeeVault.sol": "0x17b30ccaed8b8dbe965c892cb8aae7f594fb4a87e0edd3ca6cd8f94559b86df9",
"contracts/legacy/DeployerWhitelist.sol": "0x47277d9c8409d517501d172db6697d55090d3d3a9e4bb2b1adea83471d793b6b",
"contracts/legacy/L1BlockNumber.sol": "0x1a1690b8b5ab53cf2b5c8e85fb86028b4078ae656286ae482cabe68374334f2a",
"contracts/legacy/LegacyMessagePasser.sol": "0xc7f42e6165507b4c50a5169a950f66602e6b4b8cff17f5d95994e121abb18390",
"contracts/periphery/op-nft/AttestationStation.sol": "0xe8a905953896b45bb5ece6598c12c8234ee78e57bdb6022ee0e6c4771fd36b7e",
"contracts/periphery/op-nft/Optimist.sol": "0x7fe55cdb30c6f00d8058abc949e441743ac41c8f345ad92711e5348c515790f0",
"contracts/periphery/op-nft/OptimistAllowlist.sol": "0x1c4d648ccee99e3d1849b362117de2b6ff215b685fd81e529641afbd0f7eda37",
"contracts/periphery/op-nft/OptimistInviter.sol": "0xf465cf89f1b71dad3698a3e7626bf6b7ee9172cfdadba0ca3542a5b0150d38d5",
"contracts/universal/OptimismMintableERC20.sol": "0xadcb9f22ae05f8dd05202de210faf56d44c5af4fd9ccdc049f116fc7d2499ff7",
"contracts/universal/OptimismMintableERC20Factory.sol": "0x1d48aaec29c6732e5d25652a568c4f58a9606656711a14ef98c7cdd5768d9677",
"contracts/universal/OptimismMintableERC721.sol": "0x72c9c204caddf5a48b6a704621363926714162c2453392b922091d80aa73924f",
"contracts/universal/OptimismMintableERC721Factory.sol": "0x138d1cecb3c0daa85c73617a1c5d0956544bf65153c13dc11529a71f4b70fb3b"
}

0 comments on commit 4f4afaa

Please sign in to comment.