From c42499d92a1c6ed59e53d3035ec5bd03ec899f97 Mon Sep 17 00:00:00 2001 From: Sara Reynolds <30504811+snreynolds@users.noreply.github.com> Date: Wed, 18 Dec 2024 21:25:30 +0000 Subject: [PATCH] add code hash snap (#417) * code hash snap * move files, add descriptor * rename * add mock router snap * router --- snapshots/PosMGasTest.json | 1 + snapshots/PositionDescriptorTest.json | 1 + snapshots/V4RouterTest.json | 3 ++- test/PositionDescriptor.t.sol | 7 +++++++ test/position-managers/PositionManager.gas.t.sol | 7 +++++++ test/router/V4Router.gas.t.sol | 7 +++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/snapshots/PosMGasTest.json b/snapshots/PosMGasTest.json index 195b2104..fab212ff 100644 --- a/snapshots/PosMGasTest.json +++ b/snapshots/PosMGasTest.json @@ -38,5 +38,6 @@ "PositionManager_permit_twice": "44975", "PositionManager_subscribe": "87968", "PositionManager_unsubscribe": "62697", + "position manager initcode hash (without constructor params, as uint256)": "81827502601055975118808937107769364319765058198432540518516360048852193272922", "positionManager bytecode size": "23877" } \ No newline at end of file diff --git a/snapshots/PositionDescriptorTest.json b/snapshots/PositionDescriptorTest.json index 5be19f6a..df2ff3df 100644 --- a/snapshots/PositionDescriptorTest.json +++ b/snapshots/PositionDescriptorTest.json @@ -1,3 +1,4 @@ { + "position descriptor initcode hash (without constructor params, as uint256)": "88482580191959945449130293370700011665153263709859488839371600440410373093991", "positionDescriptor bytecode size": "24110" } \ No newline at end of file diff --git a/snapshots/V4RouterTest.json b/snapshots/V4RouterTest.json index ff5612e8..952f619d 100644 --- a/snapshots/V4RouterTest.json +++ b/snapshots/V4RouterTest.json @@ -22,5 +22,6 @@ "V4Router_ExactOut3Hops_nativeOut": "224943", "V4Router_ExactOutputSingle": "133337", "V4Router_ExactOutputSingle_nativeIn_sweepETH": "126419", - "V4Router_ExactOutputSingle_nativeOut": "119821" + "V4Router_ExactOutputSingle_nativeOut": "119821", + "router initcode hash (without constructor params, as uint256)": "27545762869727400677117557485685740862616789454191614676777323590122002226479" } \ No newline at end of file diff --git a/test/PositionDescriptor.t.sol b/test/PositionDescriptor.t.sol index 57b1a641..824cc79d 100644 --- a/test/PositionDescriptor.t.sol +++ b/test/PositionDescriptor.t.sol @@ -41,6 +41,13 @@ contract PositionDescriptorTest is Test, PosmTestSetup { deployAndApprovePosm(manager); } + function test_position_descriptor_initcodeHash() public { + vm.snapshotValue( + "position descriptor initcode hash (without constructor params, as uint256)", + uint256(keccak256(abi.encodePacked(vm.getCode("PositionDescriptor.sol:PositionDescriptor")))) + ); + } + function test_bytecodeSize_positionDescriptor() public { vm.snapshotValue("positionDescriptor bytecode size", address(positionDescriptor).code.length); } diff --git a/test/position-managers/PositionManager.gas.t.sol b/test/position-managers/PositionManager.gas.t.sol index c43d6805..3b0e8dd7 100644 --- a/test/position-managers/PositionManager.gas.t.sol +++ b/test/position-managers/PositionManager.gas.t.sol @@ -73,6 +73,13 @@ contract PosMGasTest is Test, PosmTestSetup { sub = new MockSubscriber(lpm); } + function test_posm_initcodeHash() public { + vm.snapshotValue( + "position manager initcode hash (without constructor params, as uint256)", + uint256(keccak256(abi.encodePacked(vm.getCode("PositionManager.sol:PositionManager")))) + ); + } + function test_bytecodeSize_positionManager() public { vm.snapshotValue("positionManager bytecode size", address(lpm).code.length); } diff --git a/test/router/V4Router.gas.t.sol b/test/router/V4Router.gas.t.sol index 3be32029..a1ad2120 100644 --- a/test/router/V4Router.gas.t.sol +++ b/test/router/V4Router.gas.t.sol @@ -22,6 +22,13 @@ contract V4RouterTest is RoutingTestHelpers { vm.snapshotValue("V4Router_Bytecode", address(router).code.length); } + function test_router_initcodeHash() public { + vm.snapshotValue( + "router initcode hash (without constructor params, as uint256)", + uint256(keccak256(abi.encodePacked(vm.getCode("MockV4Router.sol:MockV4Router")))) + ); + } + /*////////////////////////////////////////////////////////////// ERC20 -> ERC20 EXACT INPUT //////////////////////////////////////////////////////////////*/