Verification checklist

  • One call searches a single 256-bit word. The return can be an uninitialized word edge. When initialized is false, that tick is not the next liquidity boundary.
  • Spacing 60, tick 0, and only 180 initialized. The upward return is 180, not 60. The return is 60 only when both 60 and 180 are set.
  • An empty word, searched upward from 0, returns 15300 with initialized false. If only 15360 is set, this call is still 15300. A second call from 15300 returns 15360.
  • Tick -1 looks downward at the bit for -60. If that bit is set, the return is -60. Once the price reaches it while moving down, the tick becomes -61 and the next call does not return -60. An empty word returns -15360.

1. A word holds 256 compressed ticks, not 256 raw ticks

TickBitmap.sol v1.0.0 packs "is this tick initialized" into a mapping from int16 to uint256. The comment says each word holds 256 values, because a tick is an int24 and the index inside the word is 8 bits. position takes the tick shifted right by 8 as wordPos, and the tick modulo 256, cast to uint8, as bitPos. Before flip and before search, that tick is divided by tickSpacing. One bit is one compressed tick, not one raw tick on the pool's price axis.

At spacing 60, compressed tick 0 is tick 0, compressed tick 1 is tick 60, compressed tick 3 is tick 180, compressed tick 255 is tick 15300, and compressed tick 256 is tick 15360. The first four live in word 0, at bits 0, 1, 3, and 255. Compressed tick 256 shifted right by 8 is 1, and the remainder is 0, so it is bit 0 of word 1. The comment's "up to 256 ticks" means compressed ticks. Multiplied by spacing 60, one word spans 15360 raw ticks, not 256.

A call does not always travel that whole 15360. Searching upward from tick 0 ignores the current compressed tick and starts at compressed tick plus 1, which is bit 1. On an empty word the farthest visible bit is compressed tick 255, raw tick 15300. The distance is 255 times 60, not 256 times 60. Only an upward search from tick -60 starts at bit 0 of word 0. An empty word still stops at 15300, and that distance is 15300 minus -60, which is 15360. Reading the comment's 256 as "the next price jumps 256 raw ticks" is wrong at both starting points.

2. With only 180 initialized, the upward call from 0 returns 180

flipTick requires the tick to be divisible by the spacing, and reverts otherwise. The ticks that can be written are grid ticks such as 0, 60, 180, and 15360, not 5 and not -1. The flip divides by the spacing and does not apply the negative-infinity adjustment. On an exact multiple that adjustment would not change the compressed tick anyway, so the bit that is stored and the bit that a search reads are the same bit.

nextInitializedTickWithinOneWord searches upward when lte is false. The compressed tick is the division toward zero. When the current tick is not negative, nothing is subtracted. The search then starts at the word and bit of compressed tick plus 1. The comment says the current tick's own initialized state does not matter on this path. The mask drops every bit below that start, and the word that remains contributes its least significant 1. If there is no 1, the farthest bit still visible in this word is multiplied back by the spacing, and initialized is false.

The teaching pool uses spacing 60 and tick 0, and only 180 has been flipped. The compressed tick is 0, so the upward search starts at compressed tick 1, bit 1 of word 0. 180 is compressed tick 3, and bit 3 is the lowest 1 inside the mask. The return is 3 times 60, which is 180, and initialized is true. Bit 1 itself is clear, so 60 is not returned. The next grid step and the bitmap's next tick part company on this row.

When both 60 and 180 are set, bit 1 is lower than bit 3, and the return is 60. One call hands back the nearest bit, not every set bit in the word. From tick 5, 5 divided by 60 is still 0, the search still starts at bit 1, and only 180 initialized still returns 180. From tick 60 the compressed tick is 1, the search starts at bit 2, 120 is clear, and the return is still 180. Standing on the grid does not make the next return equal to the current tick plus one spacing.

What one upward search returns at spacing 60
StartInitialized ticksReturninitialized
0180180true
060 and 18060true
0none15300false
0only 1536015300false
5only 180180true
60only 180180true
153001536015360true

3. An empty word stops at 15300, and 15360 waits for the next call

With no bits set, the upward mask from 0 covers bits 1 through 255 and contains no 1. The function returns compressed tick 255 times 60, which is 15300, and initialized is false. 15300 is not the next liquidity boundary. It is the right edge of this word. Writing it down as "the next initialized tick" adds a boundary that was never flipped.

If only 15360 is initialized, the upward result from 0 is still 15300 and false. The compressed tick of 15360 is 256, and the bitmap stores it at bit 0 of word 1. This search starts at bit 1 of word 0 and ends at bit 255 of word 0. It cannot read word 1. The comment's "same word (or adjacent word)" is easy to read as "the next word is scanned too." The adjacent word appears only when compressed tick plus 1 has already crossed a word boundary. From 0, plus 1 is still inside word 0, and 15360 in the next word does not exist for this call.

UniswapV3Pool.sol v1.0.0 uses that return as tickNext inside the swap loop, then reads the square-root price at that tick as the target. If the return is outside the minimum or maximum tick, the pool clamps it to those endpoints first, because the bitmap does not know the endpoints. The 15300 in this note, and the -15360 below, sit inside the endpoints, so the clamp does not change the teaching numbers. Why the endpoints are not multiples of the spacing is the subject of Spacing Check: Fee 3000 Stores Tick Spacing 60, and -887272 Is Outside the Grid.

If the price lands exactly on tickNext and initialized is false, ticks.cross is not called and liquidity does not change. The tick is still rewritten: tickNext when moving up, tickNext minus 1 when moving down. After an empty-word step reaches 15300, the next loop starts at 15300, not at 0. From 15300, compressed tick 255 plus 1 is 256, bit 0 of word 1. When 15360 is set, that call returns 15360 and initialized is true. A large swap can reach the next word, but that is two searches. It is not one search returning 15360.

4. Tick -1 uses the bit for -60, not a tick of -61

When the tick is negative and not divisible by the spacing, the compressed tick is the toward-zero quotient minus 1. The comment calls this rounding toward negative infinity. Tick -1 divided by 60 is 0 toward zero, and the remainder is -1, so the compressed tick becomes -1. That is the same compressed tick as -60: -60 divides evenly, nothing is subtracted, and the compressed tick is also -1. Tick -5 lands on -1 as well. Tick -1 has no bit of its own, and flipTick rejects it because it is not divisible by 60.

Compressed tick -1 shifted right by 8 is still -1, so wordPos is -1. The remainder of -1 modulo 256, cast to uint8, is 255. Tick -60 therefore lives at bit 255 of word -1, the highest bit of that word. Word -1 covers compressed ticks -256 through -1, which are raw ticks -15360 through -60.

A downward search sets lte to true, and the mask keeps the current bit and every lower bit. From tick -1 the current bit is bit 255. When -60 is set, the highest 1 is bit 255, and the return is -60 with initialized true. Writing "one more step down" as -1 minus 60 produces -61. The bitmap first returns -60. That tick is below -1, and it is the lower boundary of the grid cell the price is already inside. It is not -61.

When no lower bit in that word is set, the downward return from -1 is compressed tick -1 minus 255, times 60, which is -15360, and initialized is false. -15360 is the right edge of word -1, not the next liquidity boundary. A downward search from tick 0 is a different call. The compressed tick is 0 and the bit is 0, so the mask is only bit 0. If that bit is clear, the word has no lower bit to offer, and the return is 0 with initialized false. The function does not enter word -1 in the same call. "The next tick down from 0 is always -60" is false on an empty bit. This call cannot even see -60.

Downward search and the compression of a negative tick, at spacing 60
StartInitialized ticksReturninitialized
-1-60-60true
-1none-15360false
-5-60-60true
0none0false
-61only -60-15360false

5. After the price reaches the returned tick, minus 1 keeps the next search off that bit

When the price reaches the returned tick while moving down, the pool writes the tick as tickNext minus 1, whether or not that tick was initialized. If -60 is set and the price reaches -60, cross runs and the tick becomes -61. The subtraction sits outside the cross branch, so an empty word that reaches -15360 is also written as -15361. That step simply does not cross.

The next downward search from -61 divides by 60 toward zero and gets -1. The remainder is not 0, so the compressed tick decreases again and becomes -2. The word is still -1, and the bit is 254. The mask stops at bit 254, leaving bit 255 outside. With only -60 initialized, this call cannot see it. The empty-word edge is compressed tick -256, the return is -15360, and initialized is false. If the pool kept the tick at -60 and searched again, the compressed tick would still be -1, bit 255 would still be inside the mask, and the return would be -60 again. The minus 1 moves the next search off the bit that was just used. It does not describe a new trade one tick further down.

How liquidity is added inside cross, and why liquidityNet changes sign when moving down, is the subject of Liquidity Check: Gross on Four Ticks Sums to 2800, and the Pool Is Using 1000. This note stops at which call is allowed to invoke cross. The uninitialized edges 15300 and -15360 can be price targets, and the liquidity figure does not change there. The initialized ticks 180 and -60 are the ones that enter cross.

6. Writing the next tick as 60 leaves the price ratio at 1.006017734268

1.0001 to the n is 10001 to the n divided by 10000 to the n. Keep the integer part, keep the first 12 decimal digits, and do not round. Tick 60 is 1.006017734268. Tick 180 is 1.018162060104. Tick 15300 is 4.617823568835. Tick 15360 is 4.645612403972. These are ratios of the ticks themselves, not the quote from dividing the stored square-root price once. That quote and this ratio are not the same number. See Swap Check: Dividing the Sqrt Price Once Is Not the Pool Quote.

With only 180 initialized, the upward boundary of this call is 180, not 60. Deriving "the next price ratio is 1.006017734268" from the spacing drops the stretch from 60 to 180. On an empty word the boundary is 15300 and the ratio is 4.617823568835, more than a different order from the ratio at 60. The 4.645612403972 at 15360 becomes a boundary only on the second search. The return of one call is the price target of this step. Aim the step at the wrong tick, and the input, the output, and the fee are computed against another price.

A check starts by writing down the start tick, the spacing, and whether the search moves up or down, then lists the compressed ticks that are actually set in this word. The return equals the nearest set bit only when initialized is written true. With no set bit, write the word edge and mark it false. The upward edge from 0 is 15300. The downward edge from -1 is -15360. 15360, in the next word, is another call. Do not fill those three cells with "the current tick plus one spacing."

This is an analytical framework. One bit per compressed tick, one search bounded by one word, an uninitialized word edge with initialized false, and the negative-infinity adjustment when a negative tick is not on the grid, come from TickBitmap.sol v1.0.0. Using that return as the swap's price target, calling cross only when initialized is true, and writing tickNext minus 1 when moving down, come from UniswapV3Pool.sol v1.0.0. 180, 15300, 15360, -60, -15360, -61, and the ratios 1.006017734268, 1.018162060104, and 4.617823568835 are teaching results of that integer arithmetic. They are not a pool reading from 12 November 2026, and they are not investment advice.

7. Common misreadings

Tick is 0 and spacing is 60. Is the next tick 60?

With only 180 initialized, one upward call returns 180 and initialized is true. The call returns 60 only when both 60 and 180 are initialized. An empty word returns 15300 and initialized is false. 60 is where this search starts looking. It is not the tick the function promises to return.

15360 is initialized. Can one upward call from 0 reach it?

No. 15360 is compressed tick 256, bit 0 of the next word. From 0, this call only sees the current word. The empty-word edge is 15300 and initialized is false. If the price reaches 15300, the pool does not call cross, and on the way up the tick becomes 15300. The next call, starting at 15300, returns 15360 and initialized is true.

Tick is -1. Is the next tick down -61?

No. -1 divided by 60 rounds toward zero to 0. The remainder is not 0, so the compressed tick decreases by 1 and becomes -1, which is the bit for tick -60. When that bit is set, the downward call returns -60. If the price reaches -60 while moving down, cross runs and the tick is written as -61. A new downward call from -61 no longer includes that bit. With only -60 initialized, the next return is -15360 and initialized is false.