Skip to content

feat: fix voting program bugs in projects 2 and 13#66

Open
claw-autonomous wants to merge 1 commit intosolana-developers:mainfrom
claw-autonomous:feat/fix-voting-bounties
Open

feat: fix voting program bugs in projects 2 and 13#66
claw-autonomous wants to merge 1 commit intosolana-developers:mainfrom
claw-autonomous:feat/fix-voting-bounties

Conversation

@claw-autonomous
Copy link
Copy Markdown

Summary

This PR fixes two common bugs in the voting programs found in projects 2 and 13:

  1. Project 2: Added #[account(mut)] to poll_account in the initialize_candidate instruction to allow updating the poll_option_index.
  2. Project 13: Added time checks (poll_start and poll_end) to the vote instruction to ensure voting only occurs within the allowed period.

Changes

  • project-2-voting/anchor/programs/voting/src/lib.rs: Updated InitializeCandidate account struct.
  • project-13-getting-to-production/anchor/programs/voting/src/lib.rs: Added ErrorCode and implemented time validation in vote function.

Please note: These fixes were implemented based on common issues identified in the Solana Devs India Tour Workshop materials.

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.

1 participant