forked from ghostchain/ghost-node
		
	rustfmt service and fix typos
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
		
							parent
							
								
									8f20b7ef5c
								
							
						
					
					
						commit
						48ff511685
					
				@ -17,7 +17,7 @@ homepage.workspace = true
 | 
				
			|||||||
[workspace.package]
 | 
					[workspace.package]
 | 
				
			||||||
license = "GPL-3.0-only"
 | 
					license = "GPL-3.0-only"
 | 
				
			||||||
authors = ["571nky", "57r37ch", "f4750"]
 | 
					authors = ["571nky", "57r37ch", "f4750"]
 | 
				
			||||||
version = "0.7.206"
 | 
					version = "0.7.207"
 | 
				
			||||||
edition = "2021"
 | 
					edition = "2021"
 | 
				
			||||||
homepage = "https://ghostchain.io"
 | 
					homepage = "https://ghostchain.io"
 | 
				
			||||||
repository = "https://git.ghostchain.io/ghostchain/ghost-node"
 | 
					repository = "https://git.ghostchain.io/ghostchain/ghost-node"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					use keyring::Sr25519Keyring;
 | 
				
			||||||
use primitives::AccountId;
 | 
					use primitives::AccountId;
 | 
				
			||||||
use sc_client_api::UsageProvider;
 | 
					use sc_client_api::UsageProvider;
 | 
				
			||||||
use sp_runtime::OpaqueExtrinsic;
 | 
					use sp_runtime::OpaqueExtrinsic;
 | 
				
			||||||
use keyring::Sr25519Keyring;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::*;
 | 
					use crate::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -21,27 +21,41 @@ macro_rules! identify_chain {
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                    use ghost_runtime as runtime;
 | 
					                    use ghost_runtime as runtime;
 | 
				
			||||||
                    let call = $generic_code;
 | 
					                    let call = $generic_code;
 | 
				
			||||||
                    Ok(ghost_sign_call(call, $nonce, $current_block, $period, $genesis, $signer))
 | 
					                    Ok(ghost_sign_call(
 | 
				
			||||||
 | 
					                        call,
 | 
				
			||||||
 | 
					                        $nonce,
 | 
				
			||||||
 | 
					                        $current_block,
 | 
				
			||||||
 | 
					                        $period,
 | 
				
			||||||
 | 
					                        $genesis,
 | 
				
			||||||
 | 
					                        $signer,
 | 
				
			||||||
 | 
					                    ))
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                #[cfg(not(feature = "ghost-native"))]
 | 
					                #[cfg(not(feature = "ghost-native"))]
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Err("`ghost-native` feature not enabled")
 | 
					                    Err("`ghost-native` feature not enabled")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            }
 | 
				
			||||||
            Chain::Casper => {
 | 
					            Chain::Casper => {
 | 
				
			||||||
                #[cfg(feature = "casper-native")]
 | 
					                #[cfg(feature = "casper-native")]
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    use casper_runtime as runtime;
 | 
					                    use casper_runtime as runtime;
 | 
				
			||||||
                    let call = $generic_code;
 | 
					                    let call = $generic_code;
 | 
				
			||||||
                    Ok(casper_sign_call(call, $nonce, $current_block, $period, $genesis, $signer))
 | 
					                    Ok(casper_sign_call(
 | 
				
			||||||
 | 
					                        call,
 | 
				
			||||||
 | 
					                        $nonce,
 | 
				
			||||||
 | 
					                        $current_block,
 | 
				
			||||||
 | 
					                        $period,
 | 
				
			||||||
 | 
					                        $genesis,
 | 
				
			||||||
 | 
					                        $signer,
 | 
				
			||||||
 | 
					                    ))
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                #[cfg(not(feature = "casper-native"))]
 | 
					                #[cfg(not(feature = "casper-native"))]
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Err("`casper-native` feature not enabled")
 | 
					                    Err("`casper-native` feature not enabled")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            }
 | 
				
			||||||
            Chain::Unknown => {
 | 
					            Chain::Unknown => {
 | 
				
			||||||
                let _ = $nonce;
 | 
					                let _ = $nonce;
 | 
				
			||||||
                let _ = $current_block;
 | 
					                let _ = $current_block;
 | 
				
			||||||
@ -50,7 +64,7 @@ macro_rules! identify_chain {
 | 
				
			|||||||
                let _ = $signer;
 | 
					                let _ = $signer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Err("Unknown chain")
 | 
					                Err("Unknown chain")
 | 
				
			||||||
            },
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -105,7 +119,11 @@ pub struct TransferKeepAliveBuilder {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl TransferKeepAliveBuilder {
 | 
					impl TransferKeepAliveBuilder {
 | 
				
			||||||
    pub fn new(client: Arc<FullClient>, dest: AccountId, chain: Chain) -> Self {
 | 
					    pub fn new(client: Arc<FullClient>, dest: AccountId, chain: Chain) -> Self {
 | 
				
			||||||
        Self { client, dest, chain }
 | 
					        Self {
 | 
				
			||||||
 | 
					            client,
 | 
				
			||||||
 | 
					            dest,
 | 
				
			||||||
 | 
					            chain,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -159,10 +177,9 @@ fn casper_sign_call(
 | 
				
			|||||||
        frame_system::CheckSpecVersion::<casper_runtime::Runtime>::new(),
 | 
					        frame_system::CheckSpecVersion::<casper_runtime::Runtime>::new(),
 | 
				
			||||||
        frame_system::CheckTxVersion::<casper_runtime::Runtime>::new(),
 | 
					        frame_system::CheckTxVersion::<casper_runtime::Runtime>::new(),
 | 
				
			||||||
        frame_system::CheckGenesis::<casper_runtime::Runtime>::new(),
 | 
					        frame_system::CheckGenesis::<casper_runtime::Runtime>::new(),
 | 
				
			||||||
        frame_system::CheckMortality::<casper_runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
 | 
					        frame_system::CheckMortality::<casper_runtime::Runtime>::from(
 | 
				
			||||||
            period,
 | 
					            sp_runtime::generic::Era::mortal(period, current_block),
 | 
				
			||||||
            current_block,
 | 
					        ),
 | 
				
			||||||
        )),
 | 
					 | 
				
			||||||
        frame_system::CheckNonce::<casper_runtime::Runtime>::from(nonce),
 | 
					        frame_system::CheckNonce::<casper_runtime::Runtime>::from(nonce),
 | 
				
			||||||
        frame_system::CheckWeight::<casper_runtime::Runtime>::new(),
 | 
					        frame_system::CheckWeight::<casper_runtime::Runtime>::new(),
 | 
				
			||||||
        pallet_transaction_payment::ChargeTransactionPayment::<casper_runtime::Runtime>::from(0),
 | 
					        pallet_transaction_payment::ChargeTransactionPayment::<casper_runtime::Runtime>::from(0),
 | 
				
			||||||
@ -189,7 +206,8 @@ fn casper_sign_call(
 | 
				
			|||||||
        sp_runtime::AccountId32::from(acc.public()).into(),
 | 
					        sp_runtime::AccountId32::from(acc.public()).into(),
 | 
				
			||||||
        primitives::Signature::Sr25519(signature),
 | 
					        primitives::Signature::Sr25519(signature),
 | 
				
			||||||
        extra,
 | 
					        extra,
 | 
				
			||||||
    ).into()
 | 
					    )
 | 
				
			||||||
 | 
					    .into()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn benchmark_inherent_data() -> std::result::Result<inherents::InherentData, inherents::Error> {
 | 
					pub fn benchmark_inherent_data() -> std::result::Result<inherents::InherentData, inherents::Error> {
 | 
				
			||||||
 | 
				
			|||||||
@ -2,13 +2,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use codec::Encode;
 | 
					use codec::Encode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
 | 
					 | 
				
			||||||
use primitives::{AccountId, AccountPublic};
 | 
					 | 
				
			||||||
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
 | 
					use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
 | 
				
			||||||
use grandpa_primitives::AuthorityId as GrandpaId;
 | 
					 | 
				
			||||||
use babe_primitives::AuthorityId as BabeId;
 | 
					use babe_primitives::AuthorityId as BabeId;
 | 
				
			||||||
 | 
					use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
 | 
				
			||||||
 | 
					use grandpa_primitives::AuthorityId as GrandpaId;
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
use pallet_staking::Forcing;
 | 
					use pallet_staking::Forcing;
 | 
				
			||||||
 | 
					use primitives::{AccountId, AccountPublic};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
use casper_runtime as casper;
 | 
					use casper_runtime as casper;
 | 
				
			||||||
@ -76,7 +76,6 @@ fn casper_session_keys(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
pub fn casper_chain_spec_properties() -> serde_json::map::Map<String, serde_json::Value> {
 | 
					pub fn casper_chain_spec_properties() -> serde_json::map::Map<String, serde_json::Value> {
 | 
				
			||||||
    serde_json::json!({
 | 
					    serde_json::json!({
 | 
				
			||||||
        "ss58Format": 1996,
 | 
					        "ss58Format": 1996,
 | 
				
			||||||
@ -161,20 +160,37 @@ fn casper_testnet_accounts() -> Vec<AccountId> {
 | 
				
			|||||||
fn casper_testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> {
 | 
					fn casper_testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> {
 | 
				
			||||||
    vec![
 | 
					    vec![
 | 
				
			||||||
        // 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198
 | 
					        // 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198
 | 
				
			||||||
        (get_account_id_from_seed::<sr25519::Public>("1A69d2D5568D1878023EeB121a73d33B9116A760"), 1337 * CSPR, 1), 
 | 
					        (
 | 
				
			||||||
 | 
					            get_account_id_from_seed::<sr25519::Public>("1A69d2D5568D1878023EeB121a73d33B9116A760"),
 | 
				
			||||||
 | 
					            1337 * CSPR,
 | 
				
			||||||
 | 
					            1,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
        // b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139
 | 
					        // b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139
 | 
				
			||||||
        (get_account_id_from_seed::<sr25519::Public>("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"), 1337 * CSPR, 2), 
 | 
					        (
 | 
				
			||||||
 | 
					            get_account_id_from_seed::<sr25519::Public>("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"),
 | 
				
			||||||
 | 
					            1337 * CSPR,
 | 
				
			||||||
 | 
					            2,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
        // d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc
 | 
					        // d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc
 | 
				
			||||||
        (get_account_id_from_seed::<sr25519::Public>("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"), 69   * CSPR, 3), 
 | 
					        (
 | 
				
			||||||
 | 
					            get_account_id_from_seed::<sr25519::Public>("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"),
 | 
				
			||||||
 | 
					            69 * CSPR,
 | 
				
			||||||
 | 
					            3,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
        // c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4
 | 
					        // c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4
 | 
				
			||||||
        (get_account_id_from_seed::<sr25519::Public>("827ee4ad9b259b6fa1390ed60921508c78befd63"), 69   * CSPR, 4), 
 | 
					        (
 | 
				
			||||||
 | 
					            get_account_id_from_seed::<sr25519::Public>("827ee4ad9b259b6fa1390ed60921508c78befd63"),
 | 
				
			||||||
 | 
					            69 * CSPR,
 | 
				
			||||||
 | 
					            4,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
 | 
					fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
 | 
				
			||||||
    vec![
 | 
					    vec![(
 | 
				
			||||||
        (11155111, ghost_networks::NetworkData {
 | 
					        11155111,
 | 
				
			||||||
 | 
					        ghost_networks::NetworkData {
 | 
				
			||||||
            chain_name: "sepolia-ethereum-testnet".into(),
 | 
					            chain_name: "sepolia-ethereum-testnet".into(),
 | 
				
			||||||
            default_endpoints: vec![
 | 
					            default_endpoints: vec![
 | 
				
			||||||
                "https://sepolia.drpc.org".into(),
 | 
					                "https://sepolia.drpc.org".into(),
 | 
				
			||||||
@ -195,8 +211,9 @@ fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
 | 
				
			|||||||
            topic_name: "0x7ab52ec05c331e6257a3d705d6bea6e4c27277351764ad139209e06b203811a6".into(),
 | 
					            topic_name: "0x7ab52ec05c331e6257a3d705d6bea6e4c27277351764ad139209e06b203811a6".into(),
 | 
				
			||||||
            incoming_fee: 69_000_000u32,
 | 
					            incoming_fee: 69_000_000u32,
 | 
				
			||||||
            outgoing_fee: 0u32,
 | 
					            outgoing_fee: 0u32,
 | 
				
			||||||
        }.encode()),
 | 
					        }
 | 
				
			||||||
    ]
 | 
					        .encode(),
 | 
				
			||||||
 | 
					    )]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Helper function to create casper `GenesisConfig` for testing
 | 
					/// Helper function to create casper `GenesisConfig` for testing
 | 
				
			||||||
@ -214,14 +231,11 @@ pub fn testnet_config_genesis(
 | 
				
			|||||||
    ghost_accounts: Option<Vec<(AccountId, u128, u8)>>,
 | 
					    ghost_accounts: Option<Vec<(AccountId, u128, u8)>>,
 | 
				
			||||||
    evm_networks: Option<Vec<(u32, Vec<u8>)>>,
 | 
					    evm_networks: Option<Vec<(u32, Vec<u8>)>>,
 | 
				
			||||||
) -> serde_json::Value {
 | 
					) -> serde_json::Value {
 | 
				
			||||||
    let endowed_accounts: Vec<AccountId> = endowed_accounts
 | 
					    let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(casper_testnet_accounts);
 | 
				
			||||||
        .unwrap_or_else(casper_testnet_accounts);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let ghost_accounts: Vec<(AccountId, u128, u8)> = ghost_accounts
 | 
					    let ghost_accounts: Vec<(AccountId, u128, u8)> = ghost_accounts.unwrap_or_default();
 | 
				
			||||||
        .unwrap_or_default();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let evm_networks: Vec<(u32, Vec<u8>)> = evm_networks
 | 
					    let evm_networks: Vec<(u32, Vec<u8>)> = evm_networks.unwrap_or_default();
 | 
				
			||||||
        .unwrap_or_default();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const ENDOWMENT: u128 = 1_000 * CSPR;
 | 
					    const ENDOWMENT: u128 = 1_000 * CSPR;
 | 
				
			||||||
    const STASH: u128 = 500 * CSPR;
 | 
					    const STASH: u128 = 500 * CSPR;
 | 
				
			||||||
@ -320,13 +334,17 @@ fn casper_staging_config_genesis() -> serde_json::Value {
 | 
				
			|||||||
            // sfFXZmnDVnkQ781J2gbqUpi7K5KgMWMdM4eeii74xxGgKYnNN
 | 
					            // sfFXZmnDVnkQ781J2gbqUpi7K5KgMWMdM4eeii74xxGgKYnNN
 | 
				
			||||||
            hex!["507045c82be367f95408466cd054ca39bfa52697a3ef22809af14cf9de304f02"].into(),
 | 
					            hex!["507045c82be367f95408466cd054ca39bfa52697a3ef22809af14cf9de304f02"].into(),
 | 
				
			||||||
            // sfJeojACBa7WiH6tBwikBKAMU2oKmseEBD1GYUYATvfWuLcPa
 | 
					            // sfJeojACBa7WiH6tBwikBKAMU2oKmseEBD1GYUYATvfWuLcPa
 | 
				
			||||||
            hex!["daaaaab6a6e574099e24ae9bb75b543610edef9d374fa85a378edb573b47615f"].unchecked_into(),
 | 
					            hex!["daaaaab6a6e574099e24ae9bb75b543610edef9d374fa85a378edb573b47615f"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfFdtzNxJdeEkgHxvk144rJKxf7wcYvgX5tqfgZRutW9YvAKE
 | 
					            // sfFdtzNxJdeEkgHxvk144rJKxf7wcYvgX5tqfgZRutW9YvAKE
 | 
				
			||||||
            hex!["55446f9a7aa99ced06b317c80ce90d56b84e56526775683af2525969e8da0b64"].unchecked_into(),
 | 
					            hex!["55446f9a7aa99ced06b317c80ce90d56b84e56526775683af2525969e8da0b64"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfE8gsMYAjAJHk5gyYZN7AW6pfmJ7V9H7xxWto24nmhzCUXaQ
 | 
					            // sfE8gsMYAjAJHk5gyYZN7AW6pfmJ7V9H7xxWto24nmhzCUXaQ
 | 
				
			||||||
            hex!["12c14850562021eb99f58f90ab624fb6cfaf3ac9228a92f8b60115fe6a6af15a"].unchecked_into(),
 | 
					            hex!["12c14850562021eb99f58f90ab624fb6cfaf3ac9228a92f8b60115fe6a6af15a"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfE3GKSrKZzrZpdapJ2VGRpPor45T4D4i8QBZNumSNGqGv7PX
 | 
					            // sfE3GKSrKZzrZpdapJ2VGRpPor45T4D4i8QBZNumSNGqGv7PX
 | 
				
			||||||
            hex!["0e9e698c7b2bf5ce3861cb4bc4ddf9e200237c282025b093ada850d764d12a35"].unchecked_into(),
 | 
					            hex!["0e9e698c7b2bf5ce3861cb4bc4ddf9e200237c282025b093ada850d764d12a35"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
            // sfHLqWNC4hMKHhwvPWmWcxZsDPhCTQKgh1Ap7pm3qML5GBTBa
 | 
					            // sfHLqWNC4hMKHhwvPWmWcxZsDPhCTQKgh1Ap7pm3qML5GBTBa
 | 
				
			||||||
@ -334,13 +352,17 @@ fn casper_staging_config_genesis() -> serde_json::Value {
 | 
				
			|||||||
            // sfHLqWNC4hMKHhwvPWmWcxZsDPhCTQKgh1Ap7pm3qML5GBTBa
 | 
					            // sfHLqWNC4hMKHhwvPWmWcxZsDPhCTQKgh1Ap7pm3qML5GBTBa
 | 
				
			||||||
            hex!["a0ba0196e6ee7e6b5b0553035c5cb5c04e9725001b5732839d0529cbc00c9600"].into(),
 | 
					            hex!["a0ba0196e6ee7e6b5b0553035c5cb5c04e9725001b5732839d0529cbc00c9600"].into(),
 | 
				
			||||||
            // sfGA6tPPF8dAc8QpMCMjxitG3j8sXPhkdpm5bwz4UsXAApUiw
 | 
					            // sfGA6tPPF8dAc8QpMCMjxitG3j8sXPhkdpm5bwz4UsXAApUiw
 | 
				
			||||||
            hex!["6c4dd88b43e2011cf9a6a73d53446336ac9e04cdd4ca23587df63187ac455e49"].unchecked_into(),
 | 
					            hex!["6c4dd88b43e2011cf9a6a73d53446336ac9e04cdd4ca23587df63187ac455e49"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfGxQZXFUQH1AXv82rpjiJHFs7YsdEuVGdyvKiS2Tajpvw6Se
 | 
					            // sfGxQZXFUQH1AXv82rpjiJHFs7YsdEuVGdyvKiS2Tajpvw6Se
 | 
				
			||||||
            hex!["8f9ea20bf4a807a8e710f7559dece86e94672b5b361de157bdaa5c1f37849f8d"].unchecked_into(),
 | 
					            hex!["8f9ea20bf4a807a8e710f7559dece86e94672b5b361de157bdaa5c1f37849f8d"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfGz2enFUR22cQ5ey61MdtPqbCeEWZA1wsCFFSLGaK7vKnv8C
 | 
					            // sfGz2enFUR22cQ5ey61MdtPqbCeEWZA1wsCFFSLGaK7vKnv8C
 | 
				
			||||||
            hex!["90db5ed339a559ed157995a48d781f44c7df972dfba4bc855e4b59fa46438e17"].unchecked_into(),
 | 
					            hex!["90db5ed339a559ed157995a48d781f44c7df972dfba4bc855e4b59fa46438e17"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfEtwe5BoroNjkdLsvnjnMemUKiw8MS1X4YW8bepbbGvhS4LZ
 | 
					            // sfEtwe5BoroNjkdLsvnjnMemUKiw8MS1X4YW8bepbbGvhS4LZ
 | 
				
			||||||
            hex!["3481cdcbcf37a4669c29a78cf9ceb39383a10ef0a18b36b92d149fdd0c24ae00"].unchecked_into(),
 | 
					            hex!["3481cdcbcf37a4669c29a78cf9ceb39383a10ef0a18b36b92d149fdd0c24ae00"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
            // sfG9iWUS7AKBzvqdz3uDZv7f1t79vvSTYL1VxzYPHjhmLnQVn
 | 
					            // sfG9iWUS7AKBzvqdz3uDZv7f1t79vvSTYL1VxzYPHjhmLnQVn
 | 
				
			||||||
@ -348,13 +370,17 @@ fn casper_staging_config_genesis() -> serde_json::Value {
 | 
				
			|||||||
            // sfG9iWUS7AKBzvqdz3uDZv7f1t79vvSTYL1VxzYPHjhmLnQVn
 | 
					            // sfG9iWUS7AKBzvqdz3uDZv7f1t79vvSTYL1VxzYPHjhmLnQVn
 | 
				
			||||||
            hex!["6c0283f4c688f0e75ad546c790bbd5961c1a6931543aa589f368f8272c44b758"].into(),
 | 
					            hex!["6c0283f4c688f0e75ad546c790bbd5961c1a6931543aa589f368f8272c44b758"].into(),
 | 
				
			||||||
            // sfGMUYXSjHgwGBpbGiHFoqT1DdJwZdHk49H5ViaQM7HUnayvZ
 | 
					            // sfGMUYXSjHgwGBpbGiHFoqT1DdJwZdHk49H5ViaQM7HUnayvZ
 | 
				
			||||||
            hex!["74fa7381a7a74b316afb6793a00387eed9d95d46a69866cbb316b5d9c918af0e"].unchecked_into(),
 | 
					            hex!["74fa7381a7a74b316afb6793a00387eed9d95d46a69866cbb316b5d9c918af0e"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfEWYhczV6PbmeNXZTcA4LvhpzvCfNMatYoSNKvDphmNaQzqB
 | 
					            // sfEWYhczV6PbmeNXZTcA4LvhpzvCfNMatYoSNKvDphmNaQzqB
 | 
				
			||||||
            hex!["236d2fa03f4ed8cb65de7e514d7540159b328f1c170dd402b094ad7fbf547218"].unchecked_into(),
 | 
					            hex!["236d2fa03f4ed8cb65de7e514d7540159b328f1c170dd402b094ad7fbf547218"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfDirg32ityDvrjxh4822unhP4qm4S9yTqN99gesN322swn7h
 | 
					            // sfDirg32ityDvrjxh4822unhP4qm4S9yTqN99gesN322swn7h
 | 
				
			||||||
            hex!["00946618c353e4c6546b87f9ca1089b846b0ea4658ee8e6d9d1200c24cb5ee27"].unchecked_into(),
 | 
					            hex!["00946618c353e4c6546b87f9ca1089b846b0ea4658ee8e6d9d1200c24cb5ee27"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfFZgp1Z5diFAZ16swuQD5GojGCsMMFVR19uWnCrppMLuYjRv
 | 
					            // sfFZgp1Z5diFAZ16swuQD5GojGCsMMFVR19uWnCrppMLuYjRv
 | 
				
			||||||
            hex!["520e74f8c5853ec8577932327ad3247656db25b74c79ad09adb431b271002401"].unchecked_into(),
 | 
					            hex!["520e74f8c5853ec8577932327ad3247656db25b74c79ad09adb431b271002401"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
            // sfHjtrXFzRmxwjE4rjVxFJXpvVv7furjdymZS7PQRFiANpodz
 | 
					            // sfHjtrXFzRmxwjE4rjVxFJXpvVv7furjdymZS7PQRFiANpodz
 | 
				
			||||||
@ -362,13 +388,17 @@ fn casper_staging_config_genesis() -> serde_json::Value {
 | 
				
			|||||||
            // sfHjtrXFzRmxwjE4rjVxFJXpvVv7furjdymZS7PQRFiANpodz
 | 
					            // sfHjtrXFzRmxwjE4rjVxFJXpvVv7furjdymZS7PQRFiANpodz
 | 
				
			||||||
            hex!["b24feb55b2cac4b365a9245c2a97525b01bd1a594d2d42b91f6bc38c9c2e6517"].into(),
 | 
					            hex!["b24feb55b2cac4b365a9245c2a97525b01bd1a594d2d42b91f6bc38c9c2e6517"].into(),
 | 
				
			||||||
            // sfF5XWwvNPjZEsBz1HWs5Ys5zcE85UHnN1BV8TBBectqFQZRm
 | 
					            // sfF5XWwvNPjZEsBz1HWs5Ys5zcE85UHnN1BV8TBBectqFQZRm
 | 
				
			||||||
            hex!["3c944c704cae203619b9e7a5a4b6742736da6a8e76c762291bebdc7652cfec2f"].unchecked_into(),
 | 
					            hex!["3c944c704cae203619b9e7a5a4b6742736da6a8e76c762291bebdc7652cfec2f"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfDx3gj4wFHg3cK6bopnypHQ6TxW1VgyPsYVbXKhRHtLDLxQb
 | 
					            // sfDx3gj4wFHg3cK6bopnypHQ6TxW1VgyPsYVbXKhRHtLDLxQb
 | 
				
			||||||
            hex!["0aa3a88f6b777c95c3dfe7e997b76798413f16aa325f34824cae0c9102b281d5"].unchecked_into(),
 | 
					            hex!["0aa3a88f6b777c95c3dfe7e997b76798413f16aa325f34824cae0c9102b281d5"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfHXZbnZV3YWwnH28q2xumm7stvuC8LweYYxPNuHGonnX7QHL
 | 
					            // sfHXZbnZV3YWwnH28q2xumm7stvuC8LweYYxPNuHGonnX7QHL
 | 
				
			||||||
            hex!["a8e828d10cf7b74481b6e746e5532d4740ea8014a0d3d856540a59847f8a6b76"].unchecked_into(),
 | 
					            hex!["a8e828d10cf7b74481b6e746e5532d4740ea8014a0d3d856540a59847f8a6b76"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
            // sfEaHBrBgeMhRTA3WHE9Nbyvn3h7xkhYKi7go4yo81L88o9zJ
 | 
					            // sfEaHBrBgeMhRTA3WHE9Nbyvn3h7xkhYKi7go4yo81L88o9zJ
 | 
				
			||||||
            hex!["2645f1f6820dd3a917eebbdab033088d8862477c1c14759b218685f9a0893377"].unchecked_into(),
 | 
					            hex!["2645f1f6820dd3a917eebbdab033088d8862477c1c14759b218685f9a0893377"]
 | 
				
			||||||
 | 
					                .unchecked_into(),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -449,7 +479,9 @@ fn casper_staging_config_genesis() -> serde_json::Value {
 | 
				
			|||||||
fn casper_development_config_genesis() -> serde_json::Value {
 | 
					fn casper_development_config_genesis() -> serde_json::Value {
 | 
				
			||||||
    testnet_config_genesis(
 | 
					    testnet_config_genesis(
 | 
				
			||||||
        vec![get_authority_keys_from_seed("Alice")],
 | 
					        vec![get_authority_keys_from_seed("Alice")],
 | 
				
			||||||
        None, None, None,
 | 
					        None,
 | 
				
			||||||
 | 
					        None,
 | 
				
			||||||
 | 
					        None,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,15 +7,15 @@ pub mod chain_spec;
 | 
				
			|||||||
use {
 | 
					use {
 | 
				
			||||||
    grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider},
 | 
					    grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider},
 | 
				
			||||||
    sc_client_api::BlockBackend,
 | 
					    sc_client_api::BlockBackend,
 | 
				
			||||||
    tx_pool_api::OffchainTransactionPoolFactory,
 | 
					 | 
				
			||||||
    sp_blockchain::HeaderBackend,
 | 
					 | 
				
			||||||
    sc_service::{KeystoreContainer, RpcHandlers},
 | 
					    sc_service::{KeystoreContainer, RpcHandlers},
 | 
				
			||||||
 | 
					    sp_blockchain::HeaderBackend,
 | 
				
			||||||
    telemetry::{Telemetry, TelemetryWorkerHandle},
 | 
					    telemetry::{Telemetry, TelemetryWorkerHandle},
 | 
				
			||||||
 | 
					    tx_pool_api::OffchainTransactionPoolFactory,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
 | 
				
			||||||
use std::{sync::Arc, time::Duration};
 | 
					use std::{sync::Arc, time::Duration};
 | 
				
			||||||
use telemetry::TelemetryWorker;
 | 
					use telemetry::TelemetryWorker;
 | 
				
			||||||
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub use chain_spec::GenericChainSpec;
 | 
					pub use chain_spec::GenericChainSpec;
 | 
				
			||||||
pub use consensus_common::{Proposal, SelectChain};
 | 
					pub use consensus_common::{Proposal, SelectChain};
 | 
				
			||||||
@ -23,27 +23,23 @@ pub use primitives::{Block, BlockId, BlockNumber, Hash};
 | 
				
			|||||||
pub use sc_client_api::{Backend, CallExecutor};
 | 
					pub use sc_client_api::{Backend, CallExecutor};
 | 
				
			||||||
pub use sc_consensus::BlockImport;
 | 
					pub use sc_consensus::BlockImport;
 | 
				
			||||||
pub use sc_executor::NativeExecutionDispatch;
 | 
					pub use sc_executor::NativeExecutionDispatch;
 | 
				
			||||||
pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi};
 | 
					 | 
				
			||||||
pub use sc_service::{
 | 
					pub use sc_service::{
 | 
				
			||||||
    config::{DatabaseSource, PrometheusConfig},
 | 
					    config::{DatabaseSource, PrometheusConfig},
 | 
				
			||||||
    ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role,
 | 
					    ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, RuntimeGenesis,
 | 
				
			||||||
    RuntimeGenesis, TFullBackend, TFullCallExecutor, TFullClient, TaskManager,
 | 
					    TFullBackend, TFullCallExecutor, TFullClient, TaskManager, TransactionPoolOptions,
 | 
				
			||||||
    TransactionPoolOptions,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi};
 | 
				
			||||||
pub use sp_runtime::{
 | 
					pub use sp_runtime::{
 | 
				
			||||||
    generic,
 | 
					    generic,
 | 
				
			||||||
    traits::{
 | 
					    traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, Header as HeaderT, NumberFor},
 | 
				
			||||||
        self as runtime_traits, BlakeTwo256, Block as BlockT, Header as HeaderT,
 | 
					 | 
				
			||||||
        NumberFor,
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
 | 
					use casper_runtime::RuntimeApi;
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
pub use chain_spec::CasperChainSpec;
 | 
					pub use chain_spec::CasperChainSpec;
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					#[cfg(feature = "casper-native")]
 | 
				
			||||||
pub use {casper_runtime, casper_runtime_constants};
 | 
					pub use {casper_runtime, casper_runtime_constants};
 | 
				
			||||||
#[cfg(feature = "casper-native")]
 | 
					 | 
				
			||||||
use casper_runtime::RuntimeApi;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(feature = "full-node")]
 | 
					#[cfg(feature = "full-node")]
 | 
				
			||||||
pub type FullBackend = sc_service::TFullBackend<Block>;
 | 
					pub type FullBackend = sc_service::TFullBackend<Block>;
 | 
				
			||||||
@ -177,9 +173,13 @@ impl IdentifyVariant for Box<dyn ChainSpec> {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn identify_chain(&self) -> Chain {
 | 
					    fn identify_chain(&self) -> Chain {
 | 
				
			||||||
        if self.is_ghost() { Chain::Ghost }
 | 
					        if self.is_ghost() {
 | 
				
			||||||
        else if self.is_casper() { Chain::Casper }
 | 
					            Chain::Ghost
 | 
				
			||||||
        else { Chain::Unknown }
 | 
					        } else if self.is_casper() {
 | 
				
			||||||
 | 
					            Chain::Casper
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            Chain::Unknown
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -222,7 +222,9 @@ fn new_partial_basics(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    let heap_pages = config
 | 
					    let heap_pages = config
 | 
				
			||||||
        .default_heap_pages
 | 
					        .default_heap_pages
 | 
				
			||||||
        .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ });
 | 
					        .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
 | 
				
			||||||
 | 
					            extra_pages: h as _,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let executor = WasmExecutor::builder()
 | 
					    let executor = WasmExecutor::builder()
 | 
				
			||||||
        .with_execution_method(config.wasm_method)
 | 
					        .with_execution_method(config.wasm_method)
 | 
				
			||||||
@ -251,13 +253,25 @@ fn new_partial_basics(
 | 
				
			|||||||
        telemetry
 | 
					        telemetry
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ok(Basics { task_manager, client, backend, keystore_container, telemetry })
 | 
					    Ok(Basics {
 | 
				
			||||||
 | 
					        task_manager,
 | 
				
			||||||
 | 
					        client,
 | 
				
			||||||
 | 
					        backend,
 | 
				
			||||||
 | 
					        keystore_container,
 | 
				
			||||||
 | 
					        telemetry,
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(feature = "full-node")]
 | 
					#[cfg(feature = "full-node")]
 | 
				
			||||||
fn new_partial<ChainSelection>(
 | 
					fn new_partial<ChainSelection>(
 | 
				
			||||||
    config: &mut Configuration,
 | 
					    config: &mut Configuration,
 | 
				
			||||||
    Basics { task_manager, backend, client, keystore_container, telemetry }: Basics,
 | 
					    Basics {
 | 
				
			||||||
 | 
					        task_manager,
 | 
				
			||||||
 | 
					        backend,
 | 
				
			||||||
 | 
					        client,
 | 
				
			||||||
 | 
					        keystore_container,
 | 
				
			||||||
 | 
					        telemetry,
 | 
				
			||||||
 | 
					    }: Basics,
 | 
				
			||||||
    select_chain: ChainSelection,
 | 
					    select_chain: ChainSelection,
 | 
				
			||||||
) -> Result<
 | 
					) -> Result<
 | 
				
			||||||
    sc_service::PartialComponents<
 | 
					    sc_service::PartialComponents<
 | 
				
			||||||
@ -272,11 +286,7 @@ fn new_partial<ChainSelection>(
 | 
				
			|||||||
                ghost_rpc::SubscriptionTaskExecutor,
 | 
					                ghost_rpc::SubscriptionTaskExecutor,
 | 
				
			||||||
            ) -> Result<ghost_rpc::RpcExtension, SubstrateServiceError>,
 | 
					            ) -> Result<ghost_rpc::RpcExtension, SubstrateServiceError>,
 | 
				
			||||||
            (
 | 
					            (
 | 
				
			||||||
                babe::BabeBlockImport<
 | 
					                babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport<ChainSelection>>,
 | 
				
			||||||
                    Block,
 | 
					 | 
				
			||||||
                    FullClient, 
 | 
					 | 
				
			||||||
                    FullGrandpaBlockImport<ChainSelection>,
 | 
					 | 
				
			||||||
                >,
 | 
					 | 
				
			||||||
                grandpa::LinkHalf<Block, FullClient, ChainSelection>,
 | 
					                grandpa::LinkHalf<Block, FullClient, ChainSelection>,
 | 
				
			||||||
                babe::BabeLink<Block>,
 | 
					                babe::BabeLink<Block>,
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
@ -297,8 +307,7 @@ where
 | 
				
			|||||||
        client.clone(),
 | 
					        client.clone(),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let (grandpa_block_import, grandpa_link) =
 | 
					    let (grandpa_block_import, grandpa_link) = grandpa::block_import(
 | 
				
			||||||
        grandpa::block_import(
 | 
					 | 
				
			||||||
        client.clone(),
 | 
					        client.clone(),
 | 
				
			||||||
        GRANDPA_JUSTIFICATION_PERIOD,
 | 
					        GRANDPA_JUSTIFICATION_PERIOD,
 | 
				
			||||||
        &(client.clone() as Arc<_>),
 | 
					        &(client.clone() as Arc<_>),
 | 
				
			||||||
@ -312,8 +321,7 @@ where
 | 
				
			|||||||
        babe::block_import(babe_config.clone(), grandpa_block_import, client.clone())?;
 | 
					        babe::block_import(babe_config.clone(), grandpa_block_import, client.clone())?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let slot_duration = babe_link.config().slot_duration();
 | 
					    let slot_duration = babe_link.config().slot_duration();
 | 
				
			||||||
    let (import_queue, babe_worker_handle) =
 | 
					    let (import_queue, babe_worker_handle) = babe::import_queue(babe::ImportQueueParams {
 | 
				
			||||||
        babe::import_queue(babe::ImportQueueParams {
 | 
					 | 
				
			||||||
        link: babe_link.clone(),
 | 
					        link: babe_link.clone(),
 | 
				
			||||||
        block_import: block_import.clone(),
 | 
					        block_import: block_import.clone(),
 | 
				
			||||||
        justification_import: Some(Box::new(justification_import)),
 | 
					        justification_import: Some(Box::new(justification_import)),
 | 
				
			||||||
@ -353,10 +361,9 @@ where
 | 
				
			|||||||
        let chain_spec = config.chain_spec.cloned_box();
 | 
					        let chain_spec = config.chain_spec.cloned_box();
 | 
				
			||||||
        let backend = backend.clone();
 | 
					        let backend = backend.clone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        move |
 | 
					        move |deny_unsafe,
 | 
				
			||||||
            deny_unsafe, 
 | 
					              subscription_executor: ghost_rpc::SubscriptionTaskExecutor|
 | 
				
			||||||
            subscription_executor: ghost_rpc::SubscriptionTaskExecutor,
 | 
					              -> Result<ghost_rpc::RpcExtension, sc_service::Error> {
 | 
				
			||||||
        | -> Result<ghost_rpc::RpcExtension, sc_service::Error> {
 | 
					 | 
				
			||||||
            let deps = ghost_rpc::FullDeps {
 | 
					            let deps = ghost_rpc::FullDeps {
 | 
				
			||||||
                client: client.clone(),
 | 
					                client: client.clone(),
 | 
				
			||||||
                pool: transaction_pool.clone(),
 | 
					                pool: transaction_pool.clone(),
 | 
				
			||||||
@ -428,8 +435,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
    let backoff_authoring_blocks = if !force_authoring_backoff {
 | 
					    let backoff_authoring_blocks = if !force_authoring_backoff {
 | 
				
			||||||
        None
 | 
					        None
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        let mut backoff =
 | 
					        let mut backoff = sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default();
 | 
				
			||||||
            sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if config.chain_spec.is_dev() {
 | 
					        if config.chain_spec.is_dev() {
 | 
				
			||||||
            backoff.max_interval = 10;
 | 
					            backoff.max_interval = 10;
 | 
				
			||||||
@ -446,7 +452,14 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
    let prometheus_registry = config.prometheus_registry().cloned();
 | 
					    let prometheus_registry = config.prometheus_registry().cloned();
 | 
				
			||||||
    let select_chain = sc_consensus::LongestChain::new(basics.backend.clone());
 | 
					    let select_chain = sc_consensus::LongestChain::new(basics.backend.clone());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let sc_service::PartialComponents::<_, _, sc_consensus::LongestChain<FullBackend, Block>, _, _, _,> {
 | 
					    let sc_service::PartialComponents::<
 | 
				
			||||||
 | 
					        _,
 | 
				
			||||||
 | 
					        _,
 | 
				
			||||||
 | 
					        sc_consensus::LongestChain<FullBackend, Block>,
 | 
				
			||||||
 | 
					        _,
 | 
				
			||||||
 | 
					        _,
 | 
				
			||||||
 | 
					        _,
 | 
				
			||||||
 | 
					    > {
 | 
				
			||||||
        client,
 | 
					        client,
 | 
				
			||||||
        backend,
 | 
					        backend,
 | 
				
			||||||
        mut task_manager,
 | 
					        mut task_manager,
 | 
				
			||||||
@ -454,12 +467,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
        select_chain,
 | 
					        select_chain,
 | 
				
			||||||
        import_queue,
 | 
					        import_queue,
 | 
				
			||||||
        transaction_pool,
 | 
					        transaction_pool,
 | 
				
			||||||
        other: (
 | 
					        other: (rpc_extensions_builder, import_setup, rpc_setup, mut telemetry),
 | 
				
			||||||
            rpc_extensions_builder, 
 | 
					 | 
				
			||||||
            import_setup, 
 | 
					 | 
				
			||||||
            rpc_setup, 
 | 
					 | 
				
			||||||
            mut telemetry,
 | 
					 | 
				
			||||||
        ),
 | 
					 | 
				
			||||||
    } = new_partial::<sc_consensus::LongestChain<FullBackend, Block>>(
 | 
					    } = new_partial::<sc_consensus::LongestChain<FullBackend, Block>>(
 | 
				
			||||||
        &mut config,
 | 
					        &mut config,
 | 
				
			||||||
        basics,
 | 
					        basics,
 | 
				
			||||||
@ -476,7 +484,11 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
    let mut net_config =
 | 
					    let mut net_config =
 | 
				
			||||||
        sc_network::config::FullNetworkConfiguration::<_, _, Network>::new(&config.network);
 | 
					        sc_network::config::FullNetworkConfiguration::<_, _, Network>::new(&config.network);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
 | 
					    let genesis_hash = client
 | 
				
			||||||
 | 
					        .block_hash(0)
 | 
				
			||||||
 | 
					        .ok()
 | 
				
			||||||
 | 
					        .flatten()
 | 
				
			||||||
 | 
					        .expect("Genesis block exists; qed");
 | 
				
			||||||
    let peer_store_handle = net_config.peer_store_handle();
 | 
					    let peer_store_handle = net_config.peer_store_handle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let grandpa_protocol_name = grandpa::protocol_standard_name(&genesis_hash, &config.chain_spec);
 | 
					    let grandpa_protocol_name = grandpa::protocol_standard_name(&genesis_hash, &config.chain_spec);
 | 
				
			||||||
@ -554,8 +566,8 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
                    "⚠️  The hardware does not meet the minimal requirements {} for role 'Authority'",
 | 
					                    "⚠️  The hardware does not meet the minimal requirements {} for role 'Authority'",
 | 
				
			||||||
                    err
 | 
					                    err
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            },
 | 
					            }
 | 
				
			||||||
            _ => {},
 | 
					            _ => {}
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if let Some(ref mut telemetry) = telemetry {
 | 
					        if let Some(ref mut telemetry) = telemetry {
 | 
				
			||||||
@ -563,10 +575,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
            task_manager.spawn_handle().spawn(
 | 
					            task_manager.spawn_handle().spawn(
 | 
				
			||||||
                "telemetry_hwbench",
 | 
					                "telemetry_hwbench",
 | 
				
			||||||
                None,
 | 
					                None,
 | 
				
			||||||
                sc_sysinfo::initialize_hwbench_telemetry(
 | 
					                sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),
 | 
				
			||||||
                    telemetry_handle, 
 | 
					 | 
				
			||||||
                    hwbench,
 | 
					 | 
				
			||||||
                ),
 | 
					 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -580,7 +589,9 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
        let authority_discovery_role =
 | 
					        let authority_discovery_role =
 | 
				
			||||||
            sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore());
 | 
					            sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore());
 | 
				
			||||||
        let dht_event_stream =
 | 
					        let dht_event_stream =
 | 
				
			||||||
            network.event_stream("authority-discovery").filter_map(|e| async move {
 | 
					            network
 | 
				
			||||||
 | 
					                .event_stream("authority-discovery")
 | 
				
			||||||
 | 
					                .filter_map(|e| async move {
 | 
				
			||||||
                    match e {
 | 
					                    match e {
 | 
				
			||||||
                        Event::Dht(e) => Some(e),
 | 
					                        Event::Dht(e) => Some(e),
 | 
				
			||||||
                        _ => None,
 | 
					                        _ => None,
 | 
				
			||||||
@ -597,7 +608,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
            Arc::new(network.clone()),
 | 
					            Arc::new(network.clone()),
 | 
				
			||||||
            Box::pin(dht_event_stream),
 | 
					            Box::pin(dht_event_stream),
 | 
				
			||||||
            authority_discovery_role,
 | 
					            authority_discovery_role,
 | 
				
			||||||
            prometheus_registry.clone()
 | 
					            prometheus_registry.clone(),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        task_manager.spawn_handle().spawn(
 | 
					        task_manager.spawn_handle().spawn(
 | 
				
			||||||
@ -625,8 +636,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
            env: proposer,
 | 
					            env: proposer,
 | 
				
			||||||
            sync_oracle: sync_service.clone(),
 | 
					            sync_oracle: sync_service.clone(),
 | 
				
			||||||
            justification_sync_link: sync_service.clone(),
 | 
					            justification_sync_link: sync_service.clone(),
 | 
				
			||||||
            create_inherent_data_providers: move |_, ()| {
 | 
					            create_inherent_data_providers: move |_, ()| async move {
 | 
				
			||||||
                async move {
 | 
					 | 
				
			||||||
                let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
 | 
					                let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
 | 
				
			||||||
                let slot =
 | 
					                let slot =
 | 
				
			||||||
                        babe_primitives::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
 | 
					                        babe_primitives::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
 | 
				
			||||||
@ -634,7 +644,6 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
                            slot_duration,
 | 
					                            slot_duration,
 | 
				
			||||||
                        );
 | 
					                        );
 | 
				
			||||||
                Ok((slot, timestamp))
 | 
					                Ok((slot, timestamp))
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            force_authoring,
 | 
					            force_authoring,
 | 
				
			||||||
            backoff_authoring_blocks,
 | 
					            backoff_authoring_blocks,
 | 
				
			||||||
@ -646,7 +655,9 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let babe = babe::start_babe(babe_config)?;
 | 
					        let babe = babe::start_babe(babe_config)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        task_manager.spawn_essential_handle().spawn_blocking("babe", None, babe);
 | 
					        task_manager
 | 
				
			||||||
 | 
					            .spawn_essential_handle()
 | 
				
			||||||
 | 
					            .spawn_blocking("babe", None, babe);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let keystore_opt = if role.is_authority() {
 | 
					    let keystore_opt = if role.is_authority() {
 | 
				
			||||||
@ -711,8 +722,17 @@ macro_rules! chain_ops {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let chain_selection = sc_consensus::LongestChain::new(basics.backend.clone());
 | 
					        let chain_selection = sc_consensus::LongestChain::new(basics.backend.clone());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let sc_service::PartialComponents { client, backend, import_queue, task_manager, .. } =
 | 
					        let sc_service::PartialComponents {
 | 
				
			||||||
            new_partial::<sc_consensus::LongestChain<FullBackend, Block>>(&mut config, basics, chain_selection)?;
 | 
					            client,
 | 
				
			||||||
 | 
					            backend,
 | 
				
			||||||
 | 
					            import_queue,
 | 
				
			||||||
 | 
					            task_manager,
 | 
				
			||||||
 | 
					            ..
 | 
				
			||||||
 | 
					        } = new_partial::<sc_consensus::LongestChain<FullBackend, Block>>(
 | 
				
			||||||
 | 
					            &mut config,
 | 
				
			||||||
 | 
					            basics,
 | 
				
			||||||
 | 
					            chain_selection,
 | 
				
			||||||
 | 
					        )?;
 | 
				
			||||||
        Ok((client, backend, import_queue, task_manager))
 | 
					        Ok((client, backend, import_queue, task_manager))
 | 
				
			||||||
    }};
 | 
					    }};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -720,22 +740,28 @@ macro_rules! chain_ops {
 | 
				
			|||||||
#[cfg(feature = "full-node")]
 | 
					#[cfg(feature = "full-node")]
 | 
				
			||||||
pub fn new_chain_ops(
 | 
					pub fn new_chain_ops(
 | 
				
			||||||
    config: &mut Configuration,
 | 
					    config: &mut Configuration,
 | 
				
			||||||
) -> Result<(Arc<FullClient>, Arc<FullBackend>, sc_consensus::BasicQueue<Block>, TaskManager), Error>
 | 
					) -> Result<
 | 
				
			||||||
{
 | 
					    (
 | 
				
			||||||
 | 
					        Arc<FullClient>,
 | 
				
			||||||
 | 
					        Arc<FullBackend>,
 | 
				
			||||||
 | 
					        sc_consensus::BasicQueue<Block>,
 | 
				
			||||||
 | 
					        TaskManager,
 | 
				
			||||||
 | 
					    ),
 | 
				
			||||||
 | 
					    Error,
 | 
				
			||||||
 | 
					> {
 | 
				
			||||||
    config.keystore = sc_service::config::KeystoreConfig::InMemory;
 | 
					    config.keystore = sc_service::config::KeystoreConfig::InMemory;
 | 
				
			||||||
    chain_ops!(config, None)
 | 
					    chain_ops!(config, None)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(feature = "full-node")]
 | 
					#[cfg(feature = "full-node")]
 | 
				
			||||||
pub fn build_full(
 | 
					pub fn build_full(config: Configuration, params: NewFullParams) -> Result<NewFull, Error> {
 | 
				
			||||||
    config: Configuration,
 | 
					 | 
				
			||||||
    params: NewFullParams,
 | 
					 | 
				
			||||||
) -> Result<NewFull, Error> {
 | 
					 | 
				
			||||||
    match config.network.network_backend {
 | 
					    match config.network.network_backend {
 | 
				
			||||||
        sc_network::config::NetworkBackendType::Libp2p => 
 | 
					        sc_network::config::NetworkBackendType::Libp2p => {
 | 
				
			||||||
            new_full::<sc_network::NetworkWorker<Block, Hash>>(config, params),
 | 
					            new_full::<sc_network::NetworkWorker<Block, Hash>>(config, params)
 | 
				
			||||||
        sc_network::config::NetworkBackendType::Litep2p => 
 | 
					        }
 | 
				
			||||||
            new_full::<sc_network::Litep2pNetworkBackend>(config, params),
 | 
					        sc_network::config::NetworkBackendType::Litep2p => {
 | 
				
			||||||
 | 
					            new_full::<sc_network::Litep2pNetworkBackend>(config, params)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -750,7 +776,7 @@ pub fn revert_backend(
 | 
				
			|||||||
    let revertible = blocks.min(best_number - finalized);
 | 
					    let revertible = blocks.min(best_number - finalized);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if revertible == 0 {
 | 
					    if revertible == 0 {
 | 
				
			||||||
        return Ok(())
 | 
					        return Ok(());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    babe::revert(client.clone(), backend, blocks)?;
 | 
					    babe::revert(client.clone(), backend, blocks)?;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user