Skip to content

Commit

Permalink
Update to the latest master of Substrate
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Feb 24, 2021
1 parent 0c16466 commit 7d3ac23
Show file tree
Hide file tree
Showing 9 changed files with 1,433 additions and 2,733 deletions.
4,048 changes: 1,326 additions & 2,722 deletions Cargo.lock

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions Cargo.toml
Expand Up @@ -11,6 +11,94 @@ cli = { package = "chainx-cli", path = "cli" }
[target.'cfg(target_arch="x86_64")'.dependencies]
cli = { package = "chainx-cli", path = "cli", features = [ "wasmtime" ] }

[patch.crates-io]
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-cli = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-client-api = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-client-db = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-consensus = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-executor = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-informant = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-keystore = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-network = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-offchain = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-rpc = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-service = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }

sp-api = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-consensus = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-core = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-inherents = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-io = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-keystore = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-offchain = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-rpc = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-runtime = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-session = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-staking = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-std = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-storage = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-tracing = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-trie = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
sp-version = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }

frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
frame-executive = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
frame-support = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
frame-system = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }

substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }

pallet-authorship = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-babe = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-balances = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-bounties = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-collective = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-democracy = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-identity = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-im-online = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-indices = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-membership = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-offences = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-proxy = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-session = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-sudo = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-tips = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-treasury = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }
pallet-utility = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566" }

[workspace]
members = [
"cli",
Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Expand Up @@ -12,7 +12,7 @@ log4rs = { version = "0.12", features = ["rolling_file_appender", "compound_poli
hex = "0.4"
hex-literal = "0.3.1"
jsonrpc-pubsub = "15.0.0"
parking_lot = "0.11.0"
parking_lot = "0.11.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
structopt = "0.3.8"
Expand All @@ -27,7 +27,7 @@ sc-consensus-babe = "0.9.0"
sc-consensus-slots = "0.9.0"
sc-executor = "0.9.0"
sc-finality-grandpa = "0.9.0"
sc-finality-grandpa-warp-sync = { git = "https://github.com/paritytech/substrate", rev = "49a4103f4bfef55be20a5c6d26e18ff3003c3353", optional = true }
sc-finality-grandpa-warp-sync = { git = "https://github.com/paritytech/substrate", rev = "e6ac7e72c2251b8a23454c8cf0e3a2ad2c1ed566", optional = true }
sc-network = "0.9.0"
sc-rpc = "3.0.0"
sc-transaction-pool = "3.0.0"
Expand Down
1 change: 0 additions & 1 deletion rpc/src/lib.rs
Expand Up @@ -123,7 +123,6 @@ where
BlockNumber,
>,
C::Api: xpallet_transaction_fee_rpc_runtime_api::XTransactionFeeApi<Block, Balance>,
<C::Api as sp_api::ApiErrorExt>::Error: fmt::Debug,
P: TransactionPool + 'static,
SC: SelectChain<Block> + 'static,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
Expand Down
2 changes: 1 addition & 1 deletion runtime/chainx/src/lib.rs
Expand Up @@ -1046,7 +1046,7 @@ construct_runtime!(
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>} = 2,

// Must be before session.
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned} = 3,
Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned} = 3,

Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 4,
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>} = 5,
Expand Down
2 changes: 1 addition & 1 deletion runtime/dev/src/lib.rs
Expand Up @@ -1047,7 +1047,7 @@ construct_runtime!(
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},

// Must be before session.
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned},

Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>},
Expand Down
2 changes: 1 addition & 1 deletion runtime/malan/src/lib.rs
Expand Up @@ -1050,7 +1050,7 @@ construct_runtime!(
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>} = 2,

// Must be before session.
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned} = 3,
Babe: pallet_babe::{Module, Call, Storage, Config, ValidateUnsigned} = 3,

Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent} = 4,
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>} = 5,
Expand Down
4 changes: 2 additions & 2 deletions service/src/client.rs
Expand Up @@ -9,7 +9,7 @@ use xpallet_mining_staking_rpc_runtime_api::VoteWeight;
/// A set of APIs that chainx-like runtimes must implement.
pub trait RuntimeApiCollection:
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::ApiExt<Block, Error = sp_blockchain::Error>
+ sp_api::ApiExt<Block>
+ sp_consensus_babe::BabeApi<Block>
+ sp_finality_grandpa::GrandpaApi<Block>
+ sp_block_builder::BlockBuilder<Block>
Expand Down Expand Up @@ -48,7 +48,7 @@ where
impl<Api> RuntimeApiCollection for Api
where
Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::ApiExt<Block, Error = sp_blockchain::Error>
+ sp_api::ApiExt<Block>
+ sp_consensus_babe::BabeApi<Block>
+ sp_finality_grandpa::GrandpaApi<Block>
+ sp_block_builder::BlockBuilder<Block>
Expand Down
15 changes: 12 additions & 3 deletions service/src/lib.rs
Expand Up @@ -12,6 +12,7 @@ use sc_executor::NativeExecutionDispatch;
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
use sc_network::{Event, NetworkService};
use sc_service::{config::Configuration, error::Error as ServiceError, TaskManager};
use sc_telemetry::TelemetrySpan;
use sp_api::ConstructRuntimeApi;
use sp_inherents::InherentDataProviders;
use sp_runtime::traits::Block as BlockT;
Expand Down Expand Up @@ -111,7 +112,7 @@ where
client.clone(),
select_chain.clone(),
inherent_data_providers.clone(),
&task_manager.spawn_handle(),
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
)?;
Expand Down Expand Up @@ -250,6 +251,9 @@ where
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();

let telemetry_span = TelemetrySpan::new();
let _telemetry_span_entered = telemetry_span.enter();

let (_rpc_handlers, telemetry_connection_notifier) =
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
config,
Expand All @@ -264,6 +268,7 @@ where
remote_blockchain: None,
network_status_sinks: network_status_sinks.clone(),
system_rpc_tx,
telemetry_span: Some(telemetry_span.clone()),
})?;

let (block_import, grandpa_link, babe_link) = import_setup;
Expand Down Expand Up @@ -341,7 +346,7 @@ where
name: Some(name),
observer_enabled: false,
keystore,
is_authority: role.is_network_authority(),
is_authority: role.is_authority(),
};

if enable_grandpa {
Expand Down Expand Up @@ -470,7 +475,7 @@ where
client.clone(),
select_chain,
inherent_data_providers,
&task_manager.spawn_handle(),
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
sp_consensus::NeverCanAuthor,
)?;
Expand Down Expand Up @@ -506,6 +511,9 @@ where

let rpc_extensions = chainx_rpc::create_light(light_deps);

let telemetry_span = TelemetrySpan::new();
let _telemetry_span_entered = telemetry_span.enter();

let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
on_demand: Some(on_demand),
remote_blockchain: Some(backend.remote_blockchain()),
Expand All @@ -519,6 +527,7 @@ where
system_rpc_tx,
network,
task_manager: &mut task_manager,
telemetry_span: Some(telemetry_span.clone()),
})?;

Ok(task_manager)
Expand Down

0 comments on commit 7d3ac23

Please sign in to comment.