-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Support public/unencrypted plaintext vote/voting #2148
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
base: main
Are you sure you want to change the base?
Conversation
|
| UpdateTallyCeremonyMutation({ | ||
| variables: { | ||
| election_event_id: record?.id, | ||
| tally_session_id: tallySession.id, | ||
| status: ITallyExecutionStatus.IN_PROGRESS, | ||
| }, | ||
| }) | ||
| .catch((error) => { | ||
| // Handle error if mutation fails | ||
| notify(t("tally.startTallyError"), {type: "error"}) | ||
| console.error("Auto-start tally failed", error) | ||
| }) | ||
| .finally(() => { | ||
| setIsConfirming(false) // Always reset loading state | ||
| }) | ||
| return // Wait for mutation to cause refetch |
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.
The call to UpdateTallyCeremonyMutation should be awaited and try/catched.
| Ciphertext(Ciphertext<C>), | ||
| } | ||
|
|
||
| // --- The Solution --- |
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.
AI footprints
| let public_key_hash = if contest_encryption_policy != ContestEncryptionPolicy::PLAINTEXT { | ||
| get_public_key_hash::<RistrettoCtx>(&board_messages)? | ||
| } else { | ||
| // let found_config = board_messages |
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.
We probably don't want to leave this dead code.
| } | ||
|
|
||
| Ok(keys_ceremony) | ||
| Ok(Some(keys_ceremony)) // <-- CHANGED RETURN |
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.
more ai footprints
| } | ||
|
|
||
| // ################################################## | ||
| // ## FUNCTION MODIFIED |
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.
AI footprints
| return Err(anyhow!("Unexpected status {}", current_status.to_string())); | ||
| } | ||
|
|
||
| // --- LOGIC MODIFIED HERE --- |
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.
AI footprints
| return new MultiContestStrategy(service) | ||
| case EElectionEventContestEncryptionPolicy.PLAINTEXT: | ||
| return new PlaintextStrategy(service) | ||
| default: |
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.
so in packages/sequent-core/src/ballot.rs we have:
pub contest_encryption_policy: Option,
which is optional even though ContestEncryptionPolicy has a default. This means that here by default we'll get an error.
| } | ||
|
|
||
| impl AuditablePlaintextBallot { | ||
| pub fn deserialize_contests<C: Ctx>( |
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.
We should add tests for serializing/deserializing for the whole file.
| /// Plaintext ballots | ||
| //////////////////////////////////////////////////////////////// | ||
|
|
||
| pub fn encode_plaintext_ballot<C: Ctx<P = [u8; 30]>>( |
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.
We should add tests for these functions.
| let public_key = | ||
| if ContestEncryptionPolicy::PLAINTEXT == contest_encryption_policy { | ||
| ballot::PublicKeyConfig { | ||
| public_key: "".to_string(), |
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.
Don't use an empty string in this case, public_key should be optional and empty even if is_demo is false.
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.
Making public key optional
| # (used by the ring cryptographic library): | ||
| export NIX_HARDENING_ENABLE="" | ||
| export CFLAGS_wasm32_unknown_unknown="-O3 -ffunction-sections -fdata-sections -fno-exceptions"; | ||
| export CFLAGS_wasm32_unknown_unknown="-O3 -ffunction-sections -fdata-sections -fno-exceptions"; |
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.
We should also add documentation of the feature.
Findeton
left a comment
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.
Great work Xavier! I added some comments, please address them. Basically adding some tests, removing a magic string and adding documentation.
|
@xalsina-sequent so in order to run the new tests I run: These tests are not being run generally in the github actions. Probably this could be easily fixed by adding the test run in |
Parent issue: https://github.com/sequentech/meta/issues/838