Commit 0221590b authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-bedrock: fix deployment (#10660)

* contracts-bedrock: fix deployment

Fixes https://github.com/ethereum-optimism/optimism/issues/10634

The issue was that the salt was based on the name of the contract,
meaning that it was deterministic. The salt is now created by mixing
together the name and the `IMPL_SALT` env var. Anytime that `create2`
is used in the deploy script, the salt MUST be mixed with `IMPL_SALT`,
otherwise it will brick fresh deployments.

* kontrol: update summary
parent af2e3268
......@@ -445,7 +445,8 @@ contract Deploy is Deployer {
public
returns (address addr_)
{
console.log("Deploying safe: %s ", _name);
bytes32 salt = keccak256(abi.encode(_name, _implSalt()));
console.log("Deploying safe: %s with salt %s", _name, vm.toString(salt));
(SafeProxyFactory safeProxyFactory, Safe safeSingleton) = _getSafeFactory();
address[] memory expandedOwners = new address[](_owners.length + 1);
......@@ -462,11 +463,7 @@ contract Deploy is Deployer {
bytes memory initData = abi.encodeCall(
Safe.setup, (_owners, _threshold, address(0), hex"", address(0), address(0), 0, payable(address(0)))
);
addr_ = address(
safeProxyFactory.createProxyWithNonce(
address(safeSingleton), initData, uint256(keccak256(abi.encode(_name)))
)
);
addr_ = address(safeProxyFactory.createProxyWithNonce(address(safeSingleton), initData, uint256(salt)));
save(_name, addr_);
console.log("New safe: %s deployed at %s\n Note that this safe is owned by the deployer key", _name, addr_);
......
......@@ -32,7 +32,7 @@ contract DeploymentSummary is DeploymentSummaryCode {
address internal constant superchainConfigProxyAddress = 0xDEb1E9a6Be7Baf84208BB6E10aC9F9bbE1D70809;
address internal constant systemConfigAddress = 0x67866A5052E5302aaD08e9f352331fd8622eB6DC;
address internal constant systemConfigProxyAddress = 0x1c23A6d89F95ef3148BCDA8E242cAb145bf9c0E4;
address internal constant systemOwnerSafeAddress = 0x7d039be7F9b5190147621b02e82B250e1D748e02;
address internal constant systemOwnerSafeAddress = 0x7EA964E5D864b95f6D7d2BD04dA897F6e31084b3;
function recreateDeployment() public {
bytes32 slot;
......@@ -73,7 +73,7 @@ contract DeploymentSummary is DeploymentSummaryCode {
value = hex"000000000000000000000000bb2180ebd78ce97360503434ed37fcf4a1df61c3";
vm.store(proxyAdminAddress, slot, value);
slot = hex"0000000000000000000000000000000000000000000000000000000000000000";
value = hex"0000000000000000000000007d039be7f9b5190147621b02e82b250e1d748e02";
value = hex"0000000000000000000000007ea964e5d864b95f6d7d2bd04da897f6e31084b3";
vm.store(proxyAdminAddress, slot, value);
vm.etch(superchainConfigProxyAddress, superchainConfigProxyCode);
slot = hex"b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
......
......@@ -38,7 +38,7 @@ contract DeploymentSummaryFaultProofs is DeploymentSummaryFaultProofsCode {
address internal constant superchainConfigProxyAddress = 0xDEb1E9a6Be7Baf84208BB6E10aC9F9bbE1D70809;
address internal constant systemConfigAddress = 0x67866A5052E5302aaD08e9f352331fd8622eB6DC;
address internal constant systemConfigProxyAddress = 0x20A42a5a785622c6Ba2576B2D6e924aA82BFA11D;
address internal constant systemOwnerSafeAddress = 0x7d039be7F9b5190147621b02e82B250e1D748e02;
address internal constant systemOwnerSafeAddress = 0x7EA964E5D864b95f6D7d2BD04dA897F6e31084b3;
address internal constant acc27Address = 0x12e721c390F5728200a26BBEf206A5F4F7E991f3;
address internal constant acc28Address = 0x2abb7CBB720020ee3C9ecf3915D14B6d1886A577;
......@@ -81,7 +81,7 @@ contract DeploymentSummaryFaultProofs is DeploymentSummaryFaultProofsCode {
value = hex"000000000000000000000000bb2180ebd78ce97360503434ed37fcf4a1df61c3";
vm.store(proxyAdminAddress, slot, value);
slot = hex"0000000000000000000000000000000000000000000000000000000000000000";
value = hex"0000000000000000000000007d039be7f9b5190147621b02e82b250e1d748e02";
value = hex"0000000000000000000000007ea964e5d864b95f6d7d2bd04da897f6e31084b3";
vm.store(proxyAdminAddress, slot, value);
vm.etch(superchainConfigProxyAddress, superchainConfigProxyCode);
slot = hex"b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
......
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