2025-04-25 13:44:17 +00:00
# ! / u s r / b i n / e n v b u n
2025-05-06 20:20:02 +00:00
import { Command , InvalidArgumentError } from "@commander-js/extra-typings" ;
2025-06-12 08:24:03 +00:00
import type { DeployEnvironment } from "utils" ;
import {
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
contractsCheck ,
contractsDeploy ,
contractsPreActionHook ,
contractsVerify ,
2025-06-12 08:24:03 +00:00
deploy ,
deployPreActionHook ,
launch ,
launchPreActionHook ,
stop ,
2025-09-02 13:54:47 +00:00
stopPreActionHook ,
updateAVSMetadataURI
2025-06-12 08:24:03 +00:00
} from "./handlers" ;
2025-04-25 13:44:17 +00:00
2025-05-06 20:20:02 +00:00
// Function to parse integer
function parseIntValue ( value : string ) : number {
const parsedValue = Number . parseInt ( value , 10 ) ;
if ( Number . isNaN ( parsedValue ) ) {
throw new InvalidArgumentError ( "Not a number." ) ;
}
return parsedValue ;
}
2025-06-12 08:24:03 +00:00
// Function to parse and validate DeployEnvironment
function parseDeployEnvironment ( value : string ) : DeployEnvironment {
2025-06-26 11:48:33 +00:00
if ( value === "local" || value === "stagenet" || value === "testnet" || value === "mainnet" ) {
2025-06-12 08:24:03 +00:00
return value ;
}
throw new InvalidArgumentError (
2025-06-26 11:48:33 +00:00
"Invalid environment. Must be one of 'local', 'stagenet', 'testnet', or 'mainnet'."
2025-06-12 08:24:03 +00:00
) ;
}
2025-05-22 20:02:12 +00:00
// ===== Program =====
2025-04-25 13:44:17 +00:00
const program = new Command ( )
2025-05-22 20:02:12 +00:00
. version ( "0.2.0" )
. name ( "bun cli" )
. summary ( "🫎 DataHaven CLI: Network Toolbox" )
. usage ( "[options]" ) ;
2025-06-12 08:24:03 +00:00
// ===== Deploy ======
program
. command ( "deploy" )
. addHelpText (
"before" ,
` 🫎 DataHaven: Network Deployer CLI for deploying a full DataHaven network stack to a Kubernetes cluster
It will deploy :
- DataHaven solochain validators ( all envs ) ,
2025-10-21 20:18:50 +00:00
- StorageHub components : MSP , BSP , Indexer , Fisherman nodes and databases ( local & stagenet envs ) ,
2025-06-12 08:24:03 +00:00
- Kurtosis Ethereum private network ( stagenet env ) ,
- Snowbridge Relayers ( all envs )
`
)
. description ( "Deploy a full DataHaven network stack to a Kubernetes cluster" )
2025-06-26 11:48:33 +00:00
. option ( "--e, --environment <value>" , "Environment to deploy to" , parseDeployEnvironment , "local" )
2025-06-12 08:24:03 +00:00
. option (
"--k, --kube-namespace <value>" ,
"Kubernetes namespace to deploy to. In 'stagenet' this parameter is ignored and the Kurtosis namespace is used instead. Default will be `datahaven-<environment>`."
)
. option (
"--ke, --kurtosis-enclave-name <value>" ,
"Name of the Kurtosis enclave" ,
2025-06-26 11:48:33 +00:00
"datahaven-local"
2025-06-12 08:24:03 +00:00
)
. option ( "--st, --slot-time <number>" , "Set slot time in seconds" , parseIntValue , 12 )
. option ( "--kn, --kurtosis-network-args <value>" , "CustomKurtosis network args" )
. option ( "--v, --verified" , "Verify smart contracts with Blockscout" )
. option ( "--b, --blockscout" , "Enable Blockscout" )
. option (
"--dit, --datahaven-image-tag <value>" ,
"Tag of the datahaven image to use" ,
2025-09-02 11:02:13 +00:00
"datahavenxyz/datahaven:main"
2025-06-12 08:24:03 +00:00
)
. option (
"--el-rpc-url <value>" ,
2025-06-26 11:48:33 +00:00
"URL of the Ethereum Execution Layer (EL) RPC endpoint to use. In local & stagenet environments (private networks), the Kurtosis Ethereum network will be used. In testnet and mainnet environments (public networks), this parameter is required."
2025-06-12 08:24:03 +00:00
)
. option (
"--cl-endpoint <value>" ,
2025-06-26 11:48:33 +00:00
"URL of the Ethereum Consensus Layer (CL) endpoint to use. In local & stagenet environments (private networks), the Kurtosis Ethereum network will be used. In testnet and mainnet environments (public networks), this parameter is required."
2025-06-12 08:24:03 +00:00
)
. option (
"--rit, --relayer-image-tag <value>" ,
"Tag of the relayer image to use" ,
2025-09-02 11:02:13 +00:00
"datahavenxyz/snowbridge-relay:latest"
2025-06-12 08:24:03 +00:00
)
. option ( "--docker-username <value>" , "Docker Hub username" )
. option ( "--docker-password <value>" , "Docker Hub password" )
. option ( "--docker-email <value>" , "Docker Hub email" )
2025-08-19 06:42:45 +00:00
. option ( "--chainspec <value>" , "Absolute path to custom chainspec file" )
2025-06-12 08:24:03 +00:00
. option ( "--skip-cleanup" , "Skip cleaning up the network" , false )
. option ( "--skip-kurtosis" , "Skip deploying Kurtosis Ethereum private network" , false )
. option ( "--skip-datahaven-solochain" , "Skip deploying DataHaven solochain validators" , false )
. option ( "--skip-contracts" , "Skip deploying smart contracts" , false )
. option ( "--skip-validator-operations" , "Skip performing validator operations" , false )
. option ( "--skip-set-parameters" , "Skip setting DataHaven runtime parameters" , false )
. option ( "--skip-relayers" , "Skip deploying Snowbridge Relayers" , false )
2025-10-21 20:18:50 +00:00
. option (
"--skip-storage-hub" ,
"Skip deploying StorageHub components (MSP, BSP, Indexer, Fisherman, databases)" ,
false
)
2025-06-12 08:24:03 +00:00
. hook ( "preAction" , deployPreActionHook )
. action ( deploy ) ;
2025-05-22 20:02:12 +00:00
// ===== Launch ======
program
. command ( "launch" )
. addHelpText (
"before" ,
` 🫎 DataHaven: Network Launcher CLI for launching a full DataHaven network.
Complete with :
- Solo - chain validators ,
2025-10-21 20:18:50 +00:00
- StorageHub components : MSP , BSP , Indexer , Fisherman nodes and databases ,
2025-06-12 08:24:03 +00:00
- Ethereum Private network ,
2025-05-22 20:02:12 +00:00
- Snowbridge Relayers
2025-06-12 08:24:03 +00:00
`
2025-05-22 20:02:12 +00:00
)
. description ( "Launch a full E2E DataHaven & Ethereum network and more" )
2025-06-30 14:51:46 +00:00
. option ( "--A, --all" , "Launch all components without prompting" )
perf(CLI): ⚡ Add option to use local Docker build in CLI for faster iteration (#77)
In this PR:
1. Add new `datahaven-node-local.dockerfile` for building a local image
with the locally built DataHaven Node binary. This severely improves
iteration speed on running `bun cli` if there are changes in the DH
node. Previously, it relied on the published dockerfile, which builds
the Cargo project inside of it, taking +20m even with no changes.
2. Building this local dockerfile is integrated to the CLI, which now
also asks if the user wants to rebuild the local docker image of the DH
node.
3. A new script `cargo-crossbuild` is added, to be able to build the
DataHaven node Cargo project both from Mac and Linux, with the target
being `x86_64-unknown-linux-gnu`. For building from Mac, it uses `cargo
zigbuild`, so `zig` is now a dependency. Building for this target is
needed because the docker image is an Ubuntu image, so it will need to
run a linux binary.
4. Added `zig` as dependency in docs.
5. CI still uses the docker image built by the CI itself, which builds
the Cargo project inside of it. The CI can take advantage of caching for
this.
2025-05-16 21:04:40 +00:00
. option ( "--d, --datahaven" , "(Re)Launch DataHaven network" )
. option ( "--nd, --no-datahaven" , "Skip launching DataHaven network" )
. option ( "--bd, --build-datahaven" , "Build DataHaven node local Docker image" )
. option ( "--nbd, --no-build-datahaven" , "Skip building DataHaven node local Docker image" )
2025-05-15 21:56:36 +00:00
. option ( "--lk, --launch-kurtosis" , "Launch Kurtosis Ethereum network with EL and CL clients" )
. option ( "--nlk, --no-launch-kurtosis" , "Skip launching Kurtosis Ethereum network" )
. option ( "--dc, --deploy-contracts" , "Deploy smart contracts" )
. option ( "--ndc, --no-deploy-contracts" , "Skip deploying smart contracts" )
. option ( "--fv, --fund-validators" , "Fund validators" )
. option ( "--nfv, --no-fund-validators" , "Skip funding validators" )
. option ( "--sv, --setup-validators" , "Setup validators" )
. option ( "--nsv, --no-setup-validators" , "Skip setup validators" )
. option ( "--uv, --update-validator-set" , "Update validator set" )
. option ( "--nuv, --no-update-validator-set" , "Skip update validator set" )
2025-06-12 08:24:03 +00:00
. option ( "--sp, --set-parameters" , "Set DataHaven runtime parameters" )
. option ( "--nsp, --no-set-parameters" , "Skip setting DataHaven runtime parameters" )
2025-05-15 21:56:36 +00:00
. option ( "--r, --relayer" , "Launch Snowbridge Relayers" )
. option ( "--nr, --no-relayer" , "Skip Snowbridge Relayers" )
. option ( "--b, --blockscout" , "Enable Blockscout" )
2025-05-06 20:20:02 +00:00
. option ( "--slot-time <number>" , "Set slot time in seconds" , parseIntValue )
2025-05-21 17:01:12 +00:00
. option ( "--cn, --clean-network" , "Always clean Kurtosis enclave and Docker containers" )
2025-10-06 15:29:53 +00:00
. option ( "--ic, --inject-contracts" , "Inject smart contracts from saved state diff" )
perf(CLI): ⚡ Add option to use local Docker build in CLI for faster iteration (#77)
In this PR:
1. Add new `datahaven-node-local.dockerfile` for building a local image
with the locally built DataHaven Node binary. This severely improves
iteration speed on running `bun cli` if there are changes in the DH
node. Previously, it relied on the published dockerfile, which builds
the Cargo project inside of it, taking +20m even with no changes.
2. Building this local dockerfile is integrated to the CLI, which now
also asks if the user wants to rebuild the local docker image of the DH
node.
3. A new script `cargo-crossbuild` is added, to be able to build the
DataHaven node Cargo project both from Mac and Linux, with the target
being `x86_64-unknown-linux-gnu`. For building from Mac, it uses `cargo
zigbuild`, so `zig` is now a dependency. Building for this target is
needed because the docker image is an Ubuntu image, so it will need to
run a linux binary.
4. Added `zig` as dependency in docs.
5. CI still uses the docker image built by the CI itself, which builds
the Cargo project inside of it. The CI can take advantage of caching for
this.
2025-05-16 21:04:40 +00:00
. option (
"--datahaven-build-extra-args <value>" ,
"Extra args for DataHaven node Cargo build (the plain command is `cargo build --release` for linux, `cargo zigbuild --target x86_64-unknown-linux-gnu --release` for mac)" ,
"--features=fast-runtime"
)
2025-05-22 20:02:12 +00:00
. option (
"--e --kurtosis-enclave-name <value>" ,
"Name of the Kurtosis Enclave" ,
"datahaven-ethereum"
)
2025-05-06 20:20:02 +00:00
. option ( "--kurtosis-network-args <value>" , "CustomKurtosis network args" )
2025-05-15 21:56:36 +00:00
. option ( "--verified" , "Verify smart contracts with Blockscout" )
test: ⚙️ Parse & Generate Relayer Configs (#54)
## Human Written Description
This PR adds the following to the E2E CLI:
- Relayer config generation for: `beacon-relay` `beefy-relay`
- The other two relayer types to be added later
- Relayers don't actually work yet
- By default turned off, this requires a binary to be present in:
`<repo_root>/operator/target/release` dir
- Datahaven network launching
- DH network is using default `local` network chain spec
- Launched with 5 nodes since our authority set is 6 large (and you need
2/3 + 1 of set size
> [!NOTE]
> Both the relayer and the DH node binaries are being run as local
processes TEMPORARILY. This means that logging is done in a very
rudimentary way (we pipe to a file whilst the CLI is running).
>
> This means that when the CLI finishes **the log files will no longer
be written to**.
> This is temporary since spawning binaries is a stop gap solution until
docker images available.
---
> [!IMPORTANT]
> The following is AI generated slop describing this PR's changes:
**Key Changes:**
* **CLI Enhancements (`test/cli/index.ts`):**
* Added options `--datahaven` and `--datahaven-bin-path` to enable
launching local DataHaven nodes.
* Added options `--relayer` and `--relayer-bin-path` to enable launching
Snowbridge relayers (Beefy and Beacon).
* Added negation flags (`--no-fund-validators`, `--no-setup-validators`,
`--no-update-validator-set`) for more granular control over validator
setup steps.
* Added `--skip-cleaning` option to preserve Kurtosis state between
runs.
* Added a pre-action hook (`launchPreActionHook`) to validate flag
combinations (e.g., `--verified` requires `--blockscout`).
* **New CLI Handlers (`test/cli/handlers/launch/`):**
* `datahaven.ts`: Logic for spawning DataHaven node processes using the
specified binary. Manages ports and process cleanup.
* `relayer.ts`: Logic for configuring and spawning Snowbridge relayer
processes (Beefy and Beacon). Reads contract deployment addresses,
updates relayer config templates, and uses specified private keys.
Manages log files and process cleanup.
* `summary.ts`: Generates and displays the table of running services
(including dynamically launched DataHaven nodes) and their endpoints.
* `validator.ts`: Extracted validator funding, setup, and set update
logic into its own handler.
* `index.ts`: Orchestrates the launch sequence based on CLI options,
calling the appropriate handlers. Includes a `LaunchedNetwork` class to
track spawned processes, file descriptors, and node ports for cleanup.
* **Updated `package.json` Scripts:**
* Added `start:e2e:minrelayer` script for a minimal setup including
relayers and DataHaven nodes.
* Modified `stop:e2e` to include `pkill datahaven` for proper cleanup.
* Added `stop:e2e:quick` to only stop the Kurtosis enclave without full
cleaning.
* **Updated `launch-kurtosis.ts`:** Modified to use new Kurtosis utility
functions and added a `skipCleaning` option.
* **New Utility Functions:**
* `test/utils/kurtosis.ts`: Functions to inspect Kurtosis services
(`getServiceFromKurtosis`, `getPortFromKurtosis`,
`getServicesFromKurtosis`).
* `test/utils/parser.ts`: Zod schemas and parsing functions for
Snowbridge relayer configurations.
* **Constants & Minor Updates:**
* Added `SUBSTRATE_FUNDED_ACCOUNTS` to `test/utils/constants.ts`.
* Updated `tsconfig.json` include paths.
* Refactored `test/utils/docker.ts` (though now largely superseded by
Kurtosis utils).
* Updated logging in `test/scripts/send-txn.ts`.
**Reasoning:**
This PR significantly expands the E2E testing capabilities by allowing
developers to easily launch and integrate local DataHaven nodes and
Snowbridge relayers into the test network, facilitating more
comprehensive integration testing. The CLI refactoring makes managing
these complex setups more robust and user-friendly.
2025-04-29 12:24:00 +00:00
. option (
2025-05-22 20:02:12 +00:00
"--dit, --datahaven-image-tag <value>" ,
test: 🐳 Add docker support for datahaven nodes (#71)
> [!NOTE]
> This is `Part 3` of the ongoing _Docker Series._
## New Additions:
- Launching Datahaven network will spin up containers, as opposed to
native binaries
- `stop:docker` script to kill all dh containers
- `e2e` test suite for datahaven solochain network
- Contains reference test file that uses papi for storage queries,
submitting exts, runtime calls (good job on that facu and tobi)
- Added new utils:
- `waitForLog()` to wait for log lines in docker container logs
- `createPapiConnectors()` helper for test cases to build and connect to
dh network
- `getPapiSigner()` helper to return a papi compatible signer using our
prefunded accounts (alith by default)
- `sendTxn()` helper to submit txn and wait for block inclusion, instead
of finalization, which std library provides
## Changes:
> [!CAUTION]
> Launching native binaries for datahaven no longer supported.
- Datahaven binary location cli option changed to `-i,
--datahaven-image-tag`
- To locally run this you'll need a datahaven docker image handy, you'll
need to either:
- Point to remote dockerhub e.g. `moonsonglabs/datahaven:main` (must be
logged in and have permission)
- Build this locally with `bun build:docker:operator`
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added end-to-end tests for the Datahaven solochain, including runtime
API queries, storage lookups, extrinsic submissions, and event
listening.
- Introduced CLI option to specify the Datahaven Docker image tag, with
a default value.
- Added CLI option to disable the Relayer.
- Provided new scripts to stop Docker containers associated with
Datahaven.
- Added utility functions for Docker log monitoring and container
startup checks.
- Introduced utilities for interacting with the Datahaven Polkadot API.
- **Improvements**
- Switched Datahaven network launch from local binaries to Docker
containers.
- Enhanced cache accuracy in build workflows by including Rust source
files in cache keys.
- Improved build performance with TypeScript incremental build options.
- Increased timeout for end-to-end tests for better reliability.
- Updated CLI version to 0.2.0.
- Modified Dockerfile build to enable the `fast-runtime` feature.
- Extended network launch summary to include relayer and container
details.
- **Bug Fixes**
- Fixed cleanup logic by tracking and preparing for forced removal of
Docker containers after tests.
- **Chores**
- Updated workflow steps for Docker image handling and network checks.
- Adjusted scripts and workflow logic for improved Docker and test
management.
- Removed top-level disk usage summaries from cleanup workflow for
streamlined reporting.
- Enhanced shell command utility to support asynchronous wait during
execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-16 14:17:05 +00:00
"Tag of the datahaven image to use" ,
2025-09-02 11:02:13 +00:00
"datahavenxyz/datahaven:local"
test: ⚙️ Parse & Generate Relayer Configs (#54)
## Human Written Description
This PR adds the following to the E2E CLI:
- Relayer config generation for: `beacon-relay` `beefy-relay`
- The other two relayer types to be added later
- Relayers don't actually work yet
- By default turned off, this requires a binary to be present in:
`<repo_root>/operator/target/release` dir
- Datahaven network launching
- DH network is using default `local` network chain spec
- Launched with 5 nodes since our authority set is 6 large (and you need
2/3 + 1 of set size
> [!NOTE]
> Both the relayer and the DH node binaries are being run as local
processes TEMPORARILY. This means that logging is done in a very
rudimentary way (we pipe to a file whilst the CLI is running).
>
> This means that when the CLI finishes **the log files will no longer
be written to**.
> This is temporary since spawning binaries is a stop gap solution until
docker images available.
---
> [!IMPORTANT]
> The following is AI generated slop describing this PR's changes:
**Key Changes:**
* **CLI Enhancements (`test/cli/index.ts`):**
* Added options `--datahaven` and `--datahaven-bin-path` to enable
launching local DataHaven nodes.
* Added options `--relayer` and `--relayer-bin-path` to enable launching
Snowbridge relayers (Beefy and Beacon).
* Added negation flags (`--no-fund-validators`, `--no-setup-validators`,
`--no-update-validator-set`) for more granular control over validator
setup steps.
* Added `--skip-cleaning` option to preserve Kurtosis state between
runs.
* Added a pre-action hook (`launchPreActionHook`) to validate flag
combinations (e.g., `--verified` requires `--blockscout`).
* **New CLI Handlers (`test/cli/handlers/launch/`):**
* `datahaven.ts`: Logic for spawning DataHaven node processes using the
specified binary. Manages ports and process cleanup.
* `relayer.ts`: Logic for configuring and spawning Snowbridge relayer
processes (Beefy and Beacon). Reads contract deployment addresses,
updates relayer config templates, and uses specified private keys.
Manages log files and process cleanup.
* `summary.ts`: Generates and displays the table of running services
(including dynamically launched DataHaven nodes) and their endpoints.
* `validator.ts`: Extracted validator funding, setup, and set update
logic into its own handler.
* `index.ts`: Orchestrates the launch sequence based on CLI options,
calling the appropriate handlers. Includes a `LaunchedNetwork` class to
track spawned processes, file descriptors, and node ports for cleanup.
* **Updated `package.json` Scripts:**
* Added `start:e2e:minrelayer` script for a minimal setup including
relayers and DataHaven nodes.
* Modified `stop:e2e` to include `pkill datahaven` for proper cleanup.
* Added `stop:e2e:quick` to only stop the Kurtosis enclave without full
cleaning.
* **Updated `launch-kurtosis.ts`:** Modified to use new Kurtosis utility
functions and added a `skipCleaning` option.
* **New Utility Functions:**
* `test/utils/kurtosis.ts`: Functions to inspect Kurtosis services
(`getServiceFromKurtosis`, `getPortFromKurtosis`,
`getServicesFromKurtosis`).
* `test/utils/parser.ts`: Zod schemas and parsing functions for
Snowbridge relayer configurations.
* **Constants & Minor Updates:**
* Added `SUBSTRATE_FUNDED_ACCOUNTS` to `test/utils/constants.ts`.
* Updated `tsconfig.json` include paths.
* Refactored `test/utils/docker.ts` (though now largely superseded by
Kurtosis utils).
* Updated logging in `test/scripts/send-txn.ts`.
**Reasoning:**
This PR significantly expands the E2E testing capabilities by allowing
developers to easily launch and integrate local DataHaven nodes and
Snowbridge relayers into the test network, facilitating more
comprehensive integration testing. The CLI refactoring makes managing
these complex setups more robust and user-friendly.
2025-04-29 12:24:00 +00:00
)
2025-05-18 23:31:46 +00:00
. option (
2025-05-22 20:02:12 +00:00
"--rit, --relayer-image-tag <value>" ,
2025-05-18 23:31:46 +00:00
"Tag of the relayer" ,
2025-09-02 11:02:13 +00:00
"datahavenxyz/snowbridge-relay:latest"
2025-05-18 23:31:46 +00:00
)
2025-04-25 13:44:17 +00:00
. hook ( "preAction" , launchPreActionHook )
. action ( launch ) ;
2025-05-22 20:02:12 +00:00
// ===== Stop ======
2025-04-25 13:44:17 +00:00
program
2025-05-22 20:02:12 +00:00
. command ( "stop" )
. description ( "Stop any launched running network components" )
. option ( "--A --all" , "Stop all components associated with project" )
. option ( "--d, --datahaven" , "Stop DataHaven network" )
. option ( "--nd, --no-datahaven" , "Skip stopping DataHaven network" )
. option ( "--e, --enclave" , "Stop Ethereum Kurtosis enclave" )
. option ( "--ne, --no-enclave" , "Skip stopping Ethereum Kurtosis enclave" )
. option ( "--kurtosis-engine" , "Stop Kurtosis engine" , false )
. option ( "--r, --relayer" , "Stop Snowbridge Relayers" )
. option ( "--nr, --no-relayer" , "Skip stopping Snowbridge Relayers" )
. hook ( "preAction" , stopPreActionHook )
. action ( stop ) ;
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
// ===== Contracts ======
const contractsCommand = program
. command ( "contracts" )
. addHelpText (
"before" ,
` 🫎 DataHaven: Contracts Deployment CLI for deploying DataHaven AVS contracts to supported chains
Commands :
- status : Show deployment plan , configuration , and status ( default )
- deploy : Deploy contracts to specified chain
- verify : Verify deployed contracts on block explorer
2025-09-02 13:54:47 +00:00
- update - metadata : Update the metadata URI of an existing AVS contract
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
Common options :
-- chain : Target chain ( required : hoodi , holesky , mainnet )
-- rpc - url : Chain RPC URL ( optional , defaults based on chain )
-- private - key : Private key for deployment
-- skip - verification : Skip contract verification
`
)
. description ( "Deploy and manage DataHaven AVS contracts on supported chains" ) ;
// Contracts Check (default)
contractsCommand
. command ( "status" )
. description ( "Show deployment plan, configuration, and status" )
. option ( "--chain <value>" , "Target chain (hoodi, holesky, mainnet)" )
. option ( "--rpc-url <value>" , "Chain RPC URL (optional, defaults based on chain)" )
. option ( "--private-key <value>" , "Private key for deployment" , process . env . PRIVATE_KEY || "" )
. option ( "--skip-verification" , "Skip contract verification" , false )
. hook ( "preAction" , contractsPreActionHook )
. action ( contractsCheck ) ;
// Contracts Deploy
contractsCommand
. command ( "deploy" )
. description ( "Deploy DataHaven AVS contracts to specified chain" )
. option ( "--chain <value>" , "Target chain (hoodi, holesky, mainnet)" )
. option ( "--rpc-url <value>" , "Chain RPC URL (optional, defaults based on chain)" )
. option ( "--private-key <value>" , "Private key for deployment" , process . env . PRIVATE_KEY || "" )
. option ( "--skip-verification" , "Skip contract verification" , false )
. hook ( "preAction" , contractsPreActionHook )
. action ( contractsDeploy ) ;
// Contracts Verify
contractsCommand
. command ( "verify" )
. description ( "Verify deployed contracts on block explorer" )
. option ( "--chain <value>" , "Target chain (hoodi, holesky, mainnet)" )
. option ( "--rpc-url <value>" , "Chain RPC URL (optional, defaults based on chain)" )
. option ( "--skip-verification" , "Skip contract verification" , false )
. hook ( "preAction" , contractsPreActionHook )
. action ( contractsVerify ) ;
2025-09-02 13:54:47 +00:00
// Contracts Update Metadata
contractsCommand
. command ( "update-metadata" )
. description ( "Update AVS metadata URI for the DataHaven Service Manager" )
. option ( "--chain <value>" , "Target chain (hoodi, holesky, mainnet)" )
. option ( "--uri <value>" , "New metadata URI (required)" )
. option ( "--reset" , "Use if you want to reset the metadata URI" )
. option ( "--rpc-url <value>" , "Chain RPC URL (optional, defaults based on chain)" )
. action ( async ( options : any , command : any ) = > {
// Try to get chain from options or command
let chain = options . chain ;
if ( ! chain && command . parent ) {
chain = command . parent . getOptionValue ( "chain" ) ;
}
if ( ! chain ) {
chain = command . getOptionValue ( "chain" ) ;
}
if ( ! options . uri && ! options . reset ) {
throw new Error ( "--uri parameter is required" ) ;
}
if ( options . reset ) {
options . uri = "" ;
}
if ( ! chain ) {
throw new Error ( "--chain parameter is required" ) ;
}
await updateAVSMetadataURI ( chain , options . uri ) ;
} ) ;
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
// Default Contracts command (runs check)
contractsCommand
. description ( "Show deployment plan, configuration, and status" )
. option ( "--chain <value>" , "Target chain (hoodi, holesky, mainnet)" )
. option ( "--rpc-url <value>" , "Chain RPC URL (optional, defaults based on chain)" )
. option ( "--private-key <value>" , "Private key for deployment" , process . env . PRIVATE_KEY || "" )
. option ( "--skip-verification" , "Skip contract verification" , false )
. hook ( "preAction" , contractsPreActionHook )
. action ( contractsCheck ) ;
2025-05-22 20:02:12 +00:00
// ===== Exec ======
// Disabled until need arises
// program
// .command("exec <action> [args]")
// .description("Execute a standalone function against an running running network");
2025-04-25 13:44:17 +00:00
program . parseAsync ( Bun . argv ) ;