Skip to content

Commit

Permalink
fix: Additional DeployImplementations.s.sol tests (#11914)
Browse files Browse the repository at this point in the history
* fix: Additional testing for inferring proxy admin from superchain config.

* Apply suggestions from code review

---------

Co-authored-by: Matt Solomon <[email protected]>
  • Loading branch information
blmalone and mds1 authored Sep 15, 2024
1 parent 6cf35da commit 8341f34
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/contracts-bedrock/test/DeployImplementations.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,30 @@ contract DeployImplementationsInput_Test is Test {

vm.expectRevert("DeployImplementationsInput: not set");
dii.protocolVersionsProxy();

vm.expectRevert("DeployImplementationsInput: not set");
dii.superchainProxyAdmin();
}

function test_superchainProxyAdmin_whenNotSet_reverts() public {
vm.expectRevert("DeployImplementationsInput: not set");
dii.superchainProxyAdmin();

dii.set(dii.superchainConfigProxy.selector, address(superchainConfigProxy));
vm.expectRevert();
dii.superchainProxyAdmin();

Proxy noAdminProxy = new Proxy(address(0));
dii.set(dii.superchainConfigProxy.selector, address(noAdminProxy));
vm.expectRevert("DeployImplementationsInput: not set");
dii.superchainProxyAdmin();
}

function test_superchainProxyAdmin_succeeds() public {
Proxy proxyWithAdminSet = new Proxy(msg.sender);
dii.set(dii.superchainConfigProxy.selector, address(proxyWithAdminSet));
ProxyAdmin proxyAdmin = dii.superchainProxyAdmin();
assertEq(address(msg.sender), address(proxyAdmin), "100");
}
}

Expand Down Expand Up @@ -297,6 +321,7 @@ contract DeployImplementations_Test is Test {
assertEq(release, dii.release(), "525");
assertEq(address(superchainConfigProxy), address(dii.superchainConfigProxy()), "550");
assertEq(address(protocolVersionsProxy), address(dii.protocolVersionsProxy()), "575");
assertEq(address(superchainProxyAdmin), address(dii.superchainProxyAdmin()), "580");

// Architecture assertions.
assertEq(address(dio.mipsSingleton().oracle()), address(dio.preimageOracleSingleton()), "600");
Expand Down

0 comments on commit 8341f34

Please sign in to comment.