QuantAMM

QuantAMM
49,600 OP
View results
Submission Details
Severity: low
Invalid

The calculation of scaledAbsGradient in ChannelFollowingUpdateRule.sol deviates from the approach outlined in the whitepaper.

Summary

the white paper defines w(t) = w(t-1) + κ[channel + trend - normalizationFactor] in ChannelFollowingUpdateRule.sol

with the following declarations in the natspec

//- g = normalized price gradient = (1/p)·(dp/dt)
// - envelope = exp(-g²/(2W²))
// - s = pi * g / (3W)
// - channel = -(A/h)·envelope · (s - 1/6 s^3)
@> // - trend = (1-envelope) * sign(g) * |g/(2S)|^(exponent)
// - normalizationFactor = 1/N * ∑(κ[channel + trend])_i

The issue comes from the scaling down of the absolute gradient value (|g/(2S)|) by 2S which is not reflected in the whitepaper

@> int256 scaledAbsGradient = absGradient.div(locals.preExpScaling[0].mul(TWO));

Impact

the protocol deviates from the whitepaper

could lead to miscalculations in the long run

Tools Used

Manual review

Recommendations

The protocol should strictly follow the calculations in the white paper

Updates

Lead Judging Commences

n0kto Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

invalid_ChannelFollowingUpdateRule_whitepaper_incorrect_implementation

The formula here is the one in Whitepaper page 11, which is right and the division is explained on the last line : "Finally note …".

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!