Submitted by 0xjuan
When users configure their NFT within the AutoRange contract, they have 2 options for fee-handling:
The user sets PositionConfig.onlyFees=false for the first option, and onlyFees=true for the second option. When an operator calls the AutoRange.execute() function, they set the reward parameter rewardX64 based on the users PositionConfig.
However, the execution can be front-ran by the user. They can change the onlyFees boolean, which changes the fee handling logic, while the rewardX64 parameter set by the operator is unchanged.
The user can exploit this to their advantage by initially setting onlyFees to false, so that the operator will call the function with only 0.15% reward percentage. But when the operator sends their transaction, the user front-runs it by changing onlyFees to true. Now, the protocol only gets 0.15% of the fees collected when they initially intended to collect 0.15% of the entire position.
The cost of executing the swap is likely to exceed the fees obtained (since expected fee is 0.15% of entire position, but only 0.15% of fees are obtained). This leads to loss of funds for the protocol.
See the rewardX64 parameter and docs regarding fee source.
Let the operator pass in 2 different values for rewardX64, where each one corresponds to a different value of onlyFees. This way, the rewardX64 parameter passed in will not be inconsistent with the executed logic.
MEV
kalinbas (Revert) acknowledged and commented:
