Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit ec4b38d

Browse files
Merge remote-tracking branch 'substrate/master' into chore/bt_127_merge_substrate
* substrate/master: (102 commits) Add storage root recalculation time to benchmarks (#5035) Lazy reaping (#4895) Cargo.toml fixups for the release (#4975) Update the documentation for `secp256k1_ecdsa_recover*` (#5019) Remove `NetworkSpecialization` (#4665) Add tests & Service's Configuration has optional fields that shouldn't be optional (#4842) Add gitlab job for publishing draft releases (#5009) Removes use of sc_client::Client from sc_consensus_babe (#5014) Wait for RPC server to cleanup on shutdown (#5004) Open one substream for each notifications protocol (#4909) node, node-template: disable GRANDPA observer (#5011) Make sure we use libp2p 0.16.1 (#5017) aura: remove unneeded SlotDuration struct and rename digest -> digests (#4958) babe: directly using append_u64 in transcript instead of to_le_bytes (#5005) Un-deprecate ValidateUnsigned (#5003) CI: Add example CI job template to .gitlab-ci.yml (#5012) Benchmark macro (#4962) Remove deprecated API (#4993) Unsigned transactions should also note weight (#4998) Offchain Workers: Example Pallet (#4989) ... # Conflicts: # Cargo.lock # bin/node-template/node/src/service.rs # bin/node-template/pallets/template/src/mock.rs # bin/node-template/runtime/Cargo.toml # bin/node-template/runtime/src/lib.rs # bin/node/cli/Cargo.toml # bin/node/cli/bin/main.rs # bin/node/cli/src/service.rs # bin/node/cli/tests/common.rs # bin/node/cli/tests/purge_chain_works.rs # bin/node/cli/tests/running_the_node_and_interrupt.rs # bin/node/executor/src/lib.rs # bin/node/executor/tests/basic.rs # bin/node/executor/tests/fees.rs # bin/node/executor/tests/submit_transaction.rs # bin/node/runtime/Cargo.toml # bin/node/runtime/src/lib.rs # bin/node/transaction-factory/src/lib.rs # client/cli/src/lib.rs # client/cli/src/params.rs # client/transaction-pool/src/testing/pool.rs # frame/assets/src/lib.rs # frame/aura/src/mock.rs # frame/authority-discovery/src/lib.rs # frame/authorship/src/lib.rs # frame/babe/src/mock.rs # frame/balances/Cargo.toml # frame/balances/src/lib.rs # frame/balances/src/mock.rs # frame/balances/src/tests.rs # frame/balances/src/tests_composite.rs # frame/balances/src/tests_local.rs # frame/benchmarking/src/lib.rs # frame/benchmarking/src/utils.rs # frame/collective/src/lib.rs # frame/contracts/src/account_db.rs # frame/contracts/src/exec.rs # frame/contracts/src/lib.rs # frame/contracts/src/tests.rs # frame/democracy/src/lib.rs # frame/elections-phragmen/src/lib.rs # frame/elections/src/mock.rs # frame/example-offchain-worker/src/tests.rs # frame/example/src/lib.rs # frame/executive/Cargo.toml # frame/executive/src/lib.rs # frame/finality-tracker/src/lib.rs # frame/generic-asset/src/lib.rs # frame/generic-asset/src/mock.rs # frame/grandpa/src/mock.rs # frame/identity/src/lib.rs # frame/im-online/src/mock.rs # frame/indices/src/mock.rs # frame/membership/src/lib.rs # frame/nicks/src/lib.rs # frame/offences/src/mock.rs # frame/randomness-collective-flip/src/lib.rs # frame/recovery/src/lib.rs # frame/recovery/src/mock.rs # frame/scored-pool/src/mock.rs # frame/session/src/mock.rs # frame/society/src/mock.rs # frame/staking/Cargo.toml # frame/staking/src/lib.rs # frame/staking/src/mock.rs # frame/support/src/storage/migration.rs # frame/support/src/traits.rs # frame/system/benches/bench.rs # frame/system/src/lib.rs # frame/system/src/offchain.rs # frame/timestamp/src/lib.rs # frame/transaction-payment/src/lib.rs # frame/treasury/src/lib.rs # frame/utility/src/lib.rs # frame/vesting/src/lib.rs # primitives/runtime/Cargo.toml # primitives/runtime/src/testing.rs # test-utils/runtime/src/lib.rs # utils/frame/benchmarking-cli/src/lib.rs # utils/grafana-data-source/test/Cargo.toml
2 parents eaff5f7 + 41bb219 commit ec4b38d

File tree

85 files changed

+915
-2080
lines changed

Some content is hidden

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

85 files changed

+915
-2080
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ pub fn new_full(config: Configuration<GenesisConfig>)
160160
on_exit: service.on_exit(),
161161
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
162162
voting_rule: grandpa::VotingRulesBuilder::default().build(),
163-
executor: service.spawn_task_handle(),
164163
};
165164

166165
// the GRANDPA voter task is considered infallible, i.e.

bin/node-template/pallets/template/src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ impl system::Trait for Test {
3939
type AvailableBlockRatio = AvailableBlockRatio;
4040
type Version = ();
4141
type ModuleToIndex = ();
42-
type AccountData = ();
43-
type OnNewAccount = ();
44-
type OnReapAccount = ();
4542
type Doughnut = ();
4643
type DelegatedDispatchVerifier = ();
44+
type AccountData = ();
45+
type OnNewAccount = ();
46+
type OnKilledAccount = ();
4747
}
4848
impl Trait for Test {
4949
type Event = ();

bin/node-template/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl system::Trait for Runtime {
171171
/// What to do if a new account is created.
172172
type OnNewAccount = ();
173173
/// What to do if an account is fully reaped from the system.
174-
type OnReapAccount = Balances;
174+
type OnKilledAccount = ();
175175
/// The data to be stored in an account.
176176
type AccountData = balances::AccountData<Balance>;
177177
}

bin/node/cli/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub fn testnet_genesis(
239239
}),
240240
pallet_session: Some(SessionConfig {
241241
keys: initial_authorities.iter().map(|x| {
242-
(x.0.clone(), session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone()))
242+
(x.0.clone(), x.0.clone(), session_keys(x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone()))
243243
}).collect::<Vec<_>>(),
244244
}),
245245
pallet_staking: Some(StakingConfig {

bin/node/cli/src/service.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ macro_rules! new_full {
228228
on_exit: service.on_exit(),
229229
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
230230
voting_rule: grandpa::VotingRulesBuilder::default().build(),
231-
executor: service.spawn_task_handle(),
232231
};
233232

234233
// the GRANDPA voter task is considered infallible, i.e.

bin/node/cli/tests/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ pub fn run_command_for_a_while(base_path: &Path, dev: bool) {
6060

6161
// Stop the process
6262
kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap();
63-
assert!(wait_for(&mut cmd, 20).map(|x| x.success()).unwrap_or_default());
63+
assert!(wait_for(&mut cmd, 40).map(|x| x.success()).unwrap_or_default());
6464
}

bin/node/cli/tests/purge_chain_works.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use assert_cmd::cargo::cargo_bin;
1818
use std::process::Command;
1919
use tempfile::tempdir;
20+
use std::fs;
2021

2122
mod common;
2223

bin/node/cli/tests/running_the_node_and_interrupt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn running_the_node_works_and_can_be_interrupted() {
2828

2929
fn run_command_and_kill(signal: Signal) {
3030
let base_path = tempdir().expect("could not create a temp dir");
31-
let mut cmd = Command::new(cargo_bin("plug"))
31+
let mut cmd = Command::new(cargo_bin("substrate"))
3232
.args(&["--dev", "-d"])
3333
.arg(base_path.path())
3434
.spawn()
@@ -43,9 +43,8 @@ fn running_the_node_works_and_can_be_interrupted() {
4343
"the process must exit gracefully after signal {}",
4444
signal,
4545
);
46-
let _ = fs::remove_dir_all("interrupt_test");
4746
}
4847

4948
run_command_and_kill(SIGINT);
5049
run_command_and_kill(SIGTERM);
51-
}
50+
}

bin/node/executor/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ native_executor_instance!(
2727
node_runtime::api::dispatch,
2828
node_runtime::native_version,
2929
frame_benchmarking::benchmarking::HostFunctions,
30-
sp_io::benchmarking::HostFunctions,
3130
);

bin/node/executor/tests/basic.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn panic_execution_with_foreign_code_gives_error() {
166166
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(BLOATY_CODE, Storage {
167167
top: map![
168168
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
169-
(69u128, 0u128, 0u128, 0u128).encode()
169+
(69u128, 0u8, 0u128, 0u128, 0u128).encode()
170170
},
171171
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
172172
69_u128.encode()
@@ -202,7 +202,7 @@ fn bad_extrinsic_with_native_equivalent_code_gives_error() {
202202
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, Storage {
203203
top: map![
204204
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
205-
(0u32, 69u128, 0u128, 0u128, 0u128).encode()
205+
(0u32, 0u8, 69u128, 0u128, 0u128, 0u128).encode()
206206
},
207207
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
208208
69_u128.encode()
@@ -238,7 +238,7 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
238238
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, Storage {
239239
top: map![
240240
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
241-
(0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
241+
(0u32, 0u8, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
242242
},
243243
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
244244
(111 * DOLLARS).encode()
@@ -280,7 +280,7 @@ fn successful_execution_with_foreign_code_gives_ok() {
280280
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(BLOATY_CODE, Storage {
281281
top: map![
282282
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
283-
(0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
283+
(0u32, 0u8, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
284284
},
285285
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
286286
(111 * DOLLARS).encode()
@@ -736,7 +736,7 @@ fn successful_execution_gives_ok() {
736736
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, Storage {
737737
top: map![
738738
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
739-
(0u32, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
739+
(0u32, 0u8, 111 * DOLLARS, 0u128, 0u128, 0u128).encode()
740740
},
741741
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
742742
(111 * DOLLARS).encode()

bin/node/executor/tests/fees.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ fn transaction_fee_is_correct_ultimate() {
139139
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, Storage {
140140
top: map![
141141
<frame_system::Account<Runtime>>::hashed_key_for(alice()) => {
142-
(0u32, 100 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS).encode()
142+
(0u32, 0u8, 100 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS).encode()
143143
},
144144
<frame_system::Account<Runtime>>::hashed_key_for(bob()) => {
145-
(0u32, 10 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS).encode()
145+
(0u32, 0u8, 10 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS, 0 * DOLLARS).encode()
146146
},
147147
<pallet_balances::TotalIssuance<Runtime>>::hashed_key().to_vec() => {
148148
(110 * DOLLARS).encode()

bin/node/executor/tests/submit_transaction.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ fn submitted_transaction_should_be_valid() {
167167
// add balance to the account
168168
let author = extrinsic.signature.clone().unwrap().0;
169169
let address = Indices::lookup(author).unwrap();
170-
let account = pallet_balances::AccountData { free: 5_000_000_000_000, ..Default::default() };
171-
<frame_system::Account<Runtime>>::insert(&address, (0u32, account));
170+
let data = pallet_balances::AccountData { free: 5_000_000_000_000, ..Default::default() };
171+
let account = frame_system::AccountInfo { nonce: 0u32, refcount: 0u8, data };
172+
<frame_system::Account<Runtime>>::insert(&address, account);
172173

173174
// check validity
174175
let res = Executive::validate_transaction(extrinsic);

bin/node/runtime/src/lib.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub use node_primitives::{AccountId, Signature};
3131
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
3232
use sp_api::impl_runtime_apis;
3333
use sp_runtime::{
34-
Permill, Perbill, Percent, ApplyExtrinsicResult, BenchmarkResults,
35-
impl_opaque_keys, generic, create_runtime_str,
34+
Permill, Perbill, Percent, ApplyExtrinsicResult, impl_opaque_keys, generic, create_runtime_str,
3635
};
3736
use sp_runtime::curve::PiecewiseLinear;
3837
use sp_runtime::transaction_validity::TransactionValidity;
@@ -134,7 +133,7 @@ impl frame_system::Trait for Runtime {
134133
type ModuleToIndex = ModuleToIndex;
135134
type AccountData = pallet_balances::AccountData<Balance>;
136135
type OnNewAccount = ();
137-
type OnReapAccount = (Balances, Staking, Contracts, Session, Recovery);
136+
type OnKilledAccount = ();
138137
}
139138

140139
parameter_types! {
@@ -830,29 +829,26 @@ impl_runtime_apis! {
830829
SessionKeys::decode_into_raw_public_keys(&encoded)
831830
}
832831
}
833-
impl crate::Benchmark<Block> for Runtime {
834-
fn dispatch_benchmark(module: Vec<u8>, extrinsic: Vec<u8>, steps: u32, repeat: u32)
835-
-> Option<Vec<frame_benchmarking::BenchmarkResults>>
836-
{
832+
833+
impl frame_benchmarking::Benchmark<Block> for Runtime {
834+
fn dispatch_benchmark(
835+
module: Vec<u8>,
836+
extrinsic: Vec<u8>,
837+
steps: u32,
838+
repeat: u32,
839+
) -> Option<Vec<frame_benchmarking::BenchmarkResults>> {
837840
use frame_benchmarking::Benchmarking;
841+
838842
match module.as_slice() {
839843
b"pallet-balances" | b"balances" => Balances::run_benchmark(extrinsic, steps, repeat).ok(),
840844
b"pallet-identity" | b"identity" => Identity::run_benchmark(extrinsic, steps, repeat).ok(),
841845
b"pallet-timestamp" | b"timestamp" => Timestamp::run_benchmark(extrinsic, steps, repeat).ok(),
842-
_ => return None,
846+
_ => None,
843847
}
844848
}
845849
}
846850
}
847851

848-
sp_api::decl_runtime_apis! {
849-
pub trait Benchmark
850-
{
851-
fn dispatch_benchmark(module: Vec<u8>, extrinsic: Vec<u8>, steps: u32, repeat: u32)
852-
-> Option<Vec<BenchmarkResults>>;
853-
}
854-
}
855-
856852
#[cfg(test)]
857853
mod tests {
858854
use super::*;

bin/node/testing/src/genesis.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ pub fn config_endowed(
6969
}),
7070
pallet_session: Some(SessionConfig {
7171
keys: vec![
72-
(alice(), to_session_keys(
72+
(dave(), alice(), to_session_keys(
7373
&Ed25519Keyring::Alice,
7474
&Sr25519Keyring::Alice,
7575
)),
76-
(bob(), to_session_keys(
76+
(eve(), bob(), to_session_keys(
7777
&Ed25519Keyring::Bob,
7878
&Sr25519Keyring::Bob,
7979
)),
80-
(charlie(), to_session_keys(
80+
(ferdie(), charlie(), to_session_keys(
8181
&Ed25519Keyring::Charlie,
8282
&Sr25519Keyring::Charlie,
8383
)),

bin/node/transaction-factory/src/lib.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,7 @@ where
156156
best_hash = block.header().hash();
157157
best_block_id = BlockId::<Block>::hash(best_hash);
158158

159-
let mut import = BlockImportParams {
160-
origin: BlockOrigin::File,
161-
header: block.header().clone(),
162-
post_digests: Vec::new(),
163-
body: Some(block.extrinsics().to_vec()),
164-
storage_changes: None,
165-
finalized: false,
166-
justification: None,
167-
auxiliary: Vec::new(),
168-
intermediates: Default::default(),
169-
fork_choice: Some(ForkChoiceStrategy::LongestChain),
170-
allow_missing_state: false,
171-
import_existing: false,
172-
};
159+
let mut import = BlockImportParams::new(BlockOrigin::File, block.header().clone());
173160
import.body = Some(block.extrinsics().to_vec());
174161
import.fork_choice = Some(ForkChoiceStrategy::LongestChain);
175162
client.clone().import_block(import, HashMap::new()).expect("Failed to import block");

client/cli/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#![warn(unused_extern_crates)]
2121

2222
mod params;
23-
mod execution_strategy;
24-
pub mod error;
2523
mod arg_enums;
24+
mod error;
2625
mod runtime;
2726
mod commands;
2827

0 commit comments

Comments
 (0)