datahaven/test
Gonza Montiel 5121ae002b
feat: Datahaven contracts deployment on public testnet (#123)
## Summary
This PR introduces support for deploying Datahaven contracts to
different chains (hoodi, holesky, mainnet), as well as a new cli command
to manage this deployment separately from the regular deployment, while
maintaining compatibility with it.

#### New CLI command
- **`bun cli contracts deploy`** - Deploy contracts to supported chains
(Hoodi, Holesky, Mainnet)
- **`bun cli contracts status`** - Check deployment configuration and
status
- **`bun cli contracts verify`** - Verify contracts on block explorers
- Commands need the chain parameter: `--chain <hoodi | holesky |
mainnet>`
- Right now only `hoodi` and `holesky` are supported

### Deployment

#### Hoodi & Holesky Network Support
- Added **DeployBase.s.sol** as common ground for
**DeployTestnet.s.sol** (also new) and **DeployLocal.s.sol** (existing).
- **Hoodi configuration** (`contracts/config/hoodi.json`) with deployed
EigenLayer contract addresses to reference.
- **Holesky configuration** (`contracts/config/hoodi.json`) with
deployed EigenLayer contract addresses to reference.

#### Contracts being deployed
- **DataHaven**: ServiceManager, VetoableSlasher, RewardsRegistry
- **Snowbridge**: BeefyClient, AgentExecutor, Gateway, RewardsAgent  
- **EigenLayer**: References existing deployed contracts (not
re-deployed)

#### Deployment files
When the deployment is done, a new file under `contracts/deployments` is
generated with the addresses of the deployed contracts, for each chain
(it will be overriden per chain if run multiple times). So we would have
one `anvil.json`, `hoodi.json`, `holesky.json`, etc, with the addresses
of the deployed contracts for reference and for later verification.

#### Todo
- [x] Test compatibility with existing `bun cli launch` and `bun cli
deploy` commands

#### For follow-up PRs
- Fix verification issue with `foundry verify-contracts` when specifying
the `chain` or `chain-id` parameter, needed for hoodi
(https://github.com/foundry-rs/foundry/issues/7466).
- Add `redeploy` feature to only override implementation contract and
leave the proxy address untouched

## Usage Examples
```bash
# Deploy to Hoodi network
bun cli contracts deploy --chain hoodi

# Check deployment status  
bun cli contracts status --chain hoodi

# Verify contracts on block explorer
bun cli contracts verify --chain hoodi
```


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

## Summary by CodeRabbit

* **New Features**
* Added deployment and configuration support for new networks "hoodi"
and "holesky", including new configuration and deployment files.
* Introduced a CLI tool for managing contract deployments, status
checks, and verification across supported chains.
* Added example environment configuration and comprehensive deployment
documentation.
* Enabled contract verification and status reporting via the CLI with
support for block explorer integration.

* **Improvements**
* Refactored deployment scripts for modularity, supporting both local
and testnet environments.
* Centralized and extended configuration loading to support additional
contract addresses and network parameters.
* Enhanced deployment utilities and typings to support multi-network
deployments.

* **Bug Fixes**
* Improved input validation and error handling in CLI commands and
deployment scripts.
* Added explicit handling for zero address in operator strategy
retrieval.

* **Chores**
* Updated documentation and configuration templates for easier
onboarding and deployment management.
* Improved logging and output formatting for deployment and verification
processes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
2025-08-21 10:02:31 +00:00
..
.papi feat: Standardize currency system to HAVE token with Wei-based units (#130) 2025-08-18 13:26:30 +02:00
cli feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
configs feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
contract-bindings Fix: 🏗️ Message encoding / decoding (#113) 2025-07-16 07:38:58 +00:00
docker perf(CLI): Add option to use local Docker build in CLI for faster iteration (#77) 2025-05-16 18:04:40 -03:00
docs test: wait for event utils (#121) 2025-08-01 20:56:46 +02:00
framework test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
launcher feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
resources fix: 🐛 Use lodestar instead of lighthouse CL client (#91) 2025-06-09 12:29:31 -03:00
scripts feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
suites test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
utils feat: Datahaven contracts deployment on public testnet (#123) 2025-08-21 10:02:31 +00:00
.gitignore test: ⚙️ Add Kurtosis Launch Script (#34) 2025-04-08 15:42:45 +00:00
biome.json fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
bun.lock Bum Polkadot api version to 1.15.1 (#125) 2025-07-31 09:40:58 +02:00
bun.lockb feat: 🏗️ run execution relayer (#73) 2025-06-05 15:00:03 +00:00
bunfig.toml test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00
package.json Bum Polkadot api version to 1.15.1 (#125) 2025-07-31 09:40:58 +02:00
README.md test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
tsconfig.json test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
wagmi.config.ts test: 🧙 Generate Type Bindings for Contracts (#58) 2025-05-01 11:14:19 +01:00

DataHaven E2E Testing

Quick start guide for running DataHaven end-to-end tests. For comprehensive documentation, see E2E Testing Guide.

Pre-requisites

  • Kurtosis: For launching test networks
  • Bun v1.2 or higher: TypeScript runtime and package manager
  • Docker: For container management
  • Foundry: To deploy contracts
  • Helm: The Kubernetes Package Manager
MacOS

Important

If you are running this on a Mac, zig is a pre-requisite for crossbuilding the node. Instructions for installation can be found here.

Quick Start

# Install dependencies
bun i

# Interactive CLI to launch a full local DataHaven network
bun cli launch

# Run all the e2e tests
bun test:e2e

# Run all the e2e tests with limited concurrency
bun test:e2e:parallel

# Run a specific test suite
bun test suites/some-test.test.ts

For more information on the E2E testing framework, see the E2E Testing Framework Overview.

Other Common Commands

Command Description
bun cli stop Stop all local DataHaven networks (interactive, will ask for confirmation on each component of the network)
bun cli deploy Deploy the DataHaven network to a remote Kubernetes cluster
bun generate:wagmi Generate contract TypeScript bindings for the contracts in the contracts directory
bun generate:types Generate Polkadot API types
bun generate:types:fast Generate Polkadot API types with the --fast-runtime feature enabled

Local Network Deployment

Follow these steps to set up and interact with your local network:

  1. Deploy a minimal test environment

    bun cli launch
    

    This script will:

    1. Check for required dependencies.
    2. Launch a DataHaven solochain.
    3. Start a Kurtosis network which includes:
      • 2 Ethereum Execution Layer clients (reth)
      • 2 Ethereum Consensus Layer clients (lodestar)
      • Blockscout Explorer services for EL (if enabled with --blockscout)
      • Dora Explorer service for CL
    4. Deploy DataHaven smart contracts to the Ethereum network. This can optionally include verification on Blockscout if the --verified flag is used (requires Blockscout to be enabled).
    5. Perform validator setup and funding operations.
    6. Set parameters in the DataHaven chain.
    7. Launch Snowbridge relayers.
    8. Perform validator set update.

    Note

    If you want to also have the contracts verified on Blockscout, you can pass the --verified flag to the bun cli launch command, along with the --blockscout flag. This will do all the previous, but also verify the contracts on Blockscout. However, note that this takes some time to complete.

  2. Explore the network

    • Block Explorer: http://127.0.0.1:3000.
    • Kurtosis Dashboard: Run kurtosis web to access. From it you can see all the services running in the network, as well as their ports, status and logs.

Troubleshooting

E2E Network Launch doesn't work

Script halts unexpectedly

When running bun cli launch the script appears to halt after the following:

## Setting up 1 EVM.

==========================

Chain 3151908

Estimated gas price: 2.75 gwei

Estimated total gas used for script: 71556274

Estimated amount required: 0.1967797535 ETH

==========================

This is due to how forge streams output to stdout, but is infact still deploying contracts to the chain. You should be able to see in blockscout the deploy script is indeed still working.

Errors with deploying forge scripts on kurtosis network

Try running forge clean to clear any spurious build artefacts, and running forge build again. Also try deploying manually to the still running kurtosis network.

Blockscout is empty

If you look at the browser console, if you see the following:

Content-Security-Policy: The page's settings blocked the loading of a resource (connect-src) at http://127.0.0.1:3000/node-api/proxy/api/v2/stats because it violates the following directive: "connect-src ' ...

this is a result of CORS and CSP errors due to running this as a local docker network.

Make sure you are connected directly to http://127.0.0.1:3000 (not localhost).

Alternatively, you can try installing a browser addon such as anti-CORS / anti-CSP to circumvent this problem.

Weird forge Errors

In the /contracts directory, you can try to run forge clean and forge build to see if it fixes the issue.

Linux: See if disabling ipV6 helps

I have found that ipV6 on Arch Linux does not play very nicely with Kurtosis networks. Disabling it completely fixed the issue for me.

macOS: Verify Docker networking settings

Docker Network Settings

If using Docker Desktop, make sure settings have permissive networking enabled.

Polkadot-API types don't match expected runtime types

If you've made changes to the runtime types, you need to re-generate the TS types for the Polkadot-API. Don't worry, this is fully automated.

From the ./test directory run the following command:

bun generate:types

This script will:

  1. Compile the runtime using cargo build --release in the ../operator directory.
  2. Re-generate the Polkadot-API types using the newly built WASM binary.

Note

The script uses the --release flag by default, meaning it uses the WASM binary from ./operator/target/release. If you need to use a different build target, you may need to adjust the script or run the steps manually.

Further Information

  • Kurtosis: Used for launching a full Ethereum network
  • Zombienet: Used for launching a Polkadot-SDK based network
  • Bun: TypeScript runtime and ecosystem tooling