Skip to content

fix: apply CEI ordering to governance votes#572

Open
sirakinb wants to merge 1 commit into
ThinkLikeAFounder:mainfrom
sirakinb:codex/fix-governance-cast-vote-cei
Open

fix: apply CEI ordering to governance votes#572
sirakinb wants to merge 1 commit into
ThinkLikeAFounder:mainfrom
sirakinb:codex/fix-governance-cast-vote-cei

Conversation

@sirakinb
Copy link
Copy Markdown

Summary

  • persist locked-token, vote, has-voted, and proposal tally effects before locking governance tokens
  • keep validation and balance checks before state changes
  • move the token transfer after vote effects so callbacks cannot observe the voter as still eligible

Tests

  • cargo +1.91.1 test -p pulsar-governance-dao cast_vote
  • cargo +1.91.1 test -p pulsar-governance-dao double_vote

Note: cargo fmt -p pulsar-governance-dao --check is currently blocked by pre-existing formatting drift in contracts/governance-dao/src/test.rs; this PR only changes src/lib.rs.

Refs #554

@sirakinb sirakinb force-pushed the codex/fix-governance-cast-vote-cei branch from c028f5d to ce9663e Compare May 28, 2026 02:35
@sirakinb
Copy link
Copy Markdown
Author

Rebased this branch onto current main and kept the governance vote transfer after the vote guard, locked-token record, tally update, and proposal write.

Verification after rebase:

  • git diff --check
  • cargo +1.91.1 test -p pulsar-governance-dao cast_vote (3 passed)
  • cargo +1.91.1 test -p pulsar-governance-dao double_vote (2 passed)

Note: cargo +1.91.1 fmt -p pulsar-governance-dao --check still reports pre-existing formatting drift in contracts/governance-dao/src/test.rs; this branch only changes src/lib.rs.

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.

2 participants