From 92231e0d79140015093f27ee6d9ef734bbe90bb0 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 11 May 2020 17:35:59 +0200 Subject: [PATCH 01/24] Introduce mandatory statement signing into claims --- runtime/common/src/claims.rs | 171 +++++++++++++++++++++++++++++------ 1 file changed, 144 insertions(+), 27 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 87b11fd0f5bc..fbe5b765be6c 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -32,6 +32,7 @@ use sp_runtime::{ transaction_validity::{ TransactionLongevity, TransactionValidity, ValidTransaction, InvalidTransaction, TransactionSource, }, + DispatchResult, }; use primitives::ValidityError; use system; @@ -47,6 +48,27 @@ pub trait Trait: system::Trait { type Prefix: Get<&'static [u8]>; } +/// The kind of a statement this account needs to make for a claim to be valid. +pub enum StatementKind { + /// One kind of statement; this is the default. + Default, + /// Another kind of statement(!). + Alternative, +} + +impl StatementKind { + /// Convert this to the (English) statement it represents. + fn to_statement() -> &[u8] { + &[][..] + } +} + +impl Default for StatementKind { + fn default() -> Self { + StatementKind::Default + } +} + /// An Ethereum address (i.e. 20 bytes, used to represent an Ethereum account). /// /// This gets serialized to the 0x-prefixed hex representation. @@ -109,11 +131,15 @@ decl_error! { InvalidEthereumSignature, /// Ethereum address has no claim. SignerHasNoClaim, + /// Account ID sending tx has no claim. + SenderHasNoClaim, /// The destination is already vesting and cannot be the target of a further claim. DestinationVesting, /// There's not enough in the pot to pay out some unvested amount. Generally implies a logic /// error. PotUnderflow, + /// A needed statement was not included. + InvalidStatement, } } @@ -123,7 +149,7 @@ decl_storage! { // keep things around between blocks. trait Store for Module as Claims { Claims get(fn claims) build(|config: &GenesisConfig| { - config.claims.iter().map(|(a, b)| (a.clone(), b.clone())).collect::>() + config.claims.iter().map(|(a, b, _i, _s)| (a.clone(), b.clone())).collect::>() }): map hasher(identity) EthereumAddress => Option>; Total get(fn total) build(|config: &GenesisConfig| { config.claims.iter().fold(Zero::zero(), |acc: BalanceOf, &(_, n)| acc + n) @@ -135,9 +161,23 @@ decl_storage! { Vesting get(fn vesting) config(): map hasher(identity) EthereumAddress => Option<(BalanceOf, BalanceOf, T::BlockNumber)>; + + /// The statement kind that must be signed, if any. + Signing build(|config: &GenesisConfig| { + config.claims.iter() + .filter_map(|(a, _, _, s)| Some(a.clone(), s.clone()?)) + .collect::>() + }): map hasher(identity) EthereumAddress => Option; + + /// Pre-claimed Ethereum accounts, by the Account ID that they are claimed to. + Preclaims build(|config: &GenesisConfig| { + config.claims.iter() + .filter_map(|(a, _, i, _)| Some(i.clone()?, a.clone())) + .collect::>() + }): map hasher(identity) AccountId => EthereumAddress; } add_extra_genesis { - config(claims): Vec<(EthereumAddress, BalanceOf)>; + config(claims): Vec<(EthereumAddress, BalanceOf, Option, Option)>; } } @@ -193,29 +233,10 @@ decl_module! { ensure_none(origin)?; let data = dest.using_encoded(to_ascii_hex); - let signer = Self::eth_recover(ðereum_signature, &data) + let signer = Self::eth_recover(ðereum_signature, &data, statement) .ok_or(Error::::InvalidEthereumSignature)?; - let balance_due = >::get(&signer) - .ok_or(Error::::SignerHasNoClaim)?; - - let new_total = Self::total().checked_sub(&balance_due).ok_or(Error::::PotUnderflow)?; - - // Check if this claim should have a vesting schedule. - if let Some(vs) = >::get(&signer) { - // If this fails, destination account already has a vesting schedule - // applied to it, and this claim should not be processed. - T::VestingSchedule::add_vesting_schedule(&dest, vs.0, vs.1, vs.2) - .map_err(|_| Error::::DestinationVesting)?; - } - - CurrencyOf::::deposit_creating(&dest, balance_due); - >::put(new_total); - >::remove(&signer); - >::remove(&signer); - - // Let's deposit an event to let the outside world know this happened. - Self::deposit_event(RawEvent::Claimed(dest, signer, balance_due)); + Self::process_claim(signer, dest)?; } /// Mint a new claim to collect DOTs. @@ -254,6 +275,74 @@ decl_module! { >::insert(who, vs); } } + + /// Make a claim to collect your DOTs. + /// + /// The dispatch origin for this call must be _None_. + /// + /// Unsigned Validation: + /// A call to claim is deemed valid if the signature provided matches + /// the expected signed message of: + /// + /// > Ethereum Signed Message: + /// > (configured prefix string)(address)(statement) + /// + /// and `address` matches the `dest` account; the `statement` must match that which is + /// expected according to your purchase arrangement. + /// + /// Parameters: + /// - `dest`: The destination account to payout the claim. + /// - `ethereum_signature`: The signature of an ethereum signed message + /// matching the format described above. + /// - `statement`: The identity of the statement which is being attested to in the signature. + /// + /// + /// The weight of this call is invariant over the input parameters. + /// - One `eth_recover` operation which involves a keccak hash and a + /// ecdsa recover. + /// - Four storage reads to check if a claim exists for the user, to + /// get the current pot size, to see if there exists a vesting schedule, to get the + /// required statement. + /// - Up to one storage write for adding a new vesting schedule. + /// - One `deposit_creating` Currency call. + /// - One storage write to update the total. + /// - Two storage removals for vesting and claims information. + /// - One deposit event. + /// + /// Total Complexity: O(1) + /// ---------------------------- + /// Base Weight: 622.6 µs + /// DB Weight: + /// - Read: Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account + /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting + /// + #[weight = T::DbWeight::get().reads_writes(7, 6) + 650_000_000] + fn claim_attest(origin, + dest: T::AccountId, + ethereum_signature: EcdsaSignature, + statement: StatementKind, + ) { + ensure_none(origin)?; + + let data = dest.using_encoded(to_ascii_hex); + let signer = Self::eth_recover(ðereum_signature, &data, statement) + .ok_or(Error::::InvalidEthereumSignature)?; + if let Some(s) = Signing::get(signer) { + ensure!(s == statement, Error::::InvalidStatement); + } + Self::process_claim(signer, dest)?; + } + + /// Attest to a statement, needed to finalize the claims process. + #[weight = T::DbWeight::get().reads_writes(6, 6) + 650_000_000] + fn attest(origin, attested_statement: Vec) { + let who = ensure_signed(origin)?; + let signer = Preclaims::get(&who).ok_or(Error::::SenderHasNoClaim)?; + if let Some(s) = Signing::get(signer) { + ensure!(&attested_statement == s.as_statement(), Error::::InvalidStatement); + } + Self::process_claim(signer, who)?; + } } } @@ -270,9 +359,9 @@ fn to_ascii_hex(data: &[u8]) -> Vec { impl Module { // Constructs the message that Ethereum RPC's `personal_sign` and `eth_sign` would sign. - fn ethereum_signable_message(what: &[u8]) -> Vec { + fn ethereum_signable_message(what: &[u8], extra: &[u8]) -> Vec { let prefix = T::Prefix::get(); - let mut l = prefix.len() + what.len(); + let mut l = prefix.len() + what.len() + extra.len(); let mut rev = Vec::new(); while l > 0 { rev.push(b'0' + (l % 10) as u8); @@ -282,17 +371,45 @@ impl Module { v.extend(rev.into_iter().rev()); v.extend_from_slice(&prefix[..]); v.extend_from_slice(what); + v.extend_from_slice(extra); v } // Attempts to recover the Ethereum address from a message signature signed by using // the Ethereum RPC's `personal_sign` and `eth_sign`. - fn eth_recover(s: &EcdsaSignature, what: &[u8]) -> Option { - let msg = keccak_256(&Self::ethereum_signable_message(what)); + fn eth_recover(s: &EcdsaSignature, what: &[u8], extra: &[u8]) -> Option { + let msg = keccak_256(&Self::ethereum_signable_message(what, extra)); let mut res = EthereumAddress::default(); res.0.copy_from_slice(&keccak_256(&secp256k1_ecdsa_recover(&s.0, &msg).ok()?[..])[12..]); Some(res) } + + fn process_claim(signer: EthereumAddress, dest: T::AccountId) -> DispatchResult { + let balance_due = >::get(&signer) + .ok_or(Error::::SignerHasNoClaim)?; + + let new_total = Self::total().checked_sub(&balance_due).ok_or(Error::::PotUnderflow)?; + + // Check if this claim should have a vesting schedule. + if let Some(vs) = >::get(&signer) { + // If this fails, destination account already has a vesting schedule + // applied to it, and this claim should not be processed. + T::VestingSchedule::add_vesting_schedule(&dest, vs.0, vs.1, vs.2) + .map_err(|_| Error::::DestinationVesting)?; + } + + CurrencyOf::::deposit_creating(&dest, balance_due); + >::put(new_total); + >::remove(&signer); + >::remove(&signer); + Signing::remove(&signer); + Preclaims::::remove(&dest); + + // Let's deposit an event to let the outside world know this happened. + Self::deposit_event(RawEvent::Claimed(dest, signer, balance_due)); + + Ok(()) + } } impl sp_runtime::traits::ValidateUnsigned for Module { From 085ca12f87c7e4e50745f975182e8a58a6962f1f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 11 May 2020 19:23:40 +0200 Subject: [PATCH 02/24] Introduce SignedExtension --- primitives/src/lib.rs | 4 +- runtime/common/src/claims.rs | 82 +++++++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 8 deletions(-) diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 0f80ba6c59ba..16004fd5a750 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -79,12 +79,14 @@ pub use runtime_primitives::OpaqueExtrinsic as UncheckedExtrinsic; /// Custom validity errors used in Polkadot while validating transactions. #[repr(u8)] pub enum ValidityError { - /// The ethereum signature is invalid. + /// The Ethereum signature is invalid. InvalidEthereumSignature = 0, /// The signer has no claim. SignerHasNoClaim = 1, /// No permission to execute the call. NoPermission = 2, + /// An invalid statement was made for a claim. + InvalidStatement = 3, } impl From for u8 { diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index fbe5b765be6c..88521ca513ac 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -19,14 +19,14 @@ use sp_std::prelude::*; use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover}; use frame_support::{decl_event, decl_storage, decl_module, decl_error}; -use frame_support::traits::{Currency, Get, VestingSchedule}; +use frame_support::{traits::{Currency, Get, VestingSchedule}, weights::Pays}; use system::{ensure_root, ensure_none}; use codec::{Encode, Decode}; #[cfg(feature = "std")] use serde::{self, Serialize, Deserialize, Serializer, Deserializer}; #[cfg(feature = "std")] use sp_runtime::traits::Zero; -use sp_runtime::traits::CheckedSub; +use sp_runtime::traits::{CheckedSub, SignedExtension, DispatchInfoOf}; use sp_runtime::{ RuntimeDebug, transaction_validity::{ @@ -36,6 +36,7 @@ use sp_runtime::{ }; use primitives::ValidityError; use system; +use sp_runtime::transaction_validity::TransactionValidityError; type CurrencyOf = <::VestingSchedule as VestingSchedule<::AccountId>>::Currency; type BalanceOf = as Currency<::AccountId>>::Balance; @@ -334,13 +335,16 @@ decl_module! { } /// Attest to a statement, needed to finalize the claims process. - #[weight = T::DbWeight::get().reads_writes(6, 6) + 650_000_000] - fn attest(origin, attested_statement: Vec) { + /// + /// WARNING: Insecure unless your chain includes `PrevalidateAttests` as a `SignedExtension`. + #[weight = ( + T::DbWeight::get().reads_writes(6, 6) + 650_000_000, + DispatchClass::Normal, + Pays::No + )] + fn attest(origin, _attested_statement: Vec) { let who = ensure_signed(origin)?; let signer = Preclaims::get(&who).ok_or(Error::::SenderHasNoClaim)?; - if let Some(s) = Signing::get(signer) { - ensure!(&attested_statement == s.as_statement(), Error::::InvalidStatement); - } Self::process_claim(signer, who)?; } } @@ -453,6 +457,70 @@ impl sp_runtime::traits::ValidateUnsigned for Module { } } +/// Validate `attest` calls prior to execution. Needed to avoid a DoS attack since they are +/// otherwise free to place on chain. +#[derive(Encode, Decode, Clone, Eq, PartialEq)] +pub struct PrevalidateAttests(sp_std::marker::PhantomData); + +impl Debug for PrevalidateAttests { + #[cfg(feature = "std")] + fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + write!(f, "PrevalidateAttests") + } + + #[cfg(not(feature = "std"))] + fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { + Ok(()) + } +} + +impl PrevalidateAttests { + /// Create new `SignedExtension` to check runtime version. + pub fn new() -> Self { + Self(sp_std::marker::PhantomData) + } +} + +impl SignedExtension for PrevalidateAttests { + type AccountId = T::AccountId; + type Call = ::Call; + type AdditionalSigned = (); + type Pre = (); + const IDENTIFIER: &'static str = "PrevalidateAttests"; + + fn additional_signed(&self) -> Result { + Ok(()) + } + + fn validate( + &self, + who: &Self::AccountId, + call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, + ) -> TransactionValidity { + if let Some(local_call) = call.is_sub_type() { + if let Call::attest(attested_statement) = local_call { + let signer = match Preclaims::get(who) { + Ok(x) => x, + Err(_) => + return Err(InvalidTransaction::Custom( + ValidityError::SignerHasNoClaim.into() + ).into()), + }; + if let Some(s) = Signing::get(signer) { + if &attested_statement != s.as_statement() { + return Err(InvalidTransaction::Custom( + ValidityError::InvalidStatement.into() + ).into()) + } + } + } + } + Ok(ValidTransaction::default()) + } +} + #[cfg(any(test, feature = "runtime-benchmarks"))] mod secp_utils { use super::*; From 235ed972d8d8a776cf9a5d0bcc841496b797a06d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 11 May 2020 23:19:09 +0200 Subject: [PATCH 03/24] Tests passing --- runtime/common/src/claims.rs | 74 ++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 88521ca513ac..03203d260e87 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -16,27 +16,26 @@ //! Module to process claims from Ethereum addresses. -use sp_std::prelude::*; +use sp_std::{prelude::*, fmt::Debug}; use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover}; -use frame_support::{decl_event, decl_storage, decl_module, decl_error}; -use frame_support::{traits::{Currency, Get, VestingSchedule}, weights::Pays}; -use system::{ensure_root, ensure_none}; +use frame_support::{ + decl_event, decl_storage, decl_module, decl_error, ensure, + traits::{Currency, Get, VestingSchedule}, weights::{Pays, DispatchClass}, dispatch::IsSubType +}; +use system::{ensure_signed, ensure_root, ensure_none}; use codec::{Encode, Decode}; #[cfg(feature = "std")] use serde::{self, Serialize, Deserialize, Serializer, Deserializer}; #[cfg(feature = "std")] use sp_runtime::traits::Zero; -use sp_runtime::traits::{CheckedSub, SignedExtension, DispatchInfoOf}; use sp_runtime::{ - RuntimeDebug, + traits::{CheckedSub, SignedExtension, DispatchInfoOf}, RuntimeDebug, DispatchResult, transaction_validity::{ - TransactionLongevity, TransactionValidity, ValidTransaction, InvalidTransaction, TransactionSource, + TransactionLongevity, TransactionValidity, ValidTransaction, InvalidTransaction, + TransactionSource, TransactionValidityError, }, - DispatchResult, }; use primitives::ValidityError; -use system; -use sp_runtime::transaction_validity::TransactionValidityError; type CurrencyOf = <::VestingSchedule as VestingSchedule<::AccountId>>::Currency; type BalanceOf = as Currency<::AccountId>>::Balance; @@ -50,6 +49,8 @@ pub trait Trait: system::Trait { } /// The kind of a statement this account needs to make for a claim to be valid. +#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum StatementKind { /// One kind of statement; this is the default. Default, @@ -59,7 +60,7 @@ pub enum StatementKind { impl StatementKind { /// Convert this to the (English) statement it represents. - fn to_statement() -> &[u8] { + fn to_text(self) -> &'static [u8] { &[][..] } } @@ -150,10 +151,10 @@ decl_storage! { // keep things around between blocks. trait Store for Module as Claims { Claims get(fn claims) build(|config: &GenesisConfig| { - config.claims.iter().map(|(a, b, _i, _s)| (a.clone(), b.clone())).collect::>() + config.claims.iter().map(|(a, b, _, _)| (a.clone(), b.clone())).collect::>() }): map hasher(identity) EthereumAddress => Option>; Total get(fn total) build(|config: &GenesisConfig| { - config.claims.iter().fold(Zero::zero(), |acc: BalanceOf, &(_, n)| acc + n) + config.claims.iter().fold(Zero::zero(), |acc: BalanceOf, &(_, b, _, _)| acc + b) }): BalanceOf; /// Vesting schedule for a claim. /// First balance is the total amount that should be held for vesting. @@ -166,19 +167,19 @@ decl_storage! { /// The statement kind that must be signed, if any. Signing build(|config: &GenesisConfig| { config.claims.iter() - .filter_map(|(a, _, _, s)| Some(a.clone(), s.clone()?)) + .filter_map(|(a, _, _, s)| Some((a.clone(), s.clone()?))) .collect::>() }): map hasher(identity) EthereumAddress => Option; /// Pre-claimed Ethereum accounts, by the Account ID that they are claimed to. Preclaims build(|config: &GenesisConfig| { config.claims.iter() - .filter_map(|(a, _, i, _)| Some(i.clone()?, a.clone())) + .filter_map(|(a, _, i, _)| Some((i.clone()?, a.clone()))) .collect::>() - }): map hasher(identity) AccountId => EthereumAddress; + }): map hasher(identity) T::AccountId => Option; } add_extra_genesis { - config(claims): Vec<(EthereumAddress, BalanceOf, Option, Option)>; + config(claims): Vec<(EthereumAddress, BalanceOf, Option, Option)>; } } @@ -234,7 +235,7 @@ decl_module! { ensure_none(origin)?; let data = dest.using_encoded(to_ascii_hex); - let signer = Self::eth_recover(ðereum_signature, &data, statement) + let signer = Self::eth_recover(ðereum_signature, &data, &[][..]) .ok_or(Error::::InvalidEthereumSignature)?; Self::process_claim(signer, dest)?; @@ -326,7 +327,7 @@ decl_module! { ensure_none(origin)?; let data = dest.using_encoded(to_ascii_hex); - let signer = Self::eth_recover(ðereum_signature, &data, statement) + let signer = Self::eth_recover(ðereum_signature, &data, statement.to_text()) .ok_or(Error::::InvalidEthereumSignature)?; if let Some(s) = Signing::get(signer) { ensure!(s == statement, Error::::InvalidStatement); @@ -344,7 +345,7 @@ decl_module! { )] fn attest(origin, _attested_statement: Vec) { let who = ensure_signed(origin)?; - let signer = Preclaims::get(&who).ok_or(Error::::SenderHasNoClaim)?; + let signer = Preclaims::::get(&who).ok_or(Error::::SenderHasNoClaim)?; Self::process_claim(signer, who)?; } } @@ -429,7 +430,7 @@ impl sp_runtime::traits::ValidateUnsigned for Module { // Call::claim(account, ethereum_signature) => { let data = account.using_encoded(to_ascii_hex); - let maybe_signer = Self::eth_recover(ðereum_signature, &data); + let maybe_signer = Self::eth_recover(ðereum_signature, &data, &[][..]); let signer = if let Some(s) = maybe_signer { s } else { @@ -460,9 +461,12 @@ impl sp_runtime::traits::ValidateUnsigned for Module { /// Validate `attest` calls prior to execution. Needed to avoid a DoS attack since they are /// otherwise free to place on chain. #[derive(Encode, Decode, Clone, Eq, PartialEq)] -pub struct PrevalidateAttests(sp_std::marker::PhantomData); +pub struct PrevalidateAttests(sp_std::marker::PhantomData) where + ::Call: IsSubType, T>; -impl Debug for PrevalidateAttests { +impl Debug for PrevalidateAttests where + ::Call: IsSubType, T> +{ #[cfg(feature = "std")] fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { write!(f, "PrevalidateAttests") @@ -474,16 +478,20 @@ impl Debug for PrevalidateAttests { } } -impl PrevalidateAttests { +impl PrevalidateAttests where + ::Call: IsSubType, T> +{ /// Create new `SignedExtension` to check runtime version. pub fn new() -> Self { Self(sp_std::marker::PhantomData) } } -impl SignedExtension for PrevalidateAttests { +impl SignedExtension for PrevalidateAttests where + ::Call: IsSubType, T> +{ type AccountId = T::AccountId; - type Call = ::Call; + type Call = ::Call; type AdditionalSigned = (); type Pre = (); const IDENTIFIER: &'static str = "PrevalidateAttests"; @@ -501,15 +509,15 @@ impl SignedExtension for PrevalidateAttests { ) -> TransactionValidity { if let Some(local_call) = call.is_sub_type() { if let Call::attest(attested_statement) = local_call { - let signer = match Preclaims::get(who) { - Ok(x) => x, - Err(_) => + let signer = match Preclaims::::get(who) { + Some(x) => x, + None => return Err(InvalidTransaction::Custom( ValidityError::SignerHasNoClaim.into() ).into()), }; if let Some(s) = Signing::get(signer) { - if &attested_statement != s.as_statement() { + if &attested_statement[..] != s.to_text() { return Err(InvalidTransaction::Custom( ValidityError::InvalidStatement.into() ).into()) @@ -535,7 +543,7 @@ mod secp_utils { res } pub fn sig(secret: &secp256k1::SecretKey, what: &[u8]) -> EcdsaSignature { - let msg = keccak_256(&>::ethereum_signable_message(&to_ascii_hex(what)[..])); + let msg = keccak_256(&>::ethereum_signable_message(&to_ascii_hex(what)[..], &[][..])); let (sig, recovery_id) = secp256k1::sign(&secp256k1::Message::parse(&msg), secret); let mut r = [0u8; 65]; r[0..64].copy_from_slice(&sig.serialize()[..]); @@ -649,7 +657,7 @@ mod tests { // We use default for brevity, but you can configure as desired if needed. balances::GenesisConfig::::default().assimilate_storage(&mut t).unwrap(); GenesisConfig::{ - claims: vec![(eth(&alice()), 100)], + claims: vec![(eth(&alice()), 100, None, None)], vesting: vec![(eth(&alice()), (50, 10, 1))], }.assimilate_storage(&mut t).unwrap(); t.into() @@ -801,7 +809,7 @@ mod tests { let sig = hex!["444023e89b67e67c0562ed0305d252a5dd12b2af5ac51d6d3cb69a0b486bc4b3191401802dc29d26d586221f7256cd3329fe82174bdf659baea149a40e1c495d1c"]; let sig = EcdsaSignature(sig); let who = 42u64.using_encoded(to_ascii_hex); - let signer = Claims::eth_recover(&sig, &who).unwrap(); + let signer = Claims::eth_recover(&sig, &who, &[][..]).unwrap(); assert_eq!(signer.0, hex!["6d31165d5d932d571f3b44695653b46dcc327e84"]); }); } From 1a2a2936fe079e30114de610af4954e1b92d0cab Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 13 May 2020 12:18:24 +0200 Subject: [PATCH 04/24] Bump runtime version --- runtime/common/src/claims.rs | 92 ++++++++++++++++++++++++++---------- runtime/kusama/src/lib.rs | 2 +- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 03203d260e87..99eb26c95149 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -61,7 +61,10 @@ pub enum StatementKind { impl StatementKind { /// Convert this to the (English) statement it represents. fn to_text(self) -> &'static [u8] { - &[][..] + match self { + StatementKind::Default => &b"Default"[..], + StatementKind::Alternative => &b"Alternative"[..], + } } } @@ -343,9 +346,12 @@ decl_module! { DispatchClass::Normal, Pays::No )] - fn attest(origin, _attested_statement: Vec) { + fn attest(origin, statement: Vec) { let who = ensure_signed(origin)?; let signer = Preclaims::::get(&who).ok_or(Error::::SenderHasNoClaim)?; + if let Some(s) = Signing::get(signer) { + ensure!(s.to_text() == &statement[..], Error::::InvalidStatement); + } Self::process_claim(signer, who)?; } } @@ -542,8 +548,8 @@ mod secp_utils { res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]); res } - pub fn sig(secret: &secp256k1::SecretKey, what: &[u8]) -> EcdsaSignature { - let msg = keccak_256(&>::ethereum_signable_message(&to_ascii_hex(what)[..], &[][..])); + pub fn sig(secret: &secp256k1::SecretKey, what: &[u8], extra: &[u8]) -> EcdsaSignature { + let msg = keccak_256(&>::ethereum_signable_message(&to_ascii_hex(what)[..], extra)); let (sig, recovery_id) = secp256k1::sign(&secp256k1::Message::parse(&msg), secret); let mut r = [0u8; 65]; r[0..64].copy_from_slice(&sig.serialize()[..]); @@ -649,6 +655,12 @@ mod tests { fn bob() -> secp256k1::SecretKey { secp256k1::SecretKey::parse(&keccak_256(b"Bob")).unwrap() } + fn dave() -> secp256k1::SecretKey { + secp256k1::SecretKey::parse(&keccak_256(b"Dave")).unwrap() + } + fn eve() -> secp256k1::SecretKey { + secp256k1::SecretKey::parse(&keccak_256(b"Eve")).unwrap() + } // This function basically just builds a genesis storage key/value store according to // our desired mockup. @@ -657,7 +669,11 @@ mod tests { // We use default for brevity, but you can configure as desired if needed. balances::GenesisConfig::::default().assimilate_storage(&mut t).unwrap(); GenesisConfig::{ - claims: vec![(eth(&alice()), 100, None, None)], + claims: vec![ + (eth(&alice()), 100, None, None), + (eth(&dave()), 200, None, Some(StatementKind::Default)), + (eth(&eve()), 300, Some(42), Some(StatementKind::Alternative)) + ], vesting: vec![(eth(&alice()), (50, 10, 1))], }.assimilate_storage(&mut t).unwrap(); t.into() @@ -668,6 +684,8 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Claims::total(), 100); assert_eq!(Claims::claims(ð(&alice())), Some(100)); + assert_eq!(Claims::claims(ð(&dave())), Some(200)); + assert_eq!(Claims::claims(ð(&eve())), Some(300)); assert_eq!(Claims::claims(&EthereumAddress::default()), None); assert_eq!(Claims::vesting(ð(&alice())), Some((50, 10, 1))); }); @@ -686,10 +704,34 @@ mod tests { fn claiming_works() { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); - assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode()))); + assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&42), 100); assert_eq!(Vesting::vesting_balance(&42), Some(50)); - assert_eq!(Claims::total(), 0); + assert_eq!(Claims::total(), 500); + }); + } + + #[test] + fn attest_claiming_works() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::free_balance(42), 0); + let s = sig::(&dave(), &42u64.encode(), StatementKind::Alternative.to_text()); + assert_noop!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Alternative), Error::::InvalidStatement); + let s = sig::(&dave(), &42u64.encode(), StatementKind::Default.to_text()); + assert_ok!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default)); + assert_eq!(Balances::free_balance(&42), 200); + assert_eq!(Claims::total(), 400); + }); + } + + #[test] + fn attesting_works() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::free_balance(42), 0); + assert_noop!(Claims::attest(Origin::signed(42), StatementKind::Default.to_text().to_vec()), Error::::InvalidStatement); + assert_ok!(Claims::attest(Origin::signed(42), StatementKind::Alternative.to_text().to_vec())); + assert_eq!(Balances::free_balance(&42), 300); + assert_eq!(Claims::total(), 300); }); } @@ -702,15 +744,15 @@ mod tests { ); assert_eq!(Balances::free_balance(42), 0); assert_noop!( - Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode())), + Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim, ); assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None)); - assert_eq!(Claims::total(), 300); - assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode()))); + assert_eq!(Claims::total(), 800); + assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&69), 200); assert_eq!(Vesting::vesting_balance(&69), None); - assert_eq!(Claims::total(), 100); + assert_eq!(Claims::total(), 600); }); } @@ -723,11 +765,11 @@ mod tests { ); assert_eq!(Balances::free_balance(42), 0); assert_noop!( - Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode())), + Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim ); assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)))); - assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode()))); + assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&69), 200); assert_eq!(Vesting::vesting_balance(&69), Some(50)); }); @@ -738,7 +780,7 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); assert_err!( - Claims::claim(Origin::signed(42), 42, sig::(&alice(), &42u64.encode())), + Claims::claim(Origin::signed(42), 42, sig::(&alice(), &42u64.encode(), &[][..])), sp_runtime::traits::BadOrigin, ); }); @@ -748,9 +790,9 @@ mod tests { fn double_claiming_doesnt_work() { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); - assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode()))); + assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); assert_noop!( - Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode())), + Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..])), Error::::SignerHasNoClaim ); }); @@ -770,7 +812,7 @@ mod tests { // They should not be able to claim assert_noop!( - Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode())), + Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::DestinationVesting ); // Everything should be unchanged @@ -785,7 +827,7 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); assert_noop!( - Claims::claim(Origin::NONE, 42, sig::(&alice(), &69u64.encode())), + Claims::claim(Origin::NONE, 42, sig::(&alice(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim ); }); @@ -796,7 +838,7 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); assert_noop!( - Claims::claim(Origin::NONE, 42, sig::(&bob(), &69u64.encode())), + Claims::claim(Origin::NONE, 42, sig::(&bob(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim ); }); @@ -821,7 +863,7 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!( - >::validate_unsigned(source, &Call::claim(1, sig::(&alice(), &1u64.encode()))), + >::validate_unsigned(source, &Call::claim(1, sig::(&alice(), &1u64.encode(), &[][..]))), Ok(ValidTransaction { priority: 100, requires: vec![], @@ -835,11 +877,11 @@ mod tests { InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()).into(), ); assert_eq!( - >::validate_unsigned(source, &Call::claim(1, sig::(&bob(), &1u64.encode()))), + >::validate_unsigned(source, &Call::claim(1, sig::(&bob(), &1u64.encode(), &[][..]))), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); assert_eq!( - >::validate_unsigned(source, &Call::claim(0, sig::(&bob(), &1u64.encode()))), + >::validate_unsigned(source, &Call::claim(0, sig::(&bob(), &1u64.encode(), &[][..]))), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); }); @@ -883,7 +925,7 @@ mod benchmarking { let eth_address = eth(&secret_key); let account: T::AccountId = account("user", u, SEED); let vesting = Some((100_000.into(), 1_000.into(), 100.into())); - let signature = sig::(&secret_key, &account.encode()); + let signature = sig::(&secret_key, &account.encode(), &[][..]); super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting)?; assert_eq!(Claims::::get(eth_address), Some(VALUE.into())); }: _(RawOrigin::None, account, signature) @@ -907,7 +949,7 @@ mod benchmarking { // Crate signature let secret_key = secp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap(); let account: T::AccountId = account("user", c, SEED); - let signature = sig::(&secret_key, &account.encode()); + let signature = sig::(&secret_key, &account.encode(), &[][..]); let call = Call::::claim(account, signature); let source = sp_runtime::transaction_validity::TransactionSource::External; }: { @@ -930,7 +972,7 @@ mod benchmarking { // Crate signature let secret_key = secp256k1::SecretKey::parse(&keccak_256(&i.encode())).unwrap(); let account: T::AccountId = account("user", i, SEED); - let signature = sig::(&secret_key, &account.encode()); + let signature = sig::(&secret_key, &account.encode(), &[][..]); let data = account.using_encoded(to_ascii_hex); }: { for _ in 0 .. i { diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 22e9684f2b0c..5a58e7fcf372 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -83,7 +83,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("kusama"), impl_name: create_runtime_str!("parity-kusama"), authoring_version: 2, - spec_version: 1063, + spec_version: 1064, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From e4ee51c7f59b6f76657fd2b97a9a2648df1148c2 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 13 May 2020 15:22:40 +0200 Subject: [PATCH 05/24] Bump version, fix test --- Cargo.lock | 38 +++++++++++----------- Cargo.toml | 2 +- availability-store/Cargo.toml | 2 +- cli/Cargo.toml | 2 +- collator/Cargo.toml | 2 +- erasure-coding/Cargo.toml | 2 +- network/Cargo.toml | 2 +- parachain/Cargo.toml | 2 +- parachain/test-parachains/adder/Cargo.toml | 2 +- parachain/test-parachains/halt/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- rpc/Cargo.toml | 2 +- runtime/common/Cargo.toml | 2 +- runtime/common/src/claims.rs | 7 ++-- runtime/kusama/Cargo.toml | 2 +- runtime/polkadot/Cargo.toml | 2 +- runtime/test-runtime/Cargo.toml | 2 +- runtime/westend/Cargo.toml | 2 +- service/Cargo.toml | 2 +- statement-table/Cargo.toml | 2 +- validation/Cargo.toml | 2 +- 21 files changed, 41 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e701c734828e..86e04e39a2fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2229,7 +2229,7 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4073,7 +4073,7 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" [[package]] name = "polkadot" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "assert_cmd", "futures 0.3.4", @@ -4086,7 +4086,7 @@ dependencies = [ [[package]] name = "polkadot-availability-store" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.99.5", "exit-future", @@ -4112,7 +4112,7 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "frame-benchmarking-cli", "futures 0.3.4", @@ -4136,7 +4136,7 @@ dependencies = [ [[package]] name = "polkadot-collator" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "futures 0.3.4", "futures-timer 2.0.2", @@ -4163,7 +4163,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.15.0", "parity-scale-codec", @@ -4175,7 +4175,7 @@ dependencies = [ [[package]] name = "polkadot-network" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "arrayvec 0.4.12", "bytes 0.5.4", @@ -4224,7 +4224,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.99.5", "log 0.4.8", @@ -4243,7 +4243,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-system", @@ -4265,7 +4265,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "jsonrpc-core", "pallet-transaction-payment-rpc", @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4352,7 +4352,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4394,7 +4394,7 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "env_logger 0.7.1", "frame-benchmarking", @@ -4453,7 +4453,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -4462,7 +4462,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-executive", @@ -4538,7 +4538,7 @@ dependencies = [ [[package]] name = "polkadot-validation" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "derive_more 0.14.1", @@ -7542,7 +7542,7 @@ dependencies = [ [[package]] name = "test-parachain-adder" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "dlmalloc", "parity-scale-codec", @@ -7581,7 +7581,7 @@ dependencies = [ [[package]] name = "test-parachain-halt" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "substrate-wasm-builder-runner 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -8435,7 +8435,7 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", diff --git a/Cargo.toml b/Cargo.toml index d47c3cefd945..5baf461b565e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "src/main.rs" [package] name = "polkadot" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/availability-store/Cargo.toml b/availability-store/Cargo.toml index f0c5815e917f..97269c0fb053 100644 --- a/availability-store/Cargo.toml +++ b/availability-store/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "polkadot-availability-store" description = "Persistent database for parachain data" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 59154fef7b15..276e3eebbe1f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-cli" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Polkadot Relay-chain Client Node" edition = "2018" diff --git a/collator/Cargo.toml b/collator/Cargo.toml index 502e3d6fb50f..f8b89ec11c3c 100644 --- a/collator/Cargo.toml +++ b/collator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-collator" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Collator node implementation" edition = "2018" diff --git a/erasure-coding/Cargo.toml b/erasure-coding/Cargo.toml index 6a0b0adfbe05..6d036c3eb6b7 100644 --- a/erasure-coding/Cargo.toml +++ b/erasure-coding/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-erasure-coding" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/network/Cargo.toml b/network/Cargo.toml index a4e49c014421..71b40b0999ec 100644 --- a/network/Cargo.toml +++ b/network/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-network" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Polkadot-specific networking protocol" edition = "2018" diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index b8e34bb54fee..c7ca4b7be039 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-parachain" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Types and utilities for creating and working with parachains" edition = "2018" diff --git a/parachain/test-parachains/adder/Cargo.toml b/parachain/test-parachains/adder/Cargo.toml index f594625900cd..3639dac5964d 100644 --- a/parachain/test-parachains/adder/Cargo.toml +++ b/parachain/test-parachains/adder/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-parachain-adder" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Test parachain which adds to a number as its state transition" edition = "2018" diff --git a/parachain/test-parachains/halt/Cargo.toml b/parachain/test-parachains/halt/Cargo.toml index e61157037f3f..1bd912e5dbea 100644 --- a/parachain/test-parachains/halt/Cargo.toml +++ b/parachain/test-parachains/halt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-parachain-halt" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] description = "Test parachain which executes forever" edition = "2018" diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index c841cb73a255..0493edc03867 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-primitives" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 179d9480790b..738c60153eff 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-rpc" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index ed2da2e213c1..67de17db8eae 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-runtime-common" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 99eb26c95149..8ce10caf70cb 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -682,7 +682,7 @@ mod tests { #[test] fn basic_setup_works() { new_test_ext().execute_with(|| { - assert_eq!(Claims::total(), 100); + assert_eq!(Claims::total(), 600); assert_eq!(Claims::claims(ð(&alice())), Some(100)); assert_eq!(Claims::claims(ð(&dave())), Some(200)); assert_eq!(Claims::claims(ð(&eve())), Some(300)); @@ -801,14 +801,13 @@ mod tests { #[test] fn claiming_while_vested_doesnt_work() { new_test_ext().execute_with(|| { - assert_eq!(Claims::total(), 100); // A user is already vested assert_ok!(::VestingSchedule::add_vesting_schedule(&69, 1000, 100, 10)); CurrencyOf::::make_free_balance_be(&69, 1000); assert_eq!(Balances::free_balance(69), 1000); assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)))); // New total - assert_eq!(Claims::total(), 300); + assert_eq!(Claims::total(), 800); // They should not be able to claim assert_noop!( @@ -816,7 +815,7 @@ mod tests { Error::::DestinationVesting ); // Everything should be unchanged - assert_eq!(Claims::total(), 300); + assert_eq!(Claims::total(), 800); assert_eq!(Balances::free_balance(69), 1000); assert_eq!(Vesting::vesting_balance(&69), Some(1000)); }); diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index b3883c4ded62..54c97c8301b5 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kusama-runtime" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 70c4aac5631f..c7df2e7ea4b4 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-runtime" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/test-runtime/Cargo.toml b/runtime/test-runtime/Cargo.toml index 3aedca3fc67a..70b39ee68a66 100644 --- a/runtime/test-runtime/Cargo.toml +++ b/runtime/test-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-test-runtime" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/westend/Cargo.toml b/runtime/westend/Cargo.toml index 406f06a397b5..a9e9a6ed0db0 100644 --- a/runtime/westend/Cargo.toml +++ b/runtime/westend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "westend-runtime" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" build = "build.rs" diff --git a/service/Cargo.toml b/service/Cargo.toml index 6e3015048c93..c404cc125432 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-service" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/statement-table/Cargo.toml b/statement-table/Cargo.toml index 8e86c833451e..0fbc2860d48f 100644 --- a/statement-table/Cargo.toml +++ b/statement-table/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-statement-table" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" diff --git a/validation/Cargo.toml b/validation/Cargo.toml index 51e23155eab1..dbe7af09652f 100644 --- a/validation/Cargo.toml +++ b/validation/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-validation" -version = "0.7.33" +version = "0.7.34-dev" authors = ["Parity Technologies "] edition = "2018" From 3c3d2ad07a6378b15d1bf9a76ca872782f4d72d4 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 May 2020 13:59:29 +0200 Subject: [PATCH 06/24] Test for validate --- runtime/common/src/claims.rs | 45 ++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 8ce10caf70cb..68c36998444e 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -571,13 +571,22 @@ mod tests { // or public keys. `u64` is used as the `AccountId` and no `Signature`s are required. use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup, Identity}, testing::Header}; use frame_support::{ - impl_outer_origin, assert_ok, assert_err, assert_noop, parameter_types + impl_outer_origin, impl_outer_dispatch, assert_ok, assert_err, assert_noop, parameter_types, + weights::GetDispatchInfo, }; use balances; + use crate::claims; + use super::Call as ClaimsCall; impl_outer_origin! { pub enum Origin for Test {} } + + impl_outer_dispatch! { + pub enum Call for Test where origin: Origin { + claims::Claims, + } + } // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -591,7 +600,7 @@ mod tests { } impl system::Trait for Test { type Origin = Origin; - type Call = (); + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -716,11 +725,22 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); let s = sig::(&dave(), &42u64.encode(), StatementKind::Alternative.to_text()); - assert_noop!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Alternative), Error::::InvalidStatement); + let r = Claims::claim_attest(Origin::NONE, 42, s.clone(), StatementKind::Alternative); + assert_noop!(r, Error::::InvalidStatement); + + let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default); + assert_noop!(r, Error::::SignerHasNoClaim); + // ^^^ we use ecdsa_recover, so an invalid signature just results in a random signer id + // being recovered, which realistically will never have a claim. + let s = sig::(&dave(), &42u64.encode(), StatementKind::Default.to_text()); assert_ok!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default)); assert_eq!(Balances::free_balance(&42), 200); assert_eq!(Claims::total(), 400); + + let s = sig::(&dave(), &42u64.encode(), StatementKind::Default.to_text()); + let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default); + assert_noop!(r, Error::::SignerHasNoClaim); }); } @@ -728,6 +748,7 @@ mod tests { fn attesting_works() { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); + assert_noop!(Claims::attest(Origin::signed(69), StatementKind::Alternative.to_text().to_vec()), Error::::SenderHasNoClaim); assert_noop!(Claims::attest(Origin::signed(42), StatementKind::Default.to_text().to_vec()), Error::::InvalidStatement); assert_ok!(Claims::attest(Origin::signed(42), StatementKind::Alternative.to_text().to_vec())); assert_eq!(Balances::free_balance(&42), 300); @@ -735,6 +756,16 @@ mod tests { }); } + #[test] + fn valid_attest_transactions_are_free() { + new_test_ext().execute_with(|| { + let p = PrevalidateAttests::::new(); + let c = Call::Claims(ClaimsCall::attest(StatementKind::Alternative.to_text().to_vec())); + let r = p.validate(&42,&c,&c.get_dispatch_info(),20); + assert_eq!(r, TransactionValidity::Ok(ValidTransaction::default())); + }); + } + #[test] fn add_claim_works() { new_test_ext().execute_with(|| { @@ -862,7 +893,7 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!( - >::validate_unsigned(source, &Call::claim(1, sig::(&alice(), &1u64.encode(), &[][..]))), + >::validate_unsigned(source, &ClaimsCall::claim(1, sig::(&alice(), &1u64.encode(), &[][..]))), Ok(ValidTransaction { priority: 100, requires: vec![], @@ -872,15 +903,15 @@ mod tests { }) ); assert_eq!( - >::validate_unsigned(source, &Call::claim(0, EcdsaSignature([0; 65]))), + >::validate_unsigned(source, &ClaimsCall::claim(0, EcdsaSignature([0; 65]))), InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()).into(), ); assert_eq!( - >::validate_unsigned(source, &Call::claim(1, sig::(&bob(), &1u64.encode(), &[][..]))), + >::validate_unsigned(source, &ClaimsCall::claim(1, sig::(&bob(), &1u64.encode(), &[][..]))), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); assert_eq!( - >::validate_unsigned(source, &Call::claim(0, sig::(&bob(), &1u64.encode(), &[][..]))), + >::validate_unsigned(source, &ClaimsCall::claim(0, sig::(&bob(), &1u64.encode(), &[][..]))), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); }); From 577407a09d7f70936e2cbe157a751396a67e470c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 May 2020 17:18:32 +0200 Subject: [PATCH 07/24] Another couple of tests --- runtime/common/src/claims.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 68c36998444e..b6b47cadb771 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -572,7 +572,7 @@ mod tests { use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup, Identity}, testing::Header}; use frame_support::{ impl_outer_origin, impl_outer_dispatch, assert_ok, assert_err, assert_noop, parameter_types, - weights::GetDispatchInfo, + weights::{Pays, GetDispatchInfo}, }; use balances; use crate::claims; @@ -761,11 +761,28 @@ mod tests { new_test_ext().execute_with(|| { let p = PrevalidateAttests::::new(); let c = Call::Claims(ClaimsCall::attest(StatementKind::Alternative.to_text().to_vec())); - let r = p.validate(&42,&c,&c.get_dispatch_info(),20); + let di = c.get_dispatch_info(); + assert_eq!(di.pays_fee, Pays::No); + let r = p.validate(&42, &c, &di, 20); assert_eq!(r, TransactionValidity::Ok(ValidTransaction::default())); }); } + #[test] + fn invalid_attest_transactions_are_recognised() { + new_test_ext().execute_with(|| { + let p = PrevalidateAttests::::new(); + let c = Call::Claims(ClaimsCall::attest(StatementKind::Default.to_text().to_vec())); + let di = c.get_dispatch_info(); + let r = p.validate(&42, &c, &di, 20); + assert!(r.is_err()); + let c = Call::Claims(ClaimsCall::attest(StatementKind::Alternative.to_text().to_vec())); + let di = c.get_dispatch_info(); + let r = p.validate(&69, &c, &di, 20); + assert!(r.is_err()); + }); + } + #[test] fn add_claim_works() { new_test_ext().execute_with(|| { From e550ef0ffb60c30d442dc7e8b6fa0be4cccef866 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 May 2020 17:22:19 +0200 Subject: [PATCH 08/24] Enable PrevalidateAttests on Polkadot --- runtime/kusama/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 5a58e7fcf372..63a04e1b8f24 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -60,6 +60,7 @@ use im_online::sr25519::AuthorityId as ImOnlineId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::{historical as session_historical}; +use claims::PrevalidateAttests; #[cfg(feature = "std")] pub use staking::StakerStatus; @@ -846,6 +847,7 @@ pub type SignedExtra = ( registrar::LimitParathreadCommits, parachains::ValidateDoubleVoteReports, grandpa::ValidateEquivocationReport, + claims::PrevalidateAttests, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; From 07eec25d81f3ce0bab22d9a19d782d68d5fc5637 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 May 2020 17:23:24 +0200 Subject: [PATCH 09/24] Enable PrevalidateAttests on Polkadot --- runtime/kusama/src/lib.rs | 2 -- runtime/polkadot/src/lib.rs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 63a04e1b8f24..5a58e7fcf372 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -60,7 +60,6 @@ use im_online::sr25519::AuthorityId as ImOnlineId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::{historical as session_historical}; -use claims::PrevalidateAttests; #[cfg(feature = "std")] pub use staking::StakerStatus; @@ -847,7 +846,6 @@ pub type SignedExtra = ( registrar::LimitParathreadCommits, parachains::ValidateDoubleVoteReports, grandpa::ValidateEquivocationReport, - claims::PrevalidateAttests, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 3940b145c9c8..42b84cce3034 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -62,6 +62,7 @@ use im_online::sr25519::AuthorityId as ImOnlineId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::historical as session_historical; +use claims::PrevalidateAttests; #[cfg(feature = "std")] pub use staking::StakerStatus; @@ -761,6 +762,7 @@ pub type SignedExtra = ( registrar::LimitParathreadCommits, parachains::ValidateDoubleVoteReports, grandpa::ValidateEquivocationReport, + claims::PrevalidateAttests, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; From b9526dc43d285286db49a8f39dc0acdc4b177d68 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 14 May 2020 20:31:11 +0200 Subject: [PATCH 10/24] Fix build --- Cargo.lock | 260 ++++++++++++++++++------------------ runtime/polkadot/src/lib.rs | 1 + 2 files changed, 131 insertions(+), 130 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58e7c15411bb..962aa80ecd05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1221,7 +1221,7 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "fork-tree" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", ] @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -1246,7 +1246,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "parity-scale-codec", @@ -1264,7 +1264,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -1279,7 +1279,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "11.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "serde", @@ -1290,7 +1290,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "bitmask", "frame-metadata", @@ -1314,7 +1314,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.12", @@ -1325,7 +1325,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1337,7 +1337,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "proc-macro2 1.0.12", "quote 1.0.5", @@ -1347,7 +1347,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1363,7 +1363,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-api", @@ -3271,7 +3271,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3289,7 +3289,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3306,7 +3306,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3328,7 +3328,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3343,7 +3343,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3359,7 +3359,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3374,7 +3374,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3388,7 +3388,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3404,7 +3404,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3424,7 +3424,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3460,7 +3460,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3490,7 +3490,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3504,7 +3504,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3519,7 +3519,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3541,7 +3541,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3554,7 +3554,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "enumflags2", "frame-support", @@ -3569,7 +3569,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3584,7 +3584,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3603,7 +3603,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3617,7 +3617,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3632,7 +3632,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3655,7 +3655,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.12", @@ -3666,7 +3666,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3680,7 +3680,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3698,7 +3698,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "frame-system", @@ -3711,7 +3711,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -3729,7 +3729,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-support", "parity-scale-codec", @@ -3742,7 +3742,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3757,7 +3757,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-benchmarking", "frame-support", @@ -3773,7 +3773,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5315,7 +5315,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "bytes 0.5.4", "derive_more 0.99.6", @@ -5342,7 +5342,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5358,7 +5358,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "impl-trait-for-tuples", "sc-chain-spec-derive", @@ -5374,7 +5374,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.12", @@ -5385,7 +5385,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "ansi_term 0.12.1", "app_dirs", @@ -5427,7 +5427,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "fnv", @@ -5463,7 +5463,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "blake2-rfc", "hash-db", @@ -5492,7 +5492,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "sc-client-api", "sp-blockchain", @@ -5503,7 +5503,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "fork-tree", @@ -5544,7 +5544,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "fork-tree", "parity-scale-codec", @@ -5557,7 +5557,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5578,7 +5578,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "log 0.4.8", "sc-client-api", @@ -5592,7 +5592,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "lazy_static", @@ -5620,7 +5620,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "log 0.4.8", @@ -5637,7 +5637,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -5652,7 +5652,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "cranelift-codegen", "cranelift-wasm", @@ -5673,7 +5673,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "assert_matches", "derive_more 0.99.6", @@ -5710,7 +5710,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "finality-grandpa", @@ -5727,7 +5727,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -5744,7 +5744,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "hex", @@ -5759,7 +5759,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "bitflags", "bytes 0.5.4", @@ -5810,7 +5810,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -5825,7 +5825,7 @@ dependencies = [ [[package]] name = "sc-network-test" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "env_logger", "futures 0.3.5", @@ -5852,7 +5852,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "bytes 0.5.4", "fnv", @@ -5879,7 +5879,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "libp2p", @@ -5892,7 +5892,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "hash-db", @@ -5924,7 +5924,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "futures 0.3.5", @@ -5948,7 +5948,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "jsonrpc-core", "jsonrpc-http-server", @@ -5963,7 +5963,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "exit-future", @@ -6021,7 +6021,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "log 0.4.8", "parity-scale-codec", @@ -6035,7 +6035,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "bytes 0.5.4", "futures 0.3.5", @@ -6057,7 +6057,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "erased-serde", "log 0.4.8", @@ -6072,7 +6072,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "futures 0.3.5", @@ -6092,7 +6092,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "futures 0.3.5", @@ -6477,7 +6477,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "log 0.4.8", @@ -6489,7 +6489,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "hash-db", "parity-scale-codec", @@ -6504,7 +6504,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -6516,7 +6516,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "serde", @@ -6528,7 +6528,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "integer-sqrt", "num-traits 0.2.11", @@ -6542,7 +6542,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-api", @@ -6554,7 +6554,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -6565,7 +6565,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-api", @@ -6577,7 +6577,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "log 0.4.8", @@ -6593,7 +6593,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "serde", "serde_json", @@ -6602,7 +6602,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "futures 0.3.5", @@ -6624,7 +6624,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-api", @@ -6638,7 +6638,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "merlin", "parity-scale-codec", @@ -6655,7 +6655,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -6667,7 +6667,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "base58", "blake2-rfc", @@ -6708,7 +6708,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -6717,7 +6717,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "proc-macro2 1.0.12", "quote 1.0.5", @@ -6727,7 +6727,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "environmental", "parity-scale-codec", @@ -6738,7 +6738,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "finality-grandpa", "log 0.4.8", @@ -6754,7 +6754,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -6764,7 +6764,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "parity-scale-codec", @@ -6776,7 +6776,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "hash-db", @@ -6796,7 +6796,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "lazy_static", "sp-core", @@ -6807,7 +6807,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "sp-api", "sp-core", @@ -6817,7 +6817,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "backtrace", "log 0.4.8", @@ -6826,7 +6826,7 @@ dependencies = [ [[package]] name = "sp-phragmen" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "serde", @@ -6838,7 +6838,7 @@ dependencies = [ [[package]] name = "sp-phragmen-compact" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.12", @@ -6849,7 +6849,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "serde", "sp-core", @@ -6858,7 +6858,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "hash256-std-hasher", "impl-trait-for-tuples", @@ -6879,7 +6879,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "primitive-types", @@ -6894,7 +6894,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "Inflector", "proc-macro-crate", @@ -6906,7 +6906,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "serde", "serde_json", @@ -6915,7 +6915,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-api", @@ -6928,7 +6928,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -6938,7 +6938,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "hash-db", "log 0.4.8", @@ -6957,12 +6957,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" [[package]] name = "sp-storage" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "impl-serde 0.2.3", "ref-cast", @@ -6974,7 +6974,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -6988,7 +6988,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "tracing", ] @@ -6996,7 +6996,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "derive_more 0.99.6", "futures 0.3.5", @@ -7011,7 +7011,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "hash-db", "memory-db", @@ -7025,7 +7025,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "futures-core", @@ -7036,7 +7036,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "impl-serde 0.2.3", "parity-scale-codec", @@ -7048,7 +7048,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7176,7 +7176,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "chrono", "clear_on_drop", @@ -7203,7 +7203,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "platforms", ] @@ -7211,7 +7211,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -7232,7 +7232,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "async-std", "derive_more 0.99.6", @@ -7246,7 +7246,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "hash-db", @@ -7267,7 +7267,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "cfg-if", "frame-executive", @@ -7300,14 +7300,14 @@ dependencies = [ "sp-transaction-pool", "sp-trie", "sp-version", - "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights)", + "substrate-wasm-builder-runner 1.0.6 (git+https://github.com/paritytech/substrate)", "trie-db", ] [[package]] name = "substrate-test-runtime-client" version = "2.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" dependencies = [ "futures 0.3.5", "parity-scale-codec", @@ -7327,7 +7327,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder-runner" version = "1.0.6" -source = "git+https://github.com/paritytech/substrate?branch=apopiak-collective-weights#c3dd17b8631cc45d46cb9e8839b750425d158ded" +source = "git+https://github.com/paritytech/substrate#34567133e7666dfb1e49ce7e3565e66a7e5f9542" [[package]] name = "substrate-wasm-builder-runner" diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 72b5b63b78cd..4e58dd4da7d2 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -612,6 +612,7 @@ impl system::offchain::CreateSignedTransaction for Runtime registrar::LimitParathreadCommits::::new(), parachains::ValidateDoubleVoteReports::::new(), grandpa::ValidateEquivocationReport::::new(), + claims::PrevalidateAttests::::new(), ); let raw_payload = SignedPayload::new(call, extra).map_err(|e| { debug::warn!("Unable to create signed payload: {:?}", e); From a918c2fdf67c02a789a3456354b8c64360850b1c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 15 May 2020 12:39:28 +0200 Subject: [PATCH 11/24] Fixes --- runtime/common/src/claims.rs | 69 +++++++++++++++++------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index b6b47cadb771..ced25a473aac 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -429,38 +429,42 @@ impl sp_runtime::traits::ValidateUnsigned for Module { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { const PRIORITY: u64 = 100; - match call { + let maybe_signer = match call { // // Base Weight: 370 µs // DB Weight: 1 Read (Claims) // Call::claim(account, ethereum_signature) => { let data = account.using_encoded(to_ascii_hex); - let maybe_signer = Self::eth_recover(ðereum_signature, &data, &[][..]); - let signer = if let Some(s) = maybe_signer { - s - } else { - return InvalidTransaction::Custom( - ValidityError::InvalidEthereumSignature.into(), - ).into(); - }; - - if !>::contains_key(&signer) { - return Err(InvalidTransaction::Custom( - ValidityError::SignerHasNoClaim.into(), - ).into()); + Self::eth_recover(ðereum_signature, &data, &[][..]) + } + Call::claim_attest(account, ethereum_signature, statement) => { + let data = account.using_encoded(to_ascii_hex); + let maybe_signer = Self::eth_recover(ðereum_signature, &data, statement.to_text()); + if let Some(ref signer) = maybe_signer { + if let Some(s) = Signing::get(signer) { + let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); + ensure!(&s == statement, e); + } } - - Ok(ValidTransaction { - priority: PRIORITY, - requires: vec![], - provides: vec![("claims", signer).encode()], - longevity: TransactionLongevity::max_value(), - propagate: true, - }) + maybe_signer } - _ => Err(InvalidTransaction::Call.into()), - } + _ => return Err(InvalidTransaction::Call.into()), + }; + + let signer = maybe_signer + .ok_or(InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()))?; + + let e = InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()); + ensure!(>::contains_key(&signer), e); + + Ok(ValidTransaction { + priority: PRIORITY, + requires: vec![], + provides: vec![("claims", signer).encode()], + longevity: TransactionLongevity::max_value(), + propagate: true, + }) } } @@ -515,19 +519,11 @@ impl SignedExtension for PrevalidateAttests where ) -> TransactionValidity { if let Some(local_call) = call.is_sub_type() { if let Call::attest(attested_statement) = local_call { - let signer = match Preclaims::::get(who) { - Some(x) => x, - None => - return Err(InvalidTransaction::Custom( - ValidityError::SignerHasNoClaim.into() - ).into()), - }; + let signer = Preclaims::::get(who) + .ok_or(InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()))?; if let Some(s) = Signing::get(signer) { - if &attested_statement[..] != s.to_text() { - return Err(InvalidTransaction::Custom( - ValidityError::InvalidStatement.into() - ).into()) - } + let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); + ensure!(&attested_statement[..] == s.to_text(), e); } } } @@ -575,7 +571,6 @@ mod tests { weights::{Pays, GetDispatchInfo}, }; use balances; - use crate::claims; use super::Call as ClaimsCall; impl_outer_origin! { From b47b7486d302a294f3b05f3b259b37c5c0f43c05 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 15 May 2020 13:45:45 +0200 Subject: [PATCH 12/24] More fixes --- Cargo.lock | 38 ++++++++++++++++++------------------ runtime/common/src/claims.rs | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 479f9033a3ca..02e1077af5ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2220,7 +2220,7 @@ dependencies = [ [[package]] name = "kusama-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4076,7 +4076,7 @@ checksum = "feb3b2b1033b8a60b4da6ee470325f887758c95d5320f52f9ce0df055a55940e" [[package]] name = "polkadot" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "assert_cmd", "futures 0.3.5", @@ -4089,7 +4089,7 @@ dependencies = [ [[package]] name = "polkadot-availability-store" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.99.6", "exit-future", @@ -4115,7 +4115,7 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "frame-benchmarking-cli", "futures 0.3.5", @@ -4139,7 +4139,7 @@ dependencies = [ [[package]] name = "polkadot-collator" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "futures 0.3.5", "futures-timer 2.0.2", @@ -4166,7 +4166,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.15.0", "parity-scale-codec", @@ -4178,7 +4178,7 @@ dependencies = [ [[package]] name = "polkadot-network" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "arrayvec 0.4.12", "bytes 0.5.4", @@ -4227,7 +4227,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "derive_more 0.99.6", "log 0.4.8", @@ -4246,7 +4246,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-system", @@ -4268,7 +4268,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "jsonrpc-core", "pallet-transaction-payment-rpc", @@ -4287,7 +4287,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", @@ -4398,7 +4398,7 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "env_logger", "frame-benchmarking", @@ -4457,7 +4457,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -4466,7 +4466,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-executive", @@ -4542,7 +4542,7 @@ dependencies = [ [[package]] name = "polkadot-validation" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "derive_more 0.14.1", @@ -7546,7 +7546,7 @@ dependencies = [ [[package]] name = "test-parachain-adder" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "dlmalloc", "parity-scale-codec", @@ -7585,7 +7585,7 @@ dependencies = [ [[package]] name = "test-parachain-halt" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "substrate-wasm-builder-runner 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -8439,7 +8439,7 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.7.33" +version = "0.7.34-dev" dependencies = [ "bitvec", "frame-benchmarking", diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index f2f181b20c3d..3da77401b69a 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -929,7 +929,7 @@ mod tests { Ok(ValidTransaction { priority: 100, requires: vec![], - provides: vec![("claims", eth(&alice())).encode()], + provides: vec![("claims", eth(&dave())).encode()], longevity: TransactionLongevity::max_value(), propagate: true, }) From 3445735208760665bd6abfe5dc0c46f6b0a8db8f Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 15 May 2020 16:25:52 +0200 Subject: [PATCH 13/24] Fix bench tests --- runtime/common/src/claims.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 3da77401b69a..214b9b001955 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -1049,9 +1049,10 @@ mod benchmarking { let account: T::AccountId = account("user", i, SEED); let signature = sig::(&secret_key, &account.encode(), &[][..]); let data = account.using_encoded(to_ascii_hex); + let extra = StatementKind::default().to_text(); }: { for _ in 0 .. i { - assert!(super::Module::::eth_recover(&signature, &data).is_some()); + assert!(super::Module::::eth_recover(&signature, &data, extra).is_some()); } } } From 4912d2b212b3a071dbfb378985dea59c34f891ba Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 15 May 2020 17:26:00 +0200 Subject: [PATCH 14/24] Fix & test Preclaim clobbering. --- runtime/common/src/claims.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 3da77401b69a..a4e77b5668f3 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -352,7 +352,8 @@ decl_module! { if let Some(s) = Signing::get(signer) { ensure!(s.to_text() == &statement[..], Error::::InvalidStatement); } - Self::process_claim(signer, who)?; + Self::process_claim(signer, who.clone())?; + Preclaims::::remove(&who); } } } @@ -414,7 +415,6 @@ impl Module { >::remove(&signer); >::remove(&signer); Signing::remove(&signer); - Preclaims::::remove(&dest); // Let's deposit an event to let the outside world know this happened. Self::deposit_event(RawEvent::Claimed(dest, signer, balance_due)); @@ -751,6 +751,17 @@ mod tests { }); } + #[test] + fn claim_cannot_clobber_preclaim() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::free_balance(42), 0); + assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); + assert_ok!(Claims::attest(Origin::signed(42), StatementKind::Alternative.to_text().to_vec())); + assert_eq!(Balances::free_balance(&42), 400); + assert_eq!(Claims::total(), 200); + }); + } + #[test] fn valid_attest_transactions_are_free() { new_test_ext().execute_with(|| { From 6ecbb593190da90e3d3a771073839dfb96d9b75d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 15 May 2020 17:32:45 +0200 Subject: [PATCH 15/24] Fix for errant claim logic --- runtime/common/src/claims.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index a4e77b5668f3..c8c46d7a7f98 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -240,6 +240,7 @@ decl_module! { let data = dest.using_encoded(to_ascii_hex); let signer = Self::eth_recover(ðereum_signature, &data, &[][..]) .ok_or(Error::::InvalidEthereumSignature)?; + ensure!(!Signing::exists(&signer), Error::::InvalidStatement); Self::process_claim(signer, dest)?; } @@ -437,6 +438,8 @@ impl sp_runtime::traits::ValidateUnsigned for Module { Call::claim(account, ethereum_signature) => { let data = account.using_encoded(to_ascii_hex); Self::eth_recover(ðereum_signature, &data, &[][..]) + let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); + ensure!(!Signing::exists(signer), e); } Call::claim_attest(account, ethereum_signature, statement) => { let data = account.using_encoded(to_ascii_hex); From 8e9939d6b3bdc4a2e4d466fef1b94c8ad7c24a17 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 15 May 2020 17:39:33 +0200 Subject: [PATCH 16/24] Add test --- runtime/common/src/claims.rs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 004e8cbb3db3..255454855606 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -240,7 +240,7 @@ decl_module! { let data = dest.using_encoded(to_ascii_hex); let signer = Self::eth_recover(ðereum_signature, &data, &[][..]) .ok_or(Error::::InvalidEthereumSignature)?; - ensure!(!Signing::exists(&signer), Error::::InvalidStatement); + ensure!(Signing::get(&signer).is_none(), Error::::InvalidStatement); Self::process_claim(signer, dest)?; } @@ -430,27 +430,18 @@ impl sp_runtime::traits::ValidateUnsigned for Module { fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { const PRIORITY: u64 = 100; - let maybe_signer = match call { + let (maybe_signer, maybe_statement) = match call { // // Base Weight: 370 µs // DB Weight: 1 Read (Claims) // Call::claim(account, ethereum_signature) => { let data = account.using_encoded(to_ascii_hex); - Self::eth_recover(ðereum_signature, &data, &[][..]) - let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); - ensure!(!Signing::exists(signer), e); + (Self::eth_recover(ðereum_signature, &data, &[][..]), None) } Call::claim_attest(account, ethereum_signature, statement) => { let data = account.using_encoded(to_ascii_hex); - let maybe_signer = Self::eth_recover(ðereum_signature, &data, statement.to_text()); - if let Some(ref signer) = maybe_signer { - if let Some(s) = Signing::get(signer) { - let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); - ensure!(&s == statement, e); - } - } - maybe_signer + (Self::eth_recover(ðereum_signature, &data, statement.to_text()), Some(*statement)) } _ => return Err(InvalidTransaction::Call.into()), }; @@ -458,6 +449,9 @@ impl sp_runtime::traits::ValidateUnsigned for Module { let signer = maybe_signer .ok_or(InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()))?; + let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); + ensure!(Signing::get(signer) == maybe_statement, e); + let e = InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()); ensure!(>::contains_key(&signer), e); @@ -792,6 +786,16 @@ mod tests { }); } + #[test] + fn cannot_bypass_attest_claiming() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::free_balance(42), 0); + let s = sig::(&dave(), &42u64.encode(), &[]); + let r = Claims::claim(Origin::NONE, 42, s.clone()); + assert_noop!(r, Error::::InvalidStatement); + }); + } + #[test] fn add_claim_works() { new_test_ext().execute_with(|| { From 00045449e4f59d20dc914986fd4c4d79247a5fe2 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 15 May 2020 22:20:25 +0200 Subject: [PATCH 17/24] Update tests, always use Vec as input --- runtime/common/src/claims.rs | 97 ++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 33 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 255454855606..d2bb2312e92a 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -326,15 +326,15 @@ decl_module! { fn claim_attest(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature, - statement: StatementKind, + statement: Vec, ) { ensure_none(origin)?; let data = dest.using_encoded(to_ascii_hex); - let signer = Self::eth_recover(ðereum_signature, &data, statement.to_text()) + let signer = Self::eth_recover(ðereum_signature, &data, &statement) .ok_or(Error::::InvalidEthereumSignature)?; if let Some(s) = Signing::get(signer) { - ensure!(s == statement, Error::::InvalidStatement); + ensure!(s.to_text() == &statement[..], Error::::InvalidStatement); } Self::process_claim(signer, dest)?; } @@ -441,7 +441,7 @@ impl sp_runtime::traits::ValidateUnsigned for Module { } Call::claim_attest(account, ethereum_signature, statement) => { let data = account.using_encoded(to_ascii_hex); - (Self::eth_recover(ðereum_signature, &data, statement.to_text()), Some(*statement)) + (Self::eth_recover(ðereum_signature, &data, &statement), Some(statement.as_slice())) } _ => return Err(InvalidTransaction::Call.into()), }; @@ -449,12 +449,15 @@ impl sp_runtime::traits::ValidateUnsigned for Module { let signer = maybe_signer .ok_or(InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()))?; - let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); - ensure!(Signing::get(signer) == maybe_statement, e); - let e = InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()); ensure!(>::contains_key(&signer), e); + let e = InvalidTransaction::Custom(ValidityError::InvalidStatement.into()); + match Signing::get(signer) { + None => ensure!(maybe_statement.is_none(), e), + Some(s) => ensure!(Some(s.to_text()) == maybe_statement, e), + } + Ok(ValidTransaction { priority: PRIORITY, requires: vec![], @@ -662,6 +665,9 @@ mod tests { fn eve() -> secp256k1::SecretKey { secp256k1::SecretKey::parse(&keccak_256(b"Eve")).unwrap() } + fn frank() -> secp256k1::SecretKey { + secp256k1::SecretKey::parse(&keccak_256(b"Frank")).unwrap() + } // This function basically just builds a genesis storage key/value store according to // our desired mockup. @@ -673,20 +679,26 @@ mod tests { claims: vec![ (eth(&alice()), 100, None, None), (eth(&dave()), 200, None, Some(StatementKind::Default)), - (eth(&eve()), 300, Some(42), Some(StatementKind::Alternative)) + (eth(&eve()), 300, Some(42), Some(StatementKind::Alternative)), + (eth(&frank()), 400, Some(43), None), ], vesting: vec![(eth(&alice()), (50, 10, 1))], }.assimilate_storage(&mut t).unwrap(); t.into() } + fn total_claims() -> u64 { + 100 + 200 + 300 + 400 + } + #[test] fn basic_setup_works() { new_test_ext().execute_with(|| { - assert_eq!(Claims::total(), 600); + assert_eq!(Claims::total(), total_claims()); assert_eq!(Claims::claims(ð(&alice())), Some(100)); assert_eq!(Claims::claims(ð(&dave())), Some(200)); assert_eq!(Claims::claims(ð(&eve())), Some(300)); + assert_eq!(Claims::claims(ð(&frank())), Some(400)); assert_eq!(Claims::claims(&EthereumAddress::default()), None); assert_eq!(Claims::vesting(ð(&alice())), Some((50, 10, 1))); }); @@ -708,7 +720,23 @@ mod tests { assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&42), 100); assert_eq!(Vesting::vesting_balance(&42), Some(50)); - assert_eq!(Claims::total(), 500); + assert_eq!(Claims::total(), total_claims() - 100); + }); + } + + #[test] + fn claiming_does_not_bypass_signing() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); + assert_noop!( + Claims::claim(Origin::NONE, 42, sig::(&dave(), &42u64.encode(), &[][..])), + Error::::InvalidStatement, + ); + assert_noop!( + Claims::claim(Origin::NONE, 42, sig::(&eve(), &42u64.encode(), &[][..])), + Error::::InvalidStatement, + ); + assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&frank(), &42u64.encode(), &[][..]))); }); } @@ -717,21 +745,21 @@ mod tests { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); let s = sig::(&dave(), &42u64.encode(), StatementKind::Alternative.to_text()); - let r = Claims::claim_attest(Origin::NONE, 42, s.clone(), StatementKind::Alternative); + let r = Claims::claim_attest(Origin::NONE, 42, s.clone(), StatementKind::Alternative.to_text().to_vec()); assert_noop!(r, Error::::InvalidStatement); - let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default); + let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default.to_text().to_vec()); assert_noop!(r, Error::::SignerHasNoClaim); // ^^^ we use ecdsa_recover, so an invalid signature just results in a random signer id // being recovered, which realistically will never have a claim. let s = sig::(&dave(), &42u64.encode(), StatementKind::Default.to_text()); - assert_ok!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default)); + assert_ok!(Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default.to_text().to_vec())); assert_eq!(Balances::free_balance(&42), 200); - assert_eq!(Claims::total(), 400); + assert_eq!(Claims::total(), total_claims() - 200); let s = sig::(&dave(), &42u64.encode(), StatementKind::Default.to_text()); - let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default); + let r = Claims::claim_attest(Origin::NONE, 42, s, StatementKind::Default.to_text().to_vec()); assert_noop!(r, Error::::SignerHasNoClaim); }); } @@ -744,7 +772,7 @@ mod tests { assert_noop!(Claims::attest(Origin::signed(42), StatementKind::Default.to_text().to_vec()), Error::::InvalidStatement); assert_ok!(Claims::attest(Origin::signed(42), StatementKind::Alternative.to_text().to_vec())); assert_eq!(Balances::free_balance(&42), 300); - assert_eq!(Claims::total(), 300); + assert_eq!(Claims::total(), total_claims() - 300); }); } @@ -752,10 +780,13 @@ mod tests { fn claim_cannot_clobber_preclaim() { new_test_ext().execute_with(|| { assert_eq!(Balances::free_balance(42), 0); + // Alice's claim is 100 assert_ok!(Claims::claim(Origin::NONE, 42, sig::(&alice(), &42u64.encode(), &[][..]))); + assert_eq!(Balances::free_balance(&42), 100); + // Eve's claim is 300 through Account 42 assert_ok!(Claims::attest(Origin::signed(42), StatementKind::Alternative.to_text().to_vec())); - assert_eq!(Balances::free_balance(&42), 400); - assert_eq!(Claims::total(), 200); + assert_eq!(Balances::free_balance(&42), 100 + 300); + assert_eq!(Claims::total(), total_claims() - 400); }); } @@ -809,11 +840,11 @@ mod tests { Error::::SignerHasNoClaim, ); assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None)); - assert_eq!(Claims::total(), 800); + assert_eq!(Claims::total(), total_claims() + 200); assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&69), 200); assert_eq!(Vesting::vesting_balance(&69), None); - assert_eq!(Claims::total(), 600); + assert_eq!(Claims::total(), total_claims()); }); } @@ -863,22 +894,18 @@ mod tests { fn claiming_while_vested_doesnt_work() { new_test_ext().execute_with(|| { // A user is already vested - assert_ok!(::VestingSchedule::add_vesting_schedule(&69, 1000, 100, 10)); - CurrencyOf::::make_free_balance_be(&69, 1000); - assert_eq!(Balances::free_balance(69), 1000); + assert_ok!(::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10)); + CurrencyOf::::make_free_balance_be(&69, total_claims()); + assert_eq!(Balances::free_balance(69), total_claims()); assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)))); // New total - assert_eq!(Claims::total(), 800); + assert_eq!(Claims::total(), total_claims() + 200); // They should not be able to claim assert_noop!( Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::DestinationVesting ); - // Everything should be unchanged - assert_eq!(Claims::total(), 800); - assert_eq!(Balances::free_balance(69), 1000); - assert_eq!(Vesting::vesting_balance(&69), Some(1000)); }); } @@ -941,7 +968,7 @@ mod tests { InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); let s = sig::(&dave(), &1u64.encode(), StatementKind::Default.to_text()); - let call = ClaimsCall::claim_attest(1, s, StatementKind::Default); + let call = ClaimsCall::claim_attest(1, s, StatementKind::Default.to_text().to_vec()); assert_eq!( >::validate_unsigned(source, &call), Ok(ValidTransaction { @@ -953,26 +980,30 @@ mod tests { }) ); assert_eq!( - >::validate_unsigned(source, &ClaimsCall::claim_attest(1, EcdsaSignature([0; 65]), StatementKind::Default)), + >::validate_unsigned( + source, + &ClaimsCall::claim_attest(1, EcdsaSignature([0; 65]), + StatementKind::Default.to_text().to_vec()) + ), InvalidTransaction::Custom(ValidityError::InvalidEthereumSignature.into()).into(), ); let s = sig::(&bob(), &1u64.encode(), StatementKind::Default.to_text()); - let call = ClaimsCall::claim_attest(1, s, StatementKind::Default); + let call = ClaimsCall::claim_attest(1, s, StatementKind::Default.to_text().to_vec()); assert_eq!( >::validate_unsigned(source, &call), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); let s = sig::(&dave(), &1u64.encode(), StatementKind::Alternative.to_text()); - let call = ClaimsCall::claim_attest(1, s, StatementKind::Default); + let call = ClaimsCall::claim_attest(1, s, StatementKind::Default.to_text().to_vec()); assert_eq!( >::validate_unsigned(source, &call), InvalidTransaction::Custom(ValidityError::SignerHasNoClaim.into()).into(), ); let s = sig::(&dave(), &1u64.encode(), StatementKind::Alternative.to_text()); - let call = ClaimsCall::claim_attest(1, s, StatementKind::Alternative); + let call = ClaimsCall::claim_attest(1, s, StatementKind::Alternative.to_text().to_vec()); assert_eq!( >::validate_unsigned(source, &call), InvalidTransaction::Custom(ValidityError::InvalidStatement.into()).into(), From c4262b3b5075c692400deb1ca8f759bae02cfdcf Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 15 May 2020 23:50:31 +0200 Subject: [PATCH 18/24] mint_claim can add signature, some_benchmarks --- runtime/common/src/claims.rs | 79 ++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 12 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index d2bb2312e92a..490874ae58de 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -272,6 +272,7 @@ decl_module! { who: EthereumAddress, value: BalanceOf, vesting_schedule: Option<(BalanceOf, BalanceOf, T::BlockNumber)>, + statement: Option, ) { ensure_root(origin)?; @@ -280,6 +281,9 @@ decl_module! { if let Some(vs) = vesting_schedule { >::insert(who, vs); } + if let Some(s) = statement { + Signing::insert(who, s); + } } /// Make a claim to collect your DOTs. @@ -831,7 +835,7 @@ mod tests { fn add_claim_works() { new_test_ext().execute_with(|| { assert_noop!( - Claims::mint_claim(Origin::signed(42), eth(&bob()), 200, None), + Claims::mint_claim(Origin::signed(42), eth(&bob()), 200, None, None), sp_runtime::traits::BadOrigin, ); assert_eq!(Balances::free_balance(42), 0); @@ -839,7 +843,7 @@ mod tests { Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim, ); - assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None)); + assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None, None)); assert_eq!(Claims::total(), total_claims() + 200); assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&69), 200); @@ -852,7 +856,7 @@ mod tests { fn add_claim_with_vesting_works() { new_test_ext().execute_with(|| { assert_noop!( - Claims::mint_claim(Origin::signed(42), eth(&bob()), 200, Some((50, 10, 1))), + Claims::mint_claim(Origin::signed(42), eth(&bob()), 200, Some((50, 10, 1)), None), sp_runtime::traits::BadOrigin, ); assert_eq!(Balances::free_balance(42), 0); @@ -860,7 +864,7 @@ mod tests { Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..])), Error::::SignerHasNoClaim ); - assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)))); + assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)), None)); assert_ok!(Claims::claim(Origin::NONE, 69, sig::(&bob(), &69u64.encode(), &[][..]))); assert_eq!(Balances::free_balance(&69), 200); assert_eq!(Vesting::vesting_balance(&69), Some(50)); @@ -897,7 +901,7 @@ mod tests { assert_ok!(::VestingSchedule::add_vesting_schedule(&69, total_claims(), 100, 10)); CurrencyOf::::make_free_balance_be(&69, total_claims()); assert_eq!(Balances::free_balance(69), total_claims()); - assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)))); + assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, Some((50, 10, 1)), None)); // New total assert_eq!(Claims::total(), total_claims() + 200); @@ -1032,14 +1036,31 @@ mod benchmarking { let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap(); let eth_address = eth(&secret_key); let vesting = Some((100_000.into(), 1_000.into(), 100.into())); - super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting)?; + super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?; + Ok(()) + } + + fn create_claim_attest(input: u32) -> DispatchResult { + let secret_key = secp256k1::SecretKey::parse(&keccak_256(&input.encode())).unwrap(); + let eth_address = eth(&secret_key); + let vesting = Some((100_000.into(), 1_000.into(), 100.into())); + super::Module::::mint_claim( + RawOrigin::Root.into(), + eth_address, + VALUE.into(), + vesting, + Some(Default::default()) + )?; Ok(()) } benchmarks! { _ { // Create claims in storage. - let c in 0 .. MAX_CLAIMS => create_claim::(c)?; + let c in 0 .. MAX_CLAIMS => { + create_claim::(c)?; + create_claim_attest::(u32::max_value() - c)?; + }; } // Benchmark `claim` for different users. @@ -1050,7 +1071,7 @@ mod benchmarking { let account: T::AccountId = account("user", u, SEED); let vesting = Some((100_000.into(), 1_000.into(), 100.into())); let signature = sig::(&secret_key, &account.encode(), &[][..]); - super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting)?; + super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, None)?; assert_eq!(Claims::::get(eth_address), Some(VALUE.into())); }: _(RawOrigin::None, account, signature) verify { @@ -1062,13 +1083,31 @@ mod benchmarking { let c in ...; let eth_address = account("eth_address", c, SEED); let vesting = Some((100_000.into(), 1_000.into(), 100.into())); - }: _(RawOrigin::Root, eth_address, VALUE.into(), vesting) + let statement = StatementKind::Default; + }: _(RawOrigin::Root, eth_address, VALUE.into(), vesting, Some(statement)) verify { assert_eq!(Claims::::get(eth_address), Some(VALUE.into())); } - // Benchmark the time it takes to execute `validate_unsigned` - validate_unsigned { + // Benchmark `claim_attest` for different users. + claim_attest { + let u in 0 .. 1000; + let attest_u = u32::max_value() - u; + let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_u.encode())).unwrap(); + let eth_address = eth(&secret_key); + let account: T::AccountId = account("user", u, SEED); + let vesting = Some((100_000.into(), 1_000.into(), 100.into())); + let statement = StatementKind::Default; + let signature = sig::(&secret_key, &account.encode(), statement.to_text()); + super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?; + assert_eq!(Claims::::get(eth_address), Some(VALUE.into())); + }: _(RawOrigin::None, account, signature, statement.to_text().to_vec()) + verify { + assert_eq!(Claims::::get(eth_address), None); + } + + // Benchmark the time it takes to execute `validate_unsigned` for `claim` + validate_unsigned_claim { let c in ...; // Crate signature let secret_key = secp256k1::SecretKey::parse(&keccak_256(&c.encode())).unwrap(); @@ -1080,6 +1119,20 @@ mod benchmarking { super::Module::::validate_unsigned(source, &call)? } + // Benchmark the time it takes to execute `validate_unsigned` for `claim_attest` + validate_unsigned_claim_attest { + let c in ...; + // Crate signature + let attest_c = u32::max_value() - c; + let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap(); + let account: T::AccountId = account("user", c, SEED); + let signature = sig::(&secret_key, &account.encode(), StatementKind::Default.to_text()); + let call = Call::::claim_attest(account, signature, StatementKind::Default.to_text().to_vec()); + let source = sp_runtime::transaction_validity::TransactionSource::External; + }: { + super::Module::::validate_unsigned(source, &call)? + } + // Benchmark the time it takes to do `repeat` number of keccak256 hashes keccak256 { let i in 0 .. 10_000; @@ -1117,7 +1170,9 @@ mod benchmarking { new_test_ext().execute_with(|| { assert_ok!(test_benchmark_claim::()); assert_ok!(test_benchmark_mint_claim::()); - assert_ok!(test_benchmark_validate_unsigned::()); + assert_ok!(test_benchmark_claim_attest::()); + assert_ok!(test_benchmark_validate_unsigned_claim::()); + assert_ok!(test_benchmark_validate_unsigned_claim_attest::()); assert_ok!(test_benchmark_keccak256::()); assert_ok!(test_benchmark_eth_recover::()); }); From d61bfff5d79437baf3615e81682183fd66a8ed64 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 00:02:04 +0200 Subject: [PATCH 19/24] Add claim with statement test --- runtime/common/src/claims.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 490874ae58de..91e3c1cfb55b 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -871,6 +871,37 @@ mod tests { }); } + #[test] + fn add_claim_with_statement_works() { + new_test_ext().execute_with(|| { + assert_noop!( + Claims::mint_claim(Origin::signed(42), eth(&bob()), 200, None, Some(StatementKind::Default)), + sp_runtime::traits::BadOrigin, + ); + assert_eq!(Balances::free_balance(42), 0); + let signature = sig::(&bob(), &69u64.encode(), StatementKind::Default.to_text()); + assert_noop!( + Claims::claim_attest( + Origin::NONE, 69, signature.clone(), StatementKind::Default.to_text().to_vec() + ), + Error::::SignerHasNoClaim + ); + assert_ok!(Claims::mint_claim(Origin::ROOT, eth(&bob()), 200, None, Some(StatementKind::Default))); + assert_noop!( + Claims::claim_attest( + Origin::NONE, 69, signature.clone(), vec![], + ), + Error::::SignerHasNoClaim + ); + assert_ok!( + Claims::claim_attest( + Origin::NONE, 69, signature.clone(), StatementKind::Default.to_text().to_vec() + ) + ); + assert_eq!(Balances::free_balance(&69), 200); + }); + } + #[test] fn origin_signed_claiming_fail() { new_test_ext().execute_with(|| { From 825479a132f99a95a40fb60c9deee4b274aee7d5 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 00:58:17 +0200 Subject: [PATCH 20/24] finish benchmarks --- runtime/common/src/claims.rs | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 91e3c1cfb55b..0b2540d778f2 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -1137,6 +1137,24 @@ mod benchmarking { assert_eq!(Claims::::get(eth_address), None); } + // Benchmark `attest` for different users. + attest { + let u in 0 .. 1000; + let attest_u = u32::max_value() - u; + let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_u.encode())).unwrap(); + let eth_address = eth(&secret_key); + let account: T::AccountId = account("user", u, SEED); + let vesting = Some((100_000.into(), 1_000.into(), 100.into())); + let statement = StatementKind::Default; + let signature = sig::(&secret_key, &account.encode(), statement.to_text()); + super::Module::::mint_claim(RawOrigin::Root.into(), eth_address, VALUE.into(), vesting, Some(statement))?; + Preclaims::::insert(&account, eth_address); + assert_eq!(Claims::::get(eth_address), Some(VALUE.into())); + }: _(RawOrigin::Signed(account), statement.to_text().to_vec()) + verify { + assert_eq!(Claims::::get(eth_address), None); + } + // Benchmark the time it takes to execute `validate_unsigned` for `claim` validate_unsigned_claim { let c in ...; @@ -1164,6 +1182,28 @@ mod benchmarking { super::Module::::validate_unsigned(source, &call)? } + validate_prevalidate_attests { + let c in ...; + let attest_c = u32::max_value() - c; + let secret_key = secp256k1::SecretKey::parse(&keccak_256(&attest_c.encode())).unwrap(); + let eth_address = eth(&secret_key); + let account: T::AccountId = account("user", c, SEED); + Preclaims::::insert(&account, eth_address); + let call = super::Call::attest(StatementKind::Default.to_text().to_vec()); + // We have to copy the validate statement here because of trait issues... :( + let validate = |who: &T::AccountId, call: &super::Call| -> DispatchResult { + if let Call::attest(attested_statement) = call { + let signer = Preclaims::::get(who).ok_or("signer has no claim")?; + if let Some(s) = Signing::get(signer) { + ensure!(&attested_statement[..] == s.to_text(), "invalid statement"); + } + } + Ok(()) + }; + }: { + validate(&account, &call)? + } + // Benchmark the time it takes to do `repeat` number of keccak256 hashes keccak256 { let i in 0 .. 10_000; @@ -1202,8 +1242,10 @@ mod benchmarking { assert_ok!(test_benchmark_claim::()); assert_ok!(test_benchmark_mint_claim::()); assert_ok!(test_benchmark_claim_attest::()); + assert_ok!(test_benchmark_attest::()); assert_ok!(test_benchmark_validate_unsigned_claim::()); assert_ok!(test_benchmark_validate_unsigned_claim_attest::()); + assert_ok!(test_benchmark_validate_prevalidate_attests::()); assert_ok!(test_benchmark_keccak256::()); assert_ok!(test_benchmark_eth_recover::()); }); From abb566649b4161cdad9ff2862ebbe8e3ddb315ca Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 01:11:12 +0200 Subject: [PATCH 21/24] put the correct number of claims with benchmarks --- runtime/common/src/claims.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 0b2540d778f2..5801e7dbfdd0 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -1087,8 +1087,8 @@ mod benchmarking { benchmarks! { _ { - // Create claims in storage. - let c in 0 .. MAX_CLAIMS => { + // Create claims in storage. Two are created at a time! + let c in 0 .. MAX_CLAIMS / 2 => { create_claim::(c)?; create_claim_attest::(u32::max_value() - c)?; }; From a0d69d7b1815af7f792c23110dc607209f19779a Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 01:32:57 +0200 Subject: [PATCH 22/24] fix compiler warning --- runtime/polkadot/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 0a2edf0f8add..7c35b6a60c6f 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -62,7 +62,6 @@ use im_online::sr25519::AuthorityId as ImOnlineId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo; use session::historical as session_historical; -use claims::PrevalidateAttests; use static_assertions::const_assert; #[cfg(feature = "std")] From 25ac2ea587021f34f130c3ab9613aca6344c5d4a Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 02:14:53 +0200 Subject: [PATCH 23/24] Update weights --- runtime/common/src/claims.rs | 53 ++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 5801e7dbfdd0..9cf36da075cd 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -228,12 +228,13 @@ decl_module! { /// /// Total Complexity: O(1) /// ---------------------------- - /// Base Weight: 622.6 µs + /// Base Weight: 269.7 µs /// DB Weight: - /// - Read: Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account - /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting + /// - Read: Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account + /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing + /// Validate Unsigned: +188.7 µs /// - #[weight = T::DbWeight::get().reads_writes(6, 6) + 650_000_000] + #[weight = T::DbWeight::get().reads_writes(7, 7) + 270_000_000 + 190_000_000] fn claim(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature) { ensure_none(origin)?; @@ -262,12 +263,18 @@ decl_module! { /// /// Total Complexity: O(1) /// --------------------- - /// Base Weight: 25.64 µs + /// Base Weight: 10.46 µs /// DB Weight: /// - Reads: Total - /// - Writes: Total, Claims, Vesting + /// - Writes: Total, Claims + /// - Maybe Write: Vesting, Statement /// - #[weight = T::DbWeight::get().reads_writes(1, 3) + 25_000_000] + #[weight = + T::DbWeight::get().reads_writes(1, 2) + + T::DbWeight::get().writes(vesting_schedule.is_some().into()) + + T::DbWeight::get().writes(statement.is_some().into()) + + 10_000_000 + ] fn mint_claim(origin, who: EthereumAddress, value: BalanceOf, @@ -286,12 +293,12 @@ decl_module! { } } - /// Make a claim to collect your DOTs. + /// Make a claim to collect your DOTs by signing a statement. /// /// The dispatch origin for this call must be _None_. /// /// Unsigned Validation: - /// A call to claim is deemed valid if the signature provided matches + /// A call to `claim_attest` is deemed valid if the signature provided matches /// the expected signed message of: /// /// > Ethereum Signed Message: @@ -321,12 +328,13 @@ decl_module! { /// /// Total Complexity: O(1) /// ---------------------------- - /// Base Weight: 622.6 µs + /// Base Weight: 270.2 µs /// DB Weight: - /// - Read: Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account - /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting + /// - Read: Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account + /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing + /// Validate Unsigned: +190.1 µs /// - #[weight = T::DbWeight::get().reads_writes(7, 6) + 650_000_000] + #[weight = T::DbWeight::get().reads_writes(7, 7) + 270_000_000 + 190_000_000] fn claim_attest(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature, @@ -346,8 +354,25 @@ decl_module! { /// Attest to a statement, needed to finalize the claims process. /// /// WARNING: Insecure unless your chain includes `PrevalidateAttests` as a `SignedExtension`. + /// + /// Unsigned Validation: + /// A call to attest is deemed valid if the sender has a `Preclaim` registered + /// and provides a `statement` which is expected for the account. + /// + /// Parameters: + /// - `statement`: The identity of the statement which is being attested to in the signature. + /// + /// + /// Total Complexity: O(1) + /// ---------------------------- + /// Base Weight: 93.3 µs + /// DB Weight: + /// - Read: Preclaims, Signing, Claims, Total, Claims Vesting, Vesting Vesting, Balance Lock, Account + /// - Write: Vesting Vesting, Account, Balance Lock, Total, Claim, Claims Vesting, Signing, Preclaims + /// Validate PreValidateAttests: +8.631 µs + /// #[weight = ( - T::DbWeight::get().reads_writes(6, 6) + 650_000_000, + T::DbWeight::get().reads_writes(8, 8) + 90_000_000 + 10_000_000, DispatchClass::Normal, Pays::No )] From 3a0af7b0db94b96b20efef9a6b5c09248bff5eb7 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 16 May 2020 02:23:00 +0200 Subject: [PATCH 24/24] Weight comments for validation --- runtime/common/src/claims.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/runtime/common/src/claims.rs b/runtime/common/src/claims.rs index 9cf36da075cd..38378b961501 100644 --- a/runtime/common/src/claims.rs +++ b/runtime/common/src/claims.rs @@ -461,13 +461,17 @@ impl sp_runtime::traits::ValidateUnsigned for Module { let (maybe_signer, maybe_statement) = match call { // - // Base Weight: 370 µs - // DB Weight: 1 Read (Claims) + // Base Weight: 188.7 µs (includes the full logic of `validate_unsigned`) + // DB Weight: 2 Read (Claims, Signing) // Call::claim(account, ethereum_signature) => { let data = account.using_encoded(to_ascii_hex); (Self::eth_recover(ðereum_signature, &data, &[][..]), None) } + // + // Base Weight: 190.1 µs (includes the full logic of `validate_unsigned`) + // DB Weight: 2 Read (Claims, Signing) + // Call::claim_attest(account, ethereum_signature, statement) => { let data = account.using_encoded(to_ascii_hex); (Self::eth_recover(ðereum_signature, &data, &statement), Some(statement.as_slice())) @@ -539,6 +543,10 @@ impl SignedExtension for PrevalidateAttests where Ok(()) } + // + // Base Weight: 8.631 µs + // DB Weight: 2 Read (Preclaims, Signing) + // fn validate( &self, who: &Self::AccountId,