Skip to content
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

Emit scoring details and instant unstake details in V2 events #81

Merged
merged 13 commits into from
Sep 12, 2024

Conversation

ebatsell
Copy link
Collaborator

@ebatsell ebatsell commented Sep 10, 2024

Updates scoring and instant unstake functions with several improvements:

  • Events now contain a "details" field which, for each given component that fails or is triggered, will now track the specific epoch and value that contained the violation, and will be emitted.
    • Will be shown in UI to improve validators' ability to diagnose scoring failures
    • Both response structs are now updated to a V2 since adding new fields without changing the name would break the ability to backfill the event from genesis, as the event discriminator is based on the name, and fields changing mid-history is a very annoying thing to code in. Old structs are stored and noted
  • Each individual component and the associated values are now calculated in their own helper methods which greatly improves readability.
    • In a future PR we can add tests for these helper functions, which will allow us to really simplify the unit tests for these functions intest_algorithms.rs
  • All score functionality remains the same as confirmed by tests

@ebatsell ebatsell force-pushed the evan/scoring-emit-and-idle-fixes branch from 6172dee to 4d66b0f Compare September 10, 2024 22:55
@ebatsell ebatsell marked this pull request as ready for review September 10, 2024 23:17
.iter()
.rev()
.enumerate()
.filter_map(|(i, &commission)| commission.map(|c| (c, current_epoch - i as u16)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to make this a checked_sub

Copy link
Contributor

@coachchucksol coachchucksol left a comment

Choose a reason for hiding this comment

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

lgtm

@ebatsell ebatsell merged commit 57f2656 into master Sep 12, 2024
6 checks passed
@ebatsell ebatsell deleted the evan/scoring-emit-and-idle-fixes branch September 12, 2024 15:24
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.

2 participants