Commit 7c6390fe authored by Gavin Wood's avatar Gavin Wood Committed by Bastian Köcher
Browse files

Integrate the claims module (#355)



* Integrate the claims.

* Remove accidetnal code.

* Update runtime/src/lib.rs
Co-Authored-By: thiolliere's avatarthiolliere <gui.thiolliere@gmail.com>

* Add Config.

* Introduce claims to config

* Expose claims module signing Prefix (#358)

* Update parking_lot, bette trait args
parent b742b11d
Pipeline #48431 passed with stages
in 12 minutes and 41 seconds
......@@ -20,7 +20,7 @@ dependencies = [
"ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-collator 0.1.0",
"polkadot-parachain 0.1.0",
"polkadot-primitives 0.1.0",
......@@ -1854,6 +1854,14 @@ dependencies = [
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lock_api"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.3.9"
......@@ -2288,6 +2296,16 @@ dependencies = [
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.2.14"
......@@ -2338,6 +2356,20 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "paste"
version = "0.1.5"
......@@ -2406,7 +2438,7 @@ dependencies = [
"kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=616b40150ded71f57f650067fcbc5c99d7c343e6)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 4.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-primitives 0.1.0",
"substrate-primitives 2.0.0 (git+https://github.com/paritytech/substrate?branch=polkadot-master)",
]
......@@ -2474,7 +2506,7 @@ dependencies = [
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 4.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-availability-store 0.1.0",
"polkadot-primitives 0.1.0",
"polkadot-validation 0.1.0",
......@@ -2575,7 +2607,7 @@ dependencies = [
"hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-availability-store 0.1.0",
"polkadot-executor 0.1.0",
"polkadot-network 0.1.0",
......@@ -2619,7 +2651,7 @@ dependencies = [
"futures-timer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-codec 4.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-availability-store 0.1.0",
"polkadot-parachain 0.1.0",
"polkadot-primitives 0.1.0",
......@@ -5247,6 +5279,7 @@ dependencies = [
"checksum linked_hash_set 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7c91c4c7bbeb4f2f7c4e5be11e6a05bd6830bc37249c47ce1ad86ad453ff9c"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3"
"checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
......@@ -5295,10 +5328,12 @@ dependencies = [
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7"
"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c"
"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
"checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79"
"checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6"
"checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9"
......
......@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
polkadot-primitives = { path = "../primitives" }
parking_lot = "0.7.1"
parking_lot = "0.9.0"
log = "0.4.6"
parity-codec = "4.1"
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
arrayvec = "0.4"
parking_lot = "0.7.1"
parking_lot = "0.9.0"
av_store = { package = "polkadot-availability-store", path = "../availability-store" }
polkadot-validation = { path = "../validation" }
polkadot-primitives = { path = "../primitives" }
......
......@@ -68,11 +68,11 @@ impl EcdsaSignature {
decl_event!(
pub enum Event<T> where
B = BalanceOf<T>,
A = <T as system::Trait>::AccountId
Balance = BalanceOf<T>,
AccountId = <T as system::Trait>::AccountId
{
/// Someone claimed some DOTs.
Claimed(A, EthereumAddress, B),
Claimed(AccountId, EthereumAddress, Balance),
}
);
......@@ -96,6 +96,9 @@ decl_storage! {
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
/// The Prefix that is used in signed Ethereum messages for this network
const Prefix: &[u8] = T::Prefix::get();
/// Deposit one of this module's events by using the default implementation.
fn deposit_event<T>() = default;
......
......@@ -144,7 +144,7 @@ parameter_types! {
pub type DealWithFees = SplitTwoWays<
Balance,
NegativeImbalance,
_4, Treasury, // 4 parts (80%) goes to the treasury.
_4, Treasury, // 4 parts (80%) goes to the treasury.
_1, ToAuthor, // 1 part (20%) goes to the block author.
>;
......@@ -373,6 +373,16 @@ impl slots::Trait for Runtime {
impl curated_grandpa::Trait for Runtime { }
parameter_types!{
pub const Prefix: &'static [u8] = b"Pay KSMs to the Kusama account:";
}
impl claims::Trait for Runtime {
type Event = Event;
type Currency = Balances;
type Prefix = Prefix;
}
impl sudo::Trait for Runtime {
type Event = Event;
type Proposal = Call;
......@@ -403,6 +413,7 @@ construct_runtime!(
Parachains: parachains::{Module, Call, Storage, Config<T>, Inherent, Origin},
Attestations: attestations::{Module, Call, Storage},
Slots: slots::{Module, Call, Storage, Event<T>},
Claims: claims::{Module, Call, Storage, Event<T>, Config<T>, ValidateUnsigned},
Sudo: sudo,
}
);
......
......@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
parking_lot = "0.7.1"
parking_lot = "0.9.0"
lazy_static = "1.0"
log = "0.4.6"
slog = "^2"
......
......@@ -22,6 +22,7 @@ use polkadot_runtime::{
GenesisConfig, CouncilConfig, ElectionsConfig, DemocracyConfig, SystemConfig, AuraConfig,
SessionConfig, StakingConfig, BalancesConfig, Perbill, SessionKeys, TechnicalCommitteeConfig,
GrandpaConfig, SudoConfig, IndicesConfig, CuratedGrandpaConfig, StakerStatus, WASM_BINARY,
ClaimsConfig,
};
use polkadot_runtime::constants::{currency::DOTS, time::*};
use telemetry::TelemetryEndpoints;
......@@ -126,6 +127,9 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
curated_grandpa: Some(CuratedGrandpaConfig {
shuffle_period: 1024,
}),
claims: Some(ClaimsConfig {
claims: vec![],
})
}
}
......@@ -256,6 +260,9 @@ pub fn testnet_genesis(
curated_grandpa: Some(CuratedGrandpaConfig {
shuffle_period: 1024,
}),
claims: Some(ClaimsConfig {
claims: vec![],
})
}
}
......
......@@ -10,7 +10,7 @@ parachain = { package = "polkadot-parachain", path = "../../../parachain" }
collator = { package = "polkadot-collator", path = "../../../collator" }
primitives = { package = "polkadot-primitives", path = "../../../primitives" }
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
parking_lot = "0.7.1"
parking_lot = "0.9.0"
ctrlc = { version = "3.0", features = ["termination"] }
futures = "0.1"
exit-future = "0.1.2"
......@@ -8,7 +8,7 @@ edition = "2018"
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.17", features = ["compat"] }
futures-timer = "0.2.1"
parking_lot = "0.7.1"
parking_lot = "0.9.0"
tokio = "0.1.7"
derive_more = "0.14.0"
log = "0.4.6"
......
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