Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
46b8cacf
Commit
46b8cacf
authored
Sep 22, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: better semver lock script
parent
9fe09cb7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
SemverLock.s.sol
packages/contracts-bedrock/scripts/SemverLock.s.sol
+12
-3
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+2
-1
No files found.
packages/contracts-bedrock/scripts/SemverLock.s.sol
View file @
46b8cacf
...
...
@@ -2,6 +2,7 @@
pragma solidity 0.8.15;
import { Script } from "forge-std/Script.sol";
import { stdJson } from "forge-std/StdJson.sol";
import { console2 as console } from "forge-std/console2.sol";
contract SemverLock is Script {
...
...
@@ -34,14 +35,22 @@ contract SemverLock is Script {
commands[2] = string.concat("echo \"", _files[i], "\"| sed -E \'s|src/.*/(.+)\\.sol|\\1|\'");
string memory contractName = string(vm.ffi(commands));
commands[0] = "bash";
commands[1] = "-c";
commands[2] = "forge config --json | jq -r .out";
string memory artifactsDir = string(vm.ffi(commands));
// Handle the case where there are multiple artifacts for a contract. This happens
// when the same contract is compiled with multiple compiler versions.
string memory contractArtifactDir = string.concat(artifactsDir, "/", contractName, ".sol");
commands[2] = string.concat("ls -1 --color=never ", contractArtifactDir, " | jq -R -s -c 'split(\"\n\") | map(select(length > 0))'");
string memory artifactFiles = string(vm.ffi(commands));
string[] memory files = stdJson.readStringArray(artifactFiles, "");
require(files.length > 0, string.concat("No artifacts found for ", contractName));
string memory fileName = files[0];
// Parse the artifact to get the contract's initcode hash.
bytes memory initCode =
vm.getCode(string.concat(artifactsDir, "/", contractName, ".sol/",
contractName, ".json"
));
vm.getCode(string.concat(artifactsDir, "/", contractName, ".sol/",
fileName
));
// Serialize the source hash in JSON.
string memory j = vm.serializeBytes32(out, _files[i], keccak256(abi.encodePacked(fileContents, initCode)));
...
...
packages/contracts-bedrock/semver-lock.json
View file @
46b8cacf
...
...
@@ -18,7 +18,8 @@
"src/L2/L2StandardBridge.sol"
:
"0xfe01bcb1ddc947b9b8a7093d0971854b9fa8d49da5bd933a3dd106167907f882"
,
"src/L2/L2ToL1MessagePasser.sol"
:
"0xafc710b4d320ef450586d96a61cbd58cac814cb3b0c4fdc280eace3efdcdf321"
,
"src/L2/SequencerFeeVault.sol"
:
"0xc2f733c1128d06ad60bf1e1d98c8f684a4825b11875ccdf2376ede33f5aad4e6"
,
"src/dispute/FaultDisputeGame.sol"
:
"0x76e7c16431faa32e2074e6abdfe3e86f5ec90b4ac8a6b662edba8c3ce791ad80"
,
"src/dispute/DisputeGameFactory.sol"
:
"0xfdfa141408d7f8de7e230ff4bef088e30d0e4d569ca743d60d292abdd21ff270"
,
"src/dispute/FaultDisputeGame.sol"
:
"0xfdf4be4d6ed4bcbf6492c43fdbfd04d0c62ebee11b8fe9ee2e7757bde8f7383d"
,
"src/legacy/DeployerWhitelist.sol"
:
"0xf2129ec3da75307ba8e21bc943c332bb04704642e6e263149b5c8ee92dbcb7a8"
,
"src/legacy/L1BlockNumber.sol"
:
"0x30aae1fc85103476af0226b6e98c71c01feebbdc35d93401390b1ad438a37be6"
,
"src/legacy/LegacyMessagePasser.sol"
:
"0x5c08b0a663cc49d30e4e38540f6aefab19ef287c3ecd31c8d8c3decd5f5bd497"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment