Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit a55b01d

Browse files
committed
all tests and check pass
1 parent 27d63ea commit a55b01d

File tree

17 files changed

+2910
-1666
lines changed

17 files changed

+2910
-1666
lines changed

Diff for: Cargo.lock

+2,089-1,129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+458-273
Large diffs are not rendered by default.

Diff for: staging/node/Cargo.toml

+24-23
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,35 @@ futures = { version = "0.3.21", features = ["thread-pool"] }
2222
futures-timer = "3.0.1"
2323
jsonrpsee = { version = "0.16.2", features = ["server"] }
2424

25-
# TODO: clean deps.
26-
27-
sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
28-
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
29-
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
30-
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
31-
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
32-
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
33-
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
34-
sc-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" } # TODO: Naming of this crate is not aligned.
35-
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
36-
sc-rpc-api = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
37-
sc-basic-authorship = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
38-
39-
sp-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
40-
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
41-
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
42-
sp-blockchain = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
43-
sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
44-
45-
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
25+
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
26+
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
27+
sc-network = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
28+
sc-service = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
29+
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
30+
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
31+
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
32+
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
33+
sc-consensus-manual-seal = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
34+
sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
35+
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
36+
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
37+
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
38+
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
39+
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
40+
sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
41+
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
42+
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
43+
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
44+
45+
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
4646

4747
# Local Dependencies
4848
runtime = { package = "staging-runtime", path = "../runtime" }
49-
frame = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api" }
49+
frame = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
5050

5151
[build-dependencies]
52-
substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" }
52+
substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api" }
5353

5454
[features]
5555
default = []
56+

Diff for: staging/node/src/chain_spec.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
use runtime::{BalancesConfig, RuntimeGenesisConfig, SudoConfig, SystemConfig, WASM_BINARY};
219
use sc_service::{ChainType, Properties};
320
use sp_keyring::AccountKeyring;
@@ -8,7 +25,7 @@ pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
825
fn props() -> Properties {
926
let mut properties = Properties::new();
1027
properties.insert("tokenDecimals".to_string(), 0.into());
11-
properties.insert("tokenSymbol".to_string(), "TEST".into());
28+
properties.insert("tokenSymbol".to_string(), "MINI".into());
1229
properties
1330
}
1431

@@ -40,6 +57,7 @@ fn testnet_genesis(wasm_binary: &[u8]) -> RuntimeGenesisConfig {
4057
system: SystemConfig {
4158
// Add Wasm runtime to storage.
4259
code: wasm_binary.to_vec(),
60+
_config: Default::default(),
4361
},
4462
balances: BalancesConfig { balances },
4563
sudo: SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },

Diff for: staging/node/src/cli.rs

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
use sc_cli::RunCmd;
219

320
#[derive(Debug, Clone)]

Diff for: staging/node/src/command.rs

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
use crate::{
219
chain_spec,
320
cli::{Cli, Subcommand},
421
service,
522
};
6-
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
23+
use sc_cli::SubstrateCli;
724
use sc_service::PartialComponents;
825

926
#[cfg(feature = "try-runtime")]
@@ -41,10 +58,6 @@ impl SubstrateCli for Cli {
4158
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
4259
})
4360
}
44-
45-
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
46-
&runtime::VERSION
47-
}
4861
}
4962

5063
/// Parse and run command line arguments

Diff for: staging/node/src/lib.rs

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
pub mod chain_spec;
219
pub(crate) mod cli;
320
pub mod rpc;

Diff for: staging/node/src/main.rs

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
//! Substrate Node Template CLI library.
219
#![warn(missing_docs)]
320

Diff for: staging/node/src/rpc.rs

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
118
//! A collection of node-specific RPC methods.
219
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
320
//! used by Substrate nodes. This file extends those RPC definitions with
@@ -6,7 +23,7 @@
623
#![warn(missing_docs)]
724

825
use jsonrpsee::RpcModule;
9-
use runtime::interface::{AccountId, Index, OpaqueBlock};
26+
use runtime::interface::{AccountId, Nonce, OpaqueBlock};
1027
use sc_transaction_pool_api::TransactionPool;
1128
use sp_block_builder::BlockBuilder;
1229
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
@@ -31,24 +48,25 @@ pub fn create_full<C, P>(
3148
where
3249
C: sp_api::ProvideRuntimeApi<
3350
// TODO: bloody hell..
34-
frame::runtime::runtime_types_generic::Block<
35-
frame::runtime::runtime_types_generic::Header<u32, frame::primitives::BlakeTwo256>,
36-
frame::runtime::runtime_types_generic::OpaqueExtrinsic,
51+
frame::deps::sp_runtime::generic::Block<
52+
frame::deps::sp_runtime::generic::Header<u32, frame::primitives::BlakeTwo256>,
53+
frame::deps::sp_runtime::OpaqueExtrinsic,
3754
>,
3855
// OpaqueBlock,
3956
>,
4057
C: HeaderBackend<OpaqueBlock> + HeaderMetadata<OpaqueBlock, Error = BlockChainError> + 'static,
4158
C: Send + Sync + 'static,
42-
C::Api: BlockBuilder<OpaqueBlock>,
4359
P: TransactionPool + 'static,
44-
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Index>,
60+
C::Api: BlockBuilder<OpaqueBlock>,
61+
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
4562
{
4663
use substrate_frame_rpc_system::{System, SystemApiServer};
4764

4865
let mut module = RpcModule::new(());
4966
let FullDeps { client, pool, deny_unsafe } = deps;
5067

5168
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
69+
// NOTE: we have intentionally ignored adding tx-payments's custom RPC here.
5270

5371
Ok(module)
5472
}

Diff for: staging/node/src/service.rs

+47-27
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
1+
// This file is part of Substrate.
2+
3+
// Copyright (C) Parity Technologies (UK) Ltd.
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
18+
use futures::FutureExt;
119
use runtime::{self, interface::OpaqueBlock as Block, RuntimeApi};
2-
pub use sc_executor::NativeElseWasmExecutor;
20+
use sc_client_api::backend::Backend;
21+
use sc_executor::WasmExecutor;
322
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
423
use sc_telemetry::{Telemetry, TelemetryWorker};
24+
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
525
use std::sync::Arc;
626

727
use crate::cli::Consensus;
828

9-
// Our native executor instance.
10-
pub struct ExecutorDispatch;
29+
#[cfg(feature = "runtime-benchmarks")]
30+
type HostFunctions =
31+
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);
1132

12-
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
13-
/// Only enable the benchmarking host functions when we actually want to benchmark.
14-
#[cfg(feature = "runtime-benchmarks")]
15-
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
16-
/// Otherwise we only use the default Substrate host functions.
17-
#[cfg(not(feature = "runtime-benchmarks"))]
18-
type ExtendHostFunctions = ();
19-
20-
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
21-
runtime::api::dispatch(method, data)
22-
}
23-
24-
fn native_version() -> sc_executor::NativeVersion {
25-
runtime::native_version()
26-
}
27-
}
33+
#[cfg(not(feature = "runtime-benchmarks"))]
34+
type HostFunctions = sp_io::SubstrateHostFunctions;
2835

2936
pub(crate) type FullClient =
30-
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
37+
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
3138
type FullBackend = sc_service::TFullBackend<Block>;
3239
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
3340

@@ -38,7 +45,7 @@ pub fn new_partial(
3845
FullClient,
3946
FullBackend,
4047
FullSelectChain,
41-
sc_consensus::DefaultImportQueue<Block, FullClient>,
48+
sc_consensus::DefaultImportQueue<Block>,
4249
sc_transaction_pool::FullPool<Block, FullClient>,
4350
Option<Telemetry>,
4451
>,
@@ -55,7 +62,7 @@ pub fn new_partial(
5562
})
5663
.transpose()?;
5764

58-
let executor = sc_service::new_native_or_wasm_executor(&config);
65+
let executor = sc_service::new_wasm_executor(&config);
5966

6067
let (client, backend, keystore_container, task_manager) =
6168
sc_service::new_full_parts::<Block, RuntimeApi, _>(
@@ -123,14 +130,27 @@ pub fn new_full(config: Configuration, consensus: Consensus) -> Result<TaskManag
123130
net_config,
124131
block_announce_validator_builder: None,
125132
warp_sync_params: None,
133+
block_relay: None,
126134
})?;
127135

128136
if config.offchain_worker.enabled {
129-
sc_service::build_offchain_workers(
130-
&config,
131-
task_manager.spawn_handle(),
132-
client.clone(),
133-
network.clone(),
137+
task_manager.spawn_handle().spawn(
138+
"offchain-workers-runner",
139+
"offchain-worker",
140+
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
141+
runtime_api_provider: client.clone(),
142+
is_validator: config.role.is_authority(),
143+
keystore: Some(keystore_container.keystore()),
144+
offchain_db: backend.offchain_storage(),
145+
transaction_pool: Some(OffchainTransactionPoolFactory::new(
146+
transaction_pool.clone(),
147+
)),
148+
network_provider: network.clone(),
149+
enable_http_requests: true,
150+
custom_extensions: |_| vec![],
151+
})
152+
.run(client.clone(), task_manager.spawn_handle())
153+
.boxed(),
134154
);
135155
}
136156

Diff for: staging/pallets/Cargo.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ edition = "2021"
55

66

77
[dependencies]
8-
frame = { git = "https://github.com/paritytech/substrate.git", branch = "kiz-frame-api", default-features = false, features = ["runtime"] }
9-
10-
# TODO https://github.com/paritytech/substrate/issues/14127
118
parity-scale-codec = { version = "3.0.0", default-features = false }
129
scale-info = { version = "2.6.0", default-features = false }
1310

11+
frame = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "kiz-frame-api", default-features = false, features = ["runtime"] }
12+
1413
[features]
1514
default = ["std"]
1615
std = [
17-
"frame/std",
18-
1916
"parity-scale-codec/std",
2017
"scale-info/std",
18+
19+
"frame/std",
2120
]

0 commit comments

Comments
 (0)