Unverified Commit 12afa03c authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Identity pallet (#1178)



* Identity

* Bump spec

* Update runtime/polkadot/src/lib.rs
Co-authored-by: kaichao's avatarkaichao <kaichaosuna@gmail.com>

* Fix runtime

* Bump runtimes
Co-authored-by: kaichao's avatarkaichao <kaichaosuna@gmail.com>
parent 42f391c3
Pipeline #94831 canceled with stages
in 5 minutes and 24 seconds
......@@ -2324,7 +2324,7 @@ dependencies = [
[[package]]
name = "kusama-runtime"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-benchmarking",
......@@ -4165,7 +4165,7 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e"
[[package]]
name = "polkadot"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"assert_cmd",
"futures 0.3.5",
......@@ -4178,7 +4178,7 @@ dependencies = [
[[package]]
name = "polkadot-availability-store"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"derive_more 0.99.7",
"exit-future",
......@@ -4204,7 +4204,7 @@ dependencies = [
[[package]]
name = "polkadot-cli"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"frame-benchmarking-cli",
"futures 0.3.5",
......@@ -4228,7 +4228,7 @@ dependencies = [
[[package]]
name = "polkadot-collator"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"futures 0.3.5",
"futures-timer 2.0.2",
......@@ -4255,7 +4255,7 @@ dependencies = [
[[package]]
name = "polkadot-erasure-coding"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"derive_more 0.15.0",
"parity-scale-codec",
......@@ -4267,7 +4267,7 @@ dependencies = [
[[package]]
name = "polkadot-network"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"arrayvec 0.4.12",
"bytes 0.5.4",
......@@ -4295,7 +4295,7 @@ dependencies = [
[[package]]
name = "polkadot-network-test"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"futures 0.3.5",
"log 0.4.8",
......@@ -4316,7 +4316,7 @@ dependencies = [
[[package]]
name = "polkadot-parachain"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"derive_more 0.99.7",
"log 0.4.8",
......@@ -4335,7 +4335,7 @@ dependencies = [
[[package]]
name = "polkadot-primitives"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-system",
......@@ -4357,7 +4357,7 @@ dependencies = [
[[package]]
name = "polkadot-rpc"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"jsonrpc-core",
"pallet-transaction-payment-rpc",
......@@ -4382,7 +4382,7 @@ dependencies = [
[[package]]
name = "polkadot-runtime"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-benchmarking",
......@@ -4454,7 +4454,7 @@ dependencies = [
[[package]]
name = "polkadot-runtime-common"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-benchmarking",
......@@ -4497,7 +4497,7 @@ dependencies = [
[[package]]
name = "polkadot-service"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"env_logger",
"frame-benchmarking",
......@@ -4556,7 +4556,7 @@ dependencies = [
[[package]]
name = "polkadot-statement-table"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"parity-scale-codec",
"polkadot-primitives",
......@@ -4565,7 +4565,7 @@ dependencies = [
[[package]]
name = "polkadot-test-runtime"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-executive",
......@@ -4642,7 +4642,7 @@ dependencies = [
[[package]]
name = "polkadot-validation"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"derive_more 0.14.1",
......@@ -7709,7 +7709,7 @@ dependencies = [
[[package]]
name = "test-parachain-adder"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"dlmalloc",
"parity-scale-codec",
......@@ -7748,7 +7748,7 @@ dependencies = [
[[package]]
name = "test-parachain-halt"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"substrate-wasm-builder-runner 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
......@@ -8625,7 +8625,7 @@ dependencies = [
[[package]]
name = "westend-runtime"
version = "0.8.1"
version = "0.8.2"
dependencies = [
"bitvec",
"frame-benchmarking",
......
......@@ -4,7 +4,7 @@ path = "src/main.rs"
[package]
name = "polkadot"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-cli"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot Relay-chain Client Node"
edition = "2018"
......
[package]
name = "polkadot-collator"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"
......
[package]
name = "polkadot-erasure-coding"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-network"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
......
[package]
name = "polkadot-network-test"
version = "0.8.1"
version = "0.8.2"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-parachain"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains"
edition = "2018"
......
[package]
name = "test-parachain-adder"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which adds to a number as its state transition"
edition = "2018"
......
[package]
name = "test-parachain-halt"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Test parachain which executes forever"
edition = "2018"
......
[package]
name = "polkadot-primitives"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-rpc"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "polkadot-runtime-common"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
......
[package]
name = "kusama-runtime"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
......
[package]
name = "polkadot-runtime"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
......
......@@ -124,7 +124,8 @@ impl Filter<Call> for IsCallable {
Call::Authorship(_) | Call::Staking(_) | Call::Offences(_) |
Call::Session(_) | Call::FinalityTracker(_) | Call::Grandpa(_) | Call::ImOnline(_) |
Call::AuthorityDiscovery(_) |
Call::Utility(_) | Call::Claims(_) | Call::Vesting(_) | Call::Sudo(_) =>
Call::Utility(_) | Call::Claims(_) | Call::Vesting(_) | Call::Sudo(_) |
Call::Identity(_) =>
true,
}
}
......@@ -205,8 +206,8 @@ pub type DealWithFees = SplitTwoWays<
impl balances::Trait for Runtime {
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
}
......@@ -252,11 +253,6 @@ impl authorship::Trait for Runtime {
type EventHandler = (Staking, ImOnline);
}
parameter_types! {
pub const Period: BlockNumber = 10 * MINUTES;
pub const Offset: BlockNumber = 0;
}
impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
......@@ -335,6 +331,34 @@ impl staking::Trait for Runtime {
type MaxIterations = MaxIterations;
}
const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS
}
parameter_types! {
// Minimum 4 CENTS/byte
pub const BasicDeposit: Balance = deposit(1, 258);
pub const FieldDeposit: Balance = deposit(0, 66);
pub const SubAccountDeposit: Balance = deposit(1, 53);
pub const MaxSubAccounts: u32 = 100;
pub const MaxAdditionalFields: u32 = 100;
pub const MaxRegistrars: u32 = 20;
}
impl identity::Trait for Runtime {
type Event = Event;
type Currency = Balances;
type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit;
type SubAccountDeposit = SubAccountDeposit;
type MaxSubAccounts = MaxSubAccounts;
type MaxAdditionalFields = MaxAdditionalFields;
type MaxRegistrars = MaxRegistrars;
type Slashed = Treasury;
type ForceOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
type RegistrarOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
}
parameter_types! {
pub const LaunchPeriod: BlockNumber = 28 * DAYS;
pub const VotingPeriod: BlockNumber = 28 * DAYS;
......@@ -376,10 +400,10 @@ impl democracy::Trait for Runtime {
type VetoOrigin = collective::EnsureMember<AccountId, TechnicalCollective>;
type CooloffPeriod = CooloffPeriod;
type PreimageByteDeposit = PreimageByteDeposit;
type OperationalPreimageOrigin = collective::EnsureMember<AccountId, CouncilCollective>;
type Slash = Treasury;
type Scheduler = Scheduler;
type MaxVotes = MaxVotes;
type OperationalPreimageOrigin = collective::EnsureMember<AccountId, CouncilCollective>;
}
parameter_types! {
......@@ -411,6 +435,7 @@ const_assert!(DesiredMembers::get() <= collective::MAX_MEMBERS);
impl elections_phragmen::Trait for Runtime {
type Event = Event;
type ModuleId = ElectionsPhragmenModuleId;
type Currency = Balances;
type ChangeMembers = Council;
type InitializeMembers = Council;
......@@ -423,7 +448,6 @@ impl elections_phragmen::Trait for Runtime {
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type ModuleId = ElectionsPhragmenModuleId;
}
parameter_types! {
......@@ -465,6 +489,7 @@ parameter_types! {
}
impl treasury::Trait for Runtime {
type ModuleId = TreasuryModuleId;
type Currency = Balances;
type ApproveOrigin = collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>;
type RejectOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
......@@ -479,7 +504,6 @@ impl treasury::Trait for Runtime {
type ProposalBondMinimum = ProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type ModuleId = TreasuryModuleId;
}
parameter_types! {
......@@ -516,8 +540,6 @@ impl grandpa::Trait for Runtime {
type Event = Event;
type Call = Call;
type KeyOwnerProofSystem = Historical;
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
......@@ -526,6 +548,8 @@ impl grandpa::Trait for Runtime {
GrandpaId,
)>>::IdentificationTuple;
type KeyOwnerProofSystem = Historical;
type HandleEquivocation = grandpa::EquivocationHandler<
Self::KeyOwnerIdentification,
primitives::fisherman::FishermanAppCrypto,
......@@ -640,11 +664,9 @@ impl system::offchain::SigningTypes for Runtime {
type Signature = Signature;
}
impl<C> system::offchain::SendTransactionTypes<C> for Runtime where
Call: From<C>,
{
type OverarchingCall = Call;
impl<C> system::offchain::SendTransactionTypes<C> for Runtime where Call: From<C> {
type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call;
}
parameter_types! {
......@@ -777,6 +799,9 @@ construct_runtime! {
// Sudo. Last module. Usable initially, but removed once governance enabled.
Sudo: sudo::{Module, Call, Storage, Config<T>, Event<T>},
// Identity. Late addition.
Identity: identity::{Module, Call, Storage, Event<T>},
}
}
......
[package]
name = "polkadot-test-runtime"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
......
[package]
name = "westend-runtime"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
......
......@@ -82,7 +82,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("westend"),
impl_name: create_runtime_str!("parity-westend"),
authoring_version: 2,
spec_version: 2000,
spec_version: 20,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
......
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