Skip to content

Conversation

@xalsina-sequent
Copy link
Contributor

@xalsina-sequent xalsina-sequent commented Nov 5, 2025

@xalsina-sequent xalsina-sequent changed the title wip ✨ Support public/unencrypted plaintext vote/voting Nov 5, 2025
@github-actions
Copy link

github-actions bot commented Nov 27, 2025

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://docs.sequentech.io/docusaurus/pr-preview/pr-2148/

Built to branch doc-previews at 2026-01-27 07:12 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@xalsina-sequent xalsina-sequent marked this pull request as ready for review December 11, 2025 17:49
Comment on lines 424 to 439
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
Copy link
Contributor

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 ---
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 ---
Copy link
Contributor

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:
Copy link
Contributor

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>(
Copy link
Contributor

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]>>(
Copy link
Contributor

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(),
Copy link
Contributor

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.

Copy link
Contributor Author

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";
Copy link
Contributor

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.

Copy link
Contributor

@Findeton Findeton left a 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.

@Findeton
Copy link
Contributor

@xalsina-sequent so in order to run the new tests I run:

wasm-pack test --release --chrome --headless -- --features=wasmtest,default_features

These tests are not being run generally in the github actions. Probably this could be easily fixed by adding the test run in .github/workflows/build_wasm.yml

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.

3 participants