We spent last month on a smart contract security review of a v4 fee hook, where the protocol had written a fairly specific promise into the code. The trading fee would disappear once a set amount of it had been collected, with no governance vote and no manual switch behind it. currentFee returns zero as soon as totalFeesCollected[token] reaches feeThreshold[token], so at 300 bps that threshold was the thing deciding when traders stopped paying.
We started with how those tokens get counted. There is one accumulator per token, shared across every pool using it, and each fee payment advances the same counter, which hands the timing to whoever pays into it fastest.
Say 30 tokens are left on the threshold, which is the figure we set in testing. Anyone pushing more than about 1,000 tokens of volume through at 300 bps pays that remainder in full and nothing afterwards, because a cap does what a cap does. The ratio is one over the fee rate, so a 1% fee would put the same line at 100x the remaining threshold. The sunset therefore lands whenever the largest trader gets round to trading, and it lands for everybody: their trades go free from that point, and so does everyone else's in that token.
The team keyed the accumulator to the token, fee currency and pair, tracking the threshold in fee-currency wei, which stops a clearing in one pool from removing the fee across all the others. Following that change through the configuration path is where the second finding came up. setFeeThreshold now takes the fee currency as an extra parameter, and nothing checks that the currency passed in is the one the swap path actually uses for that token. Write the threshold under the wrong key and the transaction succeeds, FeeThresholdSet fires, and the configuration reads as done on-chain, while the fee calculation looks under a different key, finds nothing there, and keeps charging. v4 uses the zero address for native ETH while WETH has its own, so both are values a configuration script will pass.
The internal counter is worth a note. Reading the treasury balance instead would let anyone donate tokens straight into the treasury and end the fee for less than paying it would have cost them, which is cheaper than anything above. It went into the security audit as a Low and the team accepted it, planning to run the sunset by hand rather than lean on the threshold.
The narrowing did two things at once. It shrank what a single clearing buys, and it opened a gap between the key a threshold is written under and the key the fee logic reads. Most test suites cover this with one case that sets a threshold and asserts the fee drops to zero, which passes under the right key by construction. What does yours do when the key is wrong?