Difficulty: Advanced
Category: Feature
Context: buildDecodedVotesCsv already exports outcomeWeights/outcomeSeeds joined with /, but flattens all three outcomes into single cells, making the export hard to consume programmatically for independent audit tooling (e.g., a third party re-verifying tallies from the CSV alone without re-running the dapp's JS).
// dapp/src/utils/anonymousVotingCsv.ts
export function buildAuditableDecodedVotesCsv(
decodedVotes: DecodedVote[],
proposalId: number,
proofOk: boolean | null | undefined,
): string {
// !todo: Emit one column per outcome per field (Approve/Reject/Abstain x Weight/Seed)
// instead of slash-joined cells, so the CSV can be parsed and re-verified
// without re-implementing the "/" split logic.
// !todo: Must include proposalId and proofOk as either header metadata or per-row
// columns so the export is self-describing/auditable in isolation.
// !todo: Must remain compatible with escapeCsvValue's existing quoting rules for
// embedded commas/quotes/newlines in address or vote fields.
// !todo: Acceptance: a third party with only this CSV + the public tally formula
// must be able to reproduce talliesArr/seedsArr from anonymousVoting.ts.
throw new Error("Not implemented");
}
What contributors need to know:
- Problem:
anonymousVotingCsv.ts:1-34 — current export is human-readable but not machine-re-derivable without parsing slash-separated cells.
- Related code:
DecodedVote interface in anonymousVoting.ts:53-62.
- Suggested approach: expand
CSV_HEADERS to explicit per-outcome columns; keep the existing function as a "compact" export option if UI still needs it.
- Acceptance criteria: a round-trip test that reconstructs tally totals purely from the new CSV output matches
computeAnonymousVotingData's in-memory tallies for the same fixture.
Difficulty: Advanced
Category: Feature
Context:
buildDecodedVotesCsvalready exportsoutcomeWeights/outcomeSeedsjoined with/, but flattens all three outcomes into single cells, making the export hard to consume programmatically for independent audit tooling (e.g., a third party re-verifying tallies from the CSV alone without re-running the dapp's JS).What contributors need to know:
anonymousVotingCsv.ts:1-34— current export is human-readable but not machine-re-derivable without parsing slash-separated cells.DecodedVoteinterface inanonymousVoting.ts:53-62.CSV_HEADERSto explicit per-outcome columns; keep the existing function as a "compact" export option if UI still needs it.computeAnonymousVotingData's in-memory tallies for the same fixture.