Skip to content
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
8 changes: 4 additions & 4 deletions snapshots/BinNativePancakeSwapInfinityTest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"test_infiBinSwap_ExactInSingle_NativeIn": "128863",
"test_infiBinSwap_ExactInSingle_NativeOut": "117561",
"test_infiBinSwap_ExactInSingle_NativeOut_RouterRecipient": "117850",
"test_infiBinSwap_infiInitializeBinPool": "132794"
"test_infiBinSwap_ExactInSingle_NativeIn": "129146",
"test_infiBinSwap_ExactInSingle_NativeOut": "117925",
"test_infiBinSwap_ExactInSingle_NativeOut_RouterRecipient": "118278",
"test_infiBinSwap_infiInitializeBinPool": "132834"
}
14 changes: 7 additions & 7 deletions snapshots/BinPancakeSwapInfinityTest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"test_infiBinSwap_ExactInSingle": "143463",
"test_infiBinSwap_ExactIn_MultiHop": "174857",
"test_infiBinSwap_ExactIn_SingleHop": "145261",
"test_infiBinSwap_ExactOutSingle": "147825",
"test_infiBinSwap_ExactOut_MultiHop": "178705",
"test_infiBinSwap_ExactOut_SingleHop": "149633",
"test_infiBinSwap_InitializeBinPool": "152934"
"test_infiBinSwap_ExactInSingle": "143827",
"test_infiBinSwap_ExactIn_MultiHop": "175892",
"test_infiBinSwap_ExactIn_SingleHop": "145923",
"test_infiBinSwap_ExactOutSingle": "148195",
"test_infiBinSwap_ExactOut_MultiHop": "179796",
"test_infiBinSwap_ExactOut_SingleHop": "150323",
"test_infiBinSwap_InitializeBinPool": "152974"
}
6 changes: 3 additions & 3 deletions snapshots/CLNativePancakeSwapInfinityTest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"test_infiClSwap_ExactInSingle_NativeIn": "161904",
"test_infiClSwap_ExactInSingle_NativeOut": "144640",
"test_infiClSwap_infiInitializeClPool": "133576"
"test_infiClSwap_ExactInSingle_NativeIn": "162274",
"test_infiClSwap_ExactInSingle_NativeOut": "145091",
"test_infiClSwap_infiInitializeClPool": "133610"
}
14 changes: 7 additions & 7 deletions snapshots/CLPancakeSwapInfinityTest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"test_infiClSwap_ExactInSingle": "176504",
"test_infiClSwap_ExactIn_MultiHop": "240950",
"test_infiClSwap_ExactIn_SingleHop": "178295",
"test_infiClSwap_ExactOutSingle": "180828",
"test_infiClSwap_ExactOut_MultiHop": "244726",
"test_infiClSwap_ExactOut_SingleHop": "182631",
"test_infiClSwap_infiInitializeClPool": "153704"
"test_infiClSwap_ExactInSingle": "176955",
"test_infiClSwap_ExactIn_MultiHop": "242129",
"test_infiClSwap_ExactIn_SingleHop": "179029",
"test_infiClSwap_ExactOutSingle": "181285",
"test_infiClSwap_ExactOut_MultiHop": "245991",
"test_infiClSwap_ExactOut_SingleHop": "183408",
"test_infiClSwap_infiInitializeClPool": "153738"
}
4 changes: 2 additions & 2 deletions snapshots/StableSwapBusdUsdcTest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"test_stableSwap_ExactInput0For1": "193988",
"test_stableSwap_ExactInput1For0": "194056"
"test_stableSwap_ExactInput0For1": "194400",
"test_stableSwap_ExactInput1For0": "194468"
}
4 changes: 2 additions & 2 deletions snapshots/UniversalRouterTest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"UniversalRouterBytecodeSize": "22521",
"test_sweep_token": "55429"
"UniversalRouterBytecodeSize": "23228",
"test_sweep_token": "55452"
}
4 changes: 2 additions & 2 deletions snapshots/V2BnbCake.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"test_v2Swap_exactInput0For1": "116435",
"test_v2Swap_exactOutput0For1": "117038"
"test_v2Swap_exactInput0For1": "117142",
"test_v2Swap_exactOutput0For1": "117362"
}
4 changes: 2 additions & 2 deletions snapshots/V2MockBnb.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"test_v2Swap_exactInput0For1": "100167",
"test_v2Swap_exactOutput0For1": "100791"
"test_v2Swap_exactInput0For1": "100880",
"test_v2Swap_exactOutput0For1": "101121"
}
10 changes: 5 additions & 5 deletions snapshots/V3BnbCake.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"test_v3Swap_ExactInput0For1": "151871",
"test_v3Swap_ExactInput0For1_ContractBalance": "154778",
"test_v3Swap_exactInput_MultiHop": "243288",
"test_v3Swap_exactOutput0For1": "150573",
"test_v3Swap_exactOutput_MultiHop": "254218"
"test_v3Swap_ExactInput0For1": "152417",
"test_v3Swap_ExactInput0For1_ContractBalance": "155472",
"test_v3Swap_exactInput_MultiHop": "244408",
"test_v3Swap_exactOutput0For1": "151054",
"test_v3Swap_exactOutput_MultiHop": "255186"
}
8 changes: 5 additions & 3 deletions src/libraries/BytesLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ library BytesLib {
pure
returns (uint256 length, uint256 offset)
{
uint256 relativeOffset;
assembly {
// The offset of the `_arg`-th element is `32 * arg`, which stores the offset of the length pointer.
// shl(5, x) is equivalent to mul(32, x)
let lengthPtr := add(_bytes.offset, calldataload(add(_bytes.offset, shl(5, _arg))))
length := calldataload(lengthPtr)
offset := add(lengthPtr, 0x20)
relativeOffset := sub(offset, _bytes.offset)
let relativeOffset := sub(offset, _bytes.offset)
if lt(_bytes.length, add(shl(5, length), relativeOffset)) {
mstore(0, 0x3b99b53d) // SliceOutOfBounds()
revert(0x1c, 0x04)
}
}
if (_bytes.length < length + relativeOffset) revert SliceOutOfBounds();
}

/// @notice Returns the pool details starting at byte 0
Expand Down
Loading