datahaven/operator/runtime/testnet/Cargo.toml

439 lines
17 KiB
TOML
Raw Permalink Normal View History

[package]
authors = { workspace = true }
description = "DataHaven Testnet runtime"
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
name = "datahaven-testnet-runtime"
publish = false
repository = { workspace = true }
version = { workspace = true }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
feat : Slashing integration in EigenLayer and Datahaven AVS (#345) ## Summary This PR integrate the slashing feature with EigenLayer. With this PR, slashing can now be relayed to our Datahaven AVS and then executed within EigenLayer. In addition some refactoring of the original slashing pallet has been done. ## Motivation To avoid misbehaving actor in the network, Datahaven has implemented a slashing pallet in which offenses can be reported and then if adequate can lead to a sanction on the misbehaving node. It incentive nodes to only follow good behavior in addition to the reward incentive. The rewards flow is managed directly into EigenLayer (see https://github.com/datahaven-xyz/datahaven/pull/351). ## Slashing flow <img width="2355" height="946" alt="Slashing Flow" src="https://github.com/user-attachments/assets/c1ddc3dc-2a7e-429d-94e0-1e02a3f65246" /> ## What changes * Implemented `slashValidatorsOperator` in `DataHavenServiceManager`. It received all the slashing requests batched (every new era the queued slashing are being relayed from substrate to Ethereum). It handle the slashing of the operators reported into the Validator set. * Added a `slashes_adapter.rs` utility file to remove the duplication for each runtime. In addition, we made use of the `sol!` macro from alloy to encode the calldata for the Ethereum call. This avoid rewriting encoding logic and allow to remove the hardcoded selector value used to call the slashing function. * Added some tests in solidity to test the registering and slashing of an operator in Ethereum via Eigen Layer. * Added e2e tests that test the injection of a slash request, it being relayed via the snowbridge relayer and executed by our Datahaven AVS. ## What could be better * We are only deploying one strategy for now so it is hardcoded in the slashing flow. We should be able to update the pallet in case we are adding a new strategy. So communication from Ethereum should be relayed. * We don't have error being return in case the slashing fail. Which could happen if we don't have the right number of strategy or the validator is not registered... etc. * More tests for the unhappy path
2026-01-16 19:49:45 +00:00
alloy-core = { workspace = true, features = ["sol-types"] }
bridge-hub-common = { workspace = true, optional = true }
codec = { workspace = true, features = ["derive"] }
datahaven-runtime-common = { workspace = true }
dhp-bridge = { workspace = true }
fp-account = { workspace = true, features = ["serde"] }
fp-evm = { workspace = true, features = ["serde"] }
fp-rpc = { workspace = true }
fp-self-contained = { workspace = true, features = ["serde", "try-runtime"] }
frame-benchmarking = { workspace = true, optional = true }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-support = { workspace = true, features = ["experimental"] }
frame-system = { workspace = true }
frame-system-benchmarking = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
hex = { workspace = true }
hex-literal = { workspace = true }
itoa = { workspace = true }
feat(operator): Add External Validators Rewards Pallet (#72) This PR introduces and integrates the new `pallet-external-validators-rewards` into the operator runtimes. This pallet is responsible for managing and distributing rewards to external validators. The pallet was originally introduced by Tanssi. It was heavily modified to abstract the message building and sending with Snowbridge. ### Key Changes Related to `pallet-external-validators-rewards`: * **Pallet and Runtime API Addition:** * The `pallet-external-validators-rewards` has been added to `mainnet`, `stagenet`, and `testnet` runtimes * **Runtime Configuration (`operator/runtime/{mainnet,stagenet,testnet}/src/configs/mod.rs`):** * **`RewardsRegistryAddress` Parameter:** A new dynamic runtime parameter `RewardsRegistryAddress` (type `H160`) has been added to `runtime_params.rs`. This will hold the Ethereum address of the Rewards Registry contract. * **Author Rewards with `RewardsPoints`:** * A new struct `RewardsPoints` implements `pallet_authorship::EventHandler`. * Its `note_author` function rewards block authors (if they are not whitelisted validators) by calling `ExternalValidatorsRewards::reward_by_ids`. * The `EventHandler` in `pallet_authorship::Config` is updated to `(RewardsPoints, ImOnline)`. * **Integration with `pallet-external-validators`:** * The `OnEraStart` and `OnEraEnd` hooks in `pallet_external_validators::Config` are now set to `ExternalValidatorsRewards`, allowing the rewards pallet to react to era changes. * **`RewardsSendAdapter` for Ethereum Communication:** * A new struct `RewardsSendAdapter` implements `pallet_external_validators_rewards::types::SendMessage`. * `build()`: Constructs an `OutboundMessage` to call the `updateRewardsMerkleRoot(bytes32)` function on the `RewardsRegistryAddress` on Ethereum. The calldata includes the selector (hashed from `UpdateRewardsMerkleRootSignature`) and the `rewards_merkle_root`. * `validate()` and `deliver()`: Utilize `OutboundQueueV2` for message validation and delivery. * A constant `UpdateRewardsMerkleRootSignature` ( `b"updateRewardsMerkleRoot(bytes32)"`) is defined for this purpose. * **Runtime API (`operator/runtime/{mainnet,stagenet,testnet}/src/lib.rs`):** * The runtime implements `pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi`. * This exposes two functions: * `generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof>` * `verify_rewards_merkle_proof(merkle_proof: MerkleProof) -> bool` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a rewards system for external validators with era-based tracking, Merkle proof generation, and verification. - Added runtime APIs to generate and verify validator rewards Merkle proofs. - Enabled rewards distribution via outbound messaging to an external registry contract. - Configured runtime parameters for the rewards registry address. - Added fixed author reward points and integrated rewards logic into block authorship events. - Provided a mock runtime environment and benchmarking support for the rewards pallet. - **Tests** - Added comprehensive tests and benchmarks for validator rewards distribution and Merkle proof functionality. - **Chores** - Integrated new pallets and runtime APIs into mainnet, stagenet, and testnet configurations. - Updated dependencies and feature groups to include new rewards-related pallets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-22 00:51:24 +00:00
log = { workspace = true }
num-bigint = { workspace = true }
num_enum = { workspace = true }
pallet-authorship = { workspace = true }
pallet-babe = { workspace = true }
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 11:26:30 +00:00
pallet-balances = { workspace = true, features = ["insecure_zero_ed"] }
pallet-beefy = { workspace = true }
pallet-beefy-mmr = { workspace = true }
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>
2025-09-02 20:46:35 +00:00
pallet-collective = { workspace = true }
pallet-conviction-voting = { workspace = true }
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>
2025-08-06 11:44:42 +00:00
pallet-datahaven-native-transfer = { workspace = true }
pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] }
pallet-evm-chain-id = { workspace = true }
pallet-evm-precompile-blake2 = { workspace = true }
pallet-evm-precompile-bn128 = { workspace = true }
pallet-evm-precompile-conviction-voting = { workspace = true }
pallet-evm-precompile-modexp = { workspace = true }
pallet-evm-precompile-sha3fips = { workspace = true }
pallet-evm-precompile-simple = { workspace = true }
pallet-external-validator-slashes = { workspace = true }
pallet-external-validators = { workspace = true }
feat(operator): Add External Validators Rewards Pallet (#72) This PR introduces and integrates the new `pallet-external-validators-rewards` into the operator runtimes. This pallet is responsible for managing and distributing rewards to external validators. The pallet was originally introduced by Tanssi. It was heavily modified to abstract the message building and sending with Snowbridge. ### Key Changes Related to `pallet-external-validators-rewards`: * **Pallet and Runtime API Addition:** * The `pallet-external-validators-rewards` has been added to `mainnet`, `stagenet`, and `testnet` runtimes * **Runtime Configuration (`operator/runtime/{mainnet,stagenet,testnet}/src/configs/mod.rs`):** * **`RewardsRegistryAddress` Parameter:** A new dynamic runtime parameter `RewardsRegistryAddress` (type `H160`) has been added to `runtime_params.rs`. This will hold the Ethereum address of the Rewards Registry contract. * **Author Rewards with `RewardsPoints`:** * A new struct `RewardsPoints` implements `pallet_authorship::EventHandler`. * Its `note_author` function rewards block authors (if they are not whitelisted validators) by calling `ExternalValidatorsRewards::reward_by_ids`. * The `EventHandler` in `pallet_authorship::Config` is updated to `(RewardsPoints, ImOnline)`. * **Integration with `pallet-external-validators`:** * The `OnEraStart` and `OnEraEnd` hooks in `pallet_external_validators::Config` are now set to `ExternalValidatorsRewards`, allowing the rewards pallet to react to era changes. * **`RewardsSendAdapter` for Ethereum Communication:** * A new struct `RewardsSendAdapter` implements `pallet_external_validators_rewards::types::SendMessage`. * `build()`: Constructs an `OutboundMessage` to call the `updateRewardsMerkleRoot(bytes32)` function on the `RewardsRegistryAddress` on Ethereum. The calldata includes the selector (hashed from `UpdateRewardsMerkleRootSignature`) and the `rewards_merkle_root`. * `validate()` and `deliver()`: Utilize `OutboundQueueV2` for message validation and delivery. * A constant `UpdateRewardsMerkleRootSignature` ( `b"updateRewardsMerkleRoot(bytes32)"`) is defined for this purpose. * **Runtime API (`operator/runtime/{mainnet,stagenet,testnet}/src/lib.rs`):** * The runtime implements `pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi`. * This exposes two functions: * `generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof>` * `verify_rewards_merkle_proof(merkle_proof: MerkleProof) -> bool` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a rewards system for external validators with era-based tracking, Merkle proof generation, and verification. - Added runtime APIs to generate and verify validator rewards Merkle proofs. - Enabled rewards distribution via outbound messaging to an external registry contract. - Configured runtime parameters for the rewards registry address. - Added fixed author reward points and integrated rewards logic into block authorship events. - Provided a mock runtime environment and benchmarking support for the rewards pallet. - **Tests** - Added comprehensive tests and benchmarks for validator rewards distribution and Merkle proof functionality. - **Chores** - Integrated new pallets and runtime APIs into mainnet, stagenet, and testnet configurations. - Updated dependencies and feature groups to include new rewards-related pallets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-22 00:51:24 +00:00
pallet-external-validators-rewards = { workspace = true }
pallet-grandpa = { workspace = true }
pallet-identity = { workspace = true }
pallet-im-online = { workspace = true }
pallet-message-queue = { workspace = true }
pallet-migrations = { workspace = true }
pallet-mmr = { workspace = true }
pallet-multisig = { workspace = true }
pallet-offences = { workspace = true }
pallet-outbound-commitment-store = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
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>
2025-08-18 07:46:59 +00:00
pallet-proxy = { workspace = true }
pallet-proxy-genesis-companion = { workspace = true }
pallet-referenda = { workspace = true }
pallet-safe-mode = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-session-benchmarking = { workspace = true, optional = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
feat: ✨ Add Treasury 💰 pallet to DataHaven runtimes (#98) This PR integrates the Substrate FRAME Treasury pallet across all three DataHaven runtime environments (`testnet`, `mainnet`, `stagenet`) with a custom fee allocation mechanism and comprehensive test coverage. ### Key Changes #### Treasury Pallet Integration: - Added Treasury pallet to all three runtimes (testnet, mainnet, stagenet) with 20% fee allocation and 80% burn mechanism. - Implemented dynamic fee proportion control via `FeesTreasuryProportion` runtime parameter. - Integrated treasury with custom fee handlers: `DealWithEthereumBaseFees`, `DealWithEthereumPriorityFees`, and `DealWithSubstrateFeesAndTip`. #### Comprehensive Testing Infrastructure: - Created robust test architecture with session management and validator setup across all runtimes - Added block author management utilities for treasury testing requiring pallet_authorship integration - Implemented 15 total tests (5 tests × 3 runtimes) covering: - EVM transaction fee allocation with/without priority fees - Substrate fee and tip handling validation - Treasury spending functionality via sudo - Complete fee flow verification with actual network base fee calculations #### Technnical Implementation Fee Allocation Logic: - Base fees: 20% to treasury, 80% burned - Priority fees: 100% to block author - Substrate tips: 100% to block author The implementation is based on https://github.com/moonbeam-foundation/moonbeam/pull/3120 in [Moonbeam](https://github.com/moonbeam-foundation/moonbeam), and assisted by Claude Code.
2025-06-25 06:09:26 +00:00
pallet-treasury = { workspace = true }
pallet-tx-pause = { workspace = true }
pallet-utility = { workspace = true }
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>
2025-09-02 20:46:35 +00:00
pallet-whitelist = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-runtime-common = { workspace = true }
fix: add missing benchmarks and weights (#302) ## Add missing weights The aim of this PR is to complete our weights by enabling more runtime benchmarks from the pallets used in DataHaven. I will start this effort with Storage Hub pallets. ## What's included - [x] `pallet_nfts` - [x] Added signing helper for pallet nfts - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_session` - [x] Added a `pallet_session_benchmarking` crate - [x] Added signing helpers - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_payment_streams` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_storage_providers` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_file_system` - [x] Add pallet to benchmarks and configure properly - [ ] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_proofs_dealer` - [x] Add pallet to benchmarks and configure properly - [x] Run benches and generate weights - [x] Wire up weights to runtimes ## What's not included - `pallet_identity` - We'll enable it once we update to `2506`, that will allow us to have a BenchmarkHelper in the config on the pallet (see [here](https://github.com/datahaven-xyz/datahaven/blob/ac28323e7d9e690ae1ccbb27b55f00c3e6522681/operator/runtime/mainnet/src/configs/mod.rs#L632-L643)) - `pallet_grandpa` - the upstream pallet defines [benchmarks](https://github.com/paritytech/polkadot-sdk/blob/bbc435c7667d3283ba280a8fec44676357392753/substrate/frame/grandpa/src/benchmarking.rs#L25) for `check_equivocation_proof` and `note_stalled`, but the required weights to be wired are actually `report_equivocation`, `report_equivocation_unsigned` and `note_stalled`. That means including `pallet_grandpa` in the benchmarks results in an inconsistent `WeightInfo` implementation, so further understanding in the pallet's approach to benchmarking is needed. - `pallet_file_system` -> Run benches and generate weights. Weights will fail because of a hardcoded `AccountId32` on the [benchmarks](https://github.com/Moonsong-Labs/storage-hub/blob/57d2a195d58d39e0d6e38a927ec312dd0f640522/pallets/file-system/src/benchmark_proofs.rs#L69-L71). I'll create a PR for SH soon. These two are left for a follow up PR.
2026-02-03 16:12:11 +00:00
k256 = { workspace = true, optional = true }
precompile-utils = { workspace = true }
scale-info = { workspace = true, features = ["derive", "serde"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, default-features = false, features = [
"alloc",
] }
smallvec = { workspace = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-merkle-tree = { workspace = true }
snowbridge-outbound-queue-primitives = { workspace = true }
snowbridge-outbound-queue-v2-runtime-api = { workspace = true }
snowbridge-pallet-ethereum-client = { workspace = true }
snowbridge-pallet-ethereum-client-fixtures = { workspace = true, optional = true }
snowbridge-pallet-inbound-queue-v2 = { workspace = true }
snowbridge-pallet-outbound-queue-v2 = { workspace = true }
snowbridge-pallet-system = { workspace = true }
snowbridge-pallet-system-v2 = { workspace = true }
snowbridge-system-v2-runtime-api = { workspace = true }
snowbridge-verification-primitives = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-babe = { workspace = true, features = ["serde"] }
sp-consensus-beefy = { workspace = true, features = ["serde"] }
sp-consensus-grandpa = { workspace = true, features = ["serde"] }
sp-core = { workspace = true, features = ["serde"] }
sp-genesis-builder = { workspace = true }
sp-inherents = { workspace = true }
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>
2025-08-06 11:44:42 +00:00
sp-io = { workspace = true }
sp-keyring = { workspace = true }
sp-offchain = { workspace = true }
sp-runtime = { workspace = true, features = ["serde"] }
sp-session = { workspace = true }
sp-staking = { workspace = true }
sp-std = { workspace = true }
sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true, features = ["serde"] }
strum = { workspace = true }
strum_macros = { workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }
xcm-executor = { workspace = true }
# DataHaven precompiles
feat: Add ERC20 Balances precompile (#150) ## Summary - Introduces an ERC20-compatible precompile backed by `pallet_balances`, including approvals and EIP-2612 permit. - Wires the precompile into Mainnet, Testnet, and Stagenet at address `0x0000000000000000000000000000000000000802` (u64: 2050). - Adds comprehensive unit tests and a mock runtime. ## Motivation - Allow EVM contracts and tooling to interact with Substrate balances via a familiar ERC20 interface. - Support off-chain approvals via EIP-2612 for gasless approvals and improved UX. ## Key Changes - New crate: `operator/precompiles/erc20-balances` - Core logic: `src/lib.rs` - EIP-2612 helpers and validation: `src/eip2612.rs` - Tests + mock runtime: `src/tests.rs`, `src/mock.rs` - Runtime wiring (all networks): add `Erc20BalancesPrecompile` at `AddressU64<2050>` - `operator/runtime/{mainnet,stagenet,testnet}/src/precompiles.rs` - Workspace plumbing: include `pallet-evm-precompile-balances-erc20` in `operator/Cargo.toml` ## Interface - ERC20: `totalSupply`, `balanceOf`, `allowance`, `approve`, `transfer`, `transferFrom`, `name`, `symbol`, `decimals` - Native-only flows: `deposit()` (fallback/payable) and `withdraw(uint256)` - EIP-2612: `permit(owner,spender,value,deadline,v,r,s)`, `nonces(owner)`, `DOMAIN_SEPARATOR()` - Events: `Transfer`, `Approval`, `Deposit`, `Withdrawal` - Storage: - Approvals via `ApprovesStorage` (double map: owner → spender → amount) - EIP-2612 nonces via `NoncesStorage` keyed by `H160` - Instance-aware prefixes to support multiple `pallet_balances` instances
2025-09-12 08:57:44 +00:00
pallet-evm-precompile-balances-erc20 = { workspace = true }
pallet-evm-precompile-batch = { workspace = true }
pallet-evm-precompile-call-permit = { workspace = true }
pallet-evm-precompile-collective = { workspace = true }
pallet-evm-precompile-datahaven-native-transfer = { workspace = true }
pallet-evm-precompile-identity = { workspace = true }
pallet-evm-precompile-preimage = { workspace = true }
2025-09-12 07:45:26 +00:00
pallet-evm-precompile-proxy = { workspace = true }
pallet-evm-precompile-referenda = { workspace = true }
pallet-evm-precompile-registry = { workspace = true }
# StorageHub
pallet-bucket-nfts = { workspace = true }
pallet-cr-randomness = { workspace = true }
pallet-evm-precompile-file-system = { workspace = true }
pallet-file-system = { workspace = true }
pallet-file-system-runtime-api = { workspace = true }
pallet-nfts = { workspace = true }
pallet-payment-streams = { workspace = true }
pallet-payment-streams-runtime-api = { workspace = true }
pallet-proofs-dealer = { workspace = true }
pallet-proofs-dealer-runtime-api = { workspace = true }
pallet-randomness = { workspace = true }
pallet-storage-providers = { workspace = true }
pallet-storage-providers-runtime-api = { workspace = true }
shc-common = { workspace = true, optional = true }
shp-constants = { workspace = true }
shp-data-price-updater = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-file-metadata = { workspace = true }
shp-forest-verifier = { workspace = true }
shp-traits = { workspace = true }
shp-treasury-funding = { workspace = true }
shp-tx-implicits-runtime-api = { workspace = true }
sp-trie = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { workspace = true, optional = true, default-features = true }
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
[dev-dependencies]
# Test utilities
frame-support-test = { workspace = true }
sp-io = { workspace = true }
sp-tracing = { workspace = true }
precompile-utils = { workspace = true, features = ["std", "testing"] }
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
# Snowbridge testing
snowbridge-core = { workspace = true }
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>
2025-08-06 11:44:42 +00:00
snowbridge-outbound-queue-primitives = { workspace = true }
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
snowbridge-pallet-system = { workspace = true }
snowbridge-pallet-system-v2 = { workspace = true }
[features]
default = ["std"]
std = [
feat : Slashing integration in EigenLayer and Datahaven AVS (#345) ## Summary This PR integrate the slashing feature with EigenLayer. With this PR, slashing can now be relayed to our Datahaven AVS and then executed within EigenLayer. In addition some refactoring of the original slashing pallet has been done. ## Motivation To avoid misbehaving actor in the network, Datahaven has implemented a slashing pallet in which offenses can be reported and then if adequate can lead to a sanction on the misbehaving node. It incentive nodes to only follow good behavior in addition to the reward incentive. The rewards flow is managed directly into EigenLayer (see https://github.com/datahaven-xyz/datahaven/pull/351). ## Slashing flow <img width="2355" height="946" alt="Slashing Flow" src="https://github.com/user-attachments/assets/c1ddc3dc-2a7e-429d-94e0-1e02a3f65246" /> ## What changes * Implemented `slashValidatorsOperator` in `DataHavenServiceManager`. It received all the slashing requests batched (every new era the queued slashing are being relayed from substrate to Ethereum). It handle the slashing of the operators reported into the Validator set. * Added a `slashes_adapter.rs` utility file to remove the duplication for each runtime. In addition, we made use of the `sol!` macro from alloy to encode the calldata for the Ethereum call. This avoid rewriting encoding logic and allow to remove the hardcoded selector value used to call the slashing function. * Added some tests in solidity to test the registering and slashing of an operator in Ethereum via Eigen Layer. * Added e2e tests that test the injection of a slash request, it being relayed via the snowbridge relayer and executed by our Datahaven AVS. ## What could be better * We are only deploying one strategy for now so it is hardcoded in the slashing flow. We should be able to update the pallet in case we are adding a new strategy. So communication from Ethereum should be relayed. * We don't have error being return in case the slashing fail. Which could happen if we don't have the right number of strategy or the validator is not registered... etc. * More tests for the unhappy path
2026-01-16 19:49:45 +00:00
"alloy-core/std",
"codec/std",
"datahaven-runtime-common/std",
"fp-account/std",
"fp-evm/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"pallet-session-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
"pallet-authorship/std",
"pallet-babe/std",
"pallet-balances/std",
"pallet-beefy-mmr/std",
"pallet-beefy/std",
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>
2025-09-02 20:46:35 +00:00
"pallet-collective/std",
"pallet-conviction-voting/std",
"pallet-ethereum/std",
"pallet-evm-chain-id/std",
"pallet-evm/std",
feat: Add ERC20 Balances precompile (#150) ## Summary - Introduces an ERC20-compatible precompile backed by `pallet_balances`, including approvals and EIP-2612 permit. - Wires the precompile into Mainnet, Testnet, and Stagenet at address `0x0000000000000000000000000000000000000802` (u64: 2050). - Adds comprehensive unit tests and a mock runtime. ## Motivation - Allow EVM contracts and tooling to interact with Substrate balances via a familiar ERC20 interface. - Support off-chain approvals via EIP-2612 for gasless approvals and improved UX. ## Key Changes - New crate: `operator/precompiles/erc20-balances` - Core logic: `src/lib.rs` - EIP-2612 helpers and validation: `src/eip2612.rs` - Tests + mock runtime: `src/tests.rs`, `src/mock.rs` - Runtime wiring (all networks): add `Erc20BalancesPrecompile` at `AddressU64<2050>` - `operator/runtime/{mainnet,stagenet,testnet}/src/precompiles.rs` - Workspace plumbing: include `pallet-evm-precompile-balances-erc20` in `operator/Cargo.toml` ## Interface - ERC20: `totalSupply`, `balanceOf`, `allowance`, `approve`, `transfer`, `transferFrom`, `name`, `symbol`, `decimals` - Native-only flows: `deposit()` (fallback/payable) and `withdraw(uint256)` - EIP-2612: `permit(owner,spender,value,deadline,v,r,s)`, `nonces(owner)`, `DOMAIN_SEPARATOR()` - Events: `Transfer`, `Approval`, `Deposit`, `Withdrawal` - Storage: - Approvals via `ApprovesStorage` (double map: owner → spender → amount) - EIP-2612 nonces via `NoncesStorage` keyed by `H160` - Instance-aware prefixes to support multiple `pallet_balances` instances
2025-09-12 08:57:44 +00:00
"pallet-evm-precompile-balances-erc20/std",
"pallet-evm-precompile-batch/std",
"pallet-evm-precompile-call-permit/std",
"pallet-evm-precompile-preimage/std",
"pallet-evm-precompile-collective/std",
"pallet-evm-precompile-conviction-voting/std",
"pallet-evm-precompile-datahaven-native-transfer/std",
"pallet-evm-precompile-identity/std",
2025-09-12 07:45:26 +00:00
"pallet-evm-precompile-proxy/std",
"pallet-evm-precompile-referenda/std",
"pallet-evm-precompile-registry/std",
"pallet-evm-precompile-file-system/std",
"pallet-grandpa/std",
"pallet-identity/std",
"pallet-im-online/std",
"pallet-message-queue/std",
"pallet-migrations/std",
"pallet-mmr/std",
"pallet-multisig/std",
"pallet-offences/std",
"pallet-parameters/std",
"pallet-preimage/std",
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>
2025-10-06 17:00:10 +00:00
"pallet-safe-mode/std",
"pallet-tx-pause/std",
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>
2025-09-02 20:46:35 +00:00
"pallet-referenda/std",
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>
2025-08-18 07:46:59 +00:00
"pallet-proxy/std",
"pallet-proxy-genesis-companion/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
feat: ✨ Add Treasury 💰 pallet to DataHaven runtimes (#98) This PR integrates the Substrate FRAME Treasury pallet across all three DataHaven runtime environments (`testnet`, `mainnet`, `stagenet`) with a custom fee allocation mechanism and comprehensive test coverage. ### Key Changes #### Treasury Pallet Integration: - Added Treasury pallet to all three runtimes (testnet, mainnet, stagenet) with 20% fee allocation and 80% burn mechanism. - Implemented dynamic fee proportion control via `FeesTreasuryProportion` runtime parameter. - Integrated treasury with custom fee handlers: `DealWithEthereumBaseFees`, `DealWithEthereumPriorityFees`, and `DealWithSubstrateFeesAndTip`. #### Comprehensive Testing Infrastructure: - Created robust test architecture with session management and validator setup across all runtimes - Added block author management utilities for treasury testing requiring pallet_authorship integration - Implemented 15 total tests (5 tests × 3 runtimes) covering: - EVM transaction fee allocation with/without priority fees - Substrate fee and tip handling validation - Treasury spending functionality via sudo - Complete fee flow verification with actual network base fee calculations #### Technnical Implementation Fee Allocation Logic: - Base fees: 20% to treasury, 80% burned - Priority fees: 100% to block author - Substrate tips: 100% to block author The implementation is based on https://github.com/moonbeam-foundation/moonbeam/pull/3120 in [Moonbeam](https://github.com/moonbeam-foundation/moonbeam), and assisted by Claude Code.
2025-06-25 06:09:26 +00:00
"pallet-treasury/std",
"pallet-utility/std",
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>
2025-09-02 20:46:35 +00:00
"pallet-whitelist/std",
"polkadot-primitives/std",
"polkadot-runtime-common/std",
"scale-info/std",
"serde/std",
"serde_json/std",
"snowbridge-beacon-primitives/std",
"snowbridge-inbound-queue-primitives/std",
"snowbridge-outbound-queue-primitives/std",
"snowbridge-pallet-ethereum-client/std",
"snowbridge-pallet-inbound-queue-v2/std",
"snowbridge-pallet-outbound-queue-v2/std",
"snowbridge-merkle-tree/std",
"snowbridge-outbound-queue-v2-runtime-api/std",
"snowbridge-pallet-system/std",
"snowbridge-pallet-system-v2/std",
"snowbridge-system-v2-runtime-api/std",
"dhp-bridge/std",
"snowbridge-verification-primitives/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-babe/std",
"sp-consensus-beefy/std",
"sp-consensus-grandpa/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-keyring/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"sp-std/std",
"sp-storage/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"pallet-outbound-commitment-store/std",
"pallet-external-validators/std",
feat(operator): Add External Validators Rewards Pallet (#72) This PR introduces and integrates the new `pallet-external-validators-rewards` into the operator runtimes. This pallet is responsible for managing and distributing rewards to external validators. The pallet was originally introduced by Tanssi. It was heavily modified to abstract the message building and sending with Snowbridge. ### Key Changes Related to `pallet-external-validators-rewards`: * **Pallet and Runtime API Addition:** * The `pallet-external-validators-rewards` has been added to `mainnet`, `stagenet`, and `testnet` runtimes * **Runtime Configuration (`operator/runtime/{mainnet,stagenet,testnet}/src/configs/mod.rs`):** * **`RewardsRegistryAddress` Parameter:** A new dynamic runtime parameter `RewardsRegistryAddress` (type `H160`) has been added to `runtime_params.rs`. This will hold the Ethereum address of the Rewards Registry contract. * **Author Rewards with `RewardsPoints`:** * A new struct `RewardsPoints` implements `pallet_authorship::EventHandler`. * Its `note_author` function rewards block authors (if they are not whitelisted validators) by calling `ExternalValidatorsRewards::reward_by_ids`. * The `EventHandler` in `pallet_authorship::Config` is updated to `(RewardsPoints, ImOnline)`. * **Integration with `pallet-external-validators`:** * The `OnEraStart` and `OnEraEnd` hooks in `pallet_external_validators::Config` are now set to `ExternalValidatorsRewards`, allowing the rewards pallet to react to era changes. * **`RewardsSendAdapter` for Ethereum Communication:** * A new struct `RewardsSendAdapter` implements `pallet_external_validators_rewards::types::SendMessage`. * `build()`: Constructs an `OutboundMessage` to call the `updateRewardsMerkleRoot(bytes32)` function on the `RewardsRegistryAddress` on Ethereum. The calldata includes the selector (hashed from `UpdateRewardsMerkleRootSignature`) and the `rewards_merkle_root`. * `validate()` and `deliver()`: Utilize `OutboundQueueV2` for message validation and delivery. * A constant `UpdateRewardsMerkleRootSignature` ( `b"updateRewardsMerkleRoot(bytes32)"`) is defined for this purpose. * **Runtime API (`operator/runtime/{mainnet,stagenet,testnet}/src/lib.rs`):** * The runtime implements `pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi`. * This exposes two functions: * `generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof>` * `verify_rewards_merkle_proof(merkle_proof: MerkleProof) -> bool` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a rewards system for external validators with era-based tracking, Merkle proof generation, and verification. - Added runtime APIs to generate and verify validator rewards Merkle proofs. - Enabled rewards distribution via outbound messaging to an external registry contract. - Configured runtime parameters for the rewards registry address. - Added fixed author reward points and integrated rewards logic into block authorship events. - Provided a mock runtime environment and benchmarking support for the rewards pallet. - **Tests** - Added comprehensive tests and benchmarks for validator rewards distribution and Merkle proof functionality. - **Chores** - Integrated new pallets and runtime APIs into mainnet, stagenet, and testnet configurations. - Updated dependencies and feature groups to include new rewards-related pallets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-22 00:51:24 +00:00
"pallet-external-validators-rewards/std",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"pallet-external-validator-slashes/std",
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
"pallet-datahaven-native-transfer/std",
# StorageHub
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"pallet-bucket-nfts/std",
"pallet-nfts/std",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"pallet-cr-randomness/std",
"pallet-file-system/std",
"pallet-file-system-runtime-api/std",
"pallet-payment-streams/std",
"pallet-payment-streams-runtime-api/std",
"pallet-proofs-dealer/std",
"pallet-proofs-dealer-runtime-api/std",
"pallet-randomness/std",
"pallet-storage-providers/std",
"pallet-storage-providers-runtime-api/std",
"dep:shc-common",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"shc-common/std",
"shp-constants/std",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"shp-file-metadata/std",
"shp-forest-verifier/std",
"shp-traits/std",
"shp-treasury-funding/std",
"shp-file-key-verifier/std",
]
runtime-benchmarks = [
"bridge-hub-common",
"datahaven-runtime-common/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-beefy-mmr/runtime-benchmarks",
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>
2025-09-02 20:46:35 +00:00
"pallet-collective/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
"pallet-evm/runtime-benchmarks",
"pallet-grandpa/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-migrations/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-offences/runtime-benchmarks",
"pallet-parameters/runtime-benchmarks",
"pallet-randomness/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
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>
2025-10-06 17:00:10 +00:00
"pallet-safe-mode/runtime-benchmarks",
"pallet-tx-pause/runtime-benchmarks",
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>
2025-09-02 20:46:35 +00:00
"pallet-referenda/runtime-benchmarks",
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>
2025-08-18 07:46:59 +00:00
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
feat: ✨ Add Treasury 💰 pallet to DataHaven runtimes (#98) This PR integrates the Substrate FRAME Treasury pallet across all three DataHaven runtime environments (`testnet`, `mainnet`, `stagenet`) with a custom fee allocation mechanism and comprehensive test coverage. ### Key Changes #### Treasury Pallet Integration: - Added Treasury pallet to all three runtimes (testnet, mainnet, stagenet) with 20% fee allocation and 80% burn mechanism. - Implemented dynamic fee proportion control via `FeesTreasuryProportion` runtime parameter. - Integrated treasury with custom fee handlers: `DealWithEthereumBaseFees`, `DealWithEthereumPriorityFees`, and `DealWithSubstrateFeesAndTip`. #### Comprehensive Testing Infrastructure: - Created robust test architecture with session management and validator setup across all runtimes - Added block author management utilities for treasury testing requiring pallet_authorship integration - Implemented 15 total tests (5 tests × 3 runtimes) covering: - EVM transaction fee allocation with/without priority fees - Substrate fee and tip handling validation - Treasury spending functionality via sudo - Complete fee flow verification with actual network base fee calculations #### Technnical Implementation Fee Allocation Logic: - Base fees: 20% to treasury, 80% burned - Priority fees: 100% to block author - Substrate tips: 100% to block author The implementation is based on https://github.com/moonbeam-foundation/moonbeam/pull/3120 in [Moonbeam](https://github.com/moonbeam-foundation/moonbeam), and assisted by Claude Code.
2025-06-25 06:09:26 +00:00
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
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>
2025-09-02 20:46:35 +00:00
"pallet-whitelist/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks",
"snowbridge-pallet-inbound-queue-v2/runtime-benchmarks",
"snowbridge-pallet-system-v2/runtime-benchmarks",
"snowbridge-pallet-outbound-queue-v2/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"snowbridge-pallet-system/runtime-benchmarks",
"pallet-outbound-commitment-store/runtime-benchmarks",
"pallet-external-validators/runtime-benchmarks",
feat(operator): Add External Validators Rewards Pallet (#72) This PR introduces and integrates the new `pallet-external-validators-rewards` into the operator runtimes. This pallet is responsible for managing and distributing rewards to external validators. The pallet was originally introduced by Tanssi. It was heavily modified to abstract the message building and sending with Snowbridge. ### Key Changes Related to `pallet-external-validators-rewards`: * **Pallet and Runtime API Addition:** * The `pallet-external-validators-rewards` has been added to `mainnet`, `stagenet`, and `testnet` runtimes * **Runtime Configuration (`operator/runtime/{mainnet,stagenet,testnet}/src/configs/mod.rs`):** * **`RewardsRegistryAddress` Parameter:** A new dynamic runtime parameter `RewardsRegistryAddress` (type `H160`) has been added to `runtime_params.rs`. This will hold the Ethereum address of the Rewards Registry contract. * **Author Rewards with `RewardsPoints`:** * A new struct `RewardsPoints` implements `pallet_authorship::EventHandler`. * Its `note_author` function rewards block authors (if they are not whitelisted validators) by calling `ExternalValidatorsRewards::reward_by_ids`. * The `EventHandler` in `pallet_authorship::Config` is updated to `(RewardsPoints, ImOnline)`. * **Integration with `pallet-external-validators`:** * The `OnEraStart` and `OnEraEnd` hooks in `pallet_external_validators::Config` are now set to `ExternalValidatorsRewards`, allowing the rewards pallet to react to era changes. * **`RewardsSendAdapter` for Ethereum Communication:** * A new struct `RewardsSendAdapter` implements `pallet_external_validators_rewards::types::SendMessage`. * `build()`: Constructs an `OutboundMessage` to call the `updateRewardsMerkleRoot(bytes32)` function on the `RewardsRegistryAddress` on Ethereum. The calldata includes the selector (hashed from `UpdateRewardsMerkleRootSignature`) and the `rewards_merkle_root`. * `validate()` and `deliver()`: Utilize `OutboundQueueV2` for message validation and delivery. * A constant `UpdateRewardsMerkleRootSignature` ( `b"updateRewardsMerkleRoot(bytes32)"`) is defined for this purpose. * **Runtime API (`operator/runtime/{mainnet,stagenet,testnet}/src/lib.rs`):** * The runtime implements `pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi`. * This exposes two functions: * `generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof>` * `verify_rewards_merkle_proof(merkle_proof: MerkleProof) -> bool` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a rewards system for external validators with era-based tracking, Merkle proof generation, and verification. - Added runtime APIs to generate and verify validator rewards Merkle proofs. - Enabled rewards distribution via outbound messaging to an external registry contract. - Configured runtime parameters for the rewards registry address. - Added fixed author reward points and integrated rewards logic into block authorship events. - Provided a mock runtime environment and benchmarking support for the rewards pallet. - **Tests** - Added comprehensive tests and benchmarks for validator rewards distribution and Merkle proof functionality. - **Chores** - Integrated new pallets and runtime APIs into mainnet, stagenet, and testnet configurations. - Updated dependencies and feature groups to include new rewards-related pallets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-22 00:51:24 +00:00
"pallet-external-validators-rewards/runtime-benchmarks",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"pallet-external-validator-slashes/runtime-benchmarks",
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
"pallet-datahaven-native-transfer/runtime-benchmarks",
fix: add missing benchmarks and weights (#302) ## Add missing weights The aim of this PR is to complete our weights by enabling more runtime benchmarks from the pallets used in DataHaven. I will start this effort with Storage Hub pallets. ## What's included - [x] `pallet_nfts` - [x] Added signing helper for pallet nfts - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_session` - [x] Added a `pallet_session_benchmarking` crate - [x] Added signing helpers - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_payment_streams` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_storage_providers` - [x] Add `TreasuryAccount` helper and configure properly - [x] Add pallet to benchmarks - [x] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_file_system` - [x] Add pallet to benchmarks and configure properly - [ ] Run benches and generate weights - [x] Wire up weights to runtimes - [x] `pallet_proofs_dealer` - [x] Add pallet to benchmarks and configure properly - [x] Run benches and generate weights - [x] Wire up weights to runtimes ## What's not included - `pallet_identity` - We'll enable it once we update to `2506`, that will allow us to have a BenchmarkHelper in the config on the pallet (see [here](https://github.com/datahaven-xyz/datahaven/blob/ac28323e7d9e690ae1ccbb27b55f00c3e6522681/operator/runtime/mainnet/src/configs/mod.rs#L632-L643)) - `pallet_grandpa` - the upstream pallet defines [benchmarks](https://github.com/paritytech/polkadot-sdk/blob/bbc435c7667d3283ba280a8fec44676357392753/substrate/frame/grandpa/src/benchmarking.rs#L25) for `check_equivocation_proof` and `note_stalled`, but the required weights to be wired are actually `report_equivocation`, `report_equivocation_unsigned` and `note_stalled`. That means including `pallet_grandpa` in the benchmarks results in an inconsistent `WeightInfo` implementation, so further understanding in the pallet's approach to benchmarking is needed. - `pallet_file_system` -> Run benches and generate weights. Weights will fail because of a hardcoded `AccountId32` on the [benchmarks](https://github.com/Moonsong-Labs/storage-hub/blob/57d2a195d58d39e0d6e38a927ec312dd0f640522/pallets/file-system/src/benchmark_proofs.rs#L69-L71). I'll create a PR for SH soon. These two are left for a follow up PR.
2026-02-03 16:12:11 +00:00
# StorageHub pallets
"pallet-nfts/runtime-benchmarks",
"pallet-file-system/runtime-benchmarks",
"pallet-proofs-dealer/runtime-benchmarks",
"pallet-payment-streams/runtime-benchmarks",
"pallet-storage-providers/runtime-benchmarks",
"dep:k256",
]
try-runtime = [
"fp-self-contained/try-runtime",
"frame-executive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-authorship/try-runtime",
"pallet-babe/try-runtime",
"pallet-balances/try-runtime",
"pallet-beefy-mmr/try-runtime",
"pallet-beefy/try-runtime",
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>
2025-09-02 20:46:35 +00:00
"pallet-collective/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-ethereum/try-runtime",
"pallet-evm/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-identity/try-runtime",
"pallet-im-online/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-migrations/try-runtime",
"pallet-mmr/try-runtime",
"pallet-multisig/try-runtime",
"pallet-offences/try-runtime",
"pallet-parameters/try-runtime",
"pallet-preimage/try-runtime",
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>
2025-10-06 17:00:10 +00:00
"pallet-safe-mode/try-runtime",
"pallet-tx-pause/try-runtime",
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>
2025-09-02 20:46:35 +00:00
"pallet-referenda/try-runtime",
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>
2025-08-18 07:46:59 +00:00
"pallet-proxy/try-runtime",
"pallet-proxy-genesis-companion/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
feat: ✨ Add Treasury 💰 pallet to DataHaven runtimes (#98) This PR integrates the Substrate FRAME Treasury pallet across all three DataHaven runtime environments (`testnet`, `mainnet`, `stagenet`) with a custom fee allocation mechanism and comprehensive test coverage. ### Key Changes #### Treasury Pallet Integration: - Added Treasury pallet to all three runtimes (testnet, mainnet, stagenet) with 20% fee allocation and 80% burn mechanism. - Implemented dynamic fee proportion control via `FeesTreasuryProportion` runtime parameter. - Integrated treasury with custom fee handlers: `DealWithEthereumBaseFees`, `DealWithEthereumPriorityFees`, and `DealWithSubstrateFeesAndTip`. #### Comprehensive Testing Infrastructure: - Created robust test architecture with session management and validator setup across all runtimes - Added block author management utilities for treasury testing requiring pallet_authorship integration - Implemented 15 total tests (5 tests × 3 runtimes) covering: - EVM transaction fee allocation with/without priority fees - Substrate fee and tip handling validation - Treasury spending functionality via sudo - Complete fee flow verification with actual network base fee calculations #### Technnical Implementation Fee Allocation Logic: - Base fees: 20% to treasury, 80% burned - Priority fees: 100% to block author - Substrate tips: 100% to block author The implementation is based on https://github.com/moonbeam-foundation/moonbeam/pull/3120 in [Moonbeam](https://github.com/moonbeam-foundation/moonbeam), and assisted by Claude Code.
2025-06-25 06:09:26 +00:00
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
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>
2025-09-02 20:46:35 +00:00
"pallet-whitelist/try-runtime",
"polkadot-runtime-common/try-runtime",
"snowbridge-pallet-ethereum-client/try-runtime",
"snowbridge-pallet-inbound-queue-v2/try-runtime",
"snowbridge-pallet-system-v2/try-runtime",
"snowbridge-pallet-outbound-queue-v2/try-runtime",
"sp-runtime/try-runtime",
"snowbridge-pallet-system/try-runtime",
"pallet-outbound-commitment-store/try-runtime",
"pallet-external-validators/try-runtime",
feat(operator): Add External Validators Rewards Pallet (#72) This PR introduces and integrates the new `pallet-external-validators-rewards` into the operator runtimes. This pallet is responsible for managing and distributing rewards to external validators. The pallet was originally introduced by Tanssi. It was heavily modified to abstract the message building and sending with Snowbridge. ### Key Changes Related to `pallet-external-validators-rewards`: * **Pallet and Runtime API Addition:** * The `pallet-external-validators-rewards` has been added to `mainnet`, `stagenet`, and `testnet` runtimes * **Runtime Configuration (`operator/runtime/{mainnet,stagenet,testnet}/src/configs/mod.rs`):** * **`RewardsRegistryAddress` Parameter:** A new dynamic runtime parameter `RewardsRegistryAddress` (type `H160`) has been added to `runtime_params.rs`. This will hold the Ethereum address of the Rewards Registry contract. * **Author Rewards with `RewardsPoints`:** * A new struct `RewardsPoints` implements `pallet_authorship::EventHandler`. * Its `note_author` function rewards block authors (if they are not whitelisted validators) by calling `ExternalValidatorsRewards::reward_by_ids`. * The `EventHandler` in `pallet_authorship::Config` is updated to `(RewardsPoints, ImOnline)`. * **Integration with `pallet-external-validators`:** * The `OnEraStart` and `OnEraEnd` hooks in `pallet_external_validators::Config` are now set to `ExternalValidatorsRewards`, allowing the rewards pallet to react to era changes. * **`RewardsSendAdapter` for Ethereum Communication:** * A new struct `RewardsSendAdapter` implements `pallet_external_validators_rewards::types::SendMessage`. * `build()`: Constructs an `OutboundMessage` to call the `updateRewardsMerkleRoot(bytes32)` function on the `RewardsRegistryAddress` on Ethereum. The calldata includes the selector (hashed from `UpdateRewardsMerkleRootSignature`) and the `rewards_merkle_root`. * `validate()` and `deliver()`: Utilize `OutboundQueueV2` for message validation and delivery. * A constant `UpdateRewardsMerkleRootSignature` ( `b"updateRewardsMerkleRoot(bytes32)"`) is defined for this purpose. * **Runtime API (`operator/runtime/{mainnet,stagenet,testnet}/src/lib.rs`):** * The runtime implements `pallet_external_validators_rewards_runtime_api::ExternalValidatorsRewardsApi`. * This exposes two functions: * `generate_rewards_merkle_proof(account_id: AccountId, era_index: EraIndex) -> Option<MerkleProof>` * `verify_rewards_merkle_proof(merkle_proof: MerkleProof) -> bool` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a rewards system for external validators with era-based tracking, Merkle proof generation, and verification. - Added runtime APIs to generate and verify validator rewards Merkle proofs. - Enabled rewards distribution via outbound messaging to an external registry contract. - Configured runtime parameters for the rewards registry address. - Added fixed author reward points and integrated rewards logic into block authorship events. - Provided a mock runtime environment and benchmarking support for the rewards pallet. - **Tests** - Added comprehensive tests and benchmarks for validator rewards distribution and Merkle proof functionality. - **Chores** - Integrated new pallets and runtime APIs into mainnet, stagenet, and testnet configurations. - Updated dependencies and feature groups to include new rewards-related pallets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-22 00:51:24 +00:00
"pallet-external-validators-rewards/try-runtime",
feat: add slashing support (#242) ## 🔨 Add Slashing Support for Runtime This PR introduces the slashing functionality for the DataHaven runtime, enabling punitive measures against misbehaving validators. ### Features - Deferred slashing with configurable veto periods - Cross-chain slashing message delivery trough Snowbridge - Governance controls for slashing parameters and emergency cancellation We introduced the `external-validator-slashes` pallet, which allows to slash validators that misbehave. The slashing is triggered when an offence is reported via the offence pallet (which is already implemented). The message is sent through Snowbrige's outbound queue and the real slashing happens in the contracts side, which will come in a follow up PR. There is a configurable window of time between the time the validator is being reported, and the time the slash is triggered. This allows that in case of an error we are still able to cancel the slashing, using a sudo account. For convenience, we also have extrinsics for corner cases: - **`force_inject_slash`**: Root-only function to manually inject slashes for specific validators with custom percentages. Useful for emergency situations or governance-directed slashing outside normal offence detection - **`cancel_deferred_slash`**: Allows governance to cancel pending slashes during the defer period by specifying era and slash indices. Provides safety mechanism against false positives or malicious slash reports - **`set_slashing_mode`**: Configurable slashing behavior with three modes - `Enabled` (normal operation), `LogOnly` (track offences without applying slashes), and `Disabled` (completely halt slashing). Critical for emergency response and testing --------- Co-authored-by: Gonza Montiel <gon.montiel@gmail.com> Co-authored-by: Gonza Montiel <gonzamontiel@users.noreply.github.com>
2025-10-29 10:43:55 +00:00
"pallet-external-validator-slashes/try-runtime",
feat: ✨ Native Token Transfer to Ethereum (#88) ### Summary - Implement native token transfers from DataHaven to Ethereum using Snowbridge infrastructure - Add comprehensive datahaven-native-transfer pallet with lock-and-mint mechanism for cross-chain token representation ### Key Features **New Pallet: datahaven-native-transfer** - Cross-chain transfers: Transfer DataHaven native tokens to Ethereum addresses via `transfer_to_ethereum extrinsic` - Token locking mechanism: Secure token storage in deterministic Ethereum sovereign account during transfers - Fee management: Required fees for all transfers to compensate relayers and prevent spam - Emergency controls: Pause/unpause functionality - Token registration: Integration with Snowbridge's token registration for native token identification <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the DataHaven Native Transfer pallet enabling secure cross-chain transfers of DataHaven native tokens to and from Ethereum via Snowbridge. - Added token locking on DataHaven, minting on Ethereum, and mandatory fee collection to cover gas costs and incentivize relayers. - Implemented pause and unpause controls for emergency management of token transfers. - **Configuration** - Integrated the new pallet into mainnet, stagenet, and testnet runtimes with updated network, account, and treasury settings. - Added Ethereum sovereign account constants and native token ID support for optimized cross-chain operations. - **Documentation** - Added comprehensive README and inline documentation detailing pallet features, extrinsics, events, errors, and security considerations. - **Tests** - Added extensive unit and integration tests covering token transfers, native token registration, fee handling, pause functionality, and event validation across all supported networks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
2025-06-11 22:07:36 +00:00
"pallet-datahaven-native-transfer/try-runtime",
]
fast-runtime = ["datahaven-runtime-common/fast-runtime"]
# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]