-
Notifications
You must be signed in to change notification settings - Fork 34
fix(governance): proxy-repoint log + show proposal id in governance:propose #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
640c960
fix(governance): correct proxy-repoint log and surface new proposal i…
23250b0
fix(governance,cli): execute approval check, withdraw loop guard, sur…
c40c6ca
fix(cli): correctness bugs from full command audit
75ab333
fix(cli): declare missing --slashing flag in rewards:show
04441a4
test: cover validator balance-requirement precheck and proxy-repoint …
a99e8ae
test(cli): assert governance:propose surfaces the new proposalId
bd2f1cd
Merge branch 'master' into pahor/fix-propose-proxy-log-and-proposalid
pahor167 de558f7
test: cover election pending-votes filter and rewards:show --slashing…
66dfde5
fix(cli): surface proposal id on multisig/safe propose execute paths
9c4f775
fix(governance): resolve intra-proposal upgraded method ABIs in propo…
6f7104c
feat(cli): self-contained fork simulation for governance:propose
c5b0389
feat(explorer): resolve proposal ABIs via Blockscout/Celoscan
f0ea1e5
fix(cli): use a free port for the proposal-simulation anvil fork
5005d2a
fix(governance): match proxy repoints by stripped name or address
159b299
style: biome import order + comment empty catch in event decoder
ab8cd46
style: biome format explorer.ts (unblocks CI fmt:diff)
38aecf0
fix(explorer): migrate Sourcify lookup from v1 to v2 API
9a33726
ci: re-trigger (runner queue)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| --- | ||
| '@celo/governance': patch | ||
| '@celo/actions': patch | ||
| '@celo/dev-utils': patch | ||
| '@celo/explorer': patch | ||
| '@celo/celocli': patch | ||
| --- | ||
|
pahor167 marked this conversation as resolved.
|
||
|
|
||
| Fix several `governance`/`celocli` command output & safety issues: | ||
| - `governance:propose` logged `undefined is a proxy, repointing to ...` for | ||
| core-contract proxy repoints (logged `tx.address` which is undefined when the | ||
| tx is keyed by `contract`); now logs the real proxy id. | ||
| - `governance:propose` now surfaces the new proposal id (`ProposalQueued`), and | ||
| the `--useMultiSig` path surfaces the multisig transaction id (`Submission` on | ||
| submit, `Confirmation` on a later signer) plus the proposal id when the submit | ||
| reaches threshold and executes in the same receipt. | ||
| - `@celo/actions` `getGroupsWithPendingVotes` now filters on pending votes `> 0` | ||
| (was `>= 0`, which returned every group); fixes `election:activate` selecting | ||
| groups with no pending votes. | ||
| - `governance:execute` now checks the proposal is approved before sending, so it | ||
| fails the precondition cleanly instead of reverting with "Proposal not approved". | ||
| - `governance:upvote`/`revokeupvote`/`votePartially` and `multisig:approve` now | ||
| decode and print their on-chain events (proposal id / transaction id). | ||
| - `governance:propose` can now build a core-contract call whose method is added | ||
| by an earlier upgrade tx in the same proposal: when the method is absent from | ||
| the bundled ABI, it is resolved from the implementation a prior tx repoints the | ||
| proxy to (verified metadata), with a raw `function: "name(uint256)"` signature | ||
| fallback. | ||
| - `governance:propose` now simulates the proposal by default against a | ||
| self-contained local fork (bundled `@foundry-rs/anvil`) of the connected node, | ||
| applying the transactions in order so a transaction that depends on an earlier | ||
| one (e.g. a method added by a prior upgrade tx) simulates correctly. Use | ||
| `--simulate <rpcUrl>` to target an external fork, or `--no-simulate` to fall | ||
| back to the previous independent per-transaction `eth_call` checks. | ||
| - `lockedcelo:withdraw` (and `releasecelo:locked-gold` withdraw) no longer spin | ||
| in an infinite loop when no pending withdrawal is available, and re-fetch | ||
| between withdrawals to avoid stale indices. | ||
| - `@celo/dev-utils` anvil test harness now resolves the foundry-installed | ||
| `anvil` (snapshot-compatible) instead of a package-manager `anvil` bin shim, | ||
| so packages that bundle a newer anvil don't break the devchain state load. | ||
| - `@celo/explorer` `fetchMetadata` now uses the Sourcify v2 API (the v1 repo API | ||
| has been sunset / returns 503), so contract ABI resolution (used by | ||
| `governance:propose` to build calls to verified contracts, including | ||
| implementations added by an in-proposal upgrade) works again. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import type { Address } from 'viem' | ||
| import { describe, expect, it, vi } from 'vitest' | ||
| import { getGroupsWithPendingVotes } from './election.js' | ||
|
|
||
| // resolveAddress hits the on-chain registry; stub it so the unit test only | ||
| // exercises the pending-votes filtering logic. | ||
| vi.mock('./registry.js', () => ({ | ||
| resolveAddress: vi.fn(async () => '0x0000000000000000000000000000000000000001'), | ||
| })) | ||
|
|
||
| const ACCOUNT = '0x00000000000000000000000000000000000000aa' as Address | ||
| const GROUP_A = '0x000000000000000000000000000000000000000a' as Address | ||
| const GROUP_B = '0x000000000000000000000000000000000000000b' as Address | ||
| const GROUP_C = '0x000000000000000000000000000000000000000c' as Address | ||
|
|
||
| function clients(groups: Address[], pendingVotes: bigint[]) { | ||
| return { | ||
| public: { | ||
| readContract: vi.fn(async () => groups), | ||
| multicall: vi.fn(async () => pendingVotes), | ||
| }, | ||
| } as any | ||
| } | ||
|
|
||
| describe('getGroupsWithPendingVotes', () => { | ||
| it('returns only groups whose pending votes are strictly greater than zero', async () => { | ||
| // Regression: the filter used `>= 0`, which kept every group (including | ||
| // those with 0 pending votes). It must be `> 0`. | ||
| const result = await getGroupsWithPendingVotes( | ||
| clients([GROUP_A, GROUP_B, GROUP_C], [BigInt(0), BigInt(5), BigInt(0)]), | ||
| ACCOUNT | ||
| ) | ||
| expect(result).toEqual([GROUP_B]) | ||
| }) | ||
|
|
||
| it('returns an empty array when every group has zero pending votes', async () => { | ||
| const result = await getGroupsWithPendingVotes( | ||
| clients([GROUP_A, GROUP_B], [BigInt(0), BigInt(0)]), | ||
| ACCOUNT | ||
| ) | ||
| expect(result).toEqual([]) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.