Unverified Commit 185384a8 authored by Nikolay Volf's avatar Nikolay Volf Committed by GitHub
Browse files

Update to latest substrate master (#853)



* try to update

* latest updates

* final fixes

* Fix claim w/ vesting logic

* Make claim tests a bit better

Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
parent 4e4a9778
Pipeline #79684 passed with stages
in 23 minutes and 15 seconds
......@@ -32,13 +32,12 @@ use runtime_common::{attestations, claims, parachains, registrar, slots,
NegativeImbalance, BlockHashCount, MaximumBlockWeight, AvailableBlockRatio,
MaximumBlockLength,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
ApplyExtrinsicResult, Percent, Permill, Perbill, RuntimeDebug,
transaction_validity::{TransactionValidity, InvalidTransaction, TransactionValidityError},
curve::PiecewiseLinear,
traits::{BlakeTwo256, Block as BlockT, StaticLookup, SignedExtension, OpaqueKeys, ConvertInto},
traits::{BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup},
};
use version::RuntimeVersion;
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
......@@ -77,8 +76,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 1048,
impl_version: 0,
spec_version: 1049,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
};
......@@ -127,7 +126,7 @@ impl system::Trait for Runtime {
type Hash = Hash;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = Indices;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event;
type BlockHashCount = BlockHashCount;
......@@ -136,6 +135,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
type ModuleToIndex = ModuleToIndex;
type AccountData = balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = (Balances, Staking, Session, Recovery, Democracy);
}
parameter_types! {
......@@ -157,14 +159,13 @@ parameter_types! {
impl indices::Trait for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
type Event = Event;
type IsDeadAccount = Balances;
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
}
parameter_types! {
pub const ExistentialDeposit: Balance = 1 * CENTS;
pub const CreationFee: Balance = 1 * CENTS;
}
/// Splits fees 80/20 between treasury and block author.
......@@ -180,10 +181,7 @@ impl balances::Trait for Runtime {
type DustRemoval = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type OnReapAccount = (Staking, Session, Democracy);
type OnNewAccount = ();
type TransferPayment = ();
type CreationFee = CreationFee;
type AccountStore = System;
}
parameter_types! {
......@@ -625,7 +623,7 @@ construct_runtime! {
// Consensus support.
Authorship: authorship::{Module, Call, Storage},
Staking: staking,
Staking: staking::{Module, Call, Storage, Config<T>, Event<T>},
Offences: offences::{Module, Call, Storage, Event},
Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Inherent},
......@@ -669,7 +667,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub type Address = <Indices as StaticLookup>::Source;
pub type Address = AccountId;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
......@@ -722,6 +720,10 @@ sp_api::impl_runtime_apis! {
Executive::apply_extrinsic(extrinsic)
}
fn apply_trusted_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
Executive::finalize_block()
}
......@@ -807,6 +809,10 @@ sp_api::impl_runtime_apis! {
secondary_slots: true,
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
Babe::current_epoch_start()
}
}
impl authority_discovery_primitives::AuthorityDiscoveryApi<Block> for Runtime {
......
[package]
name = "polkadot-runtime"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
......@@ -48,7 +48,7 @@ offences = { package = "pallet-offences", git = "https://github.com/paritytech/s
randomness-collective-flip = { package = "pallet-randomness-collective-flip", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
session = { package = "pallet-session", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
staking = { package = "pallet-staking", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false, features = ["migrate"] }
staking = { package = "pallet-staking", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
system = { package = "frame-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
system_rpc_runtime_api = { package = "frame-system-rpc-runtime-api", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
......
......@@ -38,7 +38,10 @@ use sp_runtime::{
ApplyExtrinsicResult, Percent, Permill, Perbill, RuntimeDebug,
transaction_validity::{TransactionValidity, InvalidTransaction, TransactionValidityError},
curve::PiecewiseLinear,
traits::{BlakeTwo256, Block as BlockT, StaticLookup, SignedExtension, OpaqueKeys, ConvertInto},
traits::{
BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto,
IdentityLookup
},
};
use version::RuntimeVersion;
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
......@@ -78,7 +81,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("polkadot"),
impl_name: create_runtime_str!("parity-polkadot"),
authoring_version: 2,
spec_version: 1003,
spec_version: 1004,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};
......@@ -131,7 +134,7 @@ impl system::Trait for Runtime {
type Hash = Hash;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = Indices;
type Lookup = IdentityLookup<AccountId>;
type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event;
type BlockHashCount = BlockHashCount;
......@@ -140,6 +143,9 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
type ModuleToIndex = ModuleToIndex;
type AccountData = balances::AccountData<Balance>;
type OnNewAccount = ();
type OnReapAccount = (Balances, Staking, Session, Democracy);
}
parameter_types! {
......@@ -161,14 +167,13 @@ parameter_types! {
impl indices::Trait for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
type Event = Event;
type IsDeadAccount = Balances;
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
}
parameter_types! {
pub const ExistentialDeposit: Balance = 100 * CENTS;
pub const CreationFee: Balance = 1 * CENTS;
}
/// Splits fees 80/20 between treasury and block author.
......@@ -184,10 +189,7 @@ impl balances::Trait for Runtime {
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type OnReapAccount = (Staking, Session, Democracy);
type OnNewAccount = ();
type TransferPayment = ();
type CreationFee = CreationFee;
type AccountStore = System;
}
parameter_types! {
......@@ -529,7 +531,7 @@ impl vesting::Trait for Runtime {
impl sudo::Trait for Runtime {
type Event = Event;
type Proposal = Call;
type Call = Call;
}
construct_runtime! {
......@@ -546,13 +548,13 @@ construct_runtime! {
Babe: babe::{Module, Call, Storage, Config, Inherent(Timestamp)},
Timestamp: timestamp::{Module, Call, Storage, Inherent},
Indices: indices,
Indices: indices::{Module, Call, Storage, Config<T>, Event<T>},
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage},
// Consensus support.
Authorship: authorship::{Module, Call, Storage},
Staking: staking::{default},
Staking: staking::{Module, Call, Storage, Config<T>, Event<T>},
Offences: offences::{Module, Call, Storage, Event},
Session: session::{Module, Call, Storage, Event, Config<T>},
FinalityTracker: finality_tracker::{Module, Call, Inherent},
......@@ -581,12 +583,12 @@ construct_runtime! {
Vesting: vesting::{Module, Call, Storage, Event<T>, Config<T>},
// Sudo. Last module. Usable initially, but removed once governance enabled.
Sudo: sudo,
Sudo: sudo::{Module, Call, Storage, Config<T>, Event<T>},
}
}
/// The address format for describing accounts.
pub type Address = <Indices as StaticLookup>::Source;
pub type Address = AccountId;
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
......@@ -640,6 +642,10 @@ sp_api::impl_runtime_apis! {
Executive::apply_extrinsic(extrinsic)
}
fn apply_trusted_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
}
fn finalize_block() -> <Block as BlockT>::Header {
Executive::finalize_block()
}
......@@ -725,6 +731,10 @@ sp_api::impl_runtime_apis! {
secondary_slots: true,
}
}
fn current_epoch_start() -> babe_primitives::SlotNumber {
Babe::current_epoch_start()
}
}
impl authority_discovery_primitives::AuthorityDiscoveryApi<Block> for Runtime {
......
[package]
name = "polkadot-service"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
......@@ -171,9 +171,7 @@ fn staging_testnet_config_genesis() -> polkadot::GenesisConfig {
.collect(),
}),
indices: Some(polkadot::IndicesConfig {
ids: endowed_accounts.iter().cloned()
.chain(initial_authorities.iter().map(|x| x.0.clone()))
.collect::<Vec<_>>(),
indices: vec![],
}),
session: Some(polkadot::SessionConfig {
keys: initial_authorities.iter().map(|x| (
......@@ -313,7 +311,7 @@ pub fn testnet_genesis(
changes_trie_config: Default::default(),
}),
indices: Some(polkadot::IndicesConfig {
ids: endowed_accounts.clone(),
indices: vec![],
}),
balances: Some(polkadot::BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
......
......@@ -177,9 +177,8 @@ macro_rules! new_full_start {
import_setup = Some((block_import, grandpa_link, babe_link));
Ok(import_queue)
})?
.with_rpc_extensions(|client, pool, _backend, _fetcher, _remote_blockchain|
-> Result<polkadot_rpc::RpcExtension, _> {
Ok(polkadot_rpc::create_full(client, pool))
.with_rpc_extensions(|builder| -> Result<polkadot_rpc::RpcExtension, _> {
Ok(polkadot_rpc::create_full(builder.client().clone(), builder.pool()))
})?;
(builder, import_setup, inherent_data_providers)
......@@ -479,7 +478,6 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
on_exit: service.on_exit(),
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: grandpa::VotingRulesBuilder::default().build(),
executor: service.spawn_task_handle(),
};
service.spawn_essential_task(
......@@ -626,13 +624,14 @@ where
.with_finality_proof_provider(|client, backend|
Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, client)) as _)
)?
.with_rpc_extensions(|client, pool, _backend, fetcher, remote_blockchain|
.with_rpc_extensions(|builder|
-> Result<polkadot_rpc::RpcExtension, _> {
let fetcher = fetcher
let fetcher = builder.fetcher()
.ok_or_else(|| "Trying to start node RPC without active fetcher")?;
let remote_blockchain = remote_blockchain
let remote_blockchain = builder.remote_backend()
.ok_or_else(|| "Trying to start node RPC without active remote blockchain")?;
Ok(polkadot_rpc::create_light(client, remote_blockchain, fetcher, pool))
Ok(polkadot_rpc::create_light(builder.client().clone(), remote_blockchain, fetcher, builder.pool()))
})?
.build()
}
[package]
name = "polkadot-statement-table"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "adder"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition"
edition = "2018"
......
[package]
name = "halt"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which executes forever"
edition = "2018"
......
[package]
name = "polkadot-validation"
version = "0.7.20"
version = "0.7.21"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
......@@ -306,7 +306,7 @@ impl<Client, TxPool, Backend> CreateProposalData<Client, TxPool, Backend> where
break;
}
match block_builder.push(ready.data().clone()) {
match block_builder.push_trusted(ready.data().clone()) {
Ok(()) => {
debug!("[{:?}] Pushed to the block.", ready.hash());
pending_size += encoded_size;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment