Skip to content

feat(solidity): improve Sepolia deploy behavior and wallet registry flows#4000

Open
lionakhnazarov wants to merge 10 commits into
stack/testnet4-01-ci-yarnfrom
stack/testnet4-02-solidity-logic
Open

feat(solidity): improve Sepolia deploy behavior and wallet registry flows#4000
lionakhnazarov wants to merge 10 commits into
stack/testnet4-01-ci-yarnfrom
stack/testnet4-02-solidity-logic

Conversation

@lionakhnazarov
Copy link
Copy Markdown
Collaborator

@lionakhnazarov lionakhnazarov commented May 25, 2026

Stack Context

This is PR 2/4 in the reorganization stack.
Base: #3999 (stack/testnet4-01-ci-yarn)
Next: #4001

What Changed

1) ECDSA deploy/runtime logic

  • Contract-level adjustments:
    • solidity/ecdsa/contracts/WalletRegistry.sol
  • Deploy script updates for deployment flow and account/approval behavior:
    • solidity/ecdsa/deploy/00_resolve_reimbursement_pool.ts
    • solidity/ecdsa/deploy/00_resolve_token_staking.ts
    • solidity/ecdsa/deploy/01_deploy_ecdsa_sortition_pool.ts
    • solidity/ecdsa/deploy/02_deploy_dkg_validator.ts
    • solidity/ecdsa/deploy/03_deploy_wallet_registry.ts
    • solidity/ecdsa/deploy/07_approve_wallet_registry.ts
    • solidity/ecdsa/deploy/09_deploy_wallet_registry_governance.ts
  • Added verification helper:
    • solidity/ecdsa/deploy/etherscanVerification.ts
  • Hardhat runtime/config updates:
    • solidity/ecdsa/hardhat.config.ts
  • Wallet owner initialization logic update:
    • solidity/ecdsa/tasks/initialize-wallet-owner.ts

2) ECDSA test/fixture/type updates

  • Tests:
    • solidity/ecdsa/test/WalletRegistry.Authorization.test.ts
    • solidity/ecdsa/test/WalletRegistry.CustomErrors.test.ts
    • solidity/ecdsa/test/WalletRegistry.Rewards.test.ts
    • solidity/ecdsa/test/WalletRegistry.Slashing.test.ts
    • solidity/ecdsa/test/WalletRegistry.Upgrade.test.ts
    • solidity/ecdsa/test/WalletRegistry.WalletCreation.test.ts
    • solidity/ecdsa/test/WalletRegistryGovernance.test.ts
  • Fixtures/utilities:
    • solidity/ecdsa/test/fixtures/index.ts
    • solidity/ecdsa/test/utils/operators.ts
  • Added types:
    • solidity/ecdsa/types/TokenStaking.extensions.d.ts
    • solidity/ecdsa/types/chai.d.ts

3) Random beacon deploy/config/test alignment

  • Deploy/config:
    • solidity/random-beacon/deploy/05_approve_random_beacon_in_token_staking.ts
    • solidity/random-beacon/hardhat.config.ts
  • Tests/fixtures/utilities:
    • solidity/random-beacon/test/RandomBeacon.Authorization.test.ts
    • solidity/random-beacon/test/RandomBeacon.Callback.test.ts
    • solidity/random-beacon/test/RandomBeacon.GroupCreation.test.ts
    • solidity/random-beacon/test/RandomBeacon.Relay.test.ts
    • solidity/random-beacon/test/RandomBeacon.Rewards.test.ts
    • solidity/random-beacon/test/system/e2e.test.ts
    • solidity/random-beacon/test/fixtures/index.ts
    • solidity/random-beacon/test/utils/operators.ts
  • Added types:
    • solidity/random-beacon/types/TokenStaking.extensions.d.ts

4) Embedded export deploy scripts for ECDSA external random-beacon export

  • Added scripts under:
    • solidity/ecdsa/external/random-beacon-export/deploy/01_*.js ... 09_*.js

Out of Scope

Test Plan

  • cd solidity/ecdsa && yarn test
  • cd solidity/random-beacon && yarn test
  • Spot-check deployment flows for expected skip/redeploy behavior.

Isolates CI and dependency-management groundwork needed for testnet4/Sepolia work so follow-up PRs can focus on runtime and deployment behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
…andom-beacon

Adjusts hardhat/deploy scripts, WalletRegistry behavior/tests, and external random-beacon export deploy scripts so Sepolia deployment and verification paths match the new stack expectations.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lionakhnazarov lionakhnazarov force-pushed the stack/testnet4-02-solidity-logic branch from cef3185 to e1bca45 Compare May 25, 2026 10:43
@lionakhnazarov lionakhnazarov force-pushed the stack/testnet4-01-ci-yarn branch from 8e4fea1 to 23b83ce Compare May 25, 2026 10:43
…ator

Invert mainnet-only denylist to explicit allowlist (hardhat, development,
sepolia). Future production-like networks added downstream now default to
the safe behavior (preserve existing deployment) instead of silently
overwriting deployments/<network>/EcdsaDkgValidator.json.
Add README explaining that 05_approve_random_beacon_in_token_staking.js
intentionally diverges from its tsc-compiled siblings to carry an
ifaceHasFunction precheck for Threshold TokenStaking. A blind regeneration
from upstream would silently drop the precheck and reintroduce a hard
failure on networks without approveApplication.
The conditional etherscan spread inside the object literal forced removal
of the HardhatUserConfig annotation. Assign etherscan via a post-declaration
if-block instead so the annotation (and type-checking) is preserved without
relying on TS 4.9 'satisfies' (this package is on TS 4.5).
Sepolia maps deployer/governance/chaosnetOwner/esdm all to account index 0
because the testnet deploy uses a single key from ACCOUNTS_PRIVATE_KEYS.
Add a header comment so readers don't expect role-separation branches
(e.g. initialize-wallet-owner.ts's owner-vs-governance fork) to fire on
Sepolia.
The second WalletRegistry.governance() read immediately before execute() is
a deliberate recheck against concurrent transferGovernance on shared
networks (sepolia/mainnet); annotate so it isn't mistaken for dead code.
Add verifyOnTenderlyOrContinue mirroring verifyOnEtherscanOrContinue and
wrap tenderly.verify in all four deploy scripts (01, 02, 03, 09). Before
this, only 03 swallowed Tenderly errors; a Tenderly outage during deploy
would fail 01/02/09 while 03 kept going. Now all four behave the same.
hardhat-deploy walks deploy/ and requires() every file; a Markdown
sibling there crashes deployments.fixture() in tests. Move the
regeneration-policy README one level up to
external/random-beacon-export/README.md (still discoverable, no longer
in the require path).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7db203c8-9f69-4acc-bbf9-95b35cb6dcca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stack/testnet4-02-solidity-logic

Comment @coderabbitai help to get the list of available commands and usage tips.

…ety) (#4016)

## Context

Follow-up to #4000 addressing valid findings from the multi-agent
review. Stacks **on top of** `stack/testnet4-02-solidity-logic`; merge
after #4000.

## Findings addressed

| # | Fix | Commit |
|---|-----|--------|
| 3 | Allowlist redeploy-safe networks for `EcdsaDkgValidator` (was:
mainnet-only denylist) | \`fix(ecdsa/deploy): allowlist redeploy-safe
networks\` |
| 5 | README documenting vendored `random-beacon-export` regeneration
policy (`05_*.js` diverges intentionally) | \`docs(ecdsa/deploy):
document vendored random-beacon-export format policy\` |
| 7 | Restore \`HardhatUserConfig\` type annotation (TS 4.5 compatible,
no \`satisfies\`) | \`fix(ecdsa/hardhat): restore HardhatUserConfig type
annotation\` |
| 8 | \`verifyOnTenderlyOrContinue\` helper applied to all 4 deploy
scripts (was: only 03 swallowed errors) | \`fix(ecdsa/deploy): apply
tenderly verify-or-continue helper everywhere\` |
| 9 | Comment explaining sepolia named-account role collapse |
\`docs(ecdsa/hardhat): note sepolia named-account role collapse\` |
| 10 | Comment marking the second \`WalletRegistry.governance()\` read
as a deliberate TOCTOU recheck | \`docs(ecdsa/tasks): explain TOCTOU
recheck of WR.governance()\` |
| extra | Move \`README.md\` out of \`deploy/\` (hardhat-deploy walks
the dir and \`require()\`s every file) | \`fix(ecdsa/deploy): move
README out of deploy/ dir\` |

## Findings rejected after review

- **PR body wording on `WalletRegistry.sol`** (NatSpec-only) — best
handled by editing PR #4000's body directly, not as a code commit here.
- **Skip-suite disclosure** — same: belongs in PR #4000's body.
- \`#4\` (gate \`00_resolve_*\` on env var) — would break
\`deployments.fixture()\` in tests (\`yarn test\` runs the hardhat
network which needs the skip).
- \`#6\` (drop \`approveApplication\` try/catch) — deliberate runtime
backstop for forked/aliased networks where artifact ABI ≠ on-chain.

## Test Plan

Verified locally with \`FORKING_URL\` unset:
- \`cd solidity/ecdsa && yarn test\` → **644 passing, 44 pending, 0
failing**
- \`cd solidity/random-beacon && yarn test\` → **535 passing, 397
pending, 0 failing**

The 44 + 397 pending are the pre-existing \`describe.skip(...)\` suites
(legacy Keep TokenStaking ABI unavailable in current Threshold build).
Copy link
Copy Markdown
Member

@lrsaturnino lrsaturnino left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants