-
Notifications
You must be signed in to change notification settings - Fork 24
feat: script cleanup, ProofFromByteSlices, gadget for voting power #6
Conversation
…ointers, otherwise they're getting dropped
hashed_leaves | ||
} | ||
|
||
#[derive(Clone)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link go source code
src/validator.rs
Outdated
fn voting_power_greater_than_threshold( | ||
&mut self, | ||
accumulated_power: &I64Target, | ||
threshold: &I64Target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong variable name
src/validator.rs
Outdated
// Compute total_vp * 2 | ||
let (scaled_total_vp_low, scaled_total_vp_high) = self.mul_i64_by_u32(&threshold, two_u32); | ||
|
||
// Check that the accumulated voting power is greater than 2/3 of the total voting power. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suggest abstracting this into another function that just compares two i64s
src/validator.rs
Outdated
(lower_product, upper_sum) | ||
} | ||
|
||
fn voting_power_greater_than_threshold( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also pass in 2, 3 here into the function so we can control the threshold
pass | ||
} | ||
|
||
fn check_voting_power( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also pass in threshold numerator / denominator here for max flexibility
Features
tendermint-rs
for merkle proof genProofsFromByteSlices
Verify
ComputeRootHash
Fixes