diff --git a/pallets/cash/src/internal/mod.rs b/pallets/cash/src/internal/mod.rs index 411eb40fe..60e4bb9d6 100644 --- a/pallets/cash/src/internal/mod.rs +++ b/pallets/cash/src/internal/mod.rs @@ -1,6 +1,5 @@ pub mod assets; pub mod balance_helpers; -pub mod change_validators; pub mod events; pub mod exec_trx_request; pub mod extract; diff --git a/pallets/cash/src/lib.rs b/pallets/cash/src/lib.rs index bae26f8a4..56d83d9c4 100644 --- a/pallets/cash/src/lib.rs +++ b/pallets/cash/src/lib.rs @@ -48,6 +48,7 @@ use sp_runtime::{ use pallet_oracle; use pallet_session; use pallet_timestamp; +use pallet_validator; use types_derive::type_alias; #[macro_use] @@ -79,16 +80,13 @@ pub mod benchmarking; #[cfg(test)] mod tests; -/// Type for linking sessions to validators. -#[type_alias] -pub type SubstrateId = AccountId32; - /// Configure the pallet by specifying the parameters and types on which it depends. pub trait Config: frame_system::Config + CreateSignedTransaction> + pallet_timestamp::Config + pallet_oracle::Config + + pallet_validator::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type Event: From + Into<::Event>; @@ -107,9 +105,6 @@ pub trait Config: /// Placate substrate's `HandleLifetime` trait. type AccountStore: StoredMap; - /// Associated type which allows us to interact with substrate Sessions. - type SessionInterface: self::SessionInterface; - /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } @@ -122,15 +117,6 @@ decl_storage! { /// A possible next code hash which is used to accept code provided to SetNextCodeViaHash. AllowedNextCodeHash get(fn allowed_next_code_hash): Option; - /// The upcoming session at which to tell the sessions pallet to rotate the validators. - NextSessionIndex get(fn next_session_index): SessionIndex; - - /// The upcoming set of allowed validators, and their associated keys (or none). - NextValidators get(fn next_validators): map hasher(blake2_128_concat) SubstrateId => Option; - - /// The current set of allowed validators, and their associated keys. - Validators get(fn validators): map hasher(blake2_128_concat) SubstrateId => Option; - /// An index to track interest earned by CASH holders and owed by CASH borrowers. /// Note - the implementation of Default for CashIndex returns ONE. This also provides /// the initial value as it is currently implemented. @@ -202,7 +188,7 @@ decl_storage! { /// The asset metadata for each supported asset, which will also be synced with the starports. SupportedAssets get(fn asset): map hasher(blake2_128_concat) ChainAsset => Option; - /// Miner of the current block. + /// Miner of the current block. -- maybe? Miner get(fn miner): Option; /// Mapping of total principal paid to each miner. @@ -238,12 +224,10 @@ decl_storage! { add_extra_genesis { config(assets): Vec; - config(validators): Vec; config(starports): Vec; config(genesis_blocks): Vec; build(|config| { Pallet::::initialize_assets(config.assets.clone()); - Pallet::::initialize_validators(config.validators.clone()); Pallet::::initialize_starports(config.starports.clone()); Pallet::::initialize_genesis_blocks(config.genesis_blocks.clone()); }) @@ -323,9 +307,6 @@ decl_event!( /// A supported asset has been modified. [asset_info] AssetModified(AssetInfo), - /// A new validator set has been chosen. [validators] - ChangeValidators(Vec), - /// A new yield rate has been chosen. [next_rate, next_start_at] SetYieldNext(APR, Timestamp), @@ -344,154 +325,6 @@ fn check_failure(res: Result<(), Reason>) -> Result<(), Reason> { res } -pub trait SessionInterface: frame_system::Config { - fn has_next_keys(x: AccountId) -> bool; - fn rotate_session(); -} - -impl SessionInterface for T -where - T: pallet_session::Config, -{ - fn has_next_keys(x: SubstrateId) -> bool { - match >::next_keys(x as T::ValidatorId) { - Some(_keys) => true, - None => false, - } - } - - fn rotate_session() { - >::rotate_session(); - } -} - -impl pallet_session::SessionManager for Module { - // return validator set to use in the next session (aura and grandpa also stage new auths associated w these accountIds) - fn new_session(session_index: SessionIndex) -> Option> { - if NextValidators::iter().count() != 0 { - NextSessionIndex::put(session_index); - Some(NextValidators::iter().map(|x| x.0).collect::>()) - } else { - Some(Validators::iter().map(|x| x.0).collect::>()) - } - } - - fn start_session(index: SessionIndex) { - // if changes have been queued - // if starting the queued session - if NextSessionIndex::get() == index && NextValidators::iter().count() != 0 { - // delete existing validators - for validator in ::iter_values() { - ::take(&validator.substrate_id); - } - // push next validators into current validators - for (id, validator) in ::iter() { - ::take(&id); - ::insert(&id, validator); - } - } else { - () - } - } - fn end_session(_: SessionIndex) { - () - } -} - -/* --- Block N -- -changeAuth extrinsic, nextValidators set, hold is set, rotate_session is called -* new_session returns the nextValidators - --- Afterwards -- -"ShouldEndSession" returns true when notice era notices were signed -* when it does, start_session sets Validators = NextValidators - -*/ - -fn vec_to_set(a: Vec) -> BTreeSet { - let mut a_set = BTreeSet::::new(); - for v in a { - a_set.insert(v); - } - return a_set; -} - -fn has_requisite_signatures(notice_state: NoticeState, validators: &Vec) -> bool { - match notice_state { - NoticeState::Pending { signature_pairs } => match signature_pairs { - ChainSignatureList::Eth(signature_pairs) => { - // Note: inefficient, probably best to store as sorted lists / zip compare - type EthAddrType = ::Address; - let signature_set = - vec_to_set::(signature_pairs.iter().map(|p| p.0).collect()); - let validator_set = - vec_to_set::(validators.iter().map(|v| v.eth_address).collect()); - chains::has_super_majority::(&signature_set, &validator_set) - } - _ => false, - }, - _ => false, - } -} - -// periodic except when new authorities are pending and when an era notice has just been completed -impl pallet_session::ShouldEndSession for Module { - fn should_end_session(now: T::BlockNumber) -> bool { - if NextValidators::iter().count() > 0 { - // Check if we should end the hold - let validators: Vec<_> = Validators::iter().map(|v| v.1).collect(); - let every_notice_hold_executed = NoticeHolds::iter().all(|(chain_id, notice_id)| { - has_requisite_signatures(NoticeStates::get(chain_id, notice_id), &validators) - }); - - if every_notice_hold_executed { - for (chain_id, _) in NoticeHolds::iter() { - NoticeHolds::take(chain_id); - } - log!("should_end_session=true[next_validators]"); - true - } else { - log!("should_end_session=false[pending_notice_held]"); - false - } - } else { - // no era changes pending, periodic - let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); - let is_new_period = (now % period) == ::BlockNumber::from(0 as u32); - - if is_new_period { - log!( - "should_end_session={}[periodic {:?}%{:?}]", - is_new_period, - now, - period - ); - } - is_new_period - } - } -} - -impl frame_support::traits::EstimateNextSessionRotation for Module { - fn average_session_length() -> T::BlockNumber { - T::BlockNumber::zero() - } - - fn estimate_current_session_progress(now: T::BlockNumber) -> (Option, Weight) { - let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); - ( - Some(Percent::from_rational(now % period, period)), - Weight::zero(), - ) - } - - fn estimate_next_session_rotation(now: T::BlockNumber) -> (Option, Weight) { - let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); - (Some(now + period - now % period), Weight::zero()) - } -} - fn get_exec_req_weights(request: Vec) -> frame_support::weights::Weight { let request_str = match str::from_utf8(&request[..]).map_err(|_| Reason::InvalidUTF8) { Err(_) => return params::ERROR_WEIGHT, @@ -616,6 +449,7 @@ decl_module! { } } + // TODO: Move to pallet-validator? /// Sets the miner of the this block via inherent #[weight = (0, DispatchClass::Operational)] fn set_miner(origin, miner: ChainAccount) { @@ -623,13 +457,6 @@ decl_module! { internal::miner::set_miner::(miner); } - /// Sets the keys for the next set of validators beginning at the next session. [Root] - #[weight = (::WeightInfo::change_validators(), DispatchClass::Operational, Pays::No)] - pub fn change_validators(origin, validators: Vec) -> dispatch::DispatchResult { - ensure_root(origin)?; - Ok(check_failure::(internal::change_validators::change_validators::(validators))?) - } - /// Sets the allowed next code hash to the given hash. [Root] #[weight = (::WeightInfo::allow_next_code_with_hash(), DispatchClass::Operational, Pays::No)] pub fn allow_next_code_with_hash(origin, hash: CodeHash) -> dispatch::DispatchResult { @@ -742,20 +569,6 @@ impl Module { } } - /// Set the initial set of validators from the genesis config. - /// NextValidators will become current Validators upon first session start. - fn initialize_validators(validators: Vec) { - if validators.is_empty() { - warn!("Validators must be set in the genesis config"); - } - for validator in validators { - // Note: See pipeline commit for usage of T::AccountStore - log!("Adding validator: {:?}", validator); - ::insert(&validator.substrate_id, validator.clone()); - assert!(T::AccountStore::insert(&validator.substrate_id, ()).is_ok()); - } - } - /// Set the initial starports from the genesis config. fn initialize_starports(starports: Vec) { if starports.is_empty() { @@ -865,6 +678,7 @@ impl Module { Ok(core::get_portfolio::(account)?) } + // This can't be in pallet-validator since it pulls in earnings /// Get the active validators, and sets pub fn get_validator_info() -> Result<(Vec, Vec<(ChainAccount, String)>), Reason> { diff --git a/pallets/cash/src/serdes.rs b/pallets/cash/src/serdes.rs index ed7e4d9c1..d22047648 100644 --- a/pallets/cash/src/serdes.rs +++ b/pallets/cash/src/serdes.rs @@ -4,7 +4,6 @@ use serde::{de, ser::SerializeMap, Deserialize, Deserializer, Serialize, Seriali use crate::{ chains::{Chain, ChainAccount, ChainAsset, Ethereum}, symbol::Symbol, - types::ValidatorKeys, }; // For using in GenesisConfig / ChainSpec JSON. @@ -122,114 +121,3 @@ impl Serialize for Symbol { ser.serialize_str(&s) } } - -// ValidatorKeys & Vec - -impl<'de> de::Deserialize<'de> for ValidatorKeys { - fn deserialize(de: D) -> Result - where - D: Deserializer<'de>, - { - enum Field { - SubstrateId, - EthAddress, - } - impl<'de> Deserialize<'de> for Field { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct FieldVisitor; - impl<'de> de::Visitor<'de> for FieldVisitor { - type Value = Field; - - fn expecting( - &self, - formatter: &mut our_std::fmt::Formatter, - ) -> our_std::fmt::Result { - formatter.write_str("`substrate_id` or `eth_address`") - } - - fn visit_str(self, value: &str) -> Result - where - E: de::Error, - { - match value { - "substrate_id" => Ok(Field::SubstrateId), - "eth_address" => Ok(Field::EthAddress), - _ => Err(de::Error::unknown_field(value, FIELDS)), - } - } - } - - deserializer.deserialize_identifier(FieldVisitor) - } - } - - struct ValidatorKeysVisitor; - impl<'de> de::Visitor<'de> for ValidatorKeysVisitor { - type Value = ValidatorKeys; - - fn expecting(&self, formatter: &mut our_std::fmt::Formatter) -> our_std::fmt::Result { - formatter.write_str("struct ValidatorKeys") - } - - fn visit_map(self, mut map: V) -> Result - where - V: de::MapAccess<'de>, - { - let mut substrate_id = None; - let mut eth_address = None; - while let Some(key) = map.next_key()? { - match key { - Field::SubstrateId => { - if substrate_id.is_some() { - return Err(de::Error::duplicate_field("substrate_id")); - } - let s_id: [u8; 32] = map.next_value()?; - substrate_id = Some( - s_id.try_into() - .map_err(|_| de::Error::custom("bad substrate id"))?, - ); - } - Field::EthAddress => { - if eth_address.is_some() { - return Err(de::Error::duplicate_field("eth_address")); - } - let addr: String = map.next_value()?; - eth_address = Some( - ::str_to_address(&addr) - .map_err(|_| de::Error::custom("bad eth address"))?, - ); - } - } - } - let substrate_id = - substrate_id.ok_or_else(|| de::Error::missing_field("substrate_id"))?; - let eth_address = - eth_address.ok_or_else(|| de::Error::missing_field("eth_address"))?; - Ok(ValidatorKeys { - substrate_id, - eth_address, - }) - } - } - - const FIELDS: &'static [&'static str] = &["substrate_id", "eth_address"]; - de.deserialize_struct("ValidatorKeys", FIELDS, ValidatorKeysVisitor) - } -} - -impl Serialize for ValidatorKeys { - fn serialize(&self, ser: S) -> Result - where - S: Serializer, - { - let mut map = ser.serialize_map(Some(2))?; - map.serialize_key("substrate_id")?; - map.serialize_value(&<[u8; 32]>::from(self.substrate_id.clone()))?; - map.serialize_key("eth_address")?; - map.serialize_value(&::address_string(&self.eth_address))?; - map.end() - } -} diff --git a/pallets/cash/src/types.rs b/pallets/cash/src/types.rs index e857ef70f..f9421c9f4 100644 --- a/pallets/cash/src/types.rs +++ b/pallets/cash/src/types.rs @@ -95,25 +95,6 @@ pub enum GovernanceResult { DispatchFailure(DispatchError), } -/// Type for enumerating sessions. -#[type_alias] -pub type SessionIndex = u32; - -/// Type for an address used to identify a validator. -#[type_alias] -pub type ValidatorIdentity = SubstrateId; - -/// Type for signers set used to identify validators that signed this event. -#[type_alias] -pub type SignersSet = BTreeSet; - -/// Type for representing the keys to sign notices. -#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, Types)] -pub struct ValidatorKeys { - pub substrate_id: SubstrateId, - pub eth_address: ::Address, -} - /// Type for referring to either an asset or CASH. #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, Types)] pub enum CashOrChainAsset { diff --git a/pallets/validator/Cargo.toml b/pallets/validator/Cargo.toml new file mode 100644 index 000000000..b6a20792b --- /dev/null +++ b/pallets/validator/Cargo.toml @@ -0,0 +1,66 @@ +[package] +authors = ['Compound '] +description = 'Pallet for implementing Open Price Feed.' +edition = '2018' +homepage = 'https://compound.cash' +name = 'pallet-validator' +repository = 'https://github.com/compound-finance/gateway/' +version = '1.0.0' +readme = 'README.md' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +[dependencies] +codec = { package = 'parity-scale-codec', version = '2.0.0', default-features = false, features = ['derive'] } +serde = { version = '1.0.125', features = ['derive'], default-features = false } +serde_json = { version = '1.0.64', features=['alloc'], default-features = false} +async-trait = { version = "0.1.48", optional = true } + +num-bigint = { default-features = false, version = '0.3' } +num-traits = { default-features = false, version = '0.2' } +lazy_static = '1.4.0' +parking_lot = '0.11.1' + +ethabi = { version = '12.0.0', default-features = false } +ethereum-types = { version = '0.11.0', default-features = false } +hex = { version = '0.4.2', default-features = false } +hex-literal = {version = '0.3.1', default-features = false} +libsecp256k1 = { version = '0.3.2', default-features = false, features = ['hmac'] } +tiny-keccak = { version = '2.0.0', features = ['keccak'], default-features = false } + +sp-core = { default-features = false, git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +sp-io = { default-features = false, features = ['disable_oom', 'disable_panic_handler'], git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +sp-inherents = { default-features = false, git = 'https://github.com/compound-finance/substrate.git', branch = 'jflatow/compound' } +sp-runtime = { default-features = false, git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +frame-support = { default-features = false, git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +frame-system = { default-features = false, git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +pallet-session = { default-features = false, git = 'https://github.com/compound-finance/substrate', branch = 'jflatow/compound' } +pallet-timestamp = { default-features = false, git = 'https://github.com/compound-finance/substrate.git', branch = 'jflatow/compound' } + +runtime-interfaces = { path = '../runtime-interfaces', default-features = false } +ethereum-client = { path = '../../ethereum-client', default-features = false } +gateway-crypto = { path = '../../gateway-crypto', default-features = false } +trx-request = { path = '../../trx-request', default-features = false } +timestamp = { path = '../../timestamp', default-features = false } +our-std = { path = '../../our-std', default-features = false } + +types-derive = { path = '../../types-derive' } + +[features] +default = ['std'] +std = [ + 'codec/std', + 'serde/std', + 'frame-support/std', + 'frame-system/std', + 'sp-io/std', + 'sp-core/std', + 'sp-runtime/std', + 'runtime-interfaces/std', + 'gateway-crypto/std', + 'our-std/std', + 'pallet-session/std', + 'async-trait', +] +runtime-debug = ['our-std/runtime-debug'] diff --git a/pallets/validator/README.md b/pallets/validator/README.md new file mode 100644 index 000000000..2c10b3ceb --- /dev/null +++ b/pallets/validator/README.md @@ -0,0 +1,3 @@ +# Pallet for Validators + +The Validators who run the chain. \ No newline at end of file diff --git a/pallets/validator/fuzz/.gitignore b/pallets/validator/fuzz/.gitignore new file mode 100644 index 000000000..572e03bdf --- /dev/null +++ b/pallets/validator/fuzz/.gitignore @@ -0,0 +1,4 @@ + +target +corpus +artifacts diff --git a/pallets/validator/fuzz/Cargo.lock b/pallets/validator/fuzz/Cargo.lock new file mode 100644 index 000000000..a3539bd33 --- /dev/null +++ b/pallets/validator/fuzz/Cargo.lock @@ -0,0 +1,3756 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "anyhow" +version = "1.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" + +[[package]] +name = "approx" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arbitrary" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "698b65a961a9d730fb45b6b0327e20207810c9f61ee421b082b27ba003f49e2b" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "async-trait" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36ea56748e10732c49404c153638a15ec3d6211ec5ff35d9bb20e13b93576adf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "backtrace" +version = "0.3.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" +dependencies = [ + "addr2line", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + +[[package]] +name = "base58" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "beef" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474a626a67200bd107d44179bb3d4fc61891172d11696609264589be6a0e6a43" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bitvec" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium 0.3.0", +] + +[[package]] +name = "bitvec" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +dependencies = [ + "funty", + "radium 0.5.3", + "tap", + "wyz", +] + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq", +] + +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "bumpalo" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" + +[[package]] +name = "byte-slice-cast" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cc" +version = "1.0.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time 0.1.43", + "winapi 0.3.9", +] + +[[package]] +name = "const_fn" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array 0.12.4", + "subtle 1.0.0", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.4", + "subtle 2.4.0", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434e1720189a637d44fe464f4df1e6eb900b4835255b14354497c78af37d9bb8" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle 2.4.0", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f627126b946c25a4638eec0ea634fc52506dea98db118aae985118ce7c3d723f" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle 2.4.0", + "zeroize", +] + +[[package]] +name = "der-oid-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd17d13ecf875e704369fdbde242483ac769fc18f6af21e43d5a692a079732fc" +dependencies = [ + "nom", + "num-bigint 0.3.2", + "num-traits", + "proc-macro-hack", +] + +[[package]] +name = "der-parser" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e6cad1223a7b98b59275a56516ed8c40508d21284a32e404ed3fe2ae9a809a" +dependencies = [ + "der-oid-macro", + "nom", + "num-traits", + "proc-macro-hack", + "rusticata-macros", +] + +[[package]] +name = "derive_more" +version = "0.99.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +dependencies = [ + "cfg-if 0.1.10", + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" + +[[package]] +name = "ed25519" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.0.2", + "ed25519", + "rand 0.7.3", + "serde", + "sha2 0.9.3", + "zeroize", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "environmental" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6576a1755ddffd988788025e75bce9e74b018f7cc226198fe931d077911c6d7e" + +[[package]] +name = "ethabi" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052a565e3de82944527d6d10a465697e6bb92476b772ca7141080c901f6a63c6" +dependencies = [ + "ethereum-types 0.9.2", + "rustc-hex", + "serde", + "serde_json", + "tiny-keccak 1.5.0", + "uint 0.8.5", +] + +[[package]] +name = "ethbloom" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71a6567e6fd35589fea0c63b94b4cf2e55573e413901bdbe60ab15cf0e25e5df" +dependencies = [ + "crunchy", + "fixed-hash 0.6.1", + "impl-rlp", + "impl-serde", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethbloom" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779864b9c7f7ead1f092972c3257496c6a84b46dba2ce131dd8a282cb2cc5972" +dependencies = [ + "crunchy", + "fixed-hash 0.7.0", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethereum-client" +version = "0.1.0" +dependencies = [ + "ethabi", + "frame-support", + "hex", + "lazy_static", + "our-std", + "parity-scale-codec", + "serde", + "serde_json", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "types-derive", +] + +[[package]] +name = "ethereum-types" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473aecff686bd8e7b9db0165cbbb53562376b39bf35b427f0c60446a9e1634b0" +dependencies = [ + "ethbloom 0.9.2", + "fixed-hash 0.6.1", + "impl-rlp", + "impl-serde", + "primitive-types 0.7.3", + "uint 0.8.5", +] + +[[package]] +name = "ethereum-types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64b5df66a228d85e4b17e5d6c6aa43b0310898ffe8a85988c4c032357aaabfd" +dependencies = [ + "ethbloom 0.11.0", + "fixed-hash 0.7.0", + "primitive-types 0.9.0", + "uint 0.9.0", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fixed-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" +dependencies = [ + "byteorder", + "rand 0.7.3", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.3", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "frame-benchmarking" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "frame-support", + "frame-system", + "linregress", + "parity-scale-codec", + "paste", + "sp-api", + "sp-io", + "sp-runtime", + "sp-runtime-interface", + "sp-std", + "sp-storage", +] + +[[package]] +name = "frame-metadata" +version = "12.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-core", + "sp-std", +] + +[[package]] +name = "frame-support" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "bitflags", + "frame-metadata", + "frame-support-procedural", + "impl-trait-for-tuples 0.2.1", + "log", + "once_cell", + "parity-scale-codec", + "paste", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "frame-support-procedural" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "Inflector", + "frame-support-procedural-tools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "frame-system" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "frame-support", + "impl-trait-for-tuples 0.2.1", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-version", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futures" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" + +[[package]] +name = "futures-executor" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" + +[[package]] +name = "futures-macro" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" + +[[package]] +name = "futures-task" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" + +[[package]] +name = "futures-util" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.6", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "gateway-crypto" +version = "1.0.0" +dependencies = [ + "bytes 0.5.6", + "der-parser", + "hex", + "lazy_static", + "libsecp256k1", + "our-std", + "parity-scale-codec", + "rusoto_core", + "rusoto_kms", + "sp-core", + "tiny-keccak 2.0.2", + "tokio", + "types-derive", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "h2" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", + "tracing-futures", +] + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + +[[package]] +name = "hermit-abi" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5af1f635ef1bc545d78392b136bfe1c9809e029023c84a3638a864a10b8819c8" + +[[package]] +name = "hmac" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +dependencies = [ + "crypto-mac 0.7.0", + "digest 0.8.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" +dependencies = [ + "digest 0.8.1", + "generic-array 0.12.4", + "hmac 0.7.1", +] + +[[package]] +name = "http" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" +dependencies = [ + "bytes 1.0.1", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes 0.5.6", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" + +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.13.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +dependencies = [ + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project 1.0.5", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +dependencies = [ + "bytes 0.5.6", + "hyper", + "native-tls", + "tokio", + "tokio-tls", +] + +[[package]] +name = "impl-codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indexmap" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[package]] +name = "js-sys" +version = "0.3.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lexical-core" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21f866863575d0e1d654fbeeabdc927292fdf862873dc3c96c6f753357e13374" +dependencies = [ + "arrayvec 0.5.2", + "bitflags", + "cfg-if 1.0.0", + "ryu", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86c975d637bc2a2f99440932b731491fc34c7f785d239e38af3addd3c2fd0e46" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "libm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" + +[[package]] +name = "libsecp256k1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +dependencies = [ + "arrayref", + "crunchy", + "digest 0.8.1", + "hmac-drbg", + "rand 0.7.3", + "sha2 0.8.2", + "subtle 2.4.0", + "typenum", +] + +[[package]] +name = "linregress" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0ad4b5cc8385a881c561fac3501353d63d2a2b7a357b5064d71815c9a92724" +dependencies = [ + "nalgebra", + "statrs", +] + +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "logos" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91c49573597a5d6c094f9031617bb1fed15c0db68c81e6546d313414ce107e4" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-derive" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "797b1f8a0571b331c1b47e7db245af3dc634838da7a92b3bef4e30376ae1c347" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax", + "syn", + "utf8-ranges", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matrixmultiply" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1" +dependencies = [ + "rawpointer", +] + +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "memory-db" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbd2a22f201c03cc1706a727842490abfea17b7b53260358239828208daba3c" +dependencies = [ + "hash-db", + "hashbrown", + "parity-util-mem", +] + +[[package]] +name = "memory_units" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +dependencies = [ + "log", + "mio", + "miow 0.3.7", + "winapi 0.3.9", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "nalgebra" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6147c3d50b4f3cdabfe2ecc94a0191fd3d6ad58aefd9664cf396285883486" +dependencies = [ + "approx", + "generic-array 0.13.3", + "matrixmultiply", + "num-complex", + "num-rational", + "num-traits", + "rand 0.7.3", + "rand_distr", + "simba", + "typenum", +] + +[[package]] +name = "native-tls" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nom" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +dependencies = [ + "bitvec 0.19.5", + "funty", + "lexical-core", + "memchr", + "version_check", +] + +[[package]] +name = "num-bigint" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0a3d5e207573f948a9e5376662aa743a2ea13f7c50a554d7af443a73fbfeba" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +dependencies = [ + "autocfg", + "num-bigint 0.2.6", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" + +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "our-std" +version = "0.0.1" +dependencies = [ + "our-std-proc-macro", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "our-std-proc-macro" +version = "0.0.1" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "pallet-oracle" +version = "1.0.0" +dependencies = [ + "ethabi", + "ethereum-client", + "ethereum-types 0.11.0", + "frame-support", + "frame-system", + "gateway-crypto", + "hex", + "hex-literal", + "lazy_static", + "libsecp256k1", + "num-bigint 0.3.2", + "num-traits", + "our-std", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "parking_lot", + "runtime-interfaces", + "serde", + "serde_json", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", + "tiny-keccak 2.0.2", + "trx-request", + "types-derive", +] + +[[package]] +name = "pallet-oracle-fuzz" +version = "0.0.0" +dependencies = [ + "libfuzzer-sys", + "pallet-oracle", +] + +[[package]] +name = "pallet-session" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples 0.1.3", + "pallet-timestamp", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", + "sp-trie", +] + +[[package]] +name = "pallet-timestamp" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples 0.2.1", + "parity-scale-codec", + "serde", + "sp-inherents", + "sp-runtime", + "sp-std", + "sp-timestamp", +] + +[[package]] +name = "parity-scale-codec" +version = "1.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b26b16c7687c3075982af47719e481815df30bc544f7a6690763a25ca16e9d" +dependencies = [ + "arrayvec 0.5.2", + "bitvec 0.17.4", + "byte-slice-cast", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41512944b1faff334a5f1b9447611bf4ef40638ccb6328173dacefb338e878c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parity-util-mem" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f17f15cb05897127bf36a240085a1f0bbef7bce3024849eccf7f93f6171bc27" +dependencies = [ + "cfg-if 1.0.0", + "hashbrown", + "impl-trait-for-tuples 0.2.1", + "parity-util-mem-derive", + "parking_lot", + "primitive-types 0.8.0", + "winapi 0.3.9", +] + +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" +dependencies = [ + "proc-macro2", + "syn", + "synstructure", +] + +[[package]] +name = "parity-wasm" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.5", + "smallvec", + "winapi 0.3.9", +] + +[[package]] +name = "paste" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +dependencies = [ + "paste-impl", + "proc-macro-hack", +] + +[[package]] +name = "paste-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +dependencies = [ + "proc-macro-hack", +] + +[[package]] +name = "pbkdf2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" +dependencies = [ + "byteorder", + "crypto-mac 0.7.0", +] + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac 0.8.0", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +dependencies = [ + "pin-project-internal 0.4.27", +] + +[[package]] +name = "pin-project" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" +dependencies = [ + "pin-project-internal 1.0.5", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[package]] +name = "primitive-types" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd39dcacf71411ba488570da7bbc89b717225e46478b30ba99b92db6b149809" +dependencies = [ + "fixed-hash 0.6.1", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint 0.8.5", +] + +[[package]] +name = "primitive-types" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3824ae2c5e27160113b9e029a10ec9e3f0237bad8029f69c7724393c9fdefd8" +dependencies = [ + "fixed-hash 0.7.0", + "impl-codec", + "impl-serde", + "uint 0.9.0", +] + +[[package]] +name = "primitive-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2415937401cb030a2a0a4d922483f945fa068f52a7dbb22ce0fe5f2b6f6adace" +dependencies = [ + "fixed-hash 0.7.0", + "uint 0.9.0", +] + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" + +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.2", + "rand_hc 0.3.0", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +dependencies = [ + "getrandom 0.2.2", +] + +[[package]] +name = "rand_distr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" +dependencies = [ + "rand 0.7.3", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.2", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_syscall" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom 0.1.16", + "redox_syscall 0.1.57", + "rust-argon2", +] + +[[package]] +name = "ref-cast" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "rlp" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1190dcc8c3a512f1eef5d09bb8c84c7f39e1054e174d1795482e18f5272f2e73" +dependencies = [ + "rustc-hex", +] + +[[package]] +name = "runtime-interfaces" +version = "1.0.0" +dependencies = [ + "ethereum-client", + "frame-support", + "gateway-crypto", + "lazy_static", + "our-std", + "parity-scale-codec", + "sp-externalities", + "sp-io", + "sp-runtime-interface", +] + +[[package]] +name = "rusoto_core" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e977941ee0658df96fca7291ecc6fc9a754600b21ad84b959eb1dbbc9d5abcc7" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bytes 0.5.6", + "crc32fast", + "futures", + "http", + "hyper", + "hyper-tls", + "lazy_static", + "log", + "md5", + "percent-encoding", + "pin-project 0.4.27", + "rusoto_credential", + "rusoto_signature", + "rustc_version", + "serde", + "serde_json", + "tokio", + "xml-rs", +] + +[[package]] +name = "rusoto_credential" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac05563f83489b19b4d413607a30821ab08bbd9007d14fa05618da3ef09d8b" +dependencies = [ + "async-trait", + "chrono", + "dirs", + "futures", + "hyper", + "pin-project 0.4.27", + "regex", + "serde", + "serde_json", + "shlex", + "tokio", + "zeroize", +] + +[[package]] +name = "rusoto_kms" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111b99b940b1b02f5a98a5fcc96467a24ab899c43c1caff60d4a863342798c6e" +dependencies = [ + "async-trait", + "bytes 0.5.6", + "futures", + "rusoto_core", + "serde", + "serde_json", +] + +[[package]] +name = "rusoto_signature" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a740a88dde8ded81b6f2cff9cd5e054a5a2e38a38397260f7acdd2c85d17dd" +dependencies = [ + "base64 0.12.3", + "bytes 0.5.6", + "futures", + "hex", + "hmac 0.8.1", + "http", + "hyper", + "log", + "md5", + "percent-encoding", + "pin-project 0.4.27", + "rusoto_credential", + "rustc_version", + "serde", + "sha2 0.9.3", + "time 0.2.26", + "tokio", +] + +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7390af60e66c44130b4c5ea85f2555b7ace835d73b4b889c704dc3cb4c0468c8" +dependencies = [ + "nom", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.2", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "serde", + "sha2 0.8.2", + "subtle 2.4.0", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "secrecy" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa827a14b29ab7f44778d14a88d3cb76e949c45083f7dbfa507d0cb699dc12de" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sharded-slab" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + +[[package]] +name = "signal-hook-registry" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0242b8e50dd9accdd56170e94ca1ebd223b098eb9c83539a6e367d0f36ae68" + +[[package]] +name = "simba" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb931b1367faadea6b1ab1c306a860ec17aaa5fa39f367d0c744e69d971a1fb2" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "sp-api" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "hash-db", + "parity-scale-codec", + "sp-api-proc-macro", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "blake2-rfc", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-application-crypto" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-core" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "base58", + "blake2-rfc", + "byteorder", + "dyn-clonable", + "ed25519-dalek", + "futures", + "hash-db", + "hash256-std-hasher", + "hex", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "num-traits", + "parity-scale-codec", + "parity-util-mem", + "parking_lot", + "primitive-types 0.8.0", + "rand 0.7.3", + "regex", + "schnorrkel", + "secrecy", + "serde", + "sha2 0.8.2", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "tiny-keccak 2.0.2", + "twox-hash", + "wasmi", + "zeroize", +] + +[[package]] +name = "sp-debug-derive" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.8.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-inherents" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "parity-scale-codec", + "parking_lot", + "sp-core", + "sp-std", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "futures", + "hash-db", + "libsecp256k1", + "log", + "parity-scale-codec", + "parking_lot", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "sp-wasm-interface", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keystore" +version = "0.8.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "async-trait", + "derive_more", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core", + "sp-externalities", +] + +[[package]] +name = "sp-panic-handler" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "backtrace", +] + +[[package]] +name = "sp-runtime" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples 0.2.1", + "log", + "parity-scale-codec", + "parity-util-mem", + "paste", + "rand 0.7.3", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-runtime-interface" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "impl-trait-for-tuples 0.2.1", + "parity-scale-codec", + "primitive-types 0.8.0", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-session" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-core", + "sp-runtime", + "sp-staking", + "sp-std", +] + +[[package]] +name = "sp-staking" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "parity-scale-codec", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-state-machine" +version = "0.8.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "hash-db", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot", + "rand 0.7.3", + "smallvec", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "thiserror", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-std" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" + +[[package]] +name = "sp-storage" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-timestamp" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "impl-trait-for-tuples 0.2.1", + "parity-scale-codec", + "sp-api", + "sp-inherents", + "sp-runtime", + "sp-std", + "wasm-timer", +] + +[[package]] +name = "sp-tracing" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "log", + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-trie" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "hash-db", + "memory-db", + "parity-scale-codec", + "sp-core", + "sp-std", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "sp-wasm-interface" +version = "2.0.0" +source = "git+https://github.com/compound-finance/substrate?branch=master#3bb13fdc5be7b04a179b1b1c7c2032534263241d" +dependencies = [ + "impl-trait-for-tuples 0.2.1", + "parity-scale-codec", + "sp-std", + "wasmi", +] + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "statrs" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cce16f6de653e88beca7bd13780d08e09d4489dbca1f9210e041bc4852481382" +dependencies = [ + "rand 0.7.3", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + +[[package]] +name = "substrate-bip39" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bed6646a0159b9935b5d045611560eeef842b78d7adc3ba36f5ca325a13a0236" +dependencies = [ + "hmac 0.7.1", + "pbkdf2 0.3.0", + "schnorrkel", + "sha2 0.8.2", + "zeroize", +] + +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" + +[[package]] +name = "syn" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "rand 0.8.3", + "redox_syscall 0.2.5", + "remove_dir_all", + "winapi 0.3.9", +] + +[[package]] +name = "thiserror" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "time" +version = "0.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a8cbfbf47955132d0202d1662f49b2423ae35862aee471f3ba4b133358f372" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + +[[package]] +name = "tiny-bip39" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9e44c4759bae7f1032e286a7ef990bd9ed23fe831b7eeba0beb97484c2e59b8" +dependencies = [ + "anyhow", + "hmac 0.8.1", + "once_cell", + "pbkdf2 0.4.0", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.3", + "thiserror", + "unicode-normalization", + "zeroize", +] + +[[package]] +name = "tiny-keccak" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "pin-project-lite 0.1.12", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.12", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite 0.2.6", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project 1.0.5", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "705096c6f83bf68ea5d357a6aa01829ddbdac531b357b45abeca842938085baa" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "trie-db" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec051edf7f0fc9499a2cb0947652cab2148b9d7f61cee7605e312e9f970dacaf" +dependencies = [ + "hash-db", + "hashbrown", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "652931506d2c1244d7217a70b99f56718a7b4161b37f04e7cd868072a99f68cd" +dependencies = [ + "hash-db", +] + +[[package]] +name = "trx-request" +version = "0.1.0" +dependencies = [ + "hex", + "logos", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "twox-hash" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f8ab788026715fa63b31960869617cba39117e520eb415b0139543e325ab59" +dependencies = [ + "cfg-if 0.1.10", + "rand 0.7.3", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "types-derive" +version = "0.1.0" +dependencies = [ + "lazy_static", + "quote", + "serde_json", + "syn", +] + +[[package]] +name = "uint" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9db035e67dfaf7edd9aebfe8676afcd63eed53c8a4044fed514c8cccf1835177" +dependencies = [ + "byteorder", + "crunchy", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "uint" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11fe9a9348741cf134085ad57c249508345fe16411b3d7fb4ff2da2f1d6382e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "utf8-ranges" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" + +[[package]] +name = "vcpkg" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasm-bindgen" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" + +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmi" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf617d864d25af3587aa745529f7aaa541066c876d57e050c0d0c85c61c92aff" +dependencies = [ + "libc", + "memory_units", + "num-rational", + "num-traits", + "parity-wasm", + "wasmi-validation", +] + +[[package]] +name = "wasmi-validation" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea78c597064ba73596099281e2f4cfc019075122a65cdda3205af94f0b264d93" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "web-sys" +version = "0.3.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "xml-rs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" + +[[package]] +name = "zeroize" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/pallets/validator/fuzz/Cargo.toml b/pallets/validator/fuzz/Cargo.toml new file mode 100644 index 000000000..d05a1b84a --- /dev/null +++ b/pallets/validator/fuzz/Cargo.toml @@ -0,0 +1,24 @@ + +[package] +name = "pallet-oracle-fuzz" +version = "0.0.0" +authors = ["Automatically generated"] +publish = false +edition = "2018" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" +pallet-oracle = { path = ".." } + +# Prevent this from interfering with workspaces +[workspace] +members = ["."] + +[[bin]] +name = "parse_message_fuzz" +path = "fuzz_targets/parse_message_fuzz.rs" +test = false +doc = false diff --git a/pallets/validator/fuzz/fuzz_targets/parse_message_fuzz.rs b/pallets/validator/fuzz/fuzz_targets/parse_message_fuzz.rs new file mode 100644 index 000000000..aaf0d3dfb --- /dev/null +++ b/pallets/validator/fuzz/fuzz_targets/parse_message_fuzz.rs @@ -0,0 +1,7 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use pallet_oracle::oracle::{parse_message}; + +fuzz_target!(|data: &[u8]| { + parse_message(data); +}); diff --git a/pallets/validator/src/benchmarking.rs b/pallets/validator/src/benchmarking.rs new file mode 100644 index 000000000..f674f96a2 --- /dev/null +++ b/pallets/validator/src/benchmarking.rs @@ -0,0 +1,99 @@ +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use crate::{ + chains::{Chain, ChainAsset, ChainSignatureList, Ethereum}, + notices::{ExtractionNotice, Notice}, + rates::APR, + types::*, + types::{AssetInfo, Factor, ValidatorKeys}, + Pallet as Cash, +}; +use codec::EncodeLike; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; +pub use frame_support::{ + assert_err, assert_ok, + traits::{OnInitialize, OriginTrait}, + StorageValue, +}; +use frame_system::RawOrigin; +use hex_literal::hex; +use num_traits::Zero; +use sp_core::crypto::AccountId32; +use sp_std::prelude::*; + +pub use our_std::{convert::TryInto, str::FromStr}; +use pallet_oracle::Prices; + +const TKN_ADDR: &str = "0x0101010101010101010101010101010101010101"; +const TKN_ADDR_BYTES: [u8; 20] = [1; 20]; + +const ETH_ADDR: &str = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; +const ETH_BYTES: [u8; 20] = hex!("EeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"); +const ETH_UNIT: Units = Units::from_ticker_str("ETH", 18); + +const ALICE_ADDRESS: &str = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; +const BOB_ADDRESS: &str = "0x59a055a3e566F5d9A9Ea1dA81aB375D5361D7c5e"; +const BOB_ADDRESS_BYTES: [u8; 20] = hex!("59a055a3e566F5d9A9Ea1dA81aB375D5361D7c5e"); + +benchmarks! { + where_clause { + where + T: pallet_session::Config, + T: pallet_timestamp::Config, + u64: EncodeLike<::Moment>, + <::Origin as OriginTrait>::AccountId: From +} + + // todo: parameterize over # vals? + change_validators { + let substrate_id: SubstrateId = [2; 32].into(); + let eth_address = [1; 20]; + let val_keys = ValidatorKeys { + substrate_id: substrate_id.clone(), + eth_address: eth_address.clone(), + }; + let val_keyses = vec![val_keys]; + let val_account = ChainAccount::Gate(substrate_id.clone().into()); + + // Min balance needed for account existence, to set session keys + let min_amount = params::MIN_PRINCIPAL_GATE.amount_withdrawable().unwrap(); + ChainCashPrincipals::insert(ChainId::Gate, min_amount); + assert_ok!(internal::lock::lock_cash_principal_internal::( + val_account, + val_account, + min_amount + )); + + // Set session key + assert_eq!( + pallet_session::Module::::set_keys( + T::Origin::signed(substrate_id.into()), + ::Keys::default(), + vec![] + ), + Ok(()) + ); + }: { + assert_eq!(Cash::::change_validators(RawOrigin::Root.into(), val_keyses), Ok(())); + } +} + +impl_benchmark_test_suite!(Cash, crate::tests::new_test_ext(), crate::tests::Test,); + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::{ + initialize_storage, + mock::{new_test_ext, Test}, + }; + + #[test] + fn test_benchmarks() { + new_test_ext().execute_with(|| { + initialize_storage(); + assert_ok!(test_benchmark_change_validators::()); + }); + } +} diff --git a/pallets/validator/src/error.rs b/pallets/validator/src/error.rs new file mode 100644 index 000000000..ee9f25d07 --- /dev/null +++ b/pallets/validator/src/error.rs @@ -0,0 +1,20 @@ +use codec::{Decode, Encode}; +use frame_support; +use our_std::Debuggable; + +use types_derive::Types; + +/// Errors coming from the price oracle. +#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Debuggable, Types)] +pub enum ValidatorError {} + +impl From for frame_support::dispatch::DispatchError { + fn from(err: ValidatorError) -> frame_support::dispatch::DispatchError { + let (index, error, message) = match err {}; + frame_support::dispatch::DispatchError::Module { + index, + error, + message: Some(message), + } + } +} diff --git a/pallets/validator/src/lib.rs b/pallets/validator/src/lib.rs new file mode 100644 index 000000000..ff4cc18e4 --- /dev/null +++ b/pallets/validator/src/lib.rs @@ -0,0 +1,298 @@ +#[macro_use] +extern crate alloc; + +use crate::{error::ValidatorError, types::*}; +use frame_support::{ + decl_event, decl_module, decl_storage, dispatch, + traits::{StoredMap, UnfilteredDispatchable}, + weights::{DispatchClass, GetDispatchInfo, Pays, Weight}, + Parameter, +}; +use frame_system; +use frame_system::{ensure_none, ensure_root, offchain::CreateSignedTransaction}; +use our_std::{ + collections::btree_map::BTreeMap, collections::btree_set::BTreeSet, convert::TryInto, debug, + error, log, str, vec::Vec, warn, Debuggable, +}; +use sp_runtime::{ + transaction_validity::{InvalidTransaction, TransactionSource, TransactionValidity}, + Percent, +}; + +pub mod error; +pub mod serdes; +pub mod types; +pub mod validate_trx; +pub mod validator; +pub mod weights; + +#[cfg(test)] +mod tests; + +/// Configure the pallet by specifying the parameters and types on which it depends. +pub trait Config: + frame_system::Config + CreateSignedTransaction + pallet_session::Config> +{ + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type Event: From + Into<::Event>; + + /// The overarching dispatch call type. + type Call: From> + + Parameter + + UnfilteredDispatchable + + GetDispatchInfo; + + /// Associated type which allows us to interact with substrate Sessions. + type SessionInterface: self::SessionInterface; +} + +decl_storage! { + trait Store for Pallet as Cash { + /// The upcoming session at which to tell the sessions pallet to rotate the validators. + NextSessionIndex get(fn next_session_index): SessionIndex; + + /// The upcoming set of allowed validators, and their associated keys (or none). + NextValidators get(fn next_validators): map hasher(blake2_128_concat) SubstrateId => Option; + + /// The current set of allowed validators, and their associated keys. + Validators get(fn validators): map hasher(blake2_128_concat) SubstrateId => Option; + } + add_extra_genesis { + config(validators): Vec; + build(|config| { + Pallet::::initialize_validators(config.validators.clone()); + }) + } +} + +/* ::EVENTS:: */ + +decl_event!( + pub enum Event { + /// A new validator set has been chosen. [validators] + ChangeValidators(Vec), + + /// Failed to process a given extrinsic. [reason] + Failure(ValidatorError), + } +); + +/* ::ERRORS:: */ + +fn check_failure(res: Result<(), ValidatorError>) -> Result<(), ValidatorError> { + if let Err(err) = res { + >::deposit_event(Event::Failure(err)); + log!("Validator Failure {:#?}", err); + } + res +} + +/* ::MODULE:: */ +/* ::EXTRINSICS:: */ + +// Dispatchable functions allows users to interact with the pallet and invoke state changes. +// These functions materialize as "extrinsics", which are often compared to transactions. +// Dispatchable functions must be annotated with a weight and must return a DispatchResult. +decl_module! { + pub struct Pallet for enum Call where origin: T::Origin { + // Events must be initialized if they are used by the pallet. + fn deposit_event() = default; + + /// Sets the keys for the next set of validators beginning at the next session. [Root] + #[weight = (::WeightInfo::change_validators(), DispatchClass::Operational, Pays::No)] + pub fn change_validators(origin, validators: Vec) -> dispatch::DispatchResult { + ensure_root(origin)?; + Ok(check_failure::(validator::change_validators::(validators))?) + } + } +} + +/// Reading error messages inside `decl_module!` can be difficult, so we move them here. +impl Pallet { + /// Set the initial set of validators from the genesis config. + /// NextValidators will become current Validators upon first session start. + fn initialize_validators(validators: Vec) { + if validators.is_empty() { + warn!("Validators must be set in the genesis config"); + } + for validator in validators { + // Note: See pipeline commit for usage of T::AccountStore + log!("Adding validator: {:?}", validator); + ::insert(&validator.substrate_id, validator.clone()); + assert!(T::AccountStore::insert(&validator.substrate_id, ()).is_ok()); + } + } + + // ** API / View Functions ** // +} + +impl frame_support::unsigned::ValidateUnsigned for Pallet { + type Call = Call; + + /// Validate unsigned call to this module. + /// + /// By default unsigned transactions are disallowed, but implementing the validator + /// here we make sure that some particular calls (the ones produced by offchain worker) + /// are being whitelisted and marked as valid. + fn validate_unsigned(source: TransactionSource, call: &Self::Call) -> TransactionValidity { + // TODO: Why like this? + validate_trx::check_validation_failure( + call, + validate_trx::validate_unsigned::(source, call), + ) + .unwrap_or(InvalidTransaction::Call.into()) + } +} + +pub trait SessionInterface: frame_system::Config { + fn has_next_keys(x: AccountId) -> bool; + fn rotate_session(); +} + +impl SessionInterface for T +where + T: pallet_session::Config, +{ + fn has_next_keys(x: SubstrateId) -> bool { + match >::next_keys(x as T::ValidatorId) { + Some(_keys) => true, + None => false, + } + } + + fn rotate_session() { + >::rotate_session(); + } +} + +impl pallet_session::SessionManager for Pallet { + // return validator set to use in the next session (aura and grandpa also stage new auths associated w these accountIds) + fn new_session(session_index: SessionIndex) -> Option> { + if NextValidators::iter().count() != 0 { + NextSessionIndex::put(session_index); + Some(NextValidators::iter().map(|x| x.0).collect::>()) + } else { + Some(Validators::iter().map(|x| x.0).collect::>()) + } + } + + fn start_session(index: SessionIndex) { + // if changes have been queued + // if starting the queued session + if NextSessionIndex::get() == index && NextValidators::iter().count() != 0 { + // delete existing validators + for validator in ::iter_values() { + ::take(&validator.substrate_id); + } + // push next validators into current validators + for (id, validator) in ::iter() { + ::take(&id); + ::insert(&id, validator); + } + } else { + () + } + } + fn end_session(_: SessionIndex) { + () + } +} + +/* +-- Block N -- +changeAuth extrinsic, nextValidators set, hold is set, rotate_session is called +* new_session returns the nextValidators + +-- Afterwards -- +"ShouldEndSession" returns true when notice era notices were signed +* when it does, start_session sets Validators = NextValidators + +*/ + +fn vec_to_set(a: Vec) -> BTreeSet { + let mut a_set = BTreeSet::::new(); + for v in a { + a_set.insert(v); + } + return a_set; +} + +// fn has_requisite_signatures(notice_state: NoticeState, validators: &Vec) -> bool { +// match notice_state { +// NoticeState::Pending { signature_pairs } => match signature_pairs { +// // TODO: This is currently dependent on Notices and ChainSignatureList? +// ChainSignatureList::Eth(signature_pairs) => { +// // Note: inefficient, probably best to store as sorted lists / zip compare +// type EthAddrType = ::Address; +// let signature_set = +// vec_to_set::(signature_pairs.iter().map(|p| p.0).collect()); +// let validator_set = +// vec_to_set::(validators.iter().map(|v| v.eth_address).collect()); +// chains::has_super_majority::(&signature_set, &validator_set) +// } +// _ => false, +// }, +// _ => false, +// } +// } + +// periodic except when new authorities are pending and when an era notice has just been completed +impl pallet_session::ShouldEndSession for Pallet { + fn should_end_session(now: T::BlockNumber) -> bool { + if NextValidators::iter().count() > 0 { + // Check if we should end the hold + let validators: Vec<_> = Validators::iter().map(|v| v.1).collect(); + + // TODO: Add back notice hold checks + // // TODO: How to deal with notice holds, etc? + // let every_notice_hold_executed = NoticeHolds::iter().all(|(chain_id, notice_id)| { + // has_requisite_signatures(NoticeStates::get(chain_id, notice_id), &validators) + // }); + + // if every_notice_hold_executed { + // for (chain_id, _) in NoticeHolds::iter() { + // NoticeHolds::take(chain_id); + // } + // log!("should_end_session=true[next_validators]"); + // true + // } else { + // log!("should_end_session=false[pending_notice_held]"); + // false + // } + true + } else { + // no era changes pending, periodic + let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); + let is_new_period = (now % period) == ::BlockNumber::from(0 as u32); + + if is_new_period { + log!( + "should_end_session={}[periodic {:?}%{:?}]", + is_new_period, + now, + period + ); + } + is_new_period + } + } +} + +impl frame_support::traits::EstimateNextSessionRotation for Pallet { + fn average_session_length() -> T::BlockNumber { + T::BlockNumber::zero() + } + + fn estimate_current_session_progress(now: T::BlockNumber) -> (Option, Weight) { + let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); + ( + Some(Percent::from_rational(now % period, period)), + Weight::zero(), + ) + } + + fn estimate_next_session_rotation(now: T::BlockNumber) -> (Option, Weight) { + let period: T::BlockNumber = ::BlockNumber::from(params::SESSION_PERIOD as u32); + (Some(now + period - now % period), Weight::zero()) + } +} diff --git a/pallets/validator/src/serdes.rs b/pallets/validator/src/serdes.rs new file mode 100644 index 000000000..5453ac625 --- /dev/null +++ b/pallets/validator/src/serdes.rs @@ -0,0 +1,114 @@ +use crate::types::ValidatorKeys; +use our_std::str::FromStr; +use serde::{de, ser::SerializeSeq, Deserializer, Serialize, Serializer}; + +// ValidatorKeys & Vec + +impl<'de> de::Deserialize<'de> for ValidatorKeys { + fn deserialize(de: D) -> Result + where + D: Deserializer<'de>, + { + enum Field { + SubstrateId, + EthAddress, + } + impl<'de> Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + impl<'de> de::Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting( + &self, + formatter: &mut our_std::fmt::Formatter, + ) -> our_std::fmt::Result { + formatter.write_str("`substrate_id` or `eth_address`") + } + + fn visit_str(self, value: &str) -> Result + where + E: de::Error, + { + match value { + "substrate_id" => Ok(Field::SubstrateId), + "eth_address" => Ok(Field::EthAddress), + _ => Err(de::Error::unknown_field(value, FIELDS)), + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + struct ValidatorKeysVisitor; + impl<'de> de::Visitor<'de> for ValidatorKeysVisitor { + type Value = ValidatorKeys; + + fn expecting(&self, formatter: &mut our_std::fmt::Formatter) -> our_std::fmt::Result { + formatter.write_str("struct ValidatorKeys") + } + + fn visit_map(self, mut map: V) -> Result + where + V: de::MapAccess<'de>, + { + let mut substrate_id = None; + let mut eth_address = None; + while let Some(key) = map.next_key()? { + match key { + Field::SubstrateId => { + if substrate_id.is_some() { + return Err(de::Error::duplicate_field("substrate_id")); + } + let s_id: [u8; 32] = map.next_value()?; + substrate_id = Some( + s_id.try_into() + .map_err(|_| de::Error::custom("bad substrate id"))?, + ); + } + Field::EthAddress => { + if eth_address.is_some() { + return Err(de::Error::duplicate_field("eth_address")); + } + let addr: String = map.next_value()?; + eth_address = Some( + gateway_crypto::eth_str_to_address(&addr) + .map_err(|_| de::Error::custom("bad eth address"))?, + ); + } + } + } + let substrate_id = + substrate_id.ok_or_else(|| de::Error::missing_field("substrate_id"))?; + let eth_address = + eth_address.ok_or_else(|| de::Error::missing_field("eth_address"))?; + Ok(ValidatorKeys { + substrate_id, + eth_address, + }) + } + } + + const FIELDS: &'static [&'static str] = &["substrate_id", "eth_address"]; + de.deserialize_struct("ValidatorKeys", FIELDS, ValidatorKeysVisitor) + } +} + +impl Serialize for ValidatorKeys { + fn serialize(&self, ser: S) -> Result + where + S: Serializer, + { + let mut map = ser.serialize_map(Some(2))?; + map.serialize_key("substrate_id")?; + map.serialize_value(&<[u8; 32]>::from(self.substrate_id.clone()))?; + map.serialize_key("eth_address")?; + map.serialize_value(&gateway_crypto::eth_address_string(&self.eth_address))?; + map.end() + } +} diff --git a/pallets/validator/src/tests/mock.rs b/pallets/validator/src/tests/mock.rs new file mode 100644 index 000000000..671223e9a --- /dev/null +++ b/pallets/validator/src/tests/mock.rs @@ -0,0 +1,160 @@ +use crate::{self as pallet_oracle, *}; +use codec::alloc::sync::Arc; +use parking_lot::RwLock; +use sp_core::{ + offchain::{ + testing::{self, OffchainState, PoolState}, + OffchainDbExt, OffchainWorkerExt, TransactionPoolExt, + }, + H256, +}; +use sp_runtime::{ + generic, + testing::{Header, TestXt}, + traits::{BlakeTwo256, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify}, + MultiAddress, MultiSignature as Signature, +}; + +pub type Extrinsic = TestXt; +pub type OracleModule = Module; +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +pub type Address = MultiAddress; +pub type SignedExtra = ( + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, +); +pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type Block = generic::Block; + +pub mod opaque { + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; +} + +pub const MILLISECS_PER_BLOCK: types::Timestamp = 6000; +pub const SLOT_DURATION: types::Timestamp = MILLISECS_PER_BLOCK; + +frame_support::parameter_types! { + pub const MinimumPeriod: types::Timestamp = SLOT_DURATION / 2; +} + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Oracle: pallet_oracle::{Pallet, Call, Config, Storage, Event, Inherent}, + } +); + +frame_support::parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Test { + type BaseCallFilter = (); + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type OnSetCode = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; +} + +impl frame_system::offchain::SigningTypes for Test { + type Public = ::Signer; + type Signature = Signature; +} + +impl Config for Test { + type Event = Event; + type Call = Call; + type GetConvertedTimestamp = timestamp::TimeConverter; +} +impl pallet_timestamp::Config for Test { + /// A timestamp: milliseconds since the unix epoch. + type Moment = types::Timestamp; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +impl frame_system::offchain::SendTransactionTypes for Test +where + Call: From, +{ + type OverarchingCall = Call; + type Extrinsic = Extrinsic; +} + +impl frame_system::offchain::CreateSignedTransaction for Test +where + Call: From, +{ + fn create_transaction>( + call: Call, + _public: ::Signer, + _account: AccountId, + nonce: u64, + ) -> Option<(Call, ::SignaturePayload)> { + Some((call, (nonce, ()))) + } +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + let (t, _pool_state, _offchain_state) = new_test_ext_with_http_calls(vec![]); + t +} + +pub fn new_test_ext_with_http_calls( + mut calls: Vec, +) -> ( + sp_io::TestExternalities, + Arc>, + Arc>, +) { + let (offchain, offchain_state) = testing::TestOffchainExt::new(); + let (pool, pool_state) = testing::TestTransactionPoolExt::new(); + + // XXX + // let mut test_externalities: sp_io::TestExternalities = frame_system::GenesisConfig::default().build_storage::().unwrap().into(); + let mut test_externalities = sp_io::TestExternalities::default(); + test_externalities.register_extension(OffchainDbExt::new(offchain.clone())); + test_externalities.register_extension(OffchainWorkerExt::new(offchain)); + test_externalities.register_extension(TransactionPoolExt::new(pool)); + + { + let mut state = offchain_state.write(); + for call in calls.drain(0..calls.len()) { + state.expect_request(call); + } + } + + test_externalities.execute_with(|| System::set_block_number(1)); + (test_externalities, pool_state, offchain_state) +} diff --git a/pallets/validator/src/tests/mod.rs b/pallets/validator/src/tests/mod.rs new file mode 100644 index 000000000..faa98ee56 --- /dev/null +++ b/pallets/validator/src/tests/mod.rs @@ -0,0 +1,184 @@ +use crate::{error::OracleError, ticker::Ticker, *}; + +use sp_core::offchain::testing; + +pub use frame_support::{assert_err, assert_ok, dispatch::DispatchError}; +pub use our_std::{convert::TryInto, str::FromStr}; + +pub mod mock; +pub use mock::*; + +pub const ETH_TICKER: Ticker = Ticker::new("ETH"); + +pub fn initialize_storage() { + OracleModule::initialize_reporters( + vec![ + "0x85615b076615317c80f14cbad6501eec031cd51c", + "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC", + ] + .try_into() + .unwrap(), + ); +} + +const TEST_OPF_URL: &str = "http://localhost/"; + +#[test] +fn test_process_prices_happy_path_makes_required_http_call() { + std::env::set_var("OPF_URL", TEST_OPF_URL); + let calls: Vec = vec![testing::PendingRequest { + method: "GET".into(), + uri: TEST_OPF_URL.into(), + body: vec![], + response: Some( + oracle::tests::API_RESPONSE_TEST_DATA + .to_owned() + .into_bytes(), + ), + headers: vec![], + sent: true, + ..Default::default() + }]; + + let (mut t, _pool_state, _offchain_state) = new_test_ext_with_http_calls(calls); + t.execute_with(|| { + initialize_storage(); + assert_ok!(oracle::process_prices::(1u64)); + // sadly, it seems we can not check storage here, but we should at least be able to check that + // the OCW attempted to call the post_price extrinsic.. that is a todo XXX + }); +} + +#[test] +fn test_post_price_happy_path() { + // an eth price message + let test_payload = hex::decode("0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000002baa48a00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000").unwrap(); + let test_signature = hex::decode("41a3f89a526dee766049f3699e9e975bfbabda4db677c9f5c41fbcc0730fccb84d08b2208c4ffae0b87bb162e2791cc305ee4e9a1d936f9e6154356154e9a8e9000000000000000000000000000000000000000000000000000000000000001c").unwrap(); + new_test_ext().execute_with(|| { + initialize_storage(); // sets up ETH + >::set_timestamp(500); + OracleModule::post_price(Origin::none(), test_payload, test_signature).unwrap(); + let eth_price = OracleModule::price(ETH_TICKER); + let eth_price_time = OracleModule::price_time(ETH_TICKER); + assert_eq!(eth_price, Some(732580000)); + assert_eq!(eth_price_time, Some(1609340760000)); + }); +} + +#[test] +fn test_post_price_invalid_signature() { + // an eth price message + let test_payload = hex::decode("0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000002baa48a00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000").unwrap(); + let test_signature = hex::decode("41a3f89a526dee766049f3699e9e975bfbabda4db677c9f5c41fbcc0730fccb84d08b2208c4ffae0b87bb162e2791cc305ee4e9a1d936f9e6154356154e9a8e90000000000000000000000000000000000000000000000000000000000000003").unwrap(); + new_test_ext().execute_with(|| { + initialize_storage(); // sets up ETH + let result = OracleModule::post_price(Origin::none(), test_payload, test_signature); + assert_err!(result, OracleError::CryptoError); + }); +} + +#[test] +fn test_post_price_invalid_reporter() { + // an eth price message + let test_payload = hex::decode("0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000002baa48a00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000").unwrap(); + let test_signature = hex::decode("51a3f89a526dee766049f3699e9e975bfbabda4db677c9f5c41fbcc0730fccb84d08b2208c4ffae0b87bb162e2791cc305ee4e9a1d936f9e6154356154e9a8e9000000000000000000000000000000000000000000000000000000000000001c").unwrap(); + new_test_ext().execute_with(|| { + initialize_storage(); // sets up ETH + let result = OracleModule::post_price(Origin::none(), test_payload, test_signature); + assert_err!(result, OracleError::CryptoError); + // XXX is this testing the right thing? + // should it be: + // assert_err!(result, Reason::OracleError(OracleError::NotAReporter)); ?? + }); +} + +#[test] +fn test_post_price_stale_price() { + // an eth price message + let test_payload = hex::decode("0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000002baa48a00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000").unwrap(); + let test_signature = hex::decode("41a3f89a526dee766049f3699e9e975bfbabda4db677c9f5c41fbcc0730fccb84d08b2208c4ffae0b87bb162e2791cc305ee4e9a1d936f9e6154356154e9a8e9000000000000000000000000000000000000000000000000000000000000001c").unwrap(); + new_test_ext().execute_with(|| { + >::set_timestamp(500); + initialize_storage(); // sets up ETH + // post once + OracleModule::post_price(Origin::none(), test_payload.clone(), test_signature.clone()) + .unwrap(); + let eth_price = OracleModule::price(ETH_TICKER); + let eth_price_time = OracleModule::price_time(ETH_TICKER); + assert_eq!(eth_price, Some(732580000)); + assert_eq!(eth_price_time, Some(1609340760000)); + // try to post the same thing again + let result = OracleModule::post_price(Origin::none(), test_payload, test_signature); + assert_err!(result, OracleError::StalePrice); + }); +} + +#[test] +fn offchain_worker_test() { + use frame_support::traits::OffchainWorker; + std::env::set_var("OPF_URL", TEST_OPF_URL); + let mut calls: Vec = vec![]; + let price_call = testing::PendingRequest { + method: "GET".into(), + uri: TEST_OPF_URL.into(), + body: vec![], + response: Some( + oracle::tests::API_RESPONSE_TEST_DATA + .to_owned() + .into_bytes(), + ), + headers: vec![], + sent: true, + ..Default::default() + }; + + calls.push(price_call); + + let (mut t, pool_state, _offchain_state) = new_test_ext_with_http_calls(calls); + + t.execute_with(|| { + initialize_storage(); + + // Set block number + let block = 1; + System::set_block_number(block); + + // Execute offchain worker with no cached block number + OracleModule::offchain_worker(block); + + // Ensure we're not posting transactions + assert_eq!(pool_state.read().transactions.len(), 0); + + // Check `post_price` transactions + let messages = [ + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000688e4cda00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000002baa48a00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034554480000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000f51180000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034441490000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000057e400000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035a52580000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000321900000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034241540000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000c63e00000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034b4e430000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000ad33d80000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044c494e4b00000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000005fec975800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000009206d00000000000000000000000000000000000000000000000000000000000000000670726963657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004434f4d5000000000000000000000000000000000000000000000000000000000" + ]; + + let signatures = [ + "69538bfa1a2097ea206780654d7baac3a17ee57547ee3eeb5d8bcb58a2fcdf401ff8834f4a003193f24224437881276fe76c8e1c0a361081de854457d41d0690000000000000000000000000000000000000000000000000000000000000001c", + "41a3f89a526dee766049f3699e9e975bfbabda4db677c9f5c41fbcc0730fccb84d08b2208c4ffae0b87bb162e2791cc305ee4e9a1d936f9e6154356154e9a8e9000000000000000000000000000000000000000000000000000000000000001c", + "15a9e7019f2b45c5e64646df571ea944b544dbf9093fbe19e41afea68fa58d721e53449245eebea3f351dbdff4dff09cf303a335cb4455f0d3219f308d448483000000000000000000000000000000000000000000000000000000000000001c", + "25be45b4fa82f48160cb0218acafe26e6fea2be797710add737d09ad305ab54e5f75783b857b2c5c526acb3f9b34ffba64c1251843d320f04b5c0efbbe661d17000000000000000000000000000000000000000000000000000000000000001b", + "19984214a69bccb410910de3b277d19fd86f2524510d83b4fc139f1469b11e375297ea89aeda2bceda4a4553e7815f93d3cff192ade88dccf43fb18ba73a97a7000000000000000000000000000000000000000000000000000000000000001b", + "549e608b0e2acc98a36ac88fac610909d430b89c7501183d83c05189260baa6754b16ef74c804f7a7789e4e468878bfe153d76a7029c29f9acce86942a1ff492000000000000000000000000000000000000000000000000000000000000001c", + "01612605d0de98506ced9ca0414a08b7c335cd1dfa0ea2b62d283a2e27d8d33c25eb0abd6cc2625d950f59baf3300a71e269c3f3eea81e5ed8876bb2f4e75cfd000000000000000000000000000000000000000000000000000000000000001b", + "883317a2aa03f1523e95bedb961d7aabfbfba73bb9f54685639d0bc1eb2fd16a7c5510e7f68e1e0824bd5a96093ef921aabb36f79e89defc4d216f6dc0d79fbb000000000000000000000000000000000000000000000000000000000000001b" + ]; + + if let Some((price_data, _ts)) = runtime_interfaces::price_feed_interface::get_price_data() { + let pair_messages: Vec = price_data.clone().into_iter().map(|pair| hex::encode(pair.0)).collect(); + let pair_signatures: Vec = price_data.into_iter().map(|pair| hex::encode(pair.1)).collect(); + assert_eq!(&messages[..], &pair_messages[..]); + assert_eq!(&signatures[..], &pair_signatures[..]); + } else { + panic!("Price data not set"); + } + }); +} diff --git a/pallets/validator/src/types.rs b/pallets/validator/src/types.rs new file mode 100644 index 000000000..66956b85c --- /dev/null +++ b/pallets/validator/src/types.rs @@ -0,0 +1,27 @@ +use sp_core::crypto::AccountId32; + +use our_std::collections::btree_set::BTreeSet; +use types_derive::{type_alias, Types}; + +/// Type for enumerating sessions. +#[type_alias] +pub type SessionIndex = u32; + +/// Type for an address used to identify a validator. +#[type_alias] +pub type ValidatorIdentity = SubstrateId; + +/// Type for signers set used to identify validators that signed this event. +#[type_alias] +pub type SignersSet = BTreeSet; + +/// Type for representing the keys to sign notices. +#[derive(Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, Types)] +pub struct ValidatorKeys { + pub substrate_id: SubstrateId, + pub eth_address: [u32; 20], // TODO: ::Address +} + +/// Type for linking sessions to validators. +#[type_alias] +pub type SubstrateId = AccountId32; diff --git a/pallets/validator/src/validate_trx.rs b/pallets/validator/src/validate_trx.rs new file mode 100644 index 000000000..151f7d962 --- /dev/null +++ b/pallets/validator/src/validate_trx.rs @@ -0,0 +1,48 @@ +use crate::{internal, Call, Config, Validators}; +use codec::Encode; +use frame_support::storage::{IterableStorageMap, StorageDoubleMap, StorageValue}; +use our_std::{log, RuntimeDebug}; +use sp_runtime::transaction_validity::{TransactionSource, TransactionValidity, ValidTransaction}; + +#[derive(Eq, PartialEq, RuntimeDebug, Clone, Copy)] +pub enum ValidationError { + InvalidCall, +} + +pub fn check_validation_failure( + call: &Call, + res: Result, +) -> Result { + if let Err(err) = res { + log!("validate_unsigned: call = {:#?}, error = {:#?}", call, err); + } + res +} + +pub fn validate_unsigned( + source: TransactionSource, + call: &Call, +) -> Result { + match call { + _ => Err(ValidationError::InvalidCall), + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{core::validator_sign, tests::*, Call}; + + #[test] + fn test_other() { + new_test_ext().execute_with(|| { + assert_eq!( + validate_unsigned( + TransactionSource::InBlock {}, + &Call::change_validators::(vec![]), + ), + Err(ValidationError::InvalidCall) + ); + }); + } +} diff --git a/pallets/cash/src/internal/change_validators.rs b/pallets/validator/src/validator.rs similarity index 90% rename from pallets/cash/src/internal/change_validators.rs rename to pallets/validator/src/validator.rs index 8d9e1fccb..b03fc5b12 100644 --- a/pallets/cash/src/internal/change_validators.rs +++ b/pallets/validator/src/validator.rs @@ -1,11 +1,18 @@ use crate::{ - internal, reason::Reason, require, types::ValidatorKeys, Config, Event, Module, NextValidators, - NoticeHolds, SessionInterface, + error::ValidatorError, + require, // TODO: Move to own crate? + types::ValidatorKeys, + Config, + Event, + Module, + NextValidators, + SessionInterface, }; use frame_support::storage::{IterableStorageMap, StorageMap}; -pub fn change_validators(validators: Vec) -> Result<(), Reason> { - require!(NoticeHolds::iter().count() == 0, Reason::PendingAuthNotice); +pub fn change_validators(validators: Vec) -> Result<(), ValidatorError> { + // TODO: NoticeHolds dependency + // require!(NoticeHolds::iter().count() == 0, Reason::PendingAuthNotice); for validator in validators.iter() { require!( @@ -23,7 +30,8 @@ pub fn change_validators(validators: Vec) -> Result<() >::deposit_event(Event::ChangeValidators(validators.clone())); - internal::notices::dispatch_change_authority_notice::(validators); + // TODO: Another notice dependency + // internal::notices::dispatch_change_authority_notice::(validators); // rotate to the currently queued session, and queue a new session with the new validators in NextValidators ::SessionInterface::rotate_session(); @@ -34,10 +42,8 @@ pub fn change_validators(validators: Vec) -> Result<() #[cfg(test)] mod tests { use super::*; - use crate::{ - chains::*, notices::*, reason::Reason, tests::*, AccountId32, LatestNotice, NoticeStates, - Notices, ValidatorKeys, - }; + use crate::{chains::*, notices::*, reason::Reason, tests::*, AccountId32, ValidatorKeys}; + // Notices, LatestNotice, NoticeStates, use frame_support::storage::{IterableStorageDoubleMap, StorageDoubleMap, StorageMap}; use mock::opaque::MockSessionKeys; diff --git a/pallets/validator/src/weights.rs b/pallets/validator/src/weights.rs new file mode 100644 index 000000000..0c91697fa --- /dev/null +++ b/pallets/validator/src/weights.rs @@ -0,0 +1,74 @@ +// This file is part of Substrate. + +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_cash +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-17, STEPS: [10, ], REPEAT: 10, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 + +// Executed Command: +// target/release/gateway +// benchmark +// --execution +// wasm +// --wasm-execution +// compiled +// --pallet +// pallet_validator +// --extrinsic +// * +// --steps +// 10 +// --repeat +// 10 +// --raw +// --template=./.maintain/frame-weight-template.hbs +// --output=./pallets/validator/src/weights.rs + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{ + traits::Get, + weights::{constants::RocksDbWeight, Weight}, +}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_cash. +pub trait WeightInfo { + fn change_validators() -> Weight; +} + +/// Weights for pallet_cash using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn change_validators() -> Weight { + (123_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add(T::DbWeight::get().writes(12 as Weight)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn change_validators() -> Weight { + (123_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(11 as Weight)) + .saturating_add(RocksDbWeight::get().writes(12 as Weight)) + } +}