mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
9 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5a7983f0d8
|
chore: ♻️ Add missing license header in operator & AVS contracts source code (#285)
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> |
||
|
|
96c4408682
|
fix: add missing weights (#271)
### Add missing weights for BABE, GRANDPA, and Randomness #### Summary Adds generated weights and wires them into the runtime for the BABE, GRANDPA, and Randomness pallets to replace defaults and ensure accurate execution costs across networks. #### What’s changed - **New weights added** for `pallet_grandpa`, `pallet_babe` and `pallet_randomness` - **Runtime configs updated to use new weights** - `operator/runtime/mainnet/src/configs/mod.rs` - `operator/runtime/stagenet/src/configs/mod.rs` - `operator/runtime/testnet/src/configs/mod.rs` #### For follow-up PRS - fix `pallet_identity` failure at running benchmarks - fix `pallet_collective` benchmarking missmatch (related to https://github.com/paritytech/polkadot-sdk/pull/6435) - add `pallet_session_benchmarking` without including `pallet_staking` (or some workaround) - add StorageHub weights to our benchmarked pallets (`pallet_nfts`, `pallet_storage_providers`, `pallet_payment_streams`, `pallet_proofs_dealer`, `pallet_file_system`, `pallet_bucket_nfts`, etc) |
||
|
|
70a505e9d8
|
fix: update weight configurations for the three runtimes (#249)
# Update Runtime Weights and WeightInfo Implementations ## Summary Updated runtime weights across all three runtimes (mainnet, stagenet, testnet) and configured WeightInfo implementations to use the new benchmarked weights. ## Changes - All weight files have been updated with new benchmark data from Substrate Benchmark CLI v51.0.0 - Updated some WeightInfo configurations to use custom weights instead of the default `()`, such as `pallet_im_online`. ## Weights comparison against Moonbeam Some weights are much higher than it's counterpart in Moonbeam, as we can observe in the following table. We need to investigate if this is expected. EDIT: ### Weights using the `production` profile comparing stagenet vs moonbase | **Pallet** | **Function** | **DataHaven Weight** | **Moonbase Weight** | **Difference** | **Notes** | |------------|--------------|----------------------|---------------------|----------------|-----------| | **pallet_balances** | transfer_allow_death | 68,497,000 | 43,117,000 | **+59%** | DataHaven higher | | | transfer_keep_alive | 55,245,000 | 41,490,000 | **+33%** | DataHaven higher | | | force_set_balance_creating | 22,034,000 | 21,537,000 | **+2%** | Similar | | | force_set_balance_killing | 31,246,000 | 23,467,000 | **+33%** | DataHaven higher | | | force_transfer | 72,181,000 | 45,384,000 | **+59%** | DataHaven higher | | | transfer_all | 67,765,000 | 51,403,000 | **+32%** | DataHaven higher | | | force_unreserve | 25,876,000 | 19,490,000 | **+33%** | DataHaven higher | | | upgrade_accounts (base) | 23,200,000 | 17,599,000 | **+32%** | DataHaven higher | | | force_adjust_total_issuance | 8,780,000 | 6,780,000 | **+29%** | DataHaven higher | | | burn_allow_death | 43,258,000 | 25,822,000 | **+68%** | DataHaven higher | | | burn_keep_alive | 30,368,000 | 22,961,000 | **+32%** | DataHaven higher | | **pallet_evm** | withdraw | 3,174,000 | 2,104,000 | **+51%** | DataHaven higher | | **frame_system** | remark (base) | 33,694,157 | 38,668,753 | **-13%** | Moonbase higher | | | remark_with_event (base) | 8,210,000 | 5,745,000 | **+43%** | DataHaven higher | | | set_heap_pages | 5,204,000 | 3,734,000 | **+39%** | DataHaven higher | | | set_code | 139,034,247,000 | 102,532,308,000 | **+36%** | DataHaven higher | | | set_storage (base) | 3,248,000 | 2,094,000 | **+55%** | DataHaven higher | | | kill_storage (base) | 3,344,000 | 2,120,000 | **+58%** | DataHaven higher | | | kill_prefix (base) | 6,028,000 | 4,258,000 | **+42%** | DataHaven higher | | | authorize_upgrade | 12,866,000 | 8,966,000 | **+44%** | DataHaven higher | | | apply_authorized_upgrade | 142,435,318,000 | 106,561,461,000 | **+34%** | DataHaven higher | | **pallet_multisig** | as_multi_threshold_1 (base) | 30,107,366 | 17,588,619 | **+71%** | DataHaven higher | | | as_multi_create (base) | 45,353,453 | 32,782,725 | **+38%** | DataHaven higher | | | as_multi_approve (base) | 22,928,808 | 18,299,865 | **+25%** | DataHaven higher | | | as_multi_complete (base) | 57,510,735 | 41,555,387 | **+38%** | DataHaven higher | | | approve_as_multi_create (base) | 42,860,897 | 32,390,857 | **+32%** | DataHaven higher | | | approve_as_multi_approve (base) | 21,640,639 | 16,839,439 | **+29%** | DataHaven higher | | | cancel_as_multi (base) | 44,014,197 | 32,643,060 | **+35%** | DataHaven higher | | **pallet_treasury** | spend_local | 15,605,000 | 12,992,000 | **+20%** | DataHaven higher | | | remove_approval | 8,641,000 | 7,766,000 | **+11%** | DataHaven higher | | | on_initialize_proposals (base) | 19,249,676 | 16,973,066 | **+13%** | DataHaven higher | | | spend | 14,082,000 | 26,612,000 | **-47%** | Moonbase higher | | | payout | 74,847,000 | 247,397,000 | **-70%** | Moonbase significantly higher | | | check_status | 16,325,000 | 16,223,000 | **+1%** | Similar | | | void_spend | 15,059,000 | 15,167,000 | **-1%** | Similar | | **pallet_scheduler** | service_agendas_base | 4,583,000 | 6,215,000 | **-26%** | Moonbase higher | | | service_agenda_base (base) | 8,728,153 | 6,640,549 | **+31%** | DataHaven higher | | | service_task_base | 4,875,000 | 3,455,000 | **+41%** | DataHaven higher | | | service_task_fetched (base) | 24,253,000 | 18,898,000 | **+28%** | DataHaven higher | | | service_task_named | 7,176,000 | 5,027,000 | **+43%** | DataHaven higher | | | service_task_periodic | 4,842,000 | 3,415,000 | **+42%** | DataHaven higher | | | execute_dispatch_signed | 10,378,000 | 4,837,000 | **+115%** | DataHaven significantly higher | | | execute_dispatch_unsigned | 3,511,000 | 2,451,000 | **+43%** | DataHaven higher | | | schedule (base) | 17,795,637 | 13,165,173 | **+35%** | DataHaven higher | | | cancel (base) | 20,509,326 | 15,513,197 | **+32%** | DataHaven higher | --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> |
||
|
|
ac09a4f2bb
|
feat: Add SafeMode and TxPause Pallets (#192)
### Overview This PR integrates the `pallet-safe-mode` and `pallet-tx-pause` from Polkadot SDK to provide comprehensive emergency governance controls across all DataHaven runtime networks (mainnet, stagenet, testnet). ### Key Changes #### 🔧 **Core Integration** - **Dependencies**: Added `pallet-safe-mode` and `pallet-tx-pause` from `polkadot-stable2412-6` - **Runtime Integration**: Integrated both pallets across all three runtime networks with pallet indices 103 and 104 - **Call Filtering**: Implemented unified `RuntimeCallFilter` that combines Normal, SafeMode, and TxPause restrictions #### 🛡️ **SafeMode Pallet Configuration** - **Duration**: 1 day activation period (`DAYS` constant) - **Deposits**: Disabled permissionless entry/extension (all `None`) - **Origins**: Root-only for all force operations (`force_enter`, `force_exit`, `force_extend`, etc.) - **Whitelisting**: SafeMode and Sudo calls are immune to restrictions #### ⏸️ **TxPause Pallet Configuration** - **Origins**: Root-only pause/unpause control - **Whitelisting**: SafeMode and Sudo calls cannot be paused - **Max Call Name Length**: 256 characters #### 🏗️ **Architecture** - **Shared Types**: Created `operator/runtime/common/src/safe_mode.rs` with reusable configurations - **Combined Filtering**: `RuntimeCallFilter` applies all three filter layers (Normal + SafeMode + TxPause) - **Consistent Config**: Identical configuration across mainnet, stagenet, and testnet #### 📊 **Infrastructure Updates** - **Benchmarking**: Added both pallets to benchmark suites across all networks - **Weight Mappings**: Placeholder weights using Substrate defaults (ready for chain-specific benchmarking) - **Metadata**: Updated runtime metadata for new pallet exposure #### 🧪 **Testing Framework** - **Coverage**: Tests for individual pallet behavior, combined restrictions, whitelisting, and edge cases ### Emergency Control Capabilities **SafeMode Pallet** (8 calls): - User calls: `enter`, `extend`, `release_deposit` - Force calls: `force_enter`, `force_exit`, `force_extend`, `force_slash_deposit`, `force_release_deposit` **TxPause Pallet** (2 calls): - `pause_call` / `unpause_call` - Granular transaction type pausing --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> |
||
|
|
eb94be1e3f
|
feat: multi block migration pallet (#180)
## Overview This PR integrates Substrate's `pallet-migrations` into all DataHaven runtimes (mainnet, stagenet, testnet) to enable robust multi-block migration capabilities. This infrastructure allows complex runtime upgrades to be executed across multiple blocks while maintaining chain stability and providing governance controls. ## What Changed ### Core Integration - **Added `pallet-migrations` dependency** across all runtime configurations - **Integrated migration pallet** as pallet index 39 in all runtimes - **Created shared migration configuration** in `datahaven-runtime-common` ### Runtime Configuration - **Mainnet, Stagenet, and Testnet** now include identical migration configurations - **MaxServiceWeight** parameter set to 75% of max block weight for safe migration execution - **Migration cursor limits** configured (65KB max cursor, 256B max identifier) - **Failure handling** configured to freeze the chain on migration failures (similar to Moonbeam's maintenance mode) ## Future Work - [ ] Add custom failure handler (safe mode) to replace chain freeze - [ ] Generate DataHaven-specific benchmarks for migration weights --------- Co-authored-by: undercover-cactus <lola@moonsonglabs.com> |
||
|
|
f0b2de3906
|
feat: ✨ Implement Moonbeam-style OpenGov governance (#131)
## 🎯 Overview This PR implements a comprehensive Moonbeam-inspired OpenGov (Gov2) governance system across all DataHaven runtime environments (Stagenet, Testnet, and Mainnet). The implementation provides multi-track referenda, conviction voting, collective decision-making through dual councils, and complete benchmarking support. ## ✨ Key Features ### 🗳️ Multi-Track Referendum System Implements **6 distinct governance tracks** with different thresholds and parameters: | Track | Purpose | |-------|---------| | **Root (0)** | Critical runtime upgrades | | **Whitelisted Caller (1)** | Fast-tracked technical proposals | | **General Admin (2)** | General governance proposals | | **Referendum Canceller (3)** | Cancel dangerous referenda | | **Referendum Killer (4)** | Emergency removal of malicious referenda | | **Fast General Admin (5)** | Expedited administrative decisions | ### 🏛️ Dual Council Structure - **Technical Committee**: Manages technical proposals with fast-track powers - **Treasury Council**: Oversees treasury spending with shorter motion duration ### 🔐 Custom Origins System 5 specialized permission levels for granular governance control: - `GeneralAdmin` - `ReferendumCanceller` - `ReferendumKiller` - `WhitelistedCaller` - `FastGeneralAdmin` ### ⚖️ Conviction Voting - Vote multipliers from 0.1x to 6x based on lock duration - Delegation support for proxy voting - Maximum 20 concurrent votes per account 🤖 Implementation assisted by [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> |
||
|
|
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> |
||
|
|
2d0af9c572
|
feat: ✨ Integrate Proxy pallet into DataHaven runtimes (#128)
## Summary This PR integrates the Substrate Proxy pallet into DataHaven runtimes (testnet, stagenet, mainnet) with comprehensive test coverage. The proxy pallet enables account delegation functionality, allowing accounts to authorize other accounts to execute calls on their behalf with configurable permissions. ## Changes ### Proxy Pallet Integration - **Added proxy pallet** to all three DataHaven runtimes (testnet, stagenet, mainnet) - **Configured custom ProxyType enum** with DataHaven-specific proxy types: - `Any` - Unrestricted proxy access - `NonTransfer` - All calls except balance transfers - `Governance` - Governance and utility calls only - `Staking` - Staking operations (placeholder) - `CancelProxy` - Proxy announcement cancellation - `Balances` - Balance transfer operations only - `IdentityJudgement` - Identity judgement operations - `SudoOnly` - Privileged sudo operations only ### Runtime Configuration - **Integrated pallet-proxy** into runtime construction macros - **Configured proxy deposits** (base + per-proxy fees) - **Set proxy limits** (maximum proxies per account) - **Implemented InstanceFilter** for call filtering per proxy type - **Added proxy pallet to runtime APIs** and metadata ### Comprehensive Test Suite - `operator/runtime/testnet/tests/proxy.rs` - 24 comprehensive proxy tests - `operator/runtime/stagenet/tests/proxy.rs` - 24 comprehensive proxy tests - `operator/runtime/mainnet/tests/proxy.rs` - 24 comprehensive proxy tests - Updated `lib.rs` files in all three runtimes to include proxy test modules <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Enable account proxies across mainnet, stagenet, and testnet with configurable types, delays, and per-type call permissions. - Support anonymous (pure) proxies, proxy announcements with delays, and deposit/limit parameters for proxy management. - Tests - Add comprehensive integration tests covering proxy lifecycle, filtering, pure proxies, announcements, batching, chaining, multisig, identity, and sudo paths. - Test builder now supports optional sudo setup. - Chores - Add benchmarking, weights, and try-runtime support for proxies. - Update internal package metadata version. <!-- 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> Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com> |
||
|
|
843502d21a
|
test: init benchmark infra (#110)
* Add `run_benchmarks.sh` script to run runtime benchmarks
* Sets up benchmark configs and directory structure to store weights
(`operator/runtime/<RUNTIME>/weights`)
* (naive) fixes to some benchmarks:
* `pallet_datahaven_native_transfer`:
* use a mock for `NativeTokenId`
* look at the balance difference of the treasury instead of the total
(this makes the benchmark agnostic to genesis setup)
* `snowbridge_pallet_system` / `snowbridge_pallet_system_v2` use native
token xcm location vs relay chain one. Add missing benchmark methods and
update fixture with valid data.
* `snowbridge_pallet_ethereum_client`: update fixtures with valid data
* `snowbrige_pallet_inbound_queue_v2`: set EthereumGatewayAddress when
initializing storage on benchmark and use a mock message processor ( as
fixture has `CreateAsset` payload which is not supported in the
`EigenLayerMessageProcessor`)
* `snowbridge_pallet_outbound_queue_v2`: add missing
`submit_delivery_receipt` benchmark which required a dedicated fixture
(all copied from the upstream pallet)
* `pallet_treasury`: Use an `ExistentialDeposit` of `1` on benchmark,
else payout fails.
* `pallet_transaction_payment`: Use a custom `WeightToFee` that makes
the Fee small, else account in benchmark cannot pay for fees (It is
funded a multiplier of `ExistentialDeposit` and is expected for that to
be enough, but it's not in our particular setup).
* comment out `pallet_identity` and `pallet_im_online` due to
incompatibilities (to be addressed later)
* Basic benchmark run to set `WeightInfo` from `weights` in configs
(real run should be done later using target hardware)
---------
Co-authored-by: Ahmad Kaouk <ahmadkaouk.93@gmail.com>
Co-authored-by: Tobi Demeco <50408393+TDemeco@users.noreply.github.com>
Co-authored-by: undercover-cactus <lola@moonsonglabs.com>
Co-authored-by: TDemeco <tdemeco@itba.edu.ar>
|