Uniswap V3 Bot — Bugfixes (Part III)
Squish!
This is a short post detailing one bug fix for the Uniswap V3 bot.
I will release periodic posts like this as I identify and fix bugs. Thank you for reporting issues!
Tick Bitmap Fix
I’ve observed random occurrences of V3LiquidityPool classes throwing exceptions related to retrieving ticks from its internal tick_bitmap dict. I have finally identified and fixed the issue.

The external_update method provides a means to process change-in-liquidity events (Mint and Burn).
The issue occurs when an event causes a tick to “flip” from initialized to un-initialized, or vice versa. The helper was correctly marking the change in liquidity in tick_data, but was not adjusting the values in tick_bitmap. This is a subtle bug that does not often present itself, but will occur in pools with low liquidity that experience frequent tick flipping from JIT attacks.
It primarily affects the behavior of the ported swap function, which uses tick_bitmap to determine the next initialized tick as it computes swap calculations. This, in turn, affects the calculated liquidity across that region. For swaps that would cross a region where this tickBitmap was inaccurate, the resulting amounts out would be slightly off due to inaccurate liquidity information.
I have made two small corrections with this commit. After detecting a flip, the helper now passes tick_bitmap to a helper function flipTick in the TickBitmap library which adjusts the bitmap by flipping that particular tick.
I’ve been watching it for a day and it appears to work correctly. No more tick exceptions are being thrown and my simulation “false negatives” have improved.
TL;DR
Run git pull on the degenbot code base again and clear your ethereum_blacklisted_arbs.json file, since some arbs might have been incorrectly blacklisted.
