Feat/testnet4 deployment support#3932
Feat/testnet4 deployment support#3932lionakhnazarov wants to merge 74 commits intothreshold-network:mainfrom
Conversation
- Introduced Testnet4 configuration in with a new Electrum server URL. - Updated to include Testnet4 for Bitcoin networks. - Added Testnet4 constant in for better network identification. - Adjusted test cases in for improved readability. - Updated Hardhat configuration files to streamline deployment processes and handle potential errors during verification.
…ort.json file - Removed a defunct Thesis Electrum URL from the expected peers in . - Deleted the file as it is no longer needed, streamlining the project structure.
…ackage.json and yarn.lock for ECDSA and random-beacon
…abi version in ECDSA and random-beacon
…g in deployment scripts
… script for improved environment isolation
… to enhance deployment flexibility
…s for improved testing flexibility
…nterface for improved compatibility and clarity
…nd maintainability
…tency, enhancing readability and maintainability
…improve clarity and consistency
…for improved testing accuracy
…con export for deployment scripts, enhancing CI compatibility
…y directories for HOME and XDG_CONFIG_HOME, improving isolation during Git operations
…arnrc.yml for better configuration management
…and enable corepack for Yarn installation
…ocumentation generation
…ad of block counter, improving compatibility with modern transaction types
…e timing-sensitive block drops during tests and local coordination
…ion tests to skip flaky tests
lrsaturnino
left a comment
There was a problem hiding this comment.
Hey Lev, nice work on the testnet4 side — the core bits (enum variant, embedded URL, Sepolia remap) look clean and focused. Left a small set of inline comments on the infrastructure pieces that came along; these are the ones I'd flag as worth addressing before merge rather than general suggestions.
One thing worth surfacing at the top is the WalletRegistry.withdrawRewards change. I poked at the live mainnet state and the proxy at 0x46d52E41C2F300BC82217Ce22b920c34995204eb currently returns a non-zero allowlist() (0x5E1b4E41ea2eeA6aC7656431CCDC7B204a88386f), and that contract does implement rolesOf. So once this implementation is redeployed and the proxy repointed, the switch to _currentAuthorizationSource() does change beneficiary resolution on mainnet for any staker where owner ≠ beneficiary delegation is in play — it's not quite the no-op it might look like. Worth calling out explicitly in the PR description, and I'd really like to see that contract change land as its own PR with a test exercising the allowlist-set path.
| address operator = stakingProviderToOperator(stakingProvider); | ||
| if (operator == address(0)) revert UnknownOperator(); | ||
| (, address beneficiary, ) = staking.rolesOf(stakingProvider); | ||
| (, address beneficiary, ) = _currentAuthorizationSource().rolesOf( |
There was a problem hiding this comment.
This reroutes the reward beneficiary through _currentAuthorizationSource() rather than staking directly, which means the allowlist when allowlist != address(0) and staking otherwise. On mainnet today allowlist() is non-zero — I checked the live proxy and it returns 0x5E1b4E41ea2eeA6aC7656431CCDC7B204a88386f, and that contract exposes rolesOf(address)(address,address,address). So once this implementation is redeployed and the proxy is repointed, beneficiary resolution under withdrawRewards actually does change on mainnet for any staker where owner ≠ beneficiary delegation is in play. Would feel much better if this change landed as its own PR with isolated audit visibility rather than inside the testnet4 work, ideally with a Solidity test that exercises withdrawRewards() under an allowlist != address(0) state.
…ardhat-verify after Hardhat 3 upgrade, clarifying API compatibility
…ent for mainnet compatibility
… replace deprecated IP address
…encies in package-lock.json and package.json
…n test networks to improve reliability
…ailable data for various networks
…ervers and adding error handling for integration tests
…to skip outdated public endpoints
feat: Bitcoin testnet4 defaults + Sepolia Hardhat/deploy tooling
Summary
This PR wires the Go client to Bitcoin testnet4 when using the Sepolia Ethereum mapping, adds an embedded Electrum URL list for testnet4, and updates ECDSA / random-beacon Hardhat config and deploy scripts so Sepolia deployments and redeploys work reliably with local artifacts and deployer accounts.
It fixes several failures that were blocking branch validation, including Yarn/Corepack mismatches in Docker and docs workflows, Git/Yarn checkout issues in GitHub Actions, stale random-beacon deploy exports used by ECDSA tests, and flaky/incompatible Go integration tests caused by provider rate limits, Electrum timeouts, and local block watcher race conditions.
Client (Go)
bitcoin.Testnet4and extendsNetwork.String()so embedded Electrum resolution can use_electrum_urls/testnet4.config/network(replacing the legacy testnet mapping).config/_electrum_urls/testnet4with a default Electrum server URL and extendsconfig/electrum_test.goaccordingly.Solidity / Hardhat
hardhat.config.ts: makes contract verification optional (@nomicfoundation/hardhat-verify), adjusts Sepolia named accounts to use index0(works withACCOUNTS_PRIVATE_KEYS), trimsexternaldeployment paths for Sepolia to avoid RPC issues with staletransactionHashin npm artifacts, and relaxes typing where needed.02_deploy_dkg_validator,03_deploy_wallet_registry): supports forced compile viaTHRESHOLD_FORCE_DKG_COMPILE, and setsskipIfAlreadyDeployed: falsefor DKG validator where bytecode must be refreshed after Solidity changes.export.json,hardhat.config.ts,05_approve_random_beacon_in_token_staking.ts, and yarn.lock (large lockfile refresh).Other
contracts-ecdsa.ymlandcontracts-random-beacon.yml.config/peers_test.go: adds an extra expected bootstrap peer for the testnet test case (consider splitting out if this PR should stay scoped only to testnet4/Sepolia tooling).ecdsaandrandom-beaconto include.yarnrc.ymland use Corepack withyarn@4.8.1.random-beaconexport deploy path for ECDSA so CI does not depend on gitignored sibling exports or stale npm exports.05_approve_random_beacon_in_token_staking.jsflow to skip networks whereTokenStakingdoes not exposeapproveApplication.WalletRegistryGovernancetest fixture setup to load the full deployment fixture soTand other external deployments are available.local_v1block counter watcher shutdown behavior and increased watcher buffering to reduce flaky coordination-layer test failures.How to test
go test ./config/... ./pkg/bitcoin/...solidity/ecdsa/solidity/random-beacon:yarn installand deploy or dry-run against Sepolia as you normally do for this stack.Notes / follow-ups
peers_test.goand pure lockfile/export churn to separate commits or PRs if reviewers want a minimal diff.