Skip to content

Commit 8080443

Browse files
authored
Update changeset to document V3 removal and interface changes + more register upgrade gate tests (#1338)
<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> ## Does this change the ABI/API? - [ ] This changes the ABI/API <!-- If so, please describe how and what potential impact this may have --> ## What tests did you add/modify to account for these changes <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, tests ran to see how --> <!--- your change affects other areas of the code, etc. --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New module / feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I added a changeset to account for this change ## Reviewer Checklist: - [ ] My review includes a symposis of the changes and potential issues - [ ] The code style is enforced - [ ] There are no risky / concerning changes / additions to the PR
1 parent deb9175 commit 8080443

File tree

2 files changed

+109
-1
lines changed

2 files changed

+109
-1
lines changed

.changeset/famous-pens-sneeze.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
Remove Uniswap V3 support and refactor coin architecture
66

77
**Removal of V3 Support:**
8+
- Removed support for creating coins based on Uniswap V3 - only V4 coins are supported
9+
- Default coin deployment now creates Uniswap V4 coins when no config is provided (previously created V3)
810
- Removed V3-specific test files and utilities
911
- Updated remaining tests to use V4 deployment methods
1012
- Removed V3 configuration functions and encoders
11-
- Added revert logic for V3 deployment attempts
13+
- Added revert logic for V3 deployment attempts in factory deploy functions
1214

1315
**Architecture Refactoring:**
1416
- Merged BaseCoinV4 functionality into BaseCoin.sol to consolidate Uniswap V4 integration

packages/coins/test/LiquidityMigration.t.sol

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,110 @@ contract LiquidityMigrationTest is BaseTest {
282282
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, nonOwner));
283283
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
284284
}
285+
286+
function test_hookUpgradeGate_registerMultipleUpgradePaths() public {
287+
address baseImpl1 = makeAddr("baseImpl1");
288+
address baseImpl2 = makeAddr("baseImpl2");
289+
address baseImpl3 = makeAddr("baseImpl3");
290+
address upgradeImpl = makeAddr("upgradeImpl");
291+
292+
address[] memory baseImpls = new address[](3);
293+
baseImpls[0] = baseImpl1;
294+
baseImpls[1] = baseImpl2;
295+
baseImpls[2] = baseImpl3;
296+
297+
// Register multiple upgrade paths at once
298+
vm.prank(hookUpgradeGate.owner());
299+
vm.expectEmit(true, true, false, false);
300+
emit IHooksUpgradeGate.UpgradeRegistered(baseImpl1, upgradeImpl);
301+
vm.expectEmit(true, true, false, false);
302+
emit IHooksUpgradeGate.UpgradeRegistered(baseImpl2, upgradeImpl);
303+
vm.expectEmit(true, true, false, false);
304+
emit IHooksUpgradeGate.UpgradeRegistered(baseImpl3, upgradeImpl);
305+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
306+
307+
// Verify all paths are registered
308+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(baseImpl1, upgradeImpl));
309+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(baseImpl2, upgradeImpl));
310+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(baseImpl3, upgradeImpl));
311+
}
312+
313+
function test_hookUpgradeGate_registerEmptyArray() public {
314+
address upgradeImpl = makeAddr("upgradeImpl");
315+
address[] memory baseImpls = new address[](0);
316+
317+
// Register with empty array - should succeed but do nothing
318+
vm.prank(hookUpgradeGate.owner());
319+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
320+
321+
// No events should be emitted, no state changes
322+
}
323+
324+
function test_hookUpgradeGate_removeNonexistentUpgradePath() public {
325+
address baseImpl = makeAddr("baseImpl");
326+
address upgradeImpl = makeAddr("upgradeImpl");
327+
328+
// Try to remove a path that was never registered
329+
vm.prank(hookUpgradeGate.owner());
330+
vm.expectEmit(true, true, false, false);
331+
emit IHooksUpgradeGate.UpgradeRemoved(baseImpl, upgradeImpl);
332+
hookUpgradeGate.removeUpgradePath(baseImpl, upgradeImpl);
333+
334+
// Should still be false (was already false)
335+
assertFalse(hookUpgradeGate.isRegisteredUpgradePath(baseImpl, upgradeImpl));
336+
}
337+
338+
function test_hookUpgradeGate_registerSamePathTwice() public {
339+
address baseImpl = makeAddr("baseImpl");
340+
address upgradeImpl = makeAddr("upgradeImpl");
341+
342+
address[] memory baseImpls = new address[](1);
343+
baseImpls[0] = baseImpl;
344+
345+
// Register once
346+
vm.prank(hookUpgradeGate.owner());
347+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
348+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(baseImpl, upgradeImpl));
349+
350+
// Register again - should succeed and overwrite (true -> true)
351+
vm.prank(hookUpgradeGate.owner());
352+
vm.expectEmit(true, true, false, false);
353+
emit IHooksUpgradeGate.UpgradeRegistered(baseImpl, upgradeImpl);
354+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
355+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(baseImpl, upgradeImpl));
356+
}
357+
358+
function test_hookUpgradeGate_zeroAddressHandling() public {
359+
address[] memory baseImpls = new address[](2);
360+
baseImpls[0] = address(0);
361+
baseImpls[1] = makeAddr("baseImpl");
362+
address upgradeImpl = address(0);
363+
364+
// Should allow zero addresses (no validation in contract)
365+
vm.prank(hookUpgradeGate.owner());
366+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
367+
368+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(address(0), address(0)));
369+
assertTrue(hookUpgradeGate.isRegisteredUpgradePath(makeAddr("baseImpl"), address(0)));
370+
}
371+
372+
function test_hookUpgradeGate_isAllowedHookUpgradeMapping() public {
373+
address baseImpl = makeAddr("baseImpl");
374+
address upgradeImpl = makeAddr("upgradeImpl");
375+
376+
// Test direct mapping access
377+
assertFalse(hookUpgradeGate.isAllowedHookUpgrade(baseImpl, upgradeImpl));
378+
379+
// Register upgrade path
380+
address[] memory baseImpls = new address[](1);
381+
baseImpls[0] = baseImpl;
382+
vm.prank(hookUpgradeGate.owner());
383+
hookUpgradeGate.registerUpgradePath(baseImpls, upgradeImpl);
384+
385+
// Test direct mapping access
386+
assertTrue(hookUpgradeGate.isAllowedHookUpgrade(baseImpl, upgradeImpl));
387+
388+
// Should match isRegisteredUpgradePath
389+
assertEq(hookUpgradeGate.isAllowedHookUpgrade(baseImpl, upgradeImpl), hookUpgradeGate.isRegisteredUpgradePath(baseImpl, upgradeImpl));
390+
}
285391
}

0 commit comments

Comments
 (0)