Skip to content

fix(deploy): make published scripts compatible with ethers v5/v6 and replay - #186

Open
mswilkison wants to merge 2 commits into
mainfrom
codex/184-consumer-deploy
Open

mswilkison wants to merge 2 commits into
mainfrom
codex/184-consumer-deploy

Conversation

@mswilkison

@mswilkison mswilkison commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Consumers replay this package's published deployment scripts after copying existing deployment records. Today that can repeat the 4.5B T transfer, call an already-used initializer, or grant a timelock role after the deployer has relinquished administration. The mainnet proxy path also depends on ethers v5-only contract and Interface APIs.

Use on-chain balances, governance and role membership to skip completed work; fund only the vending-machine shortfall and fail if the deployer cannot cover it. Reuse TokenStaking records, recover an interrupted initialization, and save mainnet proxy addresses/ABI through hardhat-deploy using the consumer's HRE. Make the mainnet governance and proxy-admin handoffs replay-safe too. The producer remains on its existing ethers v5 dependencies.

The CI producer follows .nvmrc when available (including #182's Node 22 toolchain) and otherwise retains Node 18 for the legacy lockfile. The new CI consumer matrix installs the actual prepacked tarball on ethers v5 and v6 (hardhat-ethers 3 / upgrades 2.5.1). Each lane runs both direct and mainnet-style proxy deployment on fresh local chains, then replays with distinct deployer/council accounts and asserts unchanged account nonces and deployment addresses. It also checks partial/excess funding, insufficient funds, initializer recovery, saved ABI and ownership handoffs.

Validation: locked producer build and prepack, lint, formatting checks, and all four consumer scenarios pass locally. The full Solidity suite passed in CI. The producer integrated with #182 was also built and prepacked on Node 22; all four packed consumer scenarios passed on ethers 5.8.0 and 6.17.0. Workflow formatting and actionlint pass. No live network or npm publication is involved.

Addresses #184; sibling fix: threshold-network/keep-core#4320. Publishing the package, updating keep-core pins, and removing tbtc-v2's overrides remain release follow-ups.

piotr-roslaniec added a commit to threshold-network/keep-core that referenced this pull request Oct 7, 2026
…5/v6 and replay (#4320)

Published deploy scripts execute inside the consumer's Hardhat runtime.
Ethers v6 consumers currently fail on v5-only APIs, and replaying copied
deployments can repeat approvals, ownership transfers, or proxy
deployment.

This change keeps both producers on ethers v5 while making their exports
work on either runtime. It uses deployment records for addresses,
hardhat-deploy confirmation waits and ABI reads, preserves existing
deployments/governance, and skips completed state changes. Reused
RandomBeacon and WalletRegistryGovernance deployments still reach
verification, so failed Etherscan or Tenderly requests can be retried
without new transactions. Matching governance deployment records retain
their original constructor arguments and metadata. It also covers the
Allowlist/V2 scripts, packages their weights data, and moves
verification utilities outside the directory Hardhat treats as
executable deploy scripts.

The new consumer CI matrix installs both npm tarballs into independent
v5 and v6 projects. It exercises verification-tagged waits, Chaosnet,
the V2 upgrade and Allowlist initialization, then clears the migration
journal and replays against the same chain. It checks unchanged account
nonces and addresses, governance recovery, injected verification
failures and retries before and after governance transfer, and approval
ABI/read variants including JSON and human-readable fragments. Approval
transaction errors remain visible; an unreadable status alone cannot
establish that approval succeeded.

Validation: both packages build, prepack and pass their full lint
commands; both consumer lanes pass; the six existing verification-helper
tests pass. Explorer services are stubbed, while deployment transactions
and confirmation waits run on a real local Hardhat network.

Addresses #4319. Package publication, downstream pin bumps and removal
of tbtc-v2 overrides remain release follow-ups. The sibling Threshold
package fix is threshold-network/solidity-contracts#186.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added support for selecting custom Allowlist weight files on
non-mainnet networks.
- Added isolated deployment checks for ethers 5 and 6, covering replay,
recovery, approvals, authorizations, and ownership.

- **Bug Fixes**
- Deployment scripts now avoid repeating completed deployments,
approvals, authorizations, and ownership changes.
  - Improved deployment confirmation handling and verification retries.
  - Added safeguards against mismatched governance and proxy ownership.

- **Documentation**
- Added guidance for running deployment checks and configuring Allowlist
weights.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

1 participant