Skip to content

Commit

Permalink
add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
iKapitonau committed Jul 26, 2024
1 parent 2ab96d8 commit ef1efc2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions light-client-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ default = ["rust-crypto", "flex-error/std"]
rust-crypto = ["tendermint/rust-crypto"]

[dependencies]
log = "0.4.22"
tendermint = { version = "0.38.0", path = "../tendermint", default-features = false }

derive_more = { version = "0.99.5", default-features = false, features = ["display"] }
Expand Down
1 change: 1 addition & 0 deletions light-client-verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ pub use verifier::{PredicateVerifier, Verdict, Verifier};

#[cfg(feature = "rust-crypto")]
pub use verifier::ProdVerifier;

4 changes: 4 additions & 0 deletions light-client-verifier/src/operations/voting_power.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Provides an interface and default implementation for the `VotingPower` operation
use log::debug;
use alloc::vec::Vec;
use core::{fmt, marker::PhantomData};

Expand Down Expand Up @@ -122,6 +123,8 @@ pub trait VotingPowerCalculator: Send + Sync {
untrusted_validators: &ValidatorSet,
) -> Result<(), VerificationError> {
let trust_threshold = TrustThreshold::TWO_THIRDS;
debug!("UNTRUSTED_HEADER {:?}", untrusted_header);
debug!("UNTRUSTED_VALIDATORS {:?}", untrusted_validators);
self.voting_power_in(untrusted_header, untrusted_validators, trust_threshold)?
.check()
.map_err(VerificationError::insufficient_signers_overlap)
Expand Down Expand Up @@ -412,6 +415,7 @@ fn voting_power_in_impl<V: signature::Verifier>(
) -> Result<VotingPowerTally, VerificationError> {
let mut power = VotingPowerTally::new(total_voting_power, trust_threshold);
for validator in validator_set.validators() {
debug!("VALIDATOR {:?}", validator);
if votes.has_voted::<V>(validator)? {
power.tally(validator.power());
// Break out of the loop when we have enough voting power.
Expand Down

0 comments on commit ef1efc2

Please sign in to comment.