Skip to content
DoS Audit finding Intermediate

ConcentratedLiquidityPoolHelper : getTickState() might run out of gas

The getTickState() function iterates over all ticks in a concentrated liquidity pool, which can cause it to run out of gas depending on tick spacing. An attacker could call this function to cause a denial of service by exhausting gas.

hickuphh3 Follow

Originally disclosed on Code4rena

Submitted by hickuphh3, also found by cmichel

Impact

getTickState() attempts to fetch the state of all inserted ticks (including MIN_TICK and MAX_TICK) of a pool. Depending on the tick spacing, this function may run out of gas.

Recommended Mitigation Steps

Have a starting index parameter to start the iteration from. Also, tickCount can be made use of more meaningfully to limit the number of iterations performed.

function getTickState(
	IConcentratedLiquidityPool pool,
	int24 startIndex,
	uint24 tickCount
) external view returns (SimpleTick[] memory) {
  SimpleTick[] memory ticks = new SimpleTick[](tickCount);

  IConcentratedLiquidityPool.Tick memory tick;
	int24 current = startIndex;

	for (uint24 i; i < tickCount; i++) {
		tick = pool.ticks(current);
		ticks[i] = SimpleTick({index: current, liquidity: tick.liquidity});
		// reached end of linked list, exit loop
		if (current == TickMath.MAX_TICK) break;
		// else, continue with next iteration
		current = tick.nextTick;
	}

  return ticks;
}

sarangparikh22 (Sushi) acknowledged

alcueca (judge) commented:

Functionality is affected, severity 2.

The original report as published on Code4rena, by hickuphh3. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The function loops over all ticks without a limit, so the gas cost grows with the number of ticks and can exceed the block gas limit.

Impact

The function may run out of gas, preventing users from retrieving tick state and potentially causing a denial of service.

What the attacker needed

None

The fix

The function should be modified to accept a starting index and a tick count to limit the number of iterations, as suggested in the report.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a smart contract function that tries to read data for every tick in a pool. If there are too many ticks, the function uses too much gas and fails, so users cannot get the information they need.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by hickuphh3

View all

43 more disclosed reports, best first.

More from Sushi Trident contest phase 2

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.