Incorrect implementation of the ‘trend’ or m(t) portion of the Channel following rule with respect to the QuantAMM whitepaper.
In the ChannelFollowingUpdateRule.sol, the ‘trend’ or m(t) implementation is different from that specified in the whitepaper. The implementation in the contract is for
trend = (1-envelope) * sign(g) * |g/(2S)|^(exponent)
whereas in the QuantAMM whitepaper [Reference: https://docsend.com/view/8bx7x3vvjj6y44rh/d/xz4rrts499p69ha4], it is specified as
trend = (1-envelope) * sign(g) * |g|^(exponent)
where,
g = normalized price gradient = (1/p)·(dp/dt)
in both the cases.
All other equations for all the QuantAMM rules from the aforementioned QuantAMM whitepaper match the implementation. QuantAMM whitepaper is taken as a source of truth here and as mentioned in the “Known Issues” section, reproduced here.
“We do not exclude issues that find silent overflows, unintended sign changes based on the whitepaper equations, weight vectors that mean calculated values are not in accordance with whitepaper equations or ultimate breach of guard rails in a given block inside the weighted pool itself.”
High
Manual review
The factor (1/(2*S)) from the exponent portion of the equation for ‘trend’ or ‘m(t)’ to be deleted. For this consider changing the lines #170 and #191 of the contract from
to
and the line number #191 https://github.com/Cyfrin/2024-12-quantamm/blob/a775db4273eb36e7b4536c5b60207c9f17541b92/pkg/pool-quantamm/contracts/rules/ChannelFollowingUpdateRule.sol#L191
can be modified from
to
The formula here is the one in Whitepaper page 11, which is right and the division is explained on the last line : "Finally note …".
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.