Skip to content

Commit

Permalink
fix(ct): improve transparent proxy test names
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman committed Jan 31, 2023
1 parent 4df4568 commit 591e7da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-beds-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/contracts': patch
---

improve transparent proxy test names
3 changes: 2 additions & 1 deletion packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ remappings = [
'@eth-optimism/contracts-bedrock/=node_modules/@eth-optimism/contracts-bedrock',
'forge-std/=node_modules/forge-std/src/',
'ds-test/=node_modules/ds-test/src/'
]
]
gas_price=1
30 changes: 15 additions & 15 deletions packages/contracts/test/ChugSplashManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,16 @@ contract ChugSplashManager_Test is Test {
assertGt(finalDebt, estExecutorPayment + initialDebt);
}

function test_completeChugSplashBundle_success_customProxy() external {
TransparentUpgradeableProxy customProxy = new TransparentUpgradeableProxy(
function test_completeChugSplashBundle_success_transparentProxy() external {
TransparentUpgradeableProxy transparentProxy = new TransparentUpgradeableProxy(
address(managerImplementation), // Dummy value so that the OpenZeppelin proxy doesn't revert
address(manager),
''
);
address payable customProxyAddress = payable(address(customProxy));
address payable transparentProxyAddress = payable(address(transparentProxy));
bytes32 proxyType = keccak256(bytes("transparent"));
registry.addProxyType(proxyType, address(adapter));
helper_setProxyToReferenceName(referenceName, customProxyAddress, proxyType);
helper_setProxyToReferenceName(referenceName, transparentProxyAddress, proxyType);
helper_proposeThenApproveThenFundBundle();
helper_executeMultipleActions();
ChugSplashBundleState memory prevBundle = manager.bundles(bundleId);
Expand All @@ -636,11 +636,11 @@ contract ChugSplashManager_Test is Test {
address(registry),
abi.encodeCall(
ChugSplashRegistry.announceWithData,
("ChugSplashActionExecuted", abi.encodePacked(customProxyAddress))
("ChugSplashActionExecuted", abi.encodePacked(transparentProxyAddress))
)
);
vm.expectEmit(true, true, true, true);
emit ChugSplashActionExecuted(bundleId, customProxyAddress, executor, actionIndex);
emit ChugSplashActionExecuted(bundleId, transparentProxyAddress, executor, actionIndex);
vm.expectCall(
address(registry),
abi.encodeCall(
Expand All @@ -659,7 +659,7 @@ contract ChugSplashManager_Test is Test {
uint256 gasUsed = 45472;
uint256 estExecutorPayment = tx.gasprice * gasUsed * (100 + executorPaymentPercentage) / 100;
vm.prank(address(manager));
address implementation = customProxy.implementation();
address implementation = transparentProxy.implementation();

assertEq(bundle.actionsExecuted, prevBundle.actionsExecuted + 1);
assertTrue(bundle.executions[actions.length]);
Expand Down Expand Up @@ -814,22 +814,22 @@ contract ChugSplashManager_Test is Test {
helper_transferProxyOwnership(proxyAddress, nonOwner, firstAction.referenceName, bytes32(0));
}

function test_transferProxyOwnership_success_customProxy() external {
TransparentUpgradeableProxy customProxy = new TransparentUpgradeableProxy(
function test_transferProxyOwnership_success_transparentProxy() external {
TransparentUpgradeableProxy transparentProxy = new TransparentUpgradeableProxy(
address(registry), // Dummy value so that the OpenZeppelin proxy doesn't revert
address(manager),
''
);
address payable customProxyAddress = payable(address(customProxy));
string memory customProxyReferenceName = "CustomProxy";
address payable transparentProxyAddress = payable(address(transparentProxy));
string memory transparentProxyReferenceName = "TransparentProxy";
bytes32 proxyType = keccak256(bytes("transparent"));
registry.addProxyType(proxyType, address(adapter));
helper_setProxyToReferenceName(customProxyReferenceName, customProxyAddress, proxyType);
helper_setProxyToReferenceName(transparentProxyReferenceName, transparentProxyAddress, proxyType);

helper_transferProxyOwnership(customProxyAddress, nonOwner, customProxyReferenceName, proxyType);
helper_transferProxyOwnership(transparentProxyAddress, nonOwner, transparentProxyReferenceName, proxyType);

assertEq(manager.proxies(customProxyReferenceName), payable(address(0)));
assertEq(manager.proxyTypes(customProxyReferenceName), bytes32(0));
assertEq(manager.proxies(transparentProxyReferenceName), payable(address(0)));
assertEq(manager.proxyTypes(transparentProxyReferenceName), bytes32(0));
}

function test_setProxyToReferenceName_revert_nonOwner() external {
Expand Down

0 comments on commit 591e7da

Please sign in to comment.