mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 11:58:01 +00:00
Update to latest Substrate master (#863)
* Begin to update to latest Substrate master * Fix compilation * Remove `Balances` from `OnKilledAccount` * Update cli/src/command.rs Co-Authored-By: Cecile Tonglet <cecile@parity.io> * Change gossip name * Change again Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
This commit is contained in:
Generated
+1217
-1171
File diff suppressed because it is too large
Load Diff
+10
-15
@@ -21,33 +21,28 @@ use sp_api::ConstructRuntimeApi;
|
||||
use sc_executor::NativeExecutionDispatch;
|
||||
use crate::chain_spec::load_spec;
|
||||
use crate::cli::{Cli, Subcommand};
|
||||
use sc_cli::{VersionInfo, display_role, error};
|
||||
use sc_cli::VersionInfo;
|
||||
|
||||
/// Parses polkadot specific CLI arguments and run the service.
|
||||
pub fn run(version: VersionInfo) -> error::Result<()> {
|
||||
pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
let opt = sc_cli::from_args::<Cli>(&version);
|
||||
|
||||
let mut config = service::Configuration::new(&version);
|
||||
let mut config = service::Configuration::from_version(&version);
|
||||
config.impl_name = "parity-polkadot";
|
||||
|
||||
match opt.subcommand {
|
||||
None => {
|
||||
sc_cli::init(&opt.run.shared_params, &version)?;
|
||||
sc_cli::init_config(&mut config, &opt.run.shared_params, &version, load_spec)?;
|
||||
opt.run.init(&version)?;
|
||||
opt.run.update_config(&mut config, load_spec, &version)?;
|
||||
|
||||
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
|
||||
|
||||
sc_cli::update_config_for_running_node(
|
||||
&mut config,
|
||||
opt.run,
|
||||
)?;
|
||||
|
||||
info!("{}", version.name);
|
||||
info!(" version {}", config.full_version());
|
||||
info!(" by {}, 2017-2020", version.author);
|
||||
info!("Chain specification: {}", config.expect_chain_spec().name());
|
||||
info!("Node name: {}", config.name);
|
||||
info!("Roles: {}", display_role(&config));
|
||||
info!("Roles: {}", config.display_role());
|
||||
|
||||
if is_kusama {
|
||||
info!("Native runtime: {}", service::KusamaExecutor::native_version().runtime_version);
|
||||
@@ -73,8 +68,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
|
||||
}
|
||||
},
|
||||
Some(Subcommand::Base(cmd)) => {
|
||||
sc_cli::init(cmd.get_shared_params(), &version)?;
|
||||
sc_cli::init_config(&mut config, &cmd.get_shared_params(), &version, load_spec)?;
|
||||
cmd.init(&version)?;
|
||||
cmd.update_config(&mut config, load_spec, &version)?;
|
||||
|
||||
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
|
||||
|
||||
@@ -96,7 +91,7 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
|
||||
sc_cli::init_logger("");
|
||||
|
||||
if cfg!(feature = "browser") {
|
||||
Err(error::Error::Input("Cannot run validation worker in browser".into()))
|
||||
Err(sc_cli::Error::Input("Cannot run validation worker in browser".into()))
|
||||
} else {
|
||||
#[cfg(not(feature = "browser"))]
|
||||
service::run_validation_worker(&args.mem_id)?;
|
||||
@@ -109,7 +104,7 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
|
||||
fn run_service_until_exit<R, D, E>(
|
||||
config: service::Configuration,
|
||||
authority_discovery_enabled: bool,
|
||||
) -> error::Result<()>
|
||||
) -> sc_cli::Result<()>
|
||||
where
|
||||
R: ConstructRuntimeApi<Block, service::TFullClient<Block, R, D>>
|
||||
+ Send + Sync + 'static,
|
||||
|
||||
@@ -41,4 +41,4 @@ pub use command::*;
|
||||
pub use chain_spec::*;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
pub use sc_cli::{VersionInfo, error};
|
||||
pub use sc_cli::{VersionInfo, Error, Result};
|
||||
|
||||
@@ -444,7 +444,7 @@ pub fn run_collator<P>(
|
||||
para_id: ParaId,
|
||||
key: Arc<CollatorPair>,
|
||||
config: Configuration,
|
||||
) -> polkadot_cli::error::Result<()> where
|
||||
) -> polkadot_cli::Result<()> where
|
||||
P: BuildParachainContext,
|
||||
P::ParachainContext: Send + 'static,
|
||||
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
|
||||
|
||||
@@ -81,6 +81,7 @@ mod attestation;
|
||||
|
||||
/// The engine ID of the polkadot attestation system.
|
||||
pub const POLKADOT_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"dot1";
|
||||
pub const POLKADOT_PROTOCOL_NAME: &[u8] = b"/polkadot/legacy/1";
|
||||
|
||||
// arbitrary; in practice this should not be more than 2.
|
||||
pub(crate) const MAX_CHAIN_HEADS: usize = 5;
|
||||
@@ -284,6 +285,7 @@ pub fn register_validator<C: ChainContext + 'static, S: NetworkSpecialization<Bl
|
||||
let gossip_engine = sc_network_gossip::GossipEngine::new(
|
||||
service.clone(),
|
||||
POLKADOT_ENGINE_ID,
|
||||
POLKADOT_PROTOCOL_NAME,
|
||||
gossip_side,
|
||||
);
|
||||
|
||||
|
||||
@@ -324,7 +324,7 @@ mod tests {
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = Balances;
|
||||
type OnKilledAccount = Balances;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -421,7 +421,7 @@ mod tests {
|
||||
assert_eq!(Balances::free_balance(42), 0);
|
||||
assert_ok!(Claims::claim(Origin::NONE, 42, sig(&alice(), &42u64.encode())));
|
||||
assert_eq!(Balances::free_balance(&42), 100);
|
||||
assert_eq!(Vesting::vesting_balance(&42), 50);
|
||||
assert_eq!(Vesting::vesting_balance(&42), Some(50));
|
||||
assert_eq!(Claims::total(), 0);
|
||||
});
|
||||
}
|
||||
@@ -436,13 +436,13 @@ mod tests {
|
||||
assert_eq!(Balances::free_balance(42), 0);
|
||||
assert_noop!(
|
||||
Claims::claim(Origin::NONE, 69, sig(&bob(), &69u64.encode())),
|
||||
Error::<Test>::SignerHasNoClaim
|
||||
Error::<Test>::SignerHasNoClaim,
|
||||
);
|
||||
assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None));
|
||||
assert_eq!(Claims::total(), 300);
|
||||
assert_ok!(Claims::claim(Origin::NONE, 69, sig(&bob(), &69u64.encode())));
|
||||
assert_eq!(Balances::free_balance(&69), 200);
|
||||
assert_eq!(Vesting::vesting_balance(&69), 0);
|
||||
assert_eq!(Vesting::vesting_balance(&69), None);
|
||||
assert_eq!(Claims::total(), 100);
|
||||
});
|
||||
}
|
||||
@@ -462,7 +462,7 @@ mod tests {
|
||||
assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1))));
|
||||
assert_ok!(Claims::claim(Origin::NONE, 69, sig(&bob(), &69u64.encode())));
|
||||
assert_eq!(Balances::free_balance(&69), 200);
|
||||
assert_eq!(Vesting::vesting_balance(&69), 50);
|
||||
assert_eq!(Vesting::vesting_balance(&69), Some(50));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ mod tests {
|
||||
// Everything should be unchanged
|
||||
assert_eq!(Claims::total(), 300);
|
||||
assert_eq!(Balances::free_balance(69), 1000);
|
||||
assert_eq!(Vesting::vesting_balance(&69), 1000);
|
||||
assert_eq!(Vesting::vesting_balance(&69), Some(1000));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -616,7 +616,7 @@ mod tests {
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = Balances;
|
||||
type OnKilledAccount = Balances;
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
|
||||
@@ -939,7 +939,7 @@ mod tests {
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = balances::AccountData<u128>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -1118,7 +1118,7 @@ mod tests {
|
||||
|
||||
// stashes are the index.
|
||||
let session_keys: Vec<_> = authority_keys.iter().enumerate()
|
||||
.map(|(i, _k)| (i as u64, UintAuthorityId(i as u64)))
|
||||
.map(|(i, _k)| (i as u64, i as u64, UintAuthorityId(i as u64)))
|
||||
.collect();
|
||||
|
||||
let authorities: Vec<_> = authority_keys.iter().map(|k| ValidatorId::from(k.public())).collect();
|
||||
|
||||
@@ -705,7 +705,7 @@ mod tests {
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = balances::AccountData<u128>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = Balances;
|
||||
type OnKilledAccount = Balances;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -827,7 +827,7 @@ mod tests {
|
||||
|
||||
// stashes are the index.
|
||||
let session_keys: Vec<_> = authority_keys.iter().enumerate()
|
||||
.map(|(i, _k)| (i as u64, UintAuthorityId(i as u64)))
|
||||
.map(|(i, _k)| (i as u64, i as u64, UintAuthorityId(i as u64)))
|
||||
.collect();
|
||||
|
||||
let authorities: Vec<_> = authority_keys.iter().map(|k| ValidatorId::from(k.public())).collect();
|
||||
|
||||
@@ -917,7 +917,7 @@ mod tests {
|
||||
type ModuleToIndex = ();
|
||||
type AccountData = balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = Balances;
|
||||
type OnKilledAccount = Balances;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -137,7 +137,7 @@ impl system::Trait for Runtime {
|
||||
type ModuleToIndex = ModuleToIndex;
|
||||
type AccountData = balances::AccountData<Balance>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = (Balances, Staking, Session, Recovery, Democracy);
|
||||
type OnKilledAccount = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -145,7 +145,7 @@ impl system::Trait for Runtime {
|
||||
type ModuleToIndex = ModuleToIndex;
|
||||
type AccountData = balances::AccountData<Balance>;
|
||||
type OnNewAccount = ();
|
||||
type OnReapAccount = (Balances, Staking, Session, Democracy);
|
||||
type OnKilledAccount = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -175,6 +175,7 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
|
||||
}),
|
||||
session: Some(polkadot::SessionConfig {
|
||||
keys: initial_authorities.iter().map(|x| (
|
||||
x.0.clone(),
|
||||
x.0.clone(),
|
||||
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
|
||||
)).collect::<Vec<_>>(),
|
||||
@@ -318,6 +319,7 @@ pub fn testnet_genesis(
|
||||
}),
|
||||
session: Some(polkadot::SessionConfig {
|
||||
keys: initial_authorities.iter().map(|x| (
|
||||
x.0.clone(),
|
||||
x.0.clone(),
|
||||
session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone(), x.6.clone()),
|
||||
)).collect::<Vec<_>>(),
|
||||
|
||||
@@ -161,7 +161,6 @@ macro_rules! new_full_start {
|
||||
babe::Config::get_or_compute(&*client)?,
|
||||
grandpa_block_import,
|
||||
client.clone(),
|
||||
client.clone(),
|
||||
)?;
|
||||
|
||||
let import_queue = babe::import_queue(
|
||||
@@ -169,7 +168,6 @@ macro_rules! new_full_start {
|
||||
block_import.clone(),
|
||||
Some(Box::new(justification_import)),
|
||||
None,
|
||||
client.clone(),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
)?;
|
||||
@@ -344,15 +342,14 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
|
||||
let mut path = PathBuf::from(db_path);
|
||||
path.push("availability");
|
||||
|
||||
let gossip = polkadot_network::legacy
|
||||
::AvailabilityNetworkShim(gossip_validator.clone());
|
||||
let gossip = polkadot_network::legacy::AvailabilityNetworkShim(gossip_validator.clone());
|
||||
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
{
|
||||
av_store::Store::new(::av_store::Config {
|
||||
cache_size: None,
|
||||
path,
|
||||
}, gossip)?
|
||||
av_store::Store::new(
|
||||
av_store::Config { cache_size: None, path },
|
||||
gossip,
|
||||
)?
|
||||
}
|
||||
|
||||
#[cfg(target_os = "unknown")]
|
||||
@@ -604,7 +601,6 @@ where
|
||||
babe::Config::get_or_compute(&*client)?,
|
||||
grandpa_block_import,
|
||||
client.clone(),
|
||||
client.clone(),
|
||||
)?;
|
||||
|
||||
// FIXME: pruning task isn't started since light client doesn't do `AuthoritySetup`.
|
||||
@@ -613,7 +609,6 @@ where
|
||||
babe_block_import,
|
||||
None,
|
||||
Some(Box::new(finality_proof_import)),
|
||||
client.clone(),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
)?;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
use cli::VersionInfo;
|
||||
|
||||
fn main() -> Result<(), cli::error::Error> {
|
||||
fn main() -> Result<(), cli::Error> {
|
||||
let version = VersionInfo {
|
||||
name: "Parity Polkadot",
|
||||
commit: env!("VERGEN_SHA_SHORT"),
|
||||
|
||||
Reference in New Issue
Block a user