Treating of BLOCK_TIME as permanent will cause serious economic flaws in the oracle when block times change
The pump contract stores the chain block time as an immutable value, but block times can change (e.g., on L2s). When the actual block time differs, the price change cap becomes either too strict or too permissive, leading to arbitrage opportunities or increased manipulability.
Submitted by Trust
Pumps receive the chain BLOCK*TIME in the constructor. In every update, it is used to calculate the blocksPassed variable, which determines what is the maximum change in price (done in *capReserve()).
The issue is that BLOCKTIME is an immutable variable in the pump, which is immutable in the Well, meaning it is basically set in stone and can only be changed through a Well redeploy and liquidity migration (very long cycle). However, BLOCKTIME actually changes every now and then, especially in L2s.For example, the recent Bedrock upgrade in Optimism completely changed the block time generation. It is very clear this will happen many times over the course of Basin’s lifetime.
When a wrong BLOCK*TIME is used, the *capReserve() function will either limit price changes too strictly, or too permissively. In the too strict case, this would cause larger and large deviations between the oracle pricing and the real market prices, leading to large arb opportunities. In the too permissive case, the function will not cap changes like it is meant to, making the oracle more manipulatable than the economic model used when deploying the pump.
Impact
Treating of BLOCK_TIME as permanent will cause serious economic flaws in the oracle when block times change.
Recommended Mitigation Steps
The BLOCK_TIME should be changeable, given a long enough freeze period where LPs can withdraw their tokens if they are unsatisfied with the change.
publiuss (Basin) confirmed and commented:
This issue was addressed by (1) changing the variable name from
BLOCK_TIMEtoCAP_INTERVALand (2) rounding up when calculatingcapInterval(See here.)(1) By changing the name it is clear that this parameter does not have to be the block time. (2) By rounding up, the system protects itself against the case where the chain block chain is greater than
CAP_INTERVALcapExponent will always be non-zero when time has passed.
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 block time is stored as an immutable variable, so it cannot adapt when the chain's block time changes.
Impact
The oracle could deviate from market prices or become more manipulatable, depending on whether the cap is too strict or too permissive.
What the attacker needed
Block time changes on the chain
The fix
The block time parameter should be made changeable, with a freeze period allowing liquidity providers to withdraw if they disagree.
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.
A price oracle is a service that provides price data to a smart contract. This oracle limits how much the price can change per block based on a fixed block time. If the real block time changes, the limit becomes wrong, making the oracle either too slow to update or too easy to manipulate.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.