Skip to content

Commit

Permalink
rename: proxyAdminOwner -> superchainProxyAdminOwner (#12106)
Browse files Browse the repository at this point in the history
* rename: proxyAdminOwner -> superchainProxyAdminOwner

* fix: renames in tests.

* fix: renaming in go code.

* fix: Changing the intent to contain SuperchainProxyAdminOwner instead of just ProxyAdminOwner

* fix: reverting last change
  • Loading branch information
blmalone authored Sep 25, 2024
1 parent 616a078 commit 36180d7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion op-chain-ops/deployer/opcm/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type DeploySuperchainInput struct {
ProxyAdminOwner common.Address `toml:"proxyAdminOwner"`
SuperchainProxyAdminOwner common.Address `toml:"superchainProxyAdminOwner"`
ProtocolVersionsOwner common.Address `toml:"protocolVersionsOwner"`
Guardian common.Address `toml:"guardian"`
Paused bool `toml:"paused"`
Expand Down
2 changes: 1 addition & 1 deletion op-chain-ops/deployer/pipeline/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func DeploySuperchain(ctx context.Context, env *Env, artifactsFS foundry.StatDir
dso, err = opcm.DeploySuperchain(
host,
opcm.DeploySuperchainInput{
ProxyAdminOwner: intent.SuperchainRoles.ProxyAdminOwner,
SuperchainProxyAdminOwner: intent.SuperchainRoles.ProxyAdminOwner,
ProtocolVersionsOwner: intent.SuperchainRoles.ProtocolVersionsOwner,
Guardian: intent.SuperchainRoles.Guardian,
Paused: false,
Expand Down
2 changes: 1 addition & 1 deletion op-chain-ops/interopgen/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func deploySuperchainToL1(l1Host *script.Host, superCfg *SuperchainConfig) (*Sup
l1Host.SetTxOrigin(superCfg.Deployer)

superDeployment, err := opcm.DeploySuperchain(l1Host, opcm.DeploySuperchainInput{
ProxyAdminOwner: superCfg.ProxyAdminOwner,
SuperchainProxyAdminOwner: superCfg.ProxyAdminOwner,
ProtocolVersionsOwner: superCfg.ProtocolVersionsOwner,
Guardian: superCfg.SuperchainConfigGuardian,
Paused: superCfg.Paused,
Expand Down
16 changes: 8 additions & 8 deletions packages/contracts-bedrock/scripts/DeploySuperchain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ contract DeploySuperchainInput is BaseDeployIO {
// Role inputs.
address internal _guardian;
address internal _protocolVersionsOwner;
address internal _proxyAdminOwner;
address internal _superchainProxyAdminOwner;

// Other inputs.
bool internal _paused;
Expand All @@ -94,7 +94,7 @@ contract DeploySuperchainInput is BaseDeployIO {
require(_address != address(0), "DeploySuperchainInput: cannot set zero address");
if (_sel == this.guardian.selector) _guardian = _address;
else if (_sel == this.protocolVersionsOwner.selector) _protocolVersionsOwner = _address;
else if (_sel == this.proxyAdminOwner.selector) _proxyAdminOwner = _address;
else if (_sel == this.superchainProxyAdminOwner.selector) _superchainProxyAdminOwner = _address;
else revert("DeploySuperchainInput: unknown selector");
}

Expand All @@ -115,9 +115,9 @@ contract DeploySuperchainInput is BaseDeployIO {
// validate that each input is set before accessing it. With getter methods, we can automatically
// validate that each input is set before allowing any field to be accessed.

function proxyAdminOwner() public view returns (address) {
require(_proxyAdminOwner != address(0), "DeploySuperchainInput: proxyAdminOwner not set");
return _proxyAdminOwner;
function superchainProxyAdminOwner() public view returns (address) {
require(_superchainProxyAdminOwner != address(0), "DeploySuperchainInput: superchainProxyAdminOwner not set");
return _superchainProxyAdminOwner;
}

function protocolVersionsOwner() public view returns (address) {
Expand Down Expand Up @@ -232,7 +232,7 @@ contract DeploySuperchainOutput is BaseDeployIO {
}

function assertValidSuperchainProxyAdmin(DeploySuperchainInput _dsi) internal view {
require(superchainProxyAdmin().owner() == _dsi.proxyAdminOwner(), "SPA-10");
require(superchainProxyAdmin().owner() == _dsi.superchainProxyAdminOwner(), "SPA-10");
}

function assertValidSuperchainConfig(DeploySuperchainInput _dsi) internal {
Expand Down Expand Up @@ -386,13 +386,13 @@ contract DeploySuperchain is Script {
}

function transferProxyAdminOwnership(DeploySuperchainInput _dsi, DeploySuperchainOutput _dso) public {
address proxyAdminOwner = _dsi.proxyAdminOwner();
address superchainProxyAdminOwner = _dsi.superchainProxyAdminOwner();

ProxyAdmin superchainProxyAdmin = _dso.superchainProxyAdmin();
DeployUtils.assertValidContractAddress(address(superchainProxyAdmin));

vm.broadcast(msg.sender);
superchainProxyAdmin.transferOwnership(proxyAdminOwner);
superchainProxyAdmin.transferOwnership(superchainProxyAdminOwner);
}

// -------- Utilities --------
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/test/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ contract DeployOPChain_TestBase is Test {
DeployOPChainOutput doo;

// Define default inputs for DeploySuperchain.
address proxyAdminOwner = makeAddr("defaultProxyAdminOwner");
address superchainProxyAdminOwner = makeAddr("defaultSuperchainProxyAdminOwner");
address protocolVersionsOwner = makeAddr("defaultProtocolVersionsOwner");
address guardian = makeAddr("defaultGuardian");
bool paused = false;
Expand Down Expand Up @@ -365,7 +365,7 @@ contract DeployOPChain_TestBase is Test {
DeploySuperchain deploySuperchain = new DeploySuperchain();
(DeploySuperchainInput dsi, DeploySuperchainOutput dso) = deploySuperchain.etchIOContracts();

dsi.set(dsi.proxyAdminOwner.selector, proxyAdminOwner);
dsi.set(dsi.superchainProxyAdminOwner.selector, superchainProxyAdminOwner);
dsi.set(dsi.protocolVersionsOwner.selector, protocolVersionsOwner);
dsi.set(dsi.guardian.selector, guardian);
dsi.set(dsi.paused.selector, paused);
Expand Down
18 changes: 9 additions & 9 deletions packages/contracts-bedrock/test/DeploySuperchain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DeploySuperchainInput, DeploySuperchain, DeploySuperchainOutput } from
contract DeploySuperchainInput_Test is Test {
DeploySuperchainInput dsi;

address proxyAdminOwner = makeAddr("defaultProxyAdminOwner");
address superchainProxyAdminOwner = makeAddr("superchainProxyAdminOwner");
address protocolVersionsOwner = makeAddr("defaultProtocolVersionsOwner");
address guardian = makeAddr("defaultGuardian");
bool paused = false;
Expand All @@ -25,8 +25,8 @@ contract DeploySuperchainInput_Test is Test {
}

function test_getters_whenNotSet_revert() public {
vm.expectRevert("DeploySuperchainInput: proxyAdminOwner not set");
dsi.proxyAdminOwner();
vm.expectRevert("DeploySuperchainInput: superchainProxyAdminOwner not set");
dsi.superchainProxyAdminOwner();

vm.expectRevert("DeploySuperchainInput: protocolVersionsOwner not set");
dsi.protocolVersionsOwner();
Expand Down Expand Up @@ -151,15 +151,15 @@ contract DeploySuperchain_Test is Test {
// Generate random input values from the seed. This doesn't give us the benefit of the forge
// fuzzer's dictionary, but that's ok because we are just testing that values are set and
// passed correctly.
address proxyAdminOwner = address(uint160(uint256(hash(_seed, 0))));
address superchainProxyAdminOwner = address(uint160(uint256(hash(_seed, 0))));
address protocolVersionsOwner = address(uint160(uint256(hash(_seed, 1))));
address guardian = address(uint160(uint256(hash(_seed, 2))));
bool paused = bool(uint8(uint256(hash(_seed, 3))) % 2 == 0);
ProtocolVersion requiredProtocolVersion = ProtocolVersion.wrap(uint256(hash(_seed, 4)));
ProtocolVersion recommendedProtocolVersion = ProtocolVersion.wrap(uint256(hash(_seed, 5)));

// Set the input values on the input contract.
dsi.set(dsi.proxyAdminOwner.selector, proxyAdminOwner);
dsi.set(dsi.superchainProxyAdminOwner.selector, superchainProxyAdminOwner);
dsi.set(dsi.protocolVersionsOwner.selector, protocolVersionsOwner);
dsi.set(dsi.guardian.selector, guardian);
dsi.set(dsi.paused.selector, paused);
Expand All @@ -170,7 +170,7 @@ contract DeploySuperchain_Test is Test {
deploySuperchain.run(dsi, dso);

// Assert inputs were properly passed through to the contract initializers.
assertEq(address(dso.superchainProxyAdmin().owner()), proxyAdminOwner, "100");
assertEq(address(dso.superchainProxyAdmin().owner()), superchainProxyAdminOwner, "100");
assertEq(address(dso.protocolVersionsProxy().owner()), protocolVersionsOwner, "200");
assertEq(address(dso.superchainConfigProxy().guardian()), guardian, "300");
assertEq(dso.superchainConfigProxy().paused(), paused, "400");
Expand All @@ -196,7 +196,7 @@ contract DeploySuperchain_Test is Test {

function test_run_NullInput_reverts() public {
// Set default values for all inputs.
dsi.set(dsi.proxyAdminOwner.selector, defaultProxyAdminOwner);
dsi.set(dsi.superchainProxyAdminOwner.selector, defaultProxyAdminOwner);
dsi.set(dsi.protocolVersionsOwner.selector, defaultProtocolVersionsOwner);
dsi.set(dsi.guardian.selector, defaultGuardian);
dsi.set(dsi.paused.selector, defaultPaused);
Expand All @@ -207,8 +207,8 @@ contract DeploySuperchain_Test is Test {
// methods to set the zero address, so we use StdStorage. We can't use the `checked_write`
// method, because it does a final call to test that the value was set correctly, but for us
// that would revert. Therefore we use StdStorage to find the slot, then we write to it.
uint256 slot = zeroOutSlotForSelector(dsi.proxyAdminOwner.selector);
vm.expectRevert("DeploySuperchainInput: proxyAdminOwner not set");
uint256 slot = zeroOutSlotForSelector(dsi.superchainProxyAdminOwner.selector);
vm.expectRevert("DeploySuperchainInput: superchainProxyAdminOwner not set");
deploySuperchain.run(dsi, dso);
// Restore the value we just tested.
vm.store(address(dsi), bytes32(slot), bytes32(uint256(uint160(defaultProxyAdminOwner))));
Expand Down

0 comments on commit 36180d7

Please sign in to comment.