Skip to content

Adjusted weight function for new identities #6817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Apr 4, 2025

Motivation

Incentivise reinitialisation by giving identities that have been created after a certain epoch extra weight in their ATXs. This PR adjusts the weight function for identities that have been initialized after the configured epoch.

Description

  • Add a new config parameter BonusWeightEpoch that defines the epoch at which new identities start to receive extra
    weight
    • to be eligible for the extra weight an identity must use a commitment ATX that isn't older than
      BonusWeightEpoch-2, any ATX published in or after that epoch and is used as commitment makes an identity eligible
      for the extra weight
    • TODO: right now this epoch is set to 50 and will need to be adjusted before merging this PR
  • Weight calculation is updated to use the current formula for all identities with a commitment ATX that is older than
    BonusWeightEpoch-2 or the golden ATX
    • the new formula is used for all new identities
    • newly created identities incrementally receive more weight over 10 epochs: every epoch their weight increases by 10% to a final weight of 2x what an old identity would receive with the same PoST size.
  • For fastnet I set epoch 3 as the BonusWeightEpoch so that all identities created after genesis receive the bonus
    weight
  • TODO: if relevant existing testnets the BonusWeightEpoch should be set to an epoch in the near future, but not hard coded into testnet preset. Unless this functionality is explicitly tested on a testnet this parameter doesn't need to be set at all.

Test Plan

New unit tests have been added and existing tests have been adjusted for the changed functionality.

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

@fasmat fasmat requested review from pigmej, noamnelke, poszu and Copilot April 4, 2025 13:54
@fasmat fasmat self-assigned this Apr 4, 2025
@fasmat fasmat requested a review from dshulyak as a code owner April 4, 2025 13:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

@@ -104,6 +104,8 @@ func MainnetConfig() Config {
LayerAvgSize: 50,
LayersPerEpoch: 4032,

BonusWeightEpoch: 50, // TODO(mafa): set to correct value
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: update to correct value

@fasmat
Copy link
Member Author

fasmat commented Apr 4, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 4, 2025
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

Attention: Patch coverage is 90.37433% with 18 lines in your changes missing coverage. Please review.

Project coverage is 76.9%. Comparing base (8a6659e) to head (ec1b585).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
activation/handler_v2.go 76.7% 9 Missing and 4 partials ⚠️
activation/handler_v1.go 82.1% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #6817     +/-   ##
=========================================
- Coverage     76.9%   76.9%   -0.1%     
=========================================
  Files          369     369             
  Lines        50315   50402     +87     
=========================================
+ Hits         38734   38770     +36     
- Misses        9374    9416     +42     
- Partials      2207    2216      +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 4, 2025

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Apr 5, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 5, 2025
@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 5, 2025

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Apr 7, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 7, 2025
@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 7, 2025

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Apr 7, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 7, 2025
@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 7, 2025

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Apr 7, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 7, 2025
@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 7, 2025

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Apr 7, 2025

bors try

spacemesh-bors bot added a commit that referenced this pull request Apr 7, 2025
@spacemesh-bors
Copy link

spacemesh-bors bot commented Apr 7, 2025

try

Build succeeded:

@fasmat fasmat force-pushed the bonus-weight-reinit branch 2 times, most recently from 6113630 to cba3684 Compare April 21, 2025 10:42
@fasmat fasmat force-pushed the bonus-weight-reinit branch from cba3684 to c424e2e Compare May 18, 2025 13:14
@fasmat fasmat force-pushed the bonus-weight-reinit branch from c424e2e to ec1b585 Compare May 22, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant