Repository navigation
Port random-beacon and ecdsa deploy layers to hardhat-deploy v2 / rocketh #4295
Description
Follow-up to #4216, which #4294 closes by taking the maintained v1 line (hardhat-deploy@^1.0.4, Hardhat 2 retained). #4209 tracks the Hardhat 3 migration of both packages and calls hardhat-deploy v2 "the expensive part" without giving it a tracker of its own. This is that tracker, and the keep-core sibling of threshold-network/tbtc-v2#1128.
Why keep-core is on the critical path, not downstream of it
tbtc-v2 executes these packages' published deploy scripts out of node_modules via external.contracts[].deploy (#4216, follow-up comment). Inside keep-core, ecdsa does the same to random-beacon through resolveRandomBeaconExport("deploy"), and both packages load @threshold-network/solidity-contracts/export/deploy. So the ordering is forced:
@threshold-network/solidity-contracts → random-beacon → ecdsa → tbtc-v2
hardhat-deploy v2 is ESM-only with a different deploy-script shape. The published export/deploy is therefore public API: switching it breaks every consumer's USE_EXTERNAL_DEPLOY path until that consumer migrates too. Either all four packages cut over in a coordinated order, or these packages dual-publish during a transition (v1 CommonJS export/deploy kept alongside a v2 export). That is the first design question here, and it does not exist on the tbtc-v2 side.
Exposure on main (a7ac8989b, 2026-09-06)
random-beacon |
ecdsa |
|
|---|---|---|
hardhat-deploy |
^0.11.11 (→ 1.0.4 in #4294) |
^0.11.11 (→ 1.0.4 in #4294) |
deploy/ scripts |
9 | 22 (+2 verification helpers) |
| Fixture sites | deployments.fixture ×3 |
deployments.createFixture ×4, deployments.fixture ×19 |
| Test files | 31 | 29 |
external.contracts[].deploy sources |
solidity-contracts (13 scripts) |
solidity-contracts (13) + random-beacon (9) |
| Assertion stack | @nomiclabs/hardhat-waffle still present |
waffle removed (#4168), hardhat-chai-matchers 1.x on ethers v5 |
| ethers / TypeScript | ^5.4.7 / ^4.4.3 |
^5.5.3 / ^4.5.4 |
Both packages: prepack runs tsc -p tsconfig.export.json at target: es5 then hardhat export-artifacts into export/; files publishes deploy/, export/, and export.json; deployments/mainnet and deployments/sepolia are committed. tbtc-v2 currently consumes 18 ecdsa scripts from the published 2.1.0-dev.19; main has 22, so the published surface grows with each release.
Upstream as of 2026-09-06
hardhat-deploy@2.0.26 peers hardhat ^3.6.0 and rocketh ^0.21.0 / @rocketh/node ^0.21.0; rocketh@0.21.0; @rocketh/viem@0.19.15; @rocketh/ethers does not exist; hardhat@3.15.0. The migration guide linked from #4216 / tbtc-v2#1079 has moved to hardhat-deploy/documentation/how-to/migration-from-v1/index.md; the AI-assisted SKILL.md is unchanged.
Blocked on
- build(solidity): upgrade hardhat-deploy to v1 #4294 landing the v1
1.0.4bump. Independent of everything below. - The ethers v6 direction for both packages. Migrate solidity/ to Hardhat 3 #4209's order is waffle out → ethers v6 → chai 5 / mocha 11 →
hardhat-deploy→ Hardhat 3.random-beaconis still on waffle, and Replace the deprecated @nomiclabs/* hardhat plugins #4213'shardhat-ethersv3 swap is blocked on the same ethers v6 move. v2 puts viem underneath the deploy layer regardless; tbtc-v2's recorded decision (solidity/docs/hardhat-3-migration.mdthere) is ethers v6 for tests with viem confined to deployment, and the same shape almost certainly applies here. @threshold-network/solidity-contractspublishing v2-compatible deploy exports. Separate repo,1.3.0-dev.14consumed here, no issue known. Both packages execute its 13 scripts.@keep-network/hardhat-helpershas no Hardhat 3 line and peershardhat-deploy ~0.11.11; build(solidity): upgrade hardhat-deploy to v1 #4294 already flags that the peer range needs a separate update.- Two upstream questions, still unanswered as of today and shared with tbtc-v2#1128. They matter more here because these packages produce the format, not only consume it:
external.contractswith adeploypath: the v2 migration guide says only "Removeexternal.deploymentsconfiguration (handled differently)" and documents no mechanism for one package executing another's deploy scripts.export.json/hardhat export-artifacts:@rocketh/exportexists and emits chain info plus per-contractabi/address/startBlock; compatibility with the v1export.jsonandexport/layout thatfilespublishes is unverified.
Design decisions to make
- Dual-publish or coordinated cutover for
export/deploy, agreed with tbtc-v2 (Display beneficiary address on the operator page #1128) before either side ports a script. - B or D, per the option comparison in tbtc-v2#1079: v2 for deployment only with tests staying on ethers v6 (B), or Hardhat Ignition (D). D has no equivalent of
deployments/*.json, named accounts, orexternalloading, so it is out for as long as tbtc-v2 consumes this package's exports. - Raise the published export/ bundles off target: es5 #4210 ordering. The
es5export target exists to serve external consumers ofexport/deploy; a v2 export is ESM. Raise the published export/ bundles off target: es5 #4210 and this issue edit the sametsconfig.export.json, so decide which lands first.
Scope once unblocked
- Answer the two upstream questions; record the answers here.
- Agree dual-publish vs cutover and the cross-package order with tbtc-v2#1128; record it here.
- Decide B vs D; record it.
- Port
random-beacon's 9 deploy scripts first (ecdsaconsumes its export), thenecdsa's 22. The upstream SKILL.md covers the mechanical conversion. - Replace the fixture loaders:
random-beacondeployments.fixture×3;ecdsacreateFixture×4 anddeployments.fixture×19. - Replace
external.contractsloading ofsolidity-contracts(both) andrandom-beacon(ecdsa) with whatever v2 mechanism upstream confirms. - Preserve
deployments/{mainnet,sepolia},export/, andexport.jsonbyte-for-byte, or document the break and get tbtc-v2 sign-off. - Verify both suites (955 + 673) and a fresh local deployment +
--exportper package, as build(solidity): upgrade hardhat-deploy to v1 #4294 did for the v1 bump.
Related
#4209 (Hardhat 3 umbrella), #4216 (scoping, closed by #4294), #4210 (ES5 export target), #4213 (@nomiclabs/* replacements), #4215 (@types/*), threshold-network/tbtc-v2#1128 (downstream sibling), threshold-network/tbtc-v2#1079 (option comparison).
Activity
linear commentedon Sep 7, 2026
ENG-754
mswilkison commentedon Sep 8, 2026
Investigation and preparation are recorded in PR #4305 (
solidity/docs/hardhat-3-migration.md). This tracker remains open; the v2 port is still gated on upstream deployment exports, compatible helpers/plugins, and an agreed cross-package publication strategy.The proposed direction is ethers v6 for tests with viem confined to deployment, and dual publication that retains the current CommonJS
export/deploywhile adding a separate ESM entry point. This is a proposal to coordinate with the upstream contracts package and tbtc-v2, not an assumed cross-repository agreement. The document records the required release order and acceptance checks.The published helpers 0.7.2 line still peers with Hardhat 2 / deploy v1; the v2 package requires Hardhat 3 and Rocketh. The replacement for cross-package
external.contracts[].deployloading and compatibility of exported artifacts/JSON still need to be established. The independent maintained-v1 upgrade remains #4294.PR #4299 can land first: it preserves CommonJS while raising the target to ES2020. Fresh ES5/ES2020 deployments produced identical export JSON for all 16 beacon and 22 ECDSA contracts.
build(solidity): migrate Beacon and ECDSA tooling to ethers v6 (#4315)
build(solidity): publish ES2020 CommonJS exports (#4299)
test(random-beacon): remove Waffle before Hardhat 3 (#4305)