feat(contract-manager): multi-contract support + safety in sync_governance_vaas#3663
feat(contract-manager): multi-contract support + safety in sync_governance_vaas#3663aditya520 wants to merge 1 commit into
Conversation
…nance_vaas
Adds the ability to sync many contracts in one invocation and a few safety
improvements to the script that came out of running the q2 fee proposals.
New CLI options:
--contract <id> repeatable; replaces the previous single-contract form
--contracts-file <p> newline-separated file of ids (supports # comments)
--all iterate every mainnet pricefeed/executor contract
--gas-price-gwei <n> override gasPrice; useful on chains with fast-moving
base fees (e.g. Arbitrum)
--dry-run decode and print without submitting transactions
Bug fixes / behaviour:
- fall back to DefaultStore.executor_contracts so executor contract ids
resolve (previously threw "Contract not found")
- coerce lastExecutedGovernanceSequence to Number; EvmExecutorContract
returns a string so "lastExecuted + 1" was string-concatenating
- use contract.chain.wormholeChainName instead of contract.getChain().*;
EvmExecutorContract has no getChain()
- wrap executeGovernanceInstruction in try/catch so a single bad VAA
(e.g. signed by an expired guardian set) doesn't kill the whole loop
- log a friendly "reached end of VAA queue" instead of dumping a stack
trace when fetchVaa fails at end-of-queue
- skip non-EVM contracts gracefully when iterating with --all
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03c554812f
ℹ️ 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".
| } != ${action.targetChainId}, skipping`, | ||
| ); | ||
| } | ||
| lastExecuted++; |
There was a problem hiding this comment.
Stop advancing sequence after failed execution
When executeGovernanceInstruction throws, the script logs and continues, but lastExecuted is still incremented unconditionally. This means a transient failure on sequence N causes the loop to fetch N+1; if N+1 succeeds, the on-chain lastExecutedGovernanceSequence jumps past N (see verifyGovernanceVM in target_chains/ethereum/contracts/contracts/pyth/PythGovernance.sol, which accepts any vm.sequence > lastExecuted and then sets it), making N permanently unexecutable as an old message. This introduces a durable desync risk from a single temporary RPC/gas failure.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🚩 No test coverage for new CLI features
This PR adds several new features (--all, --contracts-file, --dry-run, --gas-price-gwei, multi-contract support, error-and-continue behavior) but does not include any tests. Per REVIEW.md, new functionality should have tests. While this is a CLI script that is harder to unit test, the core logic (contract filtering, gas price override, VAA processing loop) could be extracted into testable functions. At minimum, the --dry-run mode could serve as a basis for integration testing.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds the ability to sync many contracts in one invocation and a few safety improvements that came out of running the q2 fee proposals across 56 pricefeed + 15 entropy chains.
New CLI options
--contract <id>--contracts-file <path>#comments)--allDefaultStore--gas-price-gwei <n>gasPrice; useful on chains with fast-moving base fees (e.g. Arbitrum)--dry-runBug fixes / behaviour changes
DefaultStore.executor_contractsso executor contract ids resolve. Previously threwContract <id> not foundfor entropy/executor proposals.lastExecutedGovernanceSequencetoNumber;EvmExecutorContractreturns a string, solastExecuted + 1was string-concatenating ("647" + 1 = "6471").contract.chain.wormholeChainNameinstead ofcontract.getChain().wormholeChainName;EvmExecutorContracthas nogetChain().executeGovernanceInstructionintry/catchso a single bad VAA (e.g. signed by an expired guardian set) doesn't kill the whole loop.reached end of VAA queueinstead of dumping a stack trace whenfetchVaafails at end-of-queue.--all.Test plan
pnpm test:lintcleanpnpm build(contract_manager) cleanpnpm tsc --noEmitclean for the modified file--dry-runagainst a known-current contract walks the queue and exits cleanly with no transactions sent--dry-run --allagainst a funded key on a low-stakes branch to confirm--alliteration works as expected🤖 Generated with Claude Code