From e63bc6c99408242f2952d79ed35372a5171a9884 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen Date: Mon, 18 Nov 2024 17:00:05 +0000 Subject: [PATCH] Update test/groups/upgradeableProxy/adminOperationsUpgradeableRenounceableProxy.t.sol Co-authored-by: Yevgeniy <35062472+roleengineer@users.noreply.github.com> --- ...minOperationsUpgradeableRenounceableProxy.t.sol | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/groups/upgradeableProxy/adminOperationsUpgradeableRenounceableProxy.t.sol b/test/groups/upgradeableProxy/adminOperationsUpgradeableRenounceableProxy.t.sol index 0c35c4d..216cc9b 100644 --- a/test/groups/upgradeableProxy/adminOperationsUpgradeableRenounceableProxy.t.sol +++ b/test/groups/upgradeableProxy/adminOperationsUpgradeableRenounceableProxy.t.sol @@ -80,16 +80,18 @@ contract adminOperationsUpgradeableRenounceableProxy is Test, GroupSetup { } function testRenounceAdmin() public { - // todo: it's not trivial (or impossible?) to read the ADMIN_SLOT from the proxy from a test contract - // this can only be read over the RPC? - // So for now, just test that after renouncing the admin, the group is no longer able to upgrade - // To properly test this, we need to mock the proxy to have an admin() func - // But we can also see this in the test trace, so maybe not necessary - + // current admin + address admin = address(uint160(uint256(vm.load(address(proxy), ADMIN_SLOT)))); + assertEq(admin, group); + // renounce admin vm.prank(group); proxy.renounceUpgradeability(); + // renounced admin + admin = address(uint160(uint256(vm.load(address(proxy), ADMIN_SLOT)))); + assertEq(admin, address(0x1)); + // expect revert when trying to upgrade to implementation 0xdead vm.startPrank(group); vm.expectRevert();