Skip to content

Commit ab620d4

Browse files
authored
Sync with polkadot-v1.0.0 branch (#195)
- [x] Needs update of https://github.com/727-Ventures/pallet-assets-chain-extension to `polkadot-v1.0.0` - [x] Diff and apply commits between `0.9.43` and `1.0.0`
1 parent a16421f commit ab620d4

File tree

9 files changed

+753
-756
lines changed

9 files changed

+753
-756
lines changed

Cargo.lock

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

node/Cargo.toml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "contracts-node"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Substrate node configured for smart contracts via `pallet-contracts`."
66
edition = "2021"
@@ -19,32 +19,34 @@ path = "src/main.rs"
1919

2020
[dependencies]
2121
clap = { version = "4.2.7", features = ["derive"] }
22-
23-
sc-cli = { git = "https://github.com/paritytech/substrate", package = "sc-cli", default-features = false, branch = "polkadot-v0.9.43" }
24-
sp-core = { git = "https://github.com/paritytech/substrate", package = "sp-core", branch = "polkadot-v0.9.43" }
25-
sc-executor = { git = "https://github.com/paritytech/substrate", package = "sc-executor", branch = "polkadot-v0.9.43" }
26-
sc-network = { git = "https://github.com/paritytech/substrate", package = "sc-network", branch = "polkadot-v0.9.43" }
27-
sc-service = { git = "https://github.com/paritytech/substrate", package = "sc-service", default-features = false, branch = "polkadot-v0.9.43" }
28-
sc-telemetry = { git = "https://github.com/paritytech/substrate", package = "sc-telemetry", branch = "polkadot-v0.9.43" }
29-
sc-keystore = { git = "https://github.com/paritytech/substrate", package = "sc-keystore", branch = "polkadot-v0.9.43" }
30-
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool", branch = "polkadot-v0.9.43" }
31-
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool-api", branch = "polkadot-v0.9.43" }
32-
sc-consensus = { git = "https://github.com/paritytech/substrate", package = "sc-consensus", branch = "polkadot-v0.9.43" }
33-
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", package = "sc-consensus-manual-seal", branch = "polkadot-v0.9.43" }
34-
sc-client-api = { git = "https://github.com/paritytech/substrate", package = "sc-client-api", branch = "polkadot-v0.9.43" }
35-
sp-runtime = { git = "https://github.com/paritytech/substrate", package = "sp-runtime", branch = "polkadot-v0.9.43" }
36-
sp-timestamp = { git = "https://github.com/paritytech/substrate", package = "sp-timestamp", branch = "polkadot-v0.9.43" }
22+
futures = { version = "0.3.21", features = ["thread-pool"]}
23+
24+
sc-cli = { git = "https://github.com/paritytech/substrate", package = "sc-cli", default-features = false, branch = "polkadot-v1.0.0" }
25+
sp-core = { git = "https://github.com/paritytech/substrate", package = "sp-core", branch = "polkadot-v1.0.0" }
26+
sc-executor = { git = "https://github.com/paritytech/substrate", package = "sc-executor", branch = "polkadot-v1.0.0" }
27+
sc-network = { git = "https://github.com/paritytech/substrate", package = "sc-network", branch = "polkadot-v1.0.0" }
28+
sc-service = { git = "https://github.com/paritytech/substrate", package = "sc-service", default-features = false, branch = "polkadot-v1.0.0" }
29+
sc-telemetry = { git = "https://github.com/paritytech/substrate", package = "sc-telemetry", branch = "polkadot-v1.0.0" }
30+
sc-keystore = { git = "https://github.com/paritytech/substrate", package = "sc-keystore", branch = "polkadot-v1.0.0" }
31+
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool", branch = "polkadot-v1.0.0" }
32+
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool-api", branch = "polkadot-v1.0.0" }
33+
sc-offchain = { git = "https://github.com/paritytech/substrate", package = "sc-offchain", branch = "polkadot-v1.0.0" }
34+
sc-consensus = { git = "https://github.com/paritytech/substrate", package = "sc-consensus", branch = "polkadot-v1.0.0" }
35+
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", package = "sc-consensus-manual-seal", branch = "polkadot-v1.0.0" }
36+
sc-client-api = { git = "https://github.com/paritytech/substrate", package = "sc-client-api", branch = "polkadot-v1.0.0" }
37+
sp-runtime = { git = "https://github.com/paritytech/substrate", package = "sp-runtime", branch = "polkadot-v1.0.0" }
38+
sp-timestamp = { git = "https://github.com/paritytech/substrate", package = "sp-timestamp", branch = "polkadot-v1.0.0" }
3739

3840
# These dependencies are used for the node's RPCs
3941
jsonrpsee = { version = "0.16.2", features = ["server"] }
40-
sc-rpc = { git = "https://github.com/paritytech/substrate", package = "sc-rpc", branch = "polkadot-v0.9.43" }
41-
sp-api = { git = "https://github.com/paritytech/substrate", package = "sp-api", branch = "polkadot-v0.9.43" }
42-
sc-rpc-api = { git = "https://github.com/paritytech/substrate", package = "sc-rpc-api", branch = "polkadot-v0.9.43" }
43-
sp-blockchain = { git = "https://github.com/paritytech/substrate", package = "sp-blockchain", branch = "polkadot-v0.9.43" }
44-
sp-block-builder = { git = "https://github.com/paritytech/substrate", package = "sp-block-builder", branch = "polkadot-v0.9.43" }
45-
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", package = "sc-basic-authorship", branch = "polkadot-v0.9.43" }
46-
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", package = "substrate-frame-rpc-system", branch = "polkadot-v0.9.43" }
47-
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", package = "pallet-transaction-payment-rpc", branch = "polkadot-v0.9.43" }
42+
sp-api = { git = "https://github.com/paritytech/substrate", package = "sp-api", branch = "polkadot-v1.0.0" }
43+
sc-rpc = { git = "https://github.com/paritytech/substrate", package = "sc-rpc", branch = "polkadot-v1.0.0" }
44+
sc-rpc-api = { git = "https://github.com/paritytech/substrate", package = "sc-rpc-api", branch = "polkadot-v1.0.0" }
45+
sp-blockchain = { git = "https://github.com/paritytech/substrate", package = "sp-blockchain", branch = "polkadot-v1.0.0" }
46+
sp-block-builder = { git = "https://github.com/paritytech/substrate", package = "sp-block-builder", branch = "polkadot-v1.0.0" }
47+
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", package = "sc-basic-authorship", branch = "polkadot-v1.0.0" }
48+
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", package = "substrate-frame-rpc-system", branch = "polkadot-v1.0.0" }
49+
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", package = "pallet-transaction-payment-rpc", branch = "polkadot-v1.0.0" }
4850

4951
# Local Dependencies
5052
contracts-node-runtime = { path = "../runtime" }
@@ -55,7 +57,7 @@ contracts-node-runtime = { path = "../runtime" }
5557
enum-as-inner = "=0.5.1"
5658

5759
[build-dependencies]
58-
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", package = "substrate-build-script-utils", branch = "polkadot-v0.9.43" }
60+
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", package = "substrate-build-script-utils", branch = "polkadot-v1.0.0" }
5961

6062
[features]
6163
default = []

node/src/chain_spec.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use contracts_node_runtime::{
2-
AccountId, BalancesConfig, GenesisConfig, Signature, SudoConfig, SystemConfig, WASM_BINARY,
2+
AccountId, BalancesConfig, RuntimeGenesisConfig, Signature, SudoConfig, SystemConfig,
3+
WASM_BINARY,
34
};
45
use sc_service::ChainType;
56
use sp_core::{sr25519, Pair, Public};
@@ -9,7 +10,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
910
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
1011

1112
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
12-
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
13+
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
1314

1415
/// Generate a crypto pair from seed.
1516
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
@@ -128,11 +129,12 @@ fn testnet_genesis(
128129
root_key: AccountId,
129130
endowed_accounts: Vec<AccountId>,
130131
_enable_println: bool,
131-
) -> GenesisConfig {
132-
GenesisConfig {
132+
) -> RuntimeGenesisConfig {
133+
RuntimeGenesisConfig {
133134
system: SystemConfig {
134135
// Add Wasm runtime to storage.
135136
code: wasm_binary.to_vec(),
137+
..Default::default()
136138
},
137139
balances: BalancesConfig {
138140
// Configure endowed accounts with initial balance of 1 << 60.

node/src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct Cli {
1010
}
1111

1212
#[derive(Debug, clap::Subcommand)]
13+
#[allow(clippy::large_enum_variant)]
1314
pub enum Subcommand {
1415
/// Key management cli utilities
1516
#[clap(subcommand)]

node/src/command.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
service,
55
};
66
use contracts_node_runtime::Block;
7-
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
7+
use sc_cli::SubstrateCli;
88
use sc_service::PartialComponents;
99

1010
impl SubstrateCli for Cli {
@@ -40,10 +40,6 @@ impl SubstrateCli for Cli {
4040
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
4141
})
4242
}
43-
44-
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
45-
&contracts_node_runtime::VERSION
46-
}
4743
}
4844

4945
/// Parse and run command line arguments

node/src/rpc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use std::sync::Arc;
99

10-
use contracts_node_runtime::{opaque::Block, AccountId, Balance, Index};
10+
use contracts_node_runtime::{opaque::Block, AccountId, Balance, Nonce};
1111
use jsonrpsee::RpcModule;
1212
use sc_client_api::BlockBackend;
1313
use sc_rpc::dev::{Dev, DevApiServer};
@@ -37,7 +37,7 @@ where
3737
C: BlockBackend<Block>,
3838
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
3939
C: Send + Sync + 'static,
40-
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
40+
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
4141
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
4242
C::Api: BlockBuilder<Block>,
4343
P: TransactionPool + 'static,

node/src/service.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
22
33
use contracts_node_runtime::{self, opaque::Block, RuntimeApi};
4+
use futures::FutureExt;
5+
use sc_client_api::Backend;
46
pub use sc_executor::NativeElseWasmExecutor;
57
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
68
use sc_telemetry::{Telemetry, TelemetryWorker};
9+
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
710
use std::sync::Arc;
811

912
// Our native executor instance.
@@ -52,7 +55,7 @@ pub fn new_partial(
5255
})
5356
.transpose()?;
5457

55-
let executor = sc_service::new_native_or_wasm_executor(&config);
58+
let executor = sc_service::new_native_or_wasm_executor(config);
5659

5760
let (client, backend, keystore_container, task_manager) =
5861
sc_service::new_full_parts::<Block, RuntimeApi, _>(
@@ -123,11 +126,23 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
123126
})?;
124127

125128
if config.offchain_worker.enabled {
126-
sc_service::build_offchain_workers(
127-
&config,
128-
task_manager.spawn_handle(),
129-
client.clone(),
130-
network.clone(),
129+
task_manager.spawn_handle().spawn(
130+
"offchain-workers-runner",
131+
"offchain-worker",
132+
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
133+
runtime_api_provider: client.clone(),
134+
is_validator: config.role.is_authority(),
135+
keystore: Some(keystore_container.keystore()),
136+
offchain_db: backend.offchain_storage(),
137+
transaction_pool: Some(OffchainTransactionPoolFactory::new(
138+
transaction_pool.clone(),
139+
)),
140+
network_provider: network.clone(),
141+
enable_http_requests: true,
142+
custom_extensions: |_| vec![],
143+
})
144+
.run(client.clone(), task_manager.spawn_handle())
145+
.boxed(),
131146
);
132147
}
133148

0 commit comments

Comments
 (0)