Skip to content

Latest commit

 

History

History
205 lines (137 loc) · 6.86 KB

File metadata and controls

205 lines (137 loc) · 6.86 KB

Square Root Scoring System - Detailed Explanation

✅ Confirmation: It's Working Correctly!

The square root scoring IS applied per-user as intended. Each user's contribution to a seed's score is the square root of their total blessings on that seed.

🔍 How It Actually Works (Code Analysis)

// Step 1: Track how many times THIS SPECIFIC USER has blessed THIS SPECIFIC SEED
uint256 previousCount = userSeedBlessingCount[_blesser][_seedId];
uint256 newCount = previousCount + 1;
userSeedBlessingCount[_blesser][_seedId] = newCount;

// Step 2: Calculate the square root of the user's blessing count
uint256 previousScore = previousCount > 0 ? sqrt(previousCount) : 0;
uint256 newScore = sqrt(newCount);

// Step 3: Calculate the incremental score (with time decay)
uint256 scoreDelta = ((newScore - previousScore) * blessingDecayFactor) / 1000;

// Step 4: Add this user's score contribution to the seed's total
seedBlessingScore[_seedId] = seedBlessingScore[_seedId] + scoreDelta;

Key Data Structures

// Tracks: How many times user X has blessed seed Y
mapping(address => mapping(uint256 => uint256)) public userSeedBlessingCount;

// Stores: Total score for seed (sum of all users' sqrt contributions)
mapping(uint256 => uint256) public seedBlessingScore;

📊 Step-by-Step Example

Scenario: Seed #42 Gets Blessed

Initial State:

  • Seed #42 score: 0

User Alice (owns 100 NFTs) blesses Seed #42:

Blessing # Previous Count New Count Sqrt Delta Score Added Total Seed Score
1st 0 1 √1 - √0 = 1.000 1.000 × decay 1.000
2nd 1 2 √2 - √1 = 0.414 0.414 × decay 1.414
3rd 2 3 √3 - √2 = 0.318 0.318 × decay 1.732
4th 3 4 √4 - √3 = 0.268 0.268 × decay 2.000

Alice's total contribution: √4 = 2.000 points (not 4 points!)

User Bob (owns 1 NFT) blesses Seed #42:

Blessing # Previous Count New Count Sqrt Delta Score Added Total Seed Score
1st 0 1 √1 - √0 = 1.000 1.000 × decay 3.000

Bob's total contribution: √1 = 1.000 point

Seed #42 Final Score: 2.000 (Alice) + 1.000 (Bob) = 3.000 points

The Formula

For a seed with blessings from multiple users:

Seed Score = Σ (√(blessings_from_user_i) × time_decay_i) for all users i

🐋 Anti-Whale Effect Demonstration

Without Square Root (Linear Scoring)

User Type NFTs Owned Blessings Score Contribution % of Total
Whale 1000 1000 1000 90.9%
10 Regular Users 10 each 10 each 100 9.1%
Total - - 1100 100%

Problem: Whale controls 91% of the outcome!

With Square Root (Current Implementation)

User Type NFTs Owned Blessings Score Contribution % of Total
Whale 1000 1000 √1000 = 31.6 50.0%
10 Regular Users 10 each 10 each 10 × √10 = 31.6 50.0%
Total - - 63.2 100%

Solution: Community has equal power to the whale!

💡 Key Insights

1. Diminishing Returns for Multiple Blessings

Each additional blessing from the same user contributes less:

1st blessing:  Δ = √1 - √0  = 1.000
2nd blessing:  Δ = √2 - √1  = 0.414  (41% as effective)
3rd blessing:  Δ = √3 - √2  = 0.318  (32% as effective)
10th blessing: Δ = √10 - √9 = 0.162  (16% as effective)
100th blessing: Δ = √100 - √99 = 0.050 (5% as effective)

Why this matters: Whales get diminishing returns, making it better to spread blessings across multiple good seeds rather than dump all on one.

2. Community Curation Power

10 users blessing once each = √1 + √1 + ... + √1 = 10 points 1 whale blessing 10 times = √10 = 3.16 points

Community is 3x more powerful per blessing!

3. Time Decay Amplifies Fairness

The time decay factor further reduces whale impact:

scoreDelta = ((newScore - previousScore) * blessingDecayFactor) / 1000;
  • Early blessing (24h remaining): 100% of sqrt score
  • Mid-period blessing (12h remaining): 25% of sqrt score
  • Late blessing (1h remaining): 4% of sqrt score

Combined Effect: A whale dumping 1000 blessings at hour 23 gets:

  • √1000 × 0.04 = 1.26 points (instead of 1000!)

🔢 Real-World Scenarios

Scenario 1: Competitive Round

Seed A:

  • 5 users × 1 blessing each = 5 × √1 = 5.0 points
  • Score: 5.0

Seed B:

  • 1 whale × 25 blessings = √25 = 5.0 points
  • Score: 5.0

Result: TIE! Quality (number of supporters) equals quantity (whale blessings).

Scenario 2: Quality Wins

Seed A (High Quality):

  • 20 different users × 1 blessing each = 20 × √1 = 20.0 points

Seed B (Whale-Backed):

  • 1 whale × 400 blessings = √400 = 20.0 points

Result: 20 authentic supporters = 1 whale with 400 blessings!

Scenario 3: Time Decay in Action

Seed A:

  • 10 users bless at hour 0 (24h remaining, 100% weight)
  • Score: 10 × √1 × 1.00 = 10.0 points

Seed B:

  • 40 users bless at hour 23 (1h remaining, 4% weight)
  • Score: 40 × √1 × 0.04 = 1.6 points

Result: Early discovery beats last-minute brigading!

✅ Verification Method

You can verify this is working correctly by:

  1. Reading the mapping:

    userSeedBlessingCount[userAddress][seedId]  // Returns # of times user blessed seed
  2. Checking the score calculation:

    • Get total blessings from user X on seed Y: userSeedBlessingCount[X][Y]
    • User's contribution should be approximately: sqrt(count) × avg_time_decay
    • Seed's total score: seedBlessingScore[seedId]
  3. Event logs: Each BlessingSubmitted event shows individual blessings being recorded

🎯 Design Goals Achieved

  • Prevent whale dominance: sqrt reduces large blessing counts
  • Reward community consensus: Multiple users > single whale
  • Encourage early discovery: Time decay rewards early supporters
  • Fair competition: Quality of support matters, not just quantity
  • Sybil resistance: Per-user sqrt means splitting accounts doesn't help

Summary

The square root scoring is working exactly as intended:

  • Each user's contribution = √(their total blessings on that seed)
  • Total seed score = sum of all users' sqrt contributions (with time decay)
  • Whales get diminishing returns (√1000 = 31.6, not 1000)
  • Community curation has proportionally more power

This creates a fair, manipulation-resistant voting system that rewards genuine artistic merit over financial power.