Skip to content

Conversation

@aminsammara
Copy link
Contributor

Summary

  • Fixed a bug in the governance CLI where voting without an explicit --vote-amount would fail with Governance__CheckpointedUintLib__NotInPast error
  • Added getPowerForProposal(proposalId) method that correctly uses the proposal's pendingThrough timestamp (creation + votingDelay) to determine voting power
  • Updated vote() method to use getPowerForProposal() instead of the broken getPower() which was incorrectly using the current block timestamp

Background

The governance contract checks voting power at pendingThrough timestamp (when proposal transitions from Pending to Active). The CLI's getPower() method was calling powerAt(now.timestamp) which always failed because the contract requires _time < block.timestamp (strictly less than).

Test plan

  • Tested on local Anvil network with full governance flow (deposit → propose → vote → execute)
  • Verified voting works without explicit --vote-amount flag

The vote method was using getPower() which checks powerAt(now.timestamp),
but the contract requires timestamps to be strictly less than block.timestamp.
This caused votes without explicit amounts to fail with NotInPast error.

Added getPowerForProposal() that correctly uses the proposal's pendingThrough
timestamp (creation + votingDelay) to match the contract's voting logic.
@just-mitch
Copy link
Collaborator

Thanks!

@just-mitch just-mitch added this pull request to the merge queue Jan 23, 2026
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 23, 2026

Flakey Tests

🤖 says: This CI run detected 2 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/bd1753fef9b7c010�bd1753fef9b7c0108;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_invalidate_block.parallel.test.ts "proposer invalidates multiple blocks" (126s) (code: 1) group:e2e-p2p-epoch-flakes (\033just-mitch\033: fix(ethereum): use proposal's pendingThrough timestamp for voting power (#19856))
\033FLAKED\033 (8;;http://ci.aztec-labs.com/06388004ecdb779d�06388004ecdb779d8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/valid_epoch_pruned_slash.test.ts (398s) (code: 1) group:e2e-p2p-epoch-flakes (\033just-mitch\033: fix(ethereum): use proposal's pendingThrough timestamp for voting power (#19856))

Merged via the queue into next with commit 583fb4e Jan 23, 2026
16 checks passed
@just-mitch just-mitch deleted the am/update-gov-cli branch January 23, 2026 19:47
github-actions bot pushed a commit that referenced this pull request Jan 23, 2026
…er (#19856)

## Summary
- Fixed a bug in the governance CLI where voting without an explicit
`--vote-amount` would fail with
`Governance__CheckpointedUintLib__NotInPast` error
- Added `getPowerForProposal(proposalId)` method that correctly uses the
proposal's `pendingThrough` timestamp (creation + votingDelay) to
determine voting power
- Updated `vote()` method to use `getPowerForProposal()` instead of the
broken `getPower()` which was incorrectly using the current block
timestamp

## Background
The governance contract checks voting power at `pendingThrough`
timestamp (when proposal transitions from Pending to Active). The CLI's
`getPower()` method was calling `powerAt(now.timestamp)` which always
failed because the contract requires `_time < block.timestamp` (strictly
less than).

## Test plan
- [x] Tested on local Anvil network with full governance flow (deposit →
propose → vote → execute)
- [x] Verified voting works without explicit `--vote-amount` flag
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.

4 participants