Skip to content

Add --simulate flag to governance:propose#775

Open
martinvol wants to merge 7 commits intomasterfrom
martinvol/simulateTxPropose
Open

Add --simulate flag to governance:propose#775
martinvol wants to merge 7 commits intomasterfrom
martinvol/simulateTxPropose

Conversation

@martinvol
Copy link
Copy Markdown
Contributor

@martinvol martinvol commented Apr 29, 2026

Adds a --simulate <RPC_URL> flag to celocli governance:propose. When set, each proposal transaction is sent (not eth_call) against the given RPC, with from = Governance contract address. The node must have that address unlocked (e.g. anvil run with --auto-impersonate). Failures are reported with the decoded revert reason. The proposal isn't submitted on-chain if any tx fails.

Replaces the default eth_call-based simulation only when --simulate is set; mutually exclusive with --force.


PR-Codex overview

This PR introduces a --simulate flag for the governance:propose command, allowing for proposal execution simulation against a forked node. It enhances proposal checks and adds functionality to simulate transaction execution, improving the governance process.

Detailed summary

  • Added --simulate flag to governance:propose command.
  • Updated checkProposal function to accept governanceAddress.
  • Introduced simulateProposalOnRpc function for simulating proposals.
  • Modified proposal validation logic to use simulation when --simulate is specified.
  • Refactored public client creation to a new utility function createCeloPublicClient.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@martinvol martinvol requested a review from a team as a code owner April 29, 2026 15:06
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

⚠️ No Changeset found

Latest commit: 31b2073

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45d958eee5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +45
const hash = await walletClient.sendTransaction({
to: tx.to as StrongAddress,
value: BigInt(tx.value ?? 0),
data: (tx.input ?? '0x') as Hex,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid requiring governance to pay gas in simulation

Sending each proposal step via walletClient.sendTransaction makes the governance address the top-level transaction sender, so simulation can fail with insufficient-funds/unlocked-account errors even when the proposal would execute on-chain. In production execution, an external executor pays gas and Governance only performs internal calls, so this introduces false negatives for governance:propose --simulate (especially on forks where Governance has low balance).

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

size-limit report 📦

Path Size
require('@celo/actions') (cjs) 98.85 KB (0%)
import * from '@celo/actions' (esm) 23.55 KB (0%)
import { resolveAddress } from '@celo/actions' (esm) 23.49 KB (0%)
import { getGasPriceOnCelo } from '@celo/actions' (esm) 73 B (0%)
import { getAccountsContract } from '@celo/actions/contracts/accounts' (esm) 46.11 KB (0%)
import * from '@celo/actions/staking' (esm) 50.66 KB (0%)

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.61%. Comparing base (2276386) to head (059b19f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #775   +/-   ##
=======================================
  Coverage   69.61%   69.61%           
=======================================
  Files         150      150           
  Lines        7075     7075           
  Branches     1163     1146   -17     
=======================================
  Hits         4925     4925           
- Misses       2046     2062   +16     
+ Partials      104       88   -16     
Components Coverage Δ
celocli ∅ <ø> (∅)
sdk 69.12% <ø> (ø)
wallets 73.14% <ø> (ø)
viem-sdks 94.15% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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