Skip to content

Implement Batch Ballot Recording #33

@Just-Bamford

Description

@Just-Bamford

��# Issue 15: Implement Batch Ballot Recording

Problem

Recording multiple ballots requires N separate transactions. No batch operation for efficiency.

Solution

  • Add record_ballots_batch(ballot_ids: Vec<String>) function in lib.rs
  • Process atomically (all succeed or all fail)
  • TypeScript helper sorobanRecordBallotsBatch() to invoke batches
  • Reduces transaction overhead and improves throughput

Implementation Tasks

  • Implement record_ballots_batch() in lib.rs
  • Use atomic processing (validate all before writing any)
  • Return Result<Vec> with ballot hashes on success
  • Add TypeScript helper sorobanRecordBallotsBatch()
  • Unit tests: batch succeeds atomically
  • Unit tests: batch fails atomically if any ballot fails
  • Performance test: compare batch vs. individual calls

Note for Contributors

Complete Issue #1 (ballot metadata storage) first. Batch processing must be atomic: either all ballots are recorded or none are (all-or-nothing semantics). Validate all ballots in the batch before writing any, then write all together. Return a Result with all ballot hashes on success, or error on any failure. The batch function should respect the same authorization guards as individual record_ballot calls. Limit batch size (e.g., max 100 ballots per call) to prevent resource exhaustion. TypeScript helper should handle retries at the batch level, not individual items. Consider transaction size limits imposed by Soroban.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions