Skip to content
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

Merged
merged 12 commits into from Feb 9, 2021

Conversation

zeegomo
Copy link
Contributor

@zeegomo zeegomo commented Feb 1, 2021

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>> or Vec<Share> since it's not obvious what the structure of that is, and they actually mean different things in different contexts (e.g. is Vec<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

@zeegomo zeegomo marked this pull request as ready for review February 1, 2021 18:50
Copy link
Contributor

@eugene-babichenko eugene-babichenko left a 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!

jcli/src/jcli_app/vote/tally/decrypt_shares.rs Outdated Show resolved Hide resolved
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 {
Copy link
Contributor

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.

@zeegomo zeegomo requested a review from a team February 2, 2021 12:39
jcli/src/jcli_app/utils/vote.rs Outdated Show resolved Hide resolved
jcli/src/jcli_app/vote/mod.rs Outdated Show resolved Hide resolved
jcli/src/jcli_app/vote/tally/decrypt_shares.rs Outdated Show resolved Hide resolved
jcli/src/jcli_app/vote/tally/mod.rs Outdated Show resolved Hide resolved
jcli/src/jcli_app/vote/tally/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@mzabaluev mzabaluev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go.

Comment on lines 38 to 41
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(),
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@mzabaluev mzabaluev merged commit a995543 into input-output-hk:master Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants