mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
## 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>
28 lines
738 B
Rust
28 lines
738 B
Rust
//! Integration tests for DataHaven testnet runtime
|
|
|
|
pub mod common;
|
|
mod native_token_transfer;
|
|
mod proxy;
|
|
|
|
use common::*;
|
|
use datahaven_testnet_runtime::{Balances, System, UNIT, VERSION};
|
|
|
|
// Runtime Tests
|
|
#[test]
|
|
fn test_runtime_version_and_metadata() {
|
|
ExtBuilder::default().build().execute_with(|| {
|
|
assert!(!VERSION.spec_name.is_empty());
|
|
assert!(VERSION.spec_version > 0);
|
|
assert_eq!(System::block_number(), 1);
|
|
});
|
|
}
|
|
|
|
#[test]
|
|
fn test_balances_functionality() {
|
|
ExtBuilder::default()
|
|
.with_balances(vec![(account_id(ALICE), 2_000_000 * UNIT)])
|
|
.build()
|
|
.execute_with(|| {
|
|
assert_eq!(Balances::free_balance(&account_id(ALICE)), 2_000_000 * UNIT);
|
|
});
|
|
}
|