## Summary This PR replaces the percentage-based compounding inflation model with a **linear (non-compounding) inflation model** where a fixed amount of tokens is minted annually, regardless of current total supply. ### Key Changes - **`ExternalRewardsEraInflationProvider`** now calculates per-era inflation from a fixed annual amount instead of a percentage of current total issuance - New **`InflationAnnualAmount`** runtime parameter using the formula: `5_000_000 * HAVE * SUPPLY_FACTOR` - Consistent configuration across all runtimes using `SUPPLY_FACTOR` ### Inflation Configuration | Runtime | SUPPLY_FACTOR | Genesis Supply | Annual Inflation | Per-Era Inflation | |---------|---------------|----------------|------------------|-------------------| | **Mainnet** | 100 | 10B HAVE | 500M HAVE (5%) | ~342,231 HAVE | | **Stagenet** | 1 | 100M HAVE | 5M HAVE (5%) | ~3,422 HAVE | | **Testnet** | 1 | 100M HAVE | 5M HAVE (5%) | ~3,422 HAVE | ### Benefits - **Predictable rewards**: Validators and stakers receive consistent emissions - **Publicly auditable**: All emissions recorded on-chain - **Non-compounding**: Same absolute amount minted each year (not percentage of growing supply) - **Governance-upgradeable**: `InflationAnnualAmount` can be changed via runtime parameters ### Comparison: Before vs After | Aspect | Before (Compounding) | After (Linear) | |--------|---------------------|----------------| | Formula | 5% × current_supply | Fixed 500M HAVE | | Year 1 (10B supply) | 500M HAVE | 500M HAVE | | Year 2 (10.5B supply) | 525M HAVE | 500M HAVE | | Year 10 | ~814M HAVE | 500M HAVE | ## ⚠️ Breaking Changes ⚠️ - **Runtime parameter renamed**: `InflationTargetedAnnualRate` (Perbill) → `InflationAnnualAmount` (Balance) - Old: percentage-based rate applied to current total issuance - New: fixed annual amount in base units (wei) - **`ExternalRewardsEraInflationProvider` type parameters changed**: - Removed: `Balances` (fungible::Inspect) and `AnnualRate` (Get<Perbill>) - Added: `AnnualAmount` (Get<u128>) - **Inflation behavior change**: Inflation is now linear (fixed amount) instead of compounding (percentage of supply) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| benchmarking | ||
| node | ||
| pallets | ||
| precompiles | ||
| primitives | ||
| runtime | ||
| scripts | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| DOCKER-COMPOSE.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
| rust-toolchain.toml | ||
DataHaven Operator (Substrate Node) 🫎
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).
Overview
Built on the polkadot-sdk-solochain-template, this node implements:
- EVM Compatibility: Full Ethereum compatibility via Frontier pallets
- EigenLayer Integration: Operator registration and management via AVS contracts
- External Validators: Dynamic validator set controlled by EigenLayer registry
- Cross-chain Communication: Token and message passing via Snowbridge
- Rewards System: Performance-based validator rewards from Ethereum
Project Structure
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
Prerequisites
- Rust (latest stable)
- Substrate dependencies
- Zig (macOS only, for cross-compilation)
Building
Development Build (Fast Runtime)
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.
Production Build
For production or stagenet deployments:
cargo build --release
Running Tests
# Run all tests
cargo test
# Run tests for specific pallet
cargo test -p pallet-external-validators
# Run with output
cargo test -- --nocapture
Code Quality
# Format code
cargo fmt
# Lint with clippy
cargo clippy --all-targets --all-features
Benchmarking
DataHaven uses runtime benchmarking to generate accurate weight calculations for all pallets. The benchmarking process is automated using frame-omni-bencher.
Requirements
- Latest Rust stable version
frame-omni-bencher: Install withcargo install frame-omni-bencher --profile=production
Running Benchmarks
Execute 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:
- Discover all available pallets
- Build runtime WASM with
runtime-benchmarksfeature - Generate weight files in
runtime/{runtime}/src/weights/ - Provide summary of results
Parameters:
runtime: Runtime to benchmark (testnet, stagenet, mainnet). Default: testnetsteps: Number of steps. Default: 50repeat: Number of repetitions. Default: 20
Zombienet Testing
Zombienet provides local multi-validator network testing.
Setup
-
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.
Docker Image
Build local Docker image for testing:
cd ../test
bun build:docker:operator
This creates datahavenxyz/datahaven:local using optimized caching:
- sccache: Rust build caching
- cargo-chef: Dependency layer caching
- BuildKit cache mounts: External cache restoration
Type Generation
After runtime changes, regenerate Polkadot-API TypeScript types:
cd ../test
bun generate:types # Production runtime
bun generate:types:fast # Fast runtime (development)
Integration Testing
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.
Custom Pallets
External Validators
Manages the dynamic validator set based on EigenLayer operator registry. Syncs validator changes from Ethereum to the Substrate consensus layer.
Location: pallets/external-validators/
Native Transfer
Handles cross-chain token transfers between Ethereum and DataHaven via Snowbridge messaging.
Location: pallets/native-transfer/
Rewards
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.