QuantAMM

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

Problematic Weight Allocation in Portfolio Calculation in ChannelFollowingUpdateRule

Summary

The issue arises when one asset's price is significantly smaller than the other, leading to an excessively large gradient and an overly dominant weight for that asset. This can lead to unintended portfolio outcomes where one asset (Asset 2 in this case) dominates the entire portfolio, overshadowing the other asset (Asset 1), even if both assets had equal initial weights.

Vulnerability Details

Let's consider the following situation:

Weights: [0.5, 0.5]

prices = [1, 0.01]

movingAverage = [1, 0.001]

κ = 0.5, w = 0.1, A = 2, e = 2

Gradient Calculation :

for asset 1:

gradient[0] =( price[0] / movingAverage[0]) - 1 = (1 / 1 ) - 1 = 0

for asset 2 :

gradient[1] = price[1] / movingAverage[1] - 1 =(0.01 / 0.001) - 1 = 10 - 1 = 9

kappa gradient :

for asset 1 :

kappaGradient[0] = κ × gradient[0] = 0.5 × 0 = 0

for asset 2 :

kappaGradient[1] = κ × gradient[1] = 0.5 × 9 = 4.5

Channel Function Calculation:

For Asset 1:

channel[0] = A × (kappaGradient[0] / w)^e = 2 × (0 / 0.1)^2 = 2 × 0 = 0

For Asset 2:

channel[1] = A × (kappaGradient[1] / w)^e = 2 × (4.5 / 0.1)^2 = 2 × (45)^2 = 2 × 2025 = 4050

Updated Weights Calculation:

weights[0] = 0.5 + 0 = 0.5

For Asset 2:

weights[1] = 0.5 + 4050 = 4050.5

Normalization of Weights:

Total weight:

sumWeights = 0.5 + 4050.5 = 4051

Normalized weights:

For Asset 1:

newWeights[0] = 0.5 / 4051 ≈ 0.000123

For Asset 2: newWeights[1] = 4050.5 / 4051 ≈ 0.999877

Impact

After the calculations, Asset 2 holds 99.99% of the total weight, making it dominate the portfolio. In contrast, Asset 1 only holds 0.01%. This outcome is highly skewed, and the portfolio is now almost entirely dependent on Asset 2, despite both assets initially having equal weights.

Recommendations

Ensure moving averages don’t become too small by setting a minimum value.

Updates

Lead Judging Commences

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational or Gas / Admin is trusted / Pool creation is trusted / User mistake / Suppositions

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Support

FAQs

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