Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 506799c

Browse files
author
parity-processbot
committed
Merge remote-tracking branch 'origin/master' into lexnv/md15_expose_md_at_versions
2 parents f7c0493 + a330912 commit 506799c

File tree

104 files changed

+7182
-4073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+7182
-4073
lines changed

Cargo.lock

Lines changed: 33 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node-template/node/src/command.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
1010
use sc_service::PartialComponents;
1111
use sp_keyring::Sr25519Keyring;
1212

13+
#[cfg(feature = "try-runtime")]
14+
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
15+
1316
impl SubstrateCli for Cli {
1417
fn impl_name() -> String {
1518
"Substrate Node".into()
@@ -184,11 +187,13 @@ pub fn run() -> sc_cli::Result<()> {
184187
let task_manager =
185188
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
186189
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
190+
let info_provider = timestamp_with_aura_info(6000);
191+
187192
Ok((
188193
cmd.run::<Block, ExtendedHostFunctions<
189194
sp_io::SubstrateHostFunctions,
190195
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
191-
>>(),
196+
>, _>(Some(info_provider)),
192197
task_manager,
193198
))
194199
})

bin/node-template/node/src/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
66
pub use sc_executor::NativeElseWasmExecutor;
77
use sc_finality_grandpa::SharedVoterState;
88
use sc_keystore::LocalKeystore;
9-
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
9+
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
1010
use sc_telemetry::{Telemetry, TelemetryWorker};
1111
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
1212
use std::{sync::Arc, time::Duration};
@@ -200,7 +200,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
200200
spawn_handle: task_manager.spawn_handle(),
201201
import_queue,
202202
block_announce_validator_builder: None,
203-
warp_sync: Some(warp_sync),
203+
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
204204
})?;
205205

206206
if config.offchain_worker.enabled {

bin/node/bench/src/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl core::Benchmark for ConstructionBenchmark {
120120

121121
let _ = context
122122
.client
123-
.runtime_version_at(&BlockId::Number(0))
123+
.runtime_version_at(context.client.chain_info().genesis_hash)
124124
.expect("Failed to get runtime version")
125125
.spec_version;
126126

bin/node/bench/src/import.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use std::borrow::Cow;
3535
use node_primitives::Block;
3636
use node_testing::bench::{BenchDb, BlockType, DatabaseType, KeyTypes, Profile};
3737
use sc_client_api::backend::Backend;
38-
use sp_runtime::generic::BlockId;
3938
use sp_state_machine::InspectState;
4039

4140
use crate::{
@@ -115,7 +114,7 @@ impl core::Benchmark for ImportBenchmark {
115114

116115
let _ = context
117116
.client
118-
.runtime_version_at(&BlockId::Number(0))
117+
.runtime_version_at(context.client.chain_info().genesis_hash)
119118
.expect("Failed to get runtime version")
120119
.spec_version;
121120

bin/node/bench/src/txpool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl core::Benchmark for PoolBenchmark {
6161

6262
let _ = context
6363
.client
64-
.runtime_version_at(&BlockId::Number(0))
64+
.runtime_version_at(context.client.chain_info().genesis_hash)
6565
.expect("Failed to get runtime version")
6666
.spec_version;
6767

bin/node/cli/src/command.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ use sp_keyring::Sr25519Keyring;
3232

3333
use std::sync::Arc;
3434

35+
#[cfg(feature = "try-runtime")]
36+
use {
37+
kitchensink_runtime::constants::time::SLOT_DURATION,
38+
try_runtime_cli::block_building_info::substrate_info,
39+
};
40+
3541
impl SubstrateCli for Cli {
3642
fn impl_name() -> String {
3743
"Substrate Node".into()
@@ -236,11 +242,13 @@ pub fn run() -> Result<()> {
236242
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
237243
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
238244

245+
let info_provider = substrate_info(SLOT_DURATION);
246+
239247
Ok((
240248
cmd.run::<Block, ExtendedHostFunctions<
241249
sp_io::SubstrateHostFunctions,
242250
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
243-
>>(),
251+
>, _>(Some(info_provider)),
244252
task_manager,
245253
))
246254
})

bin/node/cli/src/service.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ use sc_client_api::BlockBackend;
3232
use sc_consensus_babe::{self, SlotProportion};
3333
use sc_executor::NativeElseWasmExecutor;
3434
use sc_network::NetworkService;
35-
use sc_network_common::{protocol::event::Event, service::NetworkEventStream};
35+
use sc_network_common::{
36+
protocol::event::Event, service::NetworkEventStream, sync::warp::WarpSyncParams,
37+
};
3638
use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
3739
use sc_telemetry::{Telemetry, TelemetryWorker};
3840
use sp_api::ProvideRuntimeApi;
@@ -359,7 +361,7 @@ pub fn new_full_base(
359361
spawn_handle: task_manager.spawn_handle(),
360362
import_queue,
361363
block_announce_validator_builder: None,
362-
warp_sync: Some(warp_sync),
364+
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
363365
})?;
364366

365367
if config.offchain_worker.enabled {
@@ -585,7 +587,7 @@ mod tests {
585587
use sp_keyring::AccountKeyring;
586588
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
587589
use sp_runtime::{
588-
generic::{BlockId, Digest, Era, SignedPayload},
590+
generic::{Digest, Era, SignedPayload},
589591
key_types::BABE,
590592
traits::{Block as BlockT, Header as HeaderT, IdentifyAccount, Verify},
591593
RuntimeAppPublic,
@@ -752,9 +754,9 @@ mod tests {
752754
let to: Address = AccountPublic::from(bob.public()).into_account().into();
753755
let from: Address = AccountPublic::from(charlie.public()).into_account().into();
754756
let genesis_hash = service.client().block_hash(0).unwrap().unwrap();
755-
let best_block_id = BlockId::number(service.client().chain_info().best_number);
757+
let best_hash = service.client().chain_info().best_hash;
756758
let (spec_version, transaction_version) = {
757-
let version = service.client().runtime_version_at(&best_block_id).unwrap();
759+
let version = service.client().runtime_version_at(best_hash).unwrap();
758760
(version.spec_version, version.transaction_version)
759761
};
760762
let signer = charlie.clone();

0 commit comments

Comments
 (0)