Skip to content

Commit

Permalink
light-client-verifier: Avoid checking signatures multiple times (#1410)
Browse files Browse the repository at this point in the history
* light-client-verifier: refactor VotingPowerTally by introducing helper methods

* light-client-verifier: avoid checking signatures multiple times

Introduce VotingPowerCalculator::voting_power_in_sets method.

* Update light-client-verifier/src/operations/voting_power.rs

Co-authored-by: Romain Ruetschi <github@romac.me>

* Update light-client-verifier/src/operations/voting_power.rs

Co-authored-by: Romain Ruetschi <github@romac.me>

* comment

* remove vote_power_in and vote_power_in_sets methods

* Revert "remove vote_power_in and vote_power_in_sets methods"

This reverts commit 92ff746.

* reduce diff

* test

* changelog

* docs

---------

Co-authored-by: Romain Ruetschi <github@romac.me>
  • Loading branch information
mina86 and romac committed Apr 22, 2024
1 parent 6399b5b commit dac61d1
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 226 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- `[light-client-verifier]` Rework VerificationPredicates and VotingPowerCalculator
by introducing methods which check validators and signers overlap at once.
The motivation of this is to avoid checking the same signature multiple
times.

Consider a validator is in old and new set. Previously their signature would
be verified twice. Once by call to `has_sufficient_validators_overlap`
method and second time by call to `has_sufficient_signers_overlap` method.

With the new interface, `has_sufficient_validators_and_signers_overlap` is
called and it can be implemented to remember which signatures have been
verified.

As a side effect of those changes, signatures are now verified in the order
of validator’s power which may further reduce number of signatures which
need to be verified.

([\#1410](https://github.com/informalsystems/tendermint-rs/pull/1410))
Loading

0 comments on commit dac61d1

Please sign in to comment.