Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary length check #406

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_collect_native.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
148593
148571
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_collect_sameRange.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
157242
157220
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_collect_withClose.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
157242
157220
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_collect_withTakePair.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
156478
156456
Original file line number Diff line number Diff line change
@@ -1 +1 @@
114183
114165
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122577
122555
Original file line number Diff line number Diff line change
@@ -1 +1 @@
121813
121791
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_decrease_burnEmpty.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
138195
138177
Original file line number Diff line number Diff line change
@@ -1 +1 @@
131276
131258
Original file line number Diff line number Diff line change
@@ -1 +1 @@
135240
135218
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_decrease_take_take.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123191
123169
Original file line number Diff line number Diff line change
@@ -1 +1 @@
162441
162419
Original file line number Diff line number Diff line change
@@ -1 +1 @@
161305
161283
Original file line number Diff line number Diff line change
@@ -1 +1 @@
145318
145296
Original file line number Diff line number Diff line change
@@ -1 +1 @@
138032
138010
Original file line number Diff line number Diff line change
@@ -1 +1 @@
180216
180194
Original file line number Diff line number Diff line change
@@ -1 +1 @@
150804
150782
2 changes: 1 addition & 1 deletion .forge-snapshots/positionManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19068
19060
9 changes: 5 additions & 4 deletions src/libraries/CalldataDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ library CalldataDecoder {
pure
returns (uint256 tokenId, uint256 liquidity, uint128 amount0, uint128 amount1, bytes calldata hookData)
{
// no length check performed, as there is a length check in `toBytes`
assembly ("memory-safe") {
if lt(params.length, 0x80) {
mstore(0, SLICE_ERROR_SELECTOR)
revert(0x1c, 4)
}
tokenId := calldataload(params.offset)
liquidity := calldataload(add(params.offset, 0x20))
amount0 := calldataload(add(params.offset, 0x40))
Expand All @@ -96,6 +93,7 @@ library CalldataDecoder {
pure
returns (uint256 tokenId, uint128 amount0Max, uint128 amount1Max, bytes calldata hookData)
{
// no length check performed, as there is a length check in `toBytes`
assembly ("memory-safe") {
tokenId := calldataload(params.offset)
amount0Max := calldataload(add(params.offset, 0x20))
Expand All @@ -120,6 +118,7 @@ library CalldataDecoder {
bytes calldata hookData
)
{
// no length check performed, as there is a length check in `toBytes`
assembly ("memory-safe") {
poolKey := params.offset
tickLower := calldataload(add(params.offset, 0xa0))
Expand All @@ -146,6 +145,7 @@ library CalldataDecoder {
bytes calldata hookData
)
{
// no length check performed, as there is a length check in `toBytes`
assembly ("memory-safe") {
poolKey := params.offset
tickLower := calldataload(add(params.offset, 0xa0))
Expand All @@ -164,6 +164,7 @@ library CalldataDecoder {
pure
returns (uint256 tokenId, uint128 amount0Min, uint128 amount1Min, bytes calldata hookData)
{
// no length check performed, as there is a length check in `toBytes`
assembly ("memory-safe") {
tokenId := calldataload(params.offset)
amount0Min := calldataload(add(params.offset, 0x20))
Expand Down
Loading