-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add jcli command to tally all proposals in a vote plan #2980
Conversation
…merge shares from multiple members
808f47c
to
c9d4b63
Compare
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.
Apart from some nitpicks this is a great job!
proposals: usize, | ||
) -> Result<Vec<Vec<chain_vote::TallyDecryptShare>>, Error> { | ||
let shares: Vec<Vec<String>> = serde_json::from_reader(io::open_file_read(share_path)?)?; | ||
if shares[0].len() < threshold || shares.len() != proposals { |
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.
There is no guarantee that all underlying vectors are of correct length if shares[0].len() >= threshold
is satisfied. IMO it is better to move that check to the .map()
call below. I guess this pattern might be repeated in a few other places.
0e83eec
to
44b843b
Compare
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.
Good to go.
jcli/src/jcli_app/vote/tally/mod.rs
Outdated
Tally::DecryptionShare(cmd) => cmd.exec(), | ||
Tally::VotePlanDecryptionShares(cmd) => cmd.exec(), | ||
Tally::DecryptionShares(cmd) => cmd.exec(), | ||
Tally::Decrypt(cmd) => cmd.exec(), | ||
Tally::DecryptVotePlan(cmd) => cmd.exec(), | ||
Tally::DecryptResults(cmd) => cmd.exec(), |
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 wonder if we could hide the deprecated commands from help, but still have them supported in the CLI.
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 we remove them altogether once we have tested the new ones? I do not see much value in keeping those, and we would have to maintain more functionalities.
Here I am keeping the old commands for compatibility reasons and I would like to remove them if not needed, but I think they are used in tests at the moment.
Intermediate steps outputs (generate shares, tally private vote) are only needed for inter-command communication, it probably makes sense if the format is fixed (i.e. always in json)
Working on decrypt shares I got a bit confused by
Vec<Vec<Share>>
orVec<Share>
since it's not obvious what the structure of that is, and they actually mean different things in different contexts (e.g. isVec<Share>
all the shares for a vote plan of a committee member or is it all the shares of multiple committee members for a single proposal), so I added some more types to clarify that.This pr is becoming quite big, I don't know what the policy is, if I should split it up or navigating diffs by commits is enough.
First step for #2972