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

light-client-verifier: optimise validator lookup in voting_power_in #1407

Merged
merged 3 commits into from
Apr 11, 2024

Commits on Apr 9, 2024

  1. light-client-verifier: optimise validator lookup in voting_power_in

    Rather than performing a linear search for a validator by its address,
    construct an index for the validator set sorted by address.  While
    building the index takes O(N log N) time, it cuts lookup to O(log n).
    
    On Solana, with ~50 validators, this change causes reduction of the
    cost of a single lookup from 20k compute units to 700.
    
    Furthermore, merge the index with the seen_validators map so that only
    a single lookup is now performed which allows us to find the validator
    and check whether it’s not a duplicate.
    
    Co-authored-by: Dhruv D Jain <dhruv@iamsizzling.com>
    mina86 and dhruvja committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    c7bedc1 View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2024

  1. Extract to ValidatorMap

    mina86 committed Apr 11, 2024
    Configuration menu
    Copy the full SHA
    426af23 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5848da6 View commit details
    Browse the repository at this point in the history