Skip to content

Commit

Permalink
add code hash snap (#417)
Browse files Browse the repository at this point in the history
* code hash snap

* move files, add descriptor

* rename

* add mock router snap

* router
  • Loading branch information
snreynolds authored Dec 18, 2024
1 parent 26dd146 commit c42499d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions snapshots/PosMGasTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
1 change: 1 addition & 0 deletions snapshots/PositionDescriptorTest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"position descriptor initcode hash (without constructor params, as uint256)": "88482580191959945449130293370700011665153263709859488839371600440410373093991",
"positionDescriptor bytecode size": "24110"
}
3 changes: 2 additions & 1 deletion snapshots/V4RouterTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
7 changes: 7 additions & 0 deletions test/PositionDescriptor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions test/position-managers/PositionManager.gas.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions test/router/V4Router.gas.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
//////////////////////////////////////////////////////////////*/
Expand Down

0 comments on commit c42499d

Please sign in to comment.