1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>
16

            
17
//! Tests for the Dancelight Runtime Configuration
18

            
19
use {
20
    crate::*, frame_support::traits::WhitelistedStorageKeys, sp_core::hexdisplay::HexDisplay,
21
    std::collections::HashSet,
22
};
23

            
24
mod author_noting_tests;
25
mod beefy;
26
mod bridge_relayers;
27
mod collator_assignment_tests;
28
mod commitment_recorder;
29
mod common;
30
mod container_token_transfers;
31
mod core_scheduling_tests;
32
mod democracy_tracks;
33
mod ethereum_client;
34
mod ethereum_outbound_relayer_rewards;
35
mod ethereum_system_v2;
36
mod ethereum_token_transfers;
37
mod ethereum_token_transfers_v2;
38
mod external_validator_rewards_tests;
39
mod external_validators_tests;
40
mod inactivity_tracking;
41
mod inbound_queue_tests;
42
mod inbound_queue_v2_tests;
43
mod inflation_rates;
44
mod inflation_rewards;
45
mod integration_test;
46
mod maintenance_mode;
47
mod migrations_test;
48
mod offline_marking;
49
mod processors;
50
mod relay_configuration;
51
mod relay_registrar;
52
mod services_payment;
53
mod session_keys;
54
mod slashes;
55
mod staking;
56
mod sudo;
57

            
58
#[macro_export]
59
macro_rules! filter_events {
60
    ($pat:pat) => {
61
17
        System::events().iter().filter(|r| match r.event {
62
16
            $pat => true,
63
94
            _ => false,
64
110
        })
65
    };
66
}
67

            
68
#[test]
69
1
fn check_whitelist() {
70
1
    let whitelist: HashSet<String> = AllPalletsWithSystem::whitelisted_storage_keys()
71
1
        .iter()
72
15
        .map(|e| HexDisplay::from(&e.key).to_string())
73
1
        .collect();
74

            
75
    // Block number
76
1
    assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"));
77
    // Total issuance
78
1
    assert!(whitelist.contains("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"));
79
    // Execution phase
80
1
    assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"));
81
    // Event count
82
1
    assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"));
83
    // System events
84
1
    assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"));
85
    // XcmPallet VersionDiscoveryQueue
86
1
    assert!(whitelist.contains("1405f2411d0af5a7ff397e7c9dc68d194a222ba0333561192e474c59ed8e30e1"));
87
    // XcmPallet SafeXcmVersion
88
1
    assert!(whitelist.contains("1405f2411d0af5a7ff397e7c9dc68d196323ae84c43568be0d1394d5d0d522c4"));
89
1
}
90

            
91
#[test]
92
1
fn check_treasury_pallet_id() {
93
1
    assert_eq!(
94
1
        <Treasury as frame_support::traits::PalletInfoAccess>::index() as u8,
95
        dancelight_runtime_constants::TREASURY_PALLET_ID
96
    );
97
1
}