Skip to content

Introduce GovActionsDoNotExist Logic - #1139

Open
yHSJ wants to merge 4 commits into
josh/disallowed-votersfrom
josh/gov-actions-do-not-exist
Open

Introduce GovActionsDoNotExist Logic#1139
yHSJ wants to merge 4 commits into
josh/disallowed-votersfrom
josh/gov-actions-do-not-exist

Conversation

@yHSJ

@yHSJ yHSJ commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Closes #924.

This PR introduces logic to validate that gov actions which are being voted on actually exist at the time of voting. It is also my first use of the new GitHub stacks feature!


Stack created with GitHub Stacks CLIGive Feedback 💬

Summary by CodeRabbit

  • Bug Fixes

    • Governance votes now reject references to nonexistent governance actions.
    • Votes recognize governance proposals created earlier in the same block.
    • Validation reports unknown voters and missing governance actions separately.
  • Tests

    • Added coverage for missing actions, invalid action indexes, committee votes, and transactions mixing valid and invalid proposals.
  • Documentation

    • Added a changelog entry describing the updated governance-action validation.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56412a18-e4a9-40be-bf73-162eed9052ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Voting procedures now validate governance-action references against initial and same-block proposal state. Missing actions produce the GovActionsDoNotExist predicate. Four negative fixtures cover the new behavior.

Changes

Governance action validation

Layer / File(s) Summary
Proposal state lookup
crates/amaru-ledger/src/context/default/validation.rs
ProposalsSlice::exists recognizes proposals present at block start and proposals acknowledged earlier in the current block.
Voting procedure validation
crates/amaru-ledger/src/rules/transaction/phase_one/voting_procedures.rs, crates/amaru-ledger/src/rules/transaction/phase_one/fixture.rs
Voting validation reports unknown proposal IDs through GovActionsDoNotExist. The phase-one fixture maps the error to the new predicate.
Validation fixtures and conformance updates
crates/amaru-ledger/tests/data/phase-one/fail/GovActionsDoNotExist/*, crates/amaru-ledger/tests/data/rules-conformance.failures.toml, CHANGELOG.md
Four negative fixtures cover absent governance actions. The obsolete conformance failure entry is removed, and the changelog records the change.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Transaction
  participant VotingProcedures
  participant ProposalsSlice
  participant Predicate
  Transaction->>VotingProcedures: execute voting procedures
  VotingProcedures->>ProposalsSlice: validate governance-action references
  ProposalsSlice-->>VotingProcedures: return missing proposal IDs
  VotingProcedures->>Predicate: map GovActionsDoNotExist
  Predicate-->>Transaction: return validation failure
Loading

Possibly related issues

  • pragma-org/amaru#932 — Adds related Conway ledger predicate coverage for invalid governance-action references, but targets InvalidPrevGovActionId.

Possibly related PRs

Suggested reviewers: ktorz, jeluard

Poem

Votes seek their proposals, neat and bright,
Same-block actions join the flight.
Missing IDs meet their proper fate,
A predicate guards the ledger gate.
Four fixtures roll in like a boss fight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: introducing GovActionsDoNotExist validation logic.
Linked Issues check ✅ Passed The changes implement GovActionsDoNotExist validation and add the required predicate fixtures for issue #924.
Out of Scope Changes check ✅ Passed The implementation, tests, conformance update, and changelog entry directly support the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch josh/gov-actions-do-not-exist

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yHSJ
yHSJ requested a review from KtorZ August 3, 2026 23:44
@yHSJ yHSJ self-assigned this Aug 3, 2026
@yHSJ
yHSJ force-pushed the josh/gov-actions-do-not-exist branch from ad65047 to d36d452 Compare August 4, 2026 20:00
@yHSJ
yHSJ force-pushed the josh/gov-actions-do-not-exist branch from d36d452 to f2de9fb Compare August 5, 2026 21:29
@yHSJ
yHSJ force-pushed the josh/gov-actions-do-not-exist branch from f2de9fb to 861d2b5 Compare August 6, 2026 15:43
yHSJ added 4 commits August 7, 2026 12:18
Signed-off-by: yHSJ <josh@securitybot.info>
Signed-off-by: yHSJ <josh@securitybot.info>
Signed-off-by: yHSJ <josh@securitybot.info>
Signed-off-by: yHSJ <josh@securitybot.info>
@yHSJ
yHSJ force-pushed the josh/gov-actions-do-not-exist branch from 861d2b5 to aae0a9a Compare August 7, 2026 17:32
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.

Ledger predicate: GovActionsDoNotExist

1 participant