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

feat(finality): move voting power table to finality module #217

Merged
merged 2 commits into from
Oct 29, 2024

Commits on Oct 29, 2024

  1. finality: move voting power dist update to finality module (#216)

    First step of #24
    
    This PR moves the voting power distribution update algorithm to
    `x/finality`. This is a major refactoring that includes
    
    - moving `max_active_finality_providers` parameter to `x/finality`
    - moving many functions in `x/btcstaking/power_dist_change.go` and
    relevant tests to `x/finality`
    - moving test utilities under `x/btcstaking/keeper_test.go` to a new
    module `testutil/btcstaking-helper`, and use it for existing tests of
    `x/btcstaking` and `x/finality`
    - removing the cyclic dependency between `x/btcstaking` and
    `x/finality`, as well as their hooks. Now the hooks in these 2 modules
    are not necessary, as the only dependency between them is that
    `x/finality` will invoke `x/btcstaking`, but not the other way
    
    TODOs in subsequent PRs:
    
    - moving some relevant query APIs to `x/finality`
    - moving the voting power dist cache and voting power table KV stores to
    `x/finality`
    SebastianElvis committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    05c3492 View commit details
    Browse the repository at this point in the history
  2. finality: refactor voting power table and APIs (#222)

    Second half of #24
    
    This PR moves the voting power table/cache and relevant APIs to
    `x/finality`. This includes the following
    
    - [x] move voting power table KV store to `x/finality`
    - [x] move voting power dist cache to `x/finality`
    - [x] move 4 APIs `ActiveFinalityProvidersAtHeight`,
    `FinalityProviderPowerAtHeight`, `FinalityProviderCurrentPower`,
    `ActivatedHeight` to `x/finality`
    - [x] fix fuzz tests
    - [x] fix e2e tests
    - [x] fix doc
    - [x] fix changelog
    
    Note that this affects many LoCs since it touches a bunch of proto
    files. The actual modification is much smaller than it looks like.
    SebastianElvis committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    6722d96 View commit details
    Browse the repository at this point in the history