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
e7a945e8
Commit
e7a945e8
authored
Jun 21, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forge-deploy: cleanup
parent
af984d60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
+27
-16
Deploy.s.sol
packages/contracts-bedrock/scripts/Deploy.s.sol
+16
-9
Deployer.sol
packages/contracts-bedrock/scripts/Deployer.sol
+11
-7
No files found.
packages/contracts-bedrock/scripts/Deploy.s.sol
View file @
e7a945e8
...
@@ -34,6 +34,12 @@ import { Predeploys } from "../contracts/libraries/Predeploys.sol";
...
@@ -34,6 +34,12 @@ import { Predeploys } from "../contracts/libraries/Predeploys.sol";
contract Deploy is Deployer {
contract Deploy is Deployer {
DeployConfig cfg;
DeployConfig cfg;
/// @notice The name of the script, used to ensure the right deploy artifacts
/// are used.
function name() public pure override returns (string memory) {
return "Deploy";
}
function setUp() public override {
function setUp() public override {
super.setUp();
super.setUp();
...
@@ -44,6 +50,7 @@ contract Deploy is Deployer {
...
@@ -44,6 +50,7 @@ contract Deploy is Deployer {
console.log("Deployment context: %s", deploymentContext);
console.log("Deployment context: %s", deploymentContext);
}
}
/// @notice Deploy all of the L1 contracts
function run() public {
function run() public {
console.log("Deploying L1 system");
console.log("Deploying L1 system");
...
@@ -149,18 +156,18 @@ contract Deploy is Deployer {
...
@@ -149,18 +156,18 @@ contract Deploy is Deployer {
/// @notice Deploy the L1CrossDomainMessengerProxy
/// @notice Deploy the L1CrossDomainMessengerProxy
function deployL1CrossDomainMessengerProxy() broadcast() public returns (address) {
function deployL1CrossDomainMessengerProxy() broadcast() public returns (address) {
AddressManager addressManager = AddressManager(mustGetAddress("AddressManager"));
AddressManager addressManager = AddressManager(mustGetAddress("AddressManager"));
string memory
n
ame = "OVM_L1CrossDomainMessenger";
string memory
contractN
ame = "OVM_L1CrossDomainMessenger";
ResolvedDelegateProxy proxy = new ResolvedDelegateProxy(addressManager,
n
ame);
ResolvedDelegateProxy proxy = new ResolvedDelegateProxy(addressManager,
contractN
ame);
save("L1CrossDomainMessengerProxy", address(proxy));
save("L1CrossDomainMessengerProxy", address(proxy));
console.log("L1CrossDomainMessengerProxy deployed at %s", address(proxy));
console.log("L1CrossDomainMessengerProxy deployed at %s", address(proxy));
address addr = addressManager.getAddress(
n
ame);
address addr = addressManager.getAddress(
contractN
ame);
if (addr != address(proxy)) {
if (addr != address(proxy)) {
addressManager.setAddress(
n
ame, address(proxy));
addressManager.setAddress(
contractN
ame, address(proxy));
}
}
require(addressManager.getAddress(
n
ame) == address(proxy));
require(addressManager.getAddress(
contractN
ame) == address(proxy));
return address(proxy);
return address(proxy);
}
}
...
@@ -569,13 +576,13 @@ contract Deploy is Deployer {
...
@@ -569,13 +576,13 @@ contract Deploy is Deployer {
}
}
require(uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy)) == uint256(ProxyAdmin.ProxyType.RESOLVED));
require(uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy)) == uint256(ProxyAdmin.ProxyType.RESOLVED));
string memory
n
ame = "OVM_L1CrossDomainMessenger";
string memory
contractN
ame = "OVM_L1CrossDomainMessenger";
string memory implName = proxyAdmin.implementationName(l1CrossDomainMessenger);
string memory implName = proxyAdmin.implementationName(l1CrossDomainMessenger);
if (keccak256(bytes(
n
ame)) != keccak256(bytes(implName))) {
if (keccak256(bytes(
contractN
ame)) != keccak256(bytes(implName))) {
proxyAdmin.setImplementationName(l1CrossDomainMessengerProxy,
n
ame);
proxyAdmin.setImplementationName(l1CrossDomainMessengerProxy,
contractN
ame);
}
}
require(
require(
keccak256(bytes(proxyAdmin.implementationName(l1CrossDomainMessengerProxy))) == keccak256(bytes(
n
ame))
keccak256(bytes(proxyAdmin.implementationName(l1CrossDomainMessengerProxy))) == keccak256(bytes(
contractN
ame))
);
);
proxyAdmin.upgradeAndCall({
proxyAdmin.upgradeAndCall({
...
...
packages/contracts-bedrock/scripts/Deployer.sol
View file @
e7a945e8
...
@@ -34,7 +34,7 @@ struct Artifact {
...
@@ -34,7 +34,7 @@ struct Artifact {
/// When a contract is deployed, call the `save` function to write its name and
/// When a contract is deployed, call the `save` function to write its name and
/// contract address to disk. Then the `sync` function can be called to generate
/// contract address to disk. Then the `sync` function can be called to generate
/// hardhat deploy style artifacts. Forked from `forge-deploy`.
/// hardhat deploy style artifacts. Forked from `forge-deploy`.
contract Deployer is Script {
abstract
contract Deployer is Script {
/// @notice The set of deployments that have been done during execution.
/// @notice The set of deployments that have been done during execution.
mapping(string => Deployment) internal _namedDeployments;
mapping(string => Deployment) internal _namedDeployments;
/// @notice The same as `_namedDeployments` but as an array.
/// @notice The same as `_namedDeployments` but as an array.
...
@@ -66,7 +66,7 @@ contract Deployer is Script {
...
@@ -66,7 +66,7 @@ contract Deployer is Script {
/// @notice Create the global variables and set up the filesystem
/// @notice Create the global variables and set up the filesystem
function setUp() public virtual {
function setUp() public virtual {
string memory root = vm.projectRoot();
string memory root = vm.projectRoot();
deployScript = vm.envOr("DEPLOY_SCRIPT",
string("DeployConfig"
));
deployScript = vm.envOr("DEPLOY_SCRIPT",
name(
));
deploymentContext = _getDeploymentContext();
deploymentContext = _getDeploymentContext();
string memory deployFile = vm.envOr("DEPLOY_FILE", string("run-latest.json"));
string memory deployFile = vm.envOr("DEPLOY_FILE", string("run-latest.json"));
...
@@ -147,6 +147,10 @@ contract Deployer is Script {
...
@@ -147,6 +147,10 @@ contract Deployer is Script {
vm.removeFile(tempDeploymentsPath);
vm.removeFile(tempDeploymentsPath);
}
}
/// @notice Returns the name of the deployment script. Children contracts
/// must implement this to ensure that the deploy artifacts can be found.
function name() public virtual pure returns (string memory);
/// @notice Returns all of the deployments done in the current context.
/// @notice Returns all of the deployments done in the current context.
function newDeployments() external view returns (Deployment[] memory) {
function newDeployments() external view returns (Deployment[] memory) {
return _newDeployments;
return _newDeployments;
...
@@ -236,10 +240,10 @@ contract Deployer is Script {
...
@@ -236,10 +240,10 @@ contract Deployer is Script {
Deployment[] memory deployments = new Deployment[](names.length);
Deployment[] memory deployments = new Deployment[](names.length);
for (uint256 i; i < names.length; i++) {
for (uint256 i; i < names.length; i++) {
string memory
n
ame = names[i];
string memory
contractN
ame = names[i];
address addr = stdJson.readAddress(json, string.concat("$.",
n
ame));
address addr = stdJson.readAddress(json, string.concat("$.",
contractN
ame));
deployments[i] = Deployment({
deployments[i] = Deployment({
name:
n
ame,
name:
contractN
ame,
addr: payable(addr)
addr: payable(addr)
});
});
}
}
...
@@ -358,9 +362,9 @@ contract Deployer is Script {
...
@@ -358,9 +362,9 @@ contract Deployer is Script {
}
}
/// @notice Adds a deployment to the temp deployments file
/// @notice Adds a deployment to the temp deployments file
function _writeTemp(string memory
name, address
deployed) internal {
function _writeTemp(string memory
_name, address _
deployed) internal {
vm.writeJson({
vm.writeJson({
json: stdJson.serialize("",
name,
deployed),
json: stdJson.serialize("",
_name, _
deployed),
path: tempDeploymentsPath
path: tempDeploymentsPath
});
});
}
}
...
...
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