operator/README.md
The DataHaven operator is a Substrate-based blockchain node that serves as an EigenLayer AVS operator. It combines Substrate's modular framework with EVM compatibility (via Frontier) and cross-chain capabilities (via Snowbridge).
Built on the polkadot-sdk-solochain-template, this node implements:
operator/
āāā node/ # Node implementation
ā āāā src/
ā ā āāā chain_spec.rs # Chain specification & genesis config
ā ā āāā cli.rs # CLI interface
ā ā āāā command.rs # Command handlers
ā ā āāā rpc.rs # RPC configuration
ā ā āāā service.rs # Node service setup
āāā pallets/ # Custom pallets
ā āāā external-validators/ # EigenLayer validator set management
ā āāā native-transfer/ # Cross-chain token transfers
ā āāā rewards/ # Validator rewards distribution
āāā runtime/ # Runtime configurations
ā āāā mainnet/ # Mainnet runtime
ā āāā stagenet/ # Stagenet runtime
ā āāā testnet/ # Testnet runtime (with fast-runtime feature)
āāā scripts/ # Utility scripts
āāā run-benchmarks.sh # Runtime benchmarking automation
For local development with shorter epochs and eras:
cargo build --release --features fast-runtime
This switches runtime parameters to the fast variants (1-minute epochs, 3 sessions per era) while the block time remains 6 seconds.
For production or stagenet deployments:
cargo build --release
# Run all tests
cargo test
# Run tests for specific pallet
cargo test -p pallet-external-validators
# Run with output
cargo test -- --nocapture
# Format code
cargo fmt
# Lint with clippy
cargo clippy --all-targets --all-features
DataHaven uses runtime benchmarking to generate accurate weight calculations for all pallets. The benchmarking process is automated using frame-omni-bencher.
frame-omni-bencher: Install with cargo install frame-omni-bencher --profile=productionExecute from the operator directory:
# Benchmark all pallets for testnet runtime (default)
./scripts/run-benchmarks.sh
# Benchmark specific runtime
./scripts/run-benchmarks.sh mainnet
# Custom steps and repetitions
./scripts/run-benchmarks.sh testnet 100 50
The script will:
runtime-benchmarks featureruntime/{runtime}/src/weights/Parameters:
runtime: Runtime to benchmark (testnet, stagenet, mainnet). Default: testnetsteps: Number of steps. Default: 50repeat: Number of repetitions. Default: 20Zombienet provides local multi-validator network testing.
Install Zombienet:
# Download binary from releases
# Or install via npm
npm install -g @zombienet/cli
Spawn local network with four validators:
zombienet -p native spawn test/config/zombie-datahaven-local.toml
This launches a local solochain with BABE consensus for testing validator coordination.
Build local Docker image for testing:
cd ../test
bun build:docker:operator
This creates datahavenxyz/datahaven:local using optimized caching:
After runtime changes, regenerate Polkadot-API TypeScript types:
cd ../test
bun generate:types # Production runtime
bun generate:types:fast # Fast runtime (development)
For full network integration tests with Ethereum, Snowbridge, and contracts:
cd ../test
bun cli launch # Interactive launcher
bun test:e2e # Run E2E test suite
See the test directory for comprehensive testing documentation.
Manages the dynamic validator set based on EigenLayer operator registry. Syncs validator changes from Ethereum to the Substrate consensus layer.
Location: pallets/external-validators/
Handles cross-chain token transfers between Ethereum and DataHaven via Snowbridge messaging.
Location: pallets/native-transfer/
Distributes performance-based rewards to validators, processing reward messages from the Ethereum RewardsRegistry contract.
Location: pallets/rewards/
Each pallet includes its own tests and benchmarks. See pallet-specific README files for details.