-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
light-client-verifier: optimise validator lookup in
voting_power_in
(…
…#1407) * 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 <[email protected]> * Extract to ValidatorMap * Update 1406-optimise-voting_power_in.md --------- Co-authored-by: Dhruv D Jain <[email protected]> Co-authored-by: Romain Ruetschi <[email protected]>
- Loading branch information
1 parent
bc8a6c3
commit 404349e
Showing
2 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
.changelog/unreleased/improvements/1406-optimise-voting_power_in.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- `[light-client-verifier]` Optimise validators lookup in | ||
`ProvidedVotingPowerCalculator::voting_power_in` method. | ||
([\#1407](https://github.com/informalsystems/tendermint-rs/pull/1407)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters