Commit graph

36 commits

Author SHA1 Message Date
Steve Degosserie
a31118da2b
feat: Update chain IDs & native token tickers for all 3 environments (#280)
Update the 3 DataHaven environments' chain IDs & native token ticker as
follows:

* **Mainnet**
  * **Chain ID**: 55930
  * **Ticker**: HAVE
* **TestNet**
  * **Chain ID**: 55931
  * **Ticker**: MOCK
* **Stagenet**
  * **Chain ID**: 55932
  * **Ticker**: STAGE

The PR includes a storage migration for the Stagenet & Testnet
environments, that are already live, to update the EVM Chain ID stored
in the `pallet-evm-chain-id` pallet.

Note: the token symbol will only be updated with the genesis config
presets or newly generated chain specs. For already live networks, the
existing chain spec must be updated (i.e. the tokenSymbol property
changed) and used by all nodes in the network. This change in the chain
spec will not alter the chain genesis so it safe to do (in the very
early stages of the chain obviously).

---------

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit a97f0547a9)
2025-11-07 12:24:02 +01:00
Facundo Farall
1fd0abccd7
build: ⬆️ Upgrade to SH v0.1.1 (#273)
Upgrade to SH release
[v0.1.1](https://github.com/Moonsong-Labs/storage-hub/releases/tag/v0.1.1)

---------

Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-11-03 15:49:30 +02:00
Steve Degosserie
8c693bfde7
fix: resolve srtool metadata hash build error (#219)
## Summary
- Fixes srtool build failure with `UnknownOpcode(252)` error during
metadata hash generation
- Removes hardcoded `WASM_BUILD_STD=0` to allow srtool to auto-detect
correct settings based on Rust version
- Adds `metadata-hash` feature to node Cargo.toml for CheckMetadataHash
extension

## Root Cause
The `WASM_BUILD_STD=0` setting forced srtool to use pre-built standard
library crates that were compiled with incompatible WASM features.
During metadata hash generation, the runtime builder encountered opcode
252 (likely from bulk memory operations) which the deserializer couldn't
recognize, causing the build to fail with:

```
thread 'main' panicked at metadata_hash.rs:73:10:
`Metadata::metadata_at_version` should exist.: RuntimeConstruction(Other("cannot deserialize module: UnknownOpcode(252)"))
```

## Changes
1. **operator/scripts/build-runtime-srtool.sh**: Removed hardcoded `-e
WASM_BUILD_STD=0` line
- Allows srtool to determine appropriate setting based on Rust version
   - For Rust < 1.84: defaults to WASM_BUILD_STD=1 (enabled)
   - For Rust >= 1.84: defaults to WASM_BUILD_STD=0 (disabled)

2. **operator/node/Cargo.toml**: Added `metadata-hash` feature
propagation
- Enables metadata-hash feature for all runtime variants (stagenet,
mainnet, testnet)
   - Required for CheckMetadataHash extension support

## Test Plan
- [x] Successfully built stagenet runtime with srtool 1.88.0
- [x] Build completed in ~14 minutes without metadata hash errors
- [x] Verified WASM artifacts generated correctly

## Testing Command
```bash
GH_WORKFLOW_MATRIX_CHAIN=stagenet \
RUNTIME_BUILD_OPTS="--features=on-chain-release-build" \
RUNTIME_BUILD_PROFILE="production" \
GH_WORKFLOW_MATRIX_SRTOOL_IMAGE="paritytech/srtool" \
GH_WORKFLOW_MATRIX_SRTOOL_IMAGE_TAG="1.88.0" \
WASM_BUILD_STD=1 \
./operator/scripts/build-runtime-srtool.sh
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-10 15:04:03 +02:00
Ahmad Kaouk
48442258ab
fix: fix block authoring and finalization (#203) 2025-10-02 10:58:40 +02:00
undercover-cactus
d2ff687dc0
feat: added the possibility to provide a config file for SH (#191)
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
2025-09-30 17:39:11 +00:00
Ahmad Kaouk
17c706dc64
test: Integrate moonwall (#185)
### Description

This PR introduces the **Moonwall** end-to-end (E2E) testing framework.
The primary motivation for this is to enable the porting of existing
Mobeam tests into the `DataHaven` repository.

### Key Changes

*   **Node Manual Sealing:**
* Introduced a `--sealing=manual` flag for the `datahaven-node`. When
enabled, blocks are only produced on demand via an RPC call. This is the
core mechanism that allows for deterministic tests.

*   **Moonwall Framework Integration:**
* Added `@moonwall/cli` and `@moonwall/util` dependencies to the
`test/package.json`.
* A new `test/moonwall.config.json` file configures the test
environment, defining how Moonwall should launch the `datahaven-node`
with the manual sealing flag.
* Added a `moonwall:test` script to `package.json` for running the
tests.

*   **CI Workflow:**
* A new reusable workflow, `.github/workflows/task-moonwall-tests.yml`,
has been created to handle the setup, execution, and reporting of
Moonwall tests.
* The main `CI.yml` now includes a `moonwall-tests` job that runs after
the `build-operator` job, ensuring it always tests the correct,
freshly-built binary.

*   **Example Test Suite:**
* A new test suite, `test/datahaven/suites/dev/test-block.ts`, had been
copied from moonbeam.

### How to Run Locally

1.  Navigate to the `test` directory.
2.  Install dependencies: `bun install`
3.  Run the tests: `bun run moonwall:test`

---------

Co-authored-by: undercover-cactus <lola@moonsonglabs.com>
2025-09-30 14:47:39 +00:00
Steve Degosserie
91e29700a3
feat: Bump client version to v0.2.0 & runtime spec_version to 200 (#194) 2025-09-29 23:35:12 +02:00
undercover-cactus
5165cbbbea
misc: update sh deps to v0.0.4-alpha (#193)
In this PR we update StorageHub to its latest tage `v0.0.4-alpha`. It
includes so minor changes on the FilesystemAPI.

Its also force to specify the `maintenance_mode` options for fisherman.
For now we are not allowing this mode so we just skip entirely.

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-09-29 20:29:17 +00:00
undercover-cactus
e5e3fbe22c
fix: fix RPC for storage hub (#190)
In this PR we actually add the storage hub RPC config to our node in
order to allow RPC call for storage hub service.
2025-09-27 19:03:32 +02:00
undercover-cactus
1ee3401a3c
fix: allow to start the indexer even without any provider set (#170)
We allow to pass only indexer configuration even is we are not running
as a MSP or a BSP.
2025-09-17 17:09:12 +02:00
undercover-cactus
54370436e4
feat: added support for fisherman (#162)
In this PR we add support for SH fisherman.

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-09-14 23:53:02 +02:00
Steve Degosserie
01e151c3b1
fix: Remove unnecessary StorageHub User provider type (#161)
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
2025-09-12 13:08:32 +02:00
undercover-cactus
ecd3311bb6
feat: add indexer configurations to cli (#154)
Added missing CLI option for the indexer configuration for Storage Hub.
Indexer is needed for MSP user.

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-09-12 00:11:37 +02:00
Steve Degosserie
1fe7a2356a
fix: Remove dev key generation for StorageHub (#159)
Key should be injected into the node's keystore at startup.
2025-09-11 13:26:22 +02:00
Ahmad Kaouk
7c5e3459dc
fix: select correct runtime in Libp2p branch for testnet and stagenet (#157)
Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-09-11 12:31:40 +02:00
Steve Degosserie
6fe4f34c4c
fix: Update Rust toolchain and Docker build dependencies (#156)
## Summary
- Upgraded Rust toolchain from 1.87 to 1.88 for latest compiler
improvements
- Updated Docker build environment with latest paritytech base image and
build tools
- Fixed node branding and support URL to reflect DataHaven project

## Changes

### Rust Toolchain Update (`rust-toolchain.toml`)
- Upgraded from Rust 1.87 to 1.88

### Docker Build Environment (`Dockerfile`)
- Updated base image from `paritytech/ci-unified:bullseye-1.85.0` to
`bullseye-1.88.0`
- Upgraded mold linker from v2.39.0 to v2.40.4 for faster builds
- Added protoc v21.12 for protobuf compilation support
- Added libpq-dev dependency for PostgreSQL integration
- Updated cargo-chef from 0.1.71 to 0.1.72

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-11 09:56:14 +02:00
undercover-cactus
a9d0f7157a
feat: storage hub client (#149)
Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-09-10 08:15:27 +02:00
Steve Degosserie
ee7969b540
chore: ♻️ Update project dependencies (#147)
This PR updates the project dependencies as follows:
- **Polkadot SDK**: from the `stable2412` (moving) branch to the
`polkadot-stable2412-6` (fixed) tag.
- **StorageHub**: to revision
`f8281283b6003a3009a32431ed0f3cd628561d6b`, which also depends on
Polkadot SDK `polkadot-stable2412-6`.
- **Frontier**: revision `75329a2df49e2cc7981485392c31160929d1bd48n`
which, likewise, depends on Polkadot SDK `polkadot-stable2412-6`.
2025-09-04 00:17:11 +02:00
Steve Degosserie
780d69ab04
feat: Standardize currency system to HAVE token with Wei-based units (#130)
## Summary

This PR modernizes DataHaven's currency system by standardizing all
three runtimes (mainnet, stagenet, testnet) to use Ethereum-compatible
Wei-based units with HAVE as the native token name.

### Key Changes

#### 🔄 Currency Unit Standardization
- **Migrated from decimal-based to Wei-based system** (18 decimals)
- **Wei units**: WEI → KILOWEI → MEGAWEI → GIGAWEI 
- **HAVE units**: MICROHAVE → MILLIHAVE → HAVE → KILOHAVE
- **Zero Existential Deposit**: Enables dust account support with
`insecure_zero_ed` feature

#### 🏷️ Token Naming
- **UNIT → HAVE**: Native token renamed to reflect DataHaven branding
- **Consistent terminology**: All constants, comments, and documentation
updated
- **Supply factors preserved**: Mainnet (100x), Stagenet/Testnet (1x)

#### ⚖️ Block Weights & Gas Configuration
- **Solochain-optimized**: Updated MAX_POV_SIZE and block weight
parameters
- **EVM compatibility**: Fixed GasLimitPovSizeRatio (u32 → u64) and
storage growth ratios
- **Proper fee structure**: Aligned with Ethereum standards

#### 🧪 Test Updates
- **Treasury tests fixed**: Updated to handle zero existential deposit
behavior
- **All tests passing**: Currency references updated across all runtime
tests
- **Storage hub parameters**: Updated to use HAVE token terminology

### Breaking Changes

⚠️ **Currency precision changed from 12 to 18 decimals**
- Applications using currency constants must update to new HAVE-based
naming
- ExistentialDeposit now 0 (was previously enforced minimum balance)

### Runtime Coverage

-  **Mainnet runtime** (supply factor: 100)
-  **Stagenet runtime** (supply factor: 1)  
-  **Testnet runtime** (supply factor: 1)
-  **Storage hub parameters** (runtime params updated)

### Technical Details

#### Fee Structure
```rust
pub const TRANSACTION_BYTE_FEE: Balance = 1 * GIGAWEI * SUPPLY_FACTOR;
pub const STORAGE_BYTE_FEE: Balance = 100 * MICROHAVE * SUPPLY_FACTOR;
pub const WEIGHT_FEE: Balance = 50 * KILOWEI * SUPPLY_FACTOR / 4;
```

#### Block Configuration
```rust
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
    WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
    MAX_POV_SIZE as u64,
);
```

## Test Plan

- [x] All runtime builds compile successfully
- [x] All unit tests pass across three runtimes
- [x] Treasury fee handling verified with zero existential deposit
- [x] Storage hub parameter compatibility confirmed
- [x] EVM gas limit calculations validated

## Files Modified

**27 files changed, 728 insertions(+), 342 deletions(-)**

- Runtime lib.rs files (currency module definitions)
- Cargo.toml files (insecure_zero_ed feature)
- Configuration modules (block weights, gas limits)
- Test suites (currency constant references)
- Storage hub runtime parameters

---

🤖 *Generated with [Claude Code](https://claude.ai/code)*

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

## Summary by CodeRabbit

- New Features
- Introduced a unified currency module with HAVE units (18 decimals),
fees, and a deposit helper.
- Adopted dynamic block weight/length configuration (5 MB blocks) and
re-exported gas-to-weight constants.

- Improvements
- Switched all runtimes and pricing parameters from UNIT/NANO_UNIT to
HAVE/GIGAWEI.
- Updated deposits, fees, and rewards to HAVE-based values across
modules (including StorageHub and Snowbridge).
- Made existential deposit runtime-configurable; enabled zero-ED mode on
selected networks.
- Updated metadata hash and token metadata to reference HAVE (symbol
wHAVE, 18 decimals).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
2025-08-18 13:26:30 +02:00
undercover-cactus
3ea6e57b66
feat: add storage hub runtime (#40)
In this PR we add StorageHub pallets to the runtime. It will only be
added if the `storage-hub` feature is activated.

---------

Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-07-01 14:01:27 +02:00
Facundo Farall
a86791ec1c
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 18:04:40 -03:00
Facundo Farall
728c320926
feat: Add Polkadot API support to CLI and e2e testing infra (#68)
In this PR:
1. Add [Polkadot API](https://papi.how/) support to `test/` directory
(i.e. the e2e CLI and testing framework) to be able to interact with the
Substrate chain.
1. This allows typed interactions with transactions, constants, storage,
runtime APIs, and non-typed interaction with RPC methods.
2. Types are autogenerated when running `bun i`, from the
`datahaven.scale` file that is part of this repo's version control.
2. Add new utilities file to `papi` related functionalities. For the
time being, generating a new signer from a private key.
3. ~Add a new step to the CLI that sends a transaction to the DataHaven
network. _*THIS SHOULD BE REMOVED SOON, IT'S JUST FOR TESTING
PURPOSES*_~
1. Both steps that send test transactions have been removed from the
CLI, for convenience and being error prone. Their scripts remain usable
for testing purposes if needed.
4. Removes the `apis.rs` files from the runtime definitions. Having them
in a separate file meant that the runtime was not including the Runtime
APIs in the metadata blob, preventing `papi` from creating types from
it. This change can be reapplied after upgrading to `polkadot-sdk`
`stable-2503`. More info
[here](https://github.com/paritytech/polkadot-sdk/issues/6659).
5. Add script to re-generate types, and corresponding docs.
6. Makes logger synchronous to avoid prints happening before logs.
2025-05-13 03:03:21 +00:00
Tim B
6aeece550b
ci: 🐳 Start Publishing Docker Images (#64) 2025-05-08 20:32:55 -03:00
Steve Degosserie
d6f76f7fa3
feat(operator): Multi-runtime support (#38)
Add support for multiple runtimes: `stagenet`, `testnet` & `mainnet`.

- Moved common types to `datahaven-runtime-common` crate.
- Made the node's command & service code generic over different
runtimes. Each runtime has a `dev` & `local` genesis config preset.
- More types / constants can be moved to the `datahaven-runtime-common`
crate ... this will be done in subsequent PRs.

---------

Co-authored-by: Gonza Montiel <gon.montiel@gmail.com>
Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-08 13:14:30 +00:00
Gonza Montiel
6c8c91b736
feat(operator): Add Ethereum RPCs (#55)
This PR adds Ethereum RPC API support to the node, enabling the
interaction with the node using standard Ethereum tools.

1. Integration of Frontier's Ethereum RPC modules (eth, net, web3,
txpool)
2. Added RPC configurations necessary for Ethereum compatibility
3. Implemented a BABE consensus data provider for handling pending
blocks
4. Added required dependencies and configurations in the node's service
5. Created necessary filter pools, block data caches, and notification
systems
6. Configured the RPC system to handle Ethereum API calls
7. Changed the transaction pool implementation to be compatible with the
fork-aware transaction pool
(https://github.com/paritytech/polkadot-sdk/pull/4639)

EDIT:
The new `transaction_pool` in `polkadot-stable2412` that comes with a
`fork-aware` feature, allowing different views of the transaction pool,
is not compatible with the current state in Frontier.
In Frontier the only supported pool is the `BasicPool`, that maintains a
similar behaviour to the one in `polkadot-stable2409`. I used this pool
directly.

---------

Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-04-30 17:01:21 +00:00
Tim B
3a671bda61
test: 🧪 Initial Relay Work (#52)
Small changes to help progress us closer to relayer support

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-04-23 15:28:19 +00:00
Ahmad Kaouk
f4ab5c2b2e
Add Snowbridge Inbound Queue V2 pallet (#32)
This PR adds the Snowbridge Inbound Queue V2 pallet to the runtime. It
also defines bridge primitives, including the message structure for
EigenLayer, and introduces the EigenLayerMessageProcessor to handle
messages coming from EigenLayer.

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-04-18 20:28:00 +00:00
Ahmad Kaouk
f84bde43b3
Upgrade to polkadot-sdk stable2412 (#42) 2025-04-16 11:48:11 +00:00
Steve Degosserie
a2d6bb1071
Use Genesis config presets (#35)
Based on https://github.com/paritytech/polkadot-sdk/pull/5868.

Note: this (somehow) breaks the ability to run a local network with the
zombienet config. It seems that the config generated by Zombienet that
automatically set the balance of validators is leading to an issue
(because of the address type).

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-04-14 18:38:55 +00:00
Gonza Montiel
535c38de6a
feat(operator): 🏗️ add frontier client (#13)
- [x] Add frontier client dependencies
- [x] Add ethereum client config
- [x] Add changes to cli.rs
- [x] Add changes to service.rs
- [x] Add runtime apis
- [x] Add changes to chain spec
- [ ] Add tests

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-04-14 13:40:24 +02:00
Gonza Montiel
c10b05e5f3
style(node): sort Cargo.toml alphabetically (#33) 2025-04-09 11:59:05 -03:00
Steve Degosserie
2a1c61673a
Set EVM chain ID & token metadata (#31) 2025-04-07 12:58:14 +02:00
Gonza Montiel
5e0ad4a59c
style(node): 🎨 fix cargo clippy (#30)
I noticed `cargo clippy` was failing in CI, I fixed it. I still think we
should tweak the lints.
For example, clippy complains at things like `1 * HOURS ` because it's
redundant to multiply by 1, buy maybe we want it explicitly that way, so
it's more evident it can be changed. In this PR I don't tweak the rule
but try to make clippy happy.
2025-04-04 16:14:05 +02:00
Steve Degosserie
5616d9e449
feat(operator): 🏗️ Add Authorship, ImOnline & Offences pallets (#27)
Track validator availability and reports offences which lead to exclusion of the misbehaving validator from the validator set.
2025-04-02 21:49:47 +00:00
undercover-cactus
b2031f4d00
misc: remove cargo fmt setup action as it is already available (#15)
This PR remove the unneeded action that install rustfmt as it is now
already available. It remove a step in the CI.

The action removed is `dtolnay/rust-toolchain@stable`

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-03-31 14:46:03 -03:00
Gonza Montiel
7a4d441fd9
build: 🏗️ DataHaven operator setup (#6)
Adds the `Substrate` node and runtime, as well as configuration and test
files, from https://github.com/Moonsong-Labs/flamingo to the `operator`
folder in DataHaven
2025-03-17 17:57:14 +01:00