AstarNetwork/Astar

dApp Staking - Threshold Issue Reimbursement

Dinonard opened this issue · 0 comments

Description

After the Astar runtime upgrade which introduced oracle feed for price, thresholds for tier entry have been increased much more than it was expected. The core issue was with the formula used to calculate the difference between number of slots, and the issue was fixed here #1252.

As a result of this issue, projects have been incorrectly pushed into the lower tiers, losing rewards they would have otherwise earned.

As part of this task, a script should be written that will identify how much projects earned, how much projects should have earned, and will prepare a call to reimburse the difference.

Approach

To minimize off-chain calculation, we should use chopsticks to replay old blocks using the new fixed runtime, part of v5.39.1 release (link).

  • Runtime upgrade after which oracle values were taken into account happened here
  • The fix was deployed here, but came into effect only from the next era, after this block
  1. Identify blocks at which era change occurred after the oracle runtime upgrade (Subscan can help).
  2. From that era change to the era change after the runtime upgrade with the fix, fetch the tier assignment & calculate how much dApp earned.
  3. Spin-up chopsticks tool, and override WASM binary with the one from the v5.39.1 release, replay the block transition that triggers new era, and calculate how much each dApp earned.
  4. Using the values from 2nd and 3rd step, calculate the delta for each dAPp.
  5. Prepare a sudo batch call to reimburse the delta to reward beneficiary accounts. Funds should be fetched from the old dApp staking rewards account (link).

Required Tasks