From 90cc9668ddc78349dabe6ffa773fe7029c542b06 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Wed, 15 Jul 2020 16:32:34 +0800 Subject: [PATCH 01/18] feat: Add account import-from-plugin sub-command Import account from keystore plugin though account-id BREAKING CHANGE: Plugin protocol add KeyStoreRequest::ImportAccount --- plugin-protocol/examples/keystore.rs | 17 ++- .../examples/keystore_no_password.rs | 9 +- plugin-protocol/src/convert.rs | 70 ++++++++---- plugin-protocol/src/lib.rs | 8 +- plugin-protocol/src/method.rs | 1 + src/plugin/builtin.rs | 3 + src/plugin/manager.rs | 29 ++++- src/subcommands/account.rs | 106 ++++++++++++------ test/src/spec/plugin.rs | 8 ++ 9 files changed, 184 insertions(+), 67 deletions(-) diff --git a/plugin-protocol/examples/keystore.rs b/plugin-protocol/examples/keystore.rs index 1b89de8f..5c869061 100644 --- a/plugin-protocol/examples/keystore.rs +++ b/plugin-protocol/examples/keystore.rs @@ -1,4 +1,4 @@ -use ckb_types::{h160, H160}; +use ckb_types::{h160, h256, H160, H256}; use ckb_cli_plugin_protocol::{ JsonrpcError, JsonrpcRequest, JsonrpcResponse, KeyStoreRequest, PluginConfig, PluginRequest, @@ -71,11 +71,11 @@ fn handle(request: PluginRequest) -> Option { } let accounts = vec![ - h160!("0xe22f7f385830a75e50ab7fc5fd4c35b134f1e84b"), - h160!("0x13e41d6F9292555916f17B4882a5477C01270142"), - h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64"), + JsonBytes::from_vec(h160!("0xe22f7f385830a75e50ab7fc5fd4c35b134f1e84b").as_bytes().to_vec()), + JsonBytes::from_vec(h256!("0x1111111f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8").as_bytes().to_vec()), + JsonBytes::from_vec(h256!("0x2222222b0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8").as_bytes().to_vec()), ]; - PluginResponse::H160Vec(accounts) + PluginResponse::BytesVec(accounts) } KeyStoreRequest::HasAccount(_) => PluginResponse::Boolean(true), KeyStoreRequest::CreateAccount(_) => { @@ -85,6 +85,13 @@ fn handle(request: PluginRequest) -> Option { KeyStoreRequest::Import { .. } => { PluginResponse::H160(h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64")) } + KeyStoreRequest::ImportAccount { account_id, .. } => { + eprintln!( + "account_id: {}", + serde_json::to_string_pretty(&account_id).unwrap() + ); + PluginResponse::H160(h160!("0x1111111111111111111222222222222222222222")) + } KeyStoreRequest::Export { .. } => PluginResponse::MasterPrivateKey { privkey: JsonBytes::from_vec(vec![3u8; 32]), chain_code: JsonBytes::from_vec(vec![4u8; 32]), diff --git a/plugin-protocol/examples/keystore_no_password.rs b/plugin-protocol/examples/keystore_no_password.rs index 3fdd4e58..60d1a866 100644 --- a/plugin-protocol/examples/keystore_no_password.rs +++ b/plugin-protocol/examples/keystore_no_password.rs @@ -54,7 +54,11 @@ fn handle(request: PluginRequest) -> Option { h160!("0x13e41d6F9292555916f17B4882a5477C01270142"), h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64"), ]; - PluginResponse::H160Vec(accounts) + let accounts = accounts + .into_iter() + .map(|hash160| JsonBytes::from_vec(hash160.as_bytes().to_vec())) + .collect::>(); + PluginResponse::BytesVec(accounts) } KeyStoreRequest::HasAccount(_) => PluginResponse::Boolean(true), KeyStoreRequest::CreateAccount(_) => { @@ -64,6 +68,9 @@ fn handle(request: PluginRequest) -> Option { KeyStoreRequest::Import { .. } => { PluginResponse::H160(h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64")) } + KeyStoreRequest::ImportAccount { .. } => { + PluginResponse::H160(h160!("0x1111111111111111111222222222222222222222")) + } KeyStoreRequest::Export { .. } => PluginResponse::MasterPrivateKey { privkey: JsonBytes::from_vec(vec![3u8; 32]), chain_code: JsonBytes::from_vec(vec![4u8; 32]), diff --git a/plugin-protocol/src/convert.rs b/plugin-protocol/src/convert.rs index cc06679b..d3dfdf36 100644 --- a/plugin-protocol/src/convert.rs +++ b/plugin-protocol/src/convert.rs @@ -1,4 +1,4 @@ -use ckb_jsonrpc_types::Transaction; +use ckb_jsonrpc_types::{JsonBytes, Transaction}; use faster_hex::{hex_decode, hex_string}; use serde::de::DeserializeOwned; use std::convert::TryFrom; @@ -157,6 +157,17 @@ impl From for (&'static str, Vec) { ]; (method::KEYSTORE_IMPORT, params) } + KeyStoreRequest::ImportAccount { + account_id, + password, + } => { + let account_id = format!( + "0x{}", + hex_string(account_id.as_bytes()).expect("Hex failed") + ); + let params = vec![serde_json::json!(account_id), serde_json::json!(password)]; + (method::KEYSTORE_IMPORT_ACCOUNT, params) + } KeyStoreRequest::Export { hash160, password } => { let params = vec![serde_json::json!(hash160), serde_json::json!(password)]; (method::KEYSTORE_EXPORT, params) @@ -245,28 +256,15 @@ impl TryFrom<&JsonrpcRequest> for KeyStoreRequest { password: parse_param(data, 1, "hash160")?, new_password: parse_param(data, 2, "hash160")?, }, - method::KEYSTORE_IMPORT => { - let parse_h256 = |index, field| { - let hex: String = parse_param(data, index, field)?; - if hex.len() != 66 { - return Err(format!("Invalid data length for field {}, method={}, expected 32bytes data hex string", field, data.method)); - } - if !hex.starts_with("0x") || hex.len() % 2 == 1 { - return Err(format!( - "Field {} is not valid hex string, method={} (0x prefix is required)", - field, data.method - )); - } - let mut dst = [0u8; 32]; - hex_decode(&hex.as_bytes()[2..], &mut dst).map_err(|err| err.to_string())?; - Ok(dst) - }; - KeyStoreRequest::Import { - privkey: parse_h256(0, "privkey")?, - chain_code: parse_h256(1, "chain_code")?, - password: parse_param(data, 2, "password")?, - } - } + method::KEYSTORE_IMPORT => KeyStoreRequest::Import { + privkey: parse_h256(data, 0, "privkey")?, + chain_code: parse_h256(data, 1, "chain_code")?, + password: parse_param(data, 2, "password")?, + }, + method::KEYSTORE_IMPORT_ACCOUNT => KeyStoreRequest::ImportAccount { + account_id: JsonBytes::from_vec(parse_bytes(data, 0, "account_id")?), + password: parse_param(data, 1, "password")?, + }, method::KEYSTORE_EXPORT => KeyStoreRequest::Export { hash160: parse_param(data, 0, "hash160")?, password: parse_param(data, 1, "password")?, @@ -442,6 +440,32 @@ fn parse_param( }) } +fn parse_bytes(data: &JsonrpcRequest, index: usize, field: &str) -> Result, String> { + let hex: String = parse_param(data, index, field)?; + if !hex.starts_with("0x") || hex.len() % 2 == 1 { + return Err(format!( + "Field {} is not valid hex string, method={} (0x prefix is required)", + field, data.method + )); + } + let mut dst = vec![0u8; hex.len() / 2 - 1]; + hex_decode(&hex.as_bytes()[2..], &mut dst).map_err(|err| err.to_string())?; + Ok(dst) +} + +fn parse_h256(data: &JsonrpcRequest, index: usize, field: &str) -> Result<[u8; 32], String> { + let vec = parse_bytes(data, index, field)?; + if vec.len() != 32 { + return Err(format!( + "Invalid data length for field {}, method={}, expected 32bytes data hex string", + field, data.method + )); + } + let mut dst = [0u8; 32]; + dst.copy_from_slice(&vec); + Ok(dst) +} + impl From<(u64, PluginResponse)> for JsonrpcResponse { fn from((id, response): (u64, PluginResponse)) -> JsonrpcResponse { let (result, error) = match response { diff --git a/plugin-protocol/src/lib.rs b/plugin-protocol/src/lib.rs index ea09dadb..0b668f4e 100644 --- a/plugin-protocol/src/lib.rs +++ b/plugin-protocol/src/lib.rs @@ -117,6 +117,7 @@ pub enum PluginResponse { BlockViewOpt(Box>), BlockRewardOpt(Option), Bytes(JsonBytes), + BytesVec(Vec), Callback(CallbackResponse), MasterPrivateKey { @@ -179,7 +180,7 @@ pub enum SignTarget { #[derive(Serialize, Deserialize, Debug, Clone)] pub enum KeyStoreRequest { - // return: PluginResponse::H160 + // return: PluginResponse::Bytes ListAccount, // return: PluginResponse::Boolean HasAccount(H160), @@ -197,6 +198,11 @@ pub enum KeyStoreRequest { chain_code: [u8; 32], password: Option, }, + // return: PluginResponse::H160 + ImportAccount { + account_id: JsonBytes, + password: Option, + }, // return: PluginResponse::MasterPrivateKey Export { hash160: H160, diff --git a/plugin-protocol/src/method.rs b/plugin-protocol/src/method.rs index 965b98cc..b0aed5f0 100644 --- a/plugin-protocol/src/method.rs +++ b/plugin-protocol/src/method.rs @@ -31,6 +31,7 @@ pub const KEYSTORE_HAS_ACCOUNT: &str = "keystore_has_account"; pub const KEYSTORE_CREATE_ACCOUNT: &str = "keystore_create_account"; pub const KEYSTORE_UPDATE_PASSWORD: &str = "keystore_update_password"; pub const KEYSTORE_IMPORT: &str = "keystore_import"; +pub const KEYSTORE_IMPORT_ACCOUNT: &str = "keystore_import_account"; pub const KEYSTORE_EXPORT: &str = "keystore_export"; pub const KEYSTORE_SIGN: &str = "keystore_sign"; pub const KEYSTORE_EXTENDED_PUBKEY: &str = "keystore_extended_pubkey"; diff --git a/src/plugin/builtin.rs b/src/plugin/builtin.rs index dfff528f..da1d46f8 100644 --- a/src/plugin/builtin.rs +++ b/src/plugin/builtin.rs @@ -82,6 +82,9 @@ impl DefaultKeyStore { .map_err(|err| err.to_string())?; Ok(PluginResponse::H160(lock_arg)) } + KeyStoreRequest::ImportAccount { .. } => { + Err("Not supported in file based keystore".to_string()) + } KeyStoreRequest::Export { hash160, password } => { let password = password.ok_or_else(|| { String::from("Password is required by default keystore: export key") diff --git a/src/plugin/manager.rs b/src/plugin/manager.rs index 17a73f75..d89220d7 100644 --- a/src/plugin/manager.rs +++ b/src/plugin/manager.rs @@ -10,7 +10,7 @@ use std::sync::Arc; use std::thread::{self, JoinHandle}; use ckb_index::LiveCellInfo; -use ckb_jsonrpc_types::{BlockNumber, HeaderView, Script}; +use ckb_jsonrpc_types::{BlockNumber, HeaderView, JsonBytes, Script}; use ckb_sdk::{ wallet::{ChildNumber, DerivationPath, DerivedKeySet, MasterPrivKey}, HttpRpcClient, @@ -1193,6 +1193,9 @@ impl KeyStoreHandler { // Default only default_only = true; } + KeyStoreRequest::ImportAccount { .. } => { + // Plugin only + } KeyStoreRequest::Export { ref hash160, .. } => { // Both hash160_opt = Some(hash160.clone()); @@ -1262,7 +1265,7 @@ impl KeyStoreHandler { } } - pub fn list_account(&self) -> Result, String> { + pub fn list_account(&self) -> Result, String> { let request = KeyStoreRequest::ListAccount; let plugin_request = PluginRequest::KeyStore(request.clone()); @@ -1273,17 +1276,18 @@ impl KeyStoreHandler { all_accounts.extend( accounts .into_iter() - .map(|hash160| (hash160, ACCOUNT_SOURCE_FS.to_owned())), + .map(|hash160| Bytes::from(hash160.as_bytes().to_vec())) + .map(|data| (data, ACCOUNT_SOURCE_FS.to_owned())), ); } else { return Err("Mismatch default keystore response".to_string()); } if let Some(cfg) = self.actived_plugin() { - if let PluginResponse::H160Vec(accounts) = self.call(request)? { + if let PluginResponse::BytesVec(accounts) = self.call(request)? { all_accounts.extend( accounts .into_iter() - .map(|hash160| (hash160, format!("[plugin]: {}", cfg.name))), + .map(|data| (data.into_bytes(), format!("[plugin]: {}", cfg.name))), ); } else { return Err("Mismatch plugin keystore response".to_string()); @@ -1338,6 +1342,21 @@ impl KeyStoreHandler { Err("Mismatch keystore response".to_string()) } } + pub fn import_account( + &self, + account_id: Bytes, + password: Option, + ) -> Result { + let request = KeyStoreRequest::ImportAccount { + account_id: JsonBytes::from_bytes(account_id), + password, + }; + if let PluginResponse::H160(lock_arg) = self.call(request)? { + Ok(lock_arg) + } else { + Err("Mismatch keystore response".to_string()) + } + } pub fn export_key( &self, hash160: H160, diff --git a/src/subcommands/account.rs b/src/subcommands/account.rs index 2283f597..16e9ba83 100644 --- a/src/subcommands/account.rs +++ b/src/subcommands/account.rs @@ -8,6 +8,7 @@ use ckb_sdk::{ }; use ckb_types::{packed::Script, prelude::*, H160, H256}; use clap::{App, Arg, ArgMatches}; +use faster_hex::hex_string; use super::{CliSubCommand, Output}; use crate::plugin::PluginManager; @@ -15,7 +16,7 @@ use crate::utils::{ arg::lock_arg, arg_parser::{ ArgParser, ExtendedPrivkeyPathParser, FilePathParser, FixedHashParser, FromStrParser, - PrivkeyPathParser, PrivkeyWrapper, + HexParser, PrivkeyPathParser, PrivkeyWrapper, }, other::read_password, }; @@ -74,6 +75,23 @@ impl<'a> AccountSubCommand<'a> { .required_unless("privkey-path") .validator(|input| ExtendedPrivkeyPathParser.validate(input)) ), + App::new("import-from-plugin") + .about("Import an account from keystore plugin") + .arg( + Arg::with_name("account-id") + .long("account-id") + .takes_value(true) + .required(true) + .validator(|input| { + let hex = HexParser.parse(input)?; + if hex.is_empty() { + Err("empty account id is not allowed".to_string()) + } else { + Ok(()) + } + }) + .about("The account id (hex format, can be found in account list)") + ), App::new("import-keystore") .about("Import key from encrypted keystore json file and create a new account.") .arg( @@ -160,13 +178,7 @@ impl<'a> CliSubCommand for AccountSubCommand<'a> { fn process(&mut self, matches: &ArgMatches, _debug: bool) -> Result { match matches.subcommand() { ("list", Some(m)) => { - let mut accounts = self - .plugin_mgr - .keystore_handler() - .list_account()? - .iter() - .map(|(lock_arg, source)| (lock_arg.clone(), source.clone())) - .collect::>(); + let mut accounts = self.plugin_mgr.keystore_handler().list_account()?; // Sort by file path name accounts.sort_by(|a, b| a.1.cmp(&b.1)); let only_mainnet_address = m.is_present("only-mainnet-address"); @@ -175,36 +187,45 @@ impl<'a> CliSubCommand for AccountSubCommand<'a> { let resp = accounts .into_iter() .enumerate() - .map(|(idx, (lock_arg, source))| { - let address_payload = AddressPayload::from_pubkey_hash(lock_arg.clone()); - let lock_hash: H256 = Script::from(&address_payload) - .calc_script_hash() - .unpack(); - if partial_fields { - let key = format!("{:#x}", lock_arg); - if only_mainnet_address { - serde_json::json!({ - key: Address::new(NetworkType::Mainnet, address_payload).to_string() - }) - } else if only_testnet_address { + .map(|(idx, (data, source))| { + if data.len() == 20 { + let lock_arg = H160::from_slice(data.as_ref()).expect("H160"); + let address_payload = AddressPayload::from_pubkey_hash(lock_arg.clone()); + let lock_hash: H256 = Script::from(&address_payload) + .calc_script_hash() + .unpack(); + if partial_fields { + let key = format!("{:#x}", lock_arg); + if only_mainnet_address { + serde_json::json!({ + key: Address::new(NetworkType::Mainnet, address_payload).to_string() + }) + } else if only_testnet_address { + serde_json::json!({ + key: Address::new(NetworkType::Testnet, address_payload).to_string() + }) + } else { + unreachable!(); + } + } else { + let has_ckb_root = self.key_store.get_ckb_root(&lock_arg, false).is_some(); serde_json::json!({ - key: Address::new(NetworkType::Testnet, address_payload).to_string() + "#": idx, + "source": source, + "lock_arg": format!("{:#x}", lock_arg), + "lock_hash": format!("{:#x}", lock_hash), + "has_ckb_root": has_ckb_root, + "address": { + "mainnet": Address::new(NetworkType::Mainnet, address_payload.clone()).to_string(), + "testnet": Address::new(NetworkType::Testnet, address_payload).to_string(), + }, }) - } else { - unreachable!(); } } else { - let has_ckb_root = self.key_store.get_ckb_root(&lock_arg, false).is_some(); serde_json::json!({ "#": idx, "source": source, - "lock_arg": format!("{:#x}", lock_arg), - "lock_hash": format!("{:#x}", lock_hash), - "has_ckb_root": has_ckb_root, - "address": { - "mainnet": Address::new(NetworkType::Mainnet, address_payload.clone()).to_string(), - "testnet": Address::new(NetworkType::Testnet, address_payload).to_string(), - }, + "account-id": format!("0x{}", hex_string(data.as_ref()).expect("hex")), }) } }) @@ -260,7 +281,28 @@ impl<'a> CliSubCommand for AccountSubCommand<'a> { .import_key(master_privkey, password)?; let address_payload = AddressPayload::from_pubkey_hash(lock_arg.clone()); let resp = serde_json::json!({ - "lock_arg": format!("{:x}", lock_arg), + "lock_arg": format!("{:#x}", lock_arg), + "address": { + "mainnet": Address::new(NetworkType::Mainnet, address_payload.clone()).to_string(), + "testnet": Address::new(NetworkType::Testnet, address_payload).to_string(), + }, + }); + Ok(Output::new_output(resp)) + } + ("import-from-plugin", Some(m)) => { + let account_id: Vec = HexParser.from_matches(m, "account-id")?; + let password = if self.plugin_mgr.keystore_require_password() { + Some(read_password(false, None)?) + } else { + None + }; + let lock_arg = self + .plugin_mgr + .keystore_handler() + .import_account(account_id.into(), password)?; + let address_payload = AddressPayload::from_pubkey_hash(lock_arg.clone()); + let resp = serde_json::json!({ + "lock_arg": format!("{:#x}", lock_arg), "address": { "mainnet": Address::new(NetworkType::Mainnet, address_payload.clone()).to_string(), "testnet": Address::new(NetworkType::Testnet, address_payload).to_string(), diff --git a/test/src/spec/plugin.rs b/test/src/spec/plugin.rs index 8d3256d6..2144c733 100644 --- a/test/src/spec/plugin.rs +++ b/test/src/spec/plugin.rs @@ -41,6 +41,14 @@ impl Spec for Plugin { "0x59fbdd52b9967b47270b207d352e6f59616a2f03b24a9710c087b379ac0f8d09" ); + let output = setup + .cli("account import-from-plugin --account-id 0x1111111f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8"); + let value: serde_yaml::Value = serde_yaml::from_str(&output).unwrap(); + assert_eq!( + value["lock_arg"], + "0x1111111111111111111222222222222222222222" + ); + let tempdir = tempdir().expect("create tempdir failed"); let extended_privkey_path = format!( "{}/exported-privkey", From 0bad26940c2b7257ebe20dbe9e6ac886e016b43e Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Thu, 29 Oct 2020 16:04:27 +0800 Subject: [PATCH 02/18] feat: Detect long fork and log an error message --- ckb-index/src/index/mod.rs | 46 ++++++++++++++++++++++++++++++--- ckb-index/src/index/types.rs | 4 +-- ckb-index/src/lib.rs | 1 + ckb-sdk-types/src/lib.rs | 1 + ckb-sdk/src/lib.rs | 2 ++ src/main.rs | 2 ++ src/subcommands/wallet/index.rs | 27 +++++++++++++------ 7 files changed, 69 insertions(+), 14 deletions(-) diff --git a/ckb-index/src/index/mod.rs b/ckb-index/src/index/mod.rs index 64cd0adb..e0ee464d 100644 --- a/ckb-index/src/index/mod.rs +++ b/ckb-index/src/index/mod.rs @@ -17,7 +17,7 @@ use crate::{KVReader, KVTxn, RocksReader, RocksTxn}; pub use key::{Key, KeyMetrics, KeyType}; pub use types::{CellIndex, HashType, LiveCellInfo, TxInfo}; -use types::BlockDeltaInfo; +use types::{BlockDeltaInfo, KEEP_RECENT_BLOCKS}; // NOTE: You should reopen to increase database size when processed enough blocks // [reference]: https://stackoverflow.com/a/33571804 @@ -121,7 +121,7 @@ impl<'a> IndexDatabase<'a> { reader .get(&Key::BlockDelta(last_header.number()).to_bytes()) .map(|bytes| bincode::deserialize(&bytes).unwrap()) - .unwrap() + .ok_or_else(|| IndexError::LongFork)? }; let mut txn = RocksTxn::new(self.db, self.cf); last_block_delta.rollback(&mut txn); @@ -376,11 +376,11 @@ pub enum IndexError { BlockImmature(u64), IllegalBlock(Byte32), InvalidBlockNumber(u64), - BlockInvalid(String), NotInit, IoError(String), InvalidGenesis(String), InvalidNetworkType(String), + LongFork, } impl From for IndexError { @@ -391,6 +391,44 @@ impl From for IndexError { impl fmt::Display for IndexError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - write!(f, "{:?}", self) + match self { + IndexError::BlockImmature(number) => { + write!( + f, + "Current applied block number {} greater than tip block number", + number + )?; + } + IndexError::IllegalBlock(_) => { + write!(f, "Current applied block number is 1, but the parent hash not match genesis block hash")?; + } + IndexError::InvalidBlockNumber(number) => { + write!( + f, + "Current applied block number {} is not the next block of lastest block", + number + )?; + } + IndexError::NotInit => { + write!(f, "Apply block before database initialization")?; + } + IndexError::IoError(msg) => { + write!(f, "IO error: {}", msg)?; + } + IndexError::InvalidGenesis(msg) => { + write!(f, "Genesis hash not match with DB, {}", msg)?; + } + IndexError::InvalidNetworkType(msg) => { + write!(f, "NetworkType not match with DB, {}", msg)?; + } + IndexError::LongFork => { + write!( + f, + "Already rollbacked {} blocks, long fork detected", + KEEP_RECENT_BLOCKS + )?; + } + } + Ok(()) } } diff --git a/ckb-index/src/index/types.rs b/ckb-index/src/index/types.rs index b5071203..19a46583 100644 --- a/ckb-index/src/index/types.rs +++ b/ckb-index/src/index/types.rs @@ -12,8 +12,8 @@ use serde_derive::{Deserialize, Serialize}; use super::key::{Key, KeyType}; use crate::{KVReader, KVTxn}; -const KEEP_RECENT_HEADERS: u64 = 10_000; -const KEEP_RECENT_BLOCKS: u64 = 200; +pub const KEEP_RECENT_HEADERS: u64 = 10_000; +pub const KEEP_RECENT_BLOCKS: u64 = 200; #[derive(Hash, Eq, PartialEq, Debug, Clone, Copy, Serialize, Deserialize)] #[repr(u8)] diff --git a/ckb-index/src/lib.rs b/ckb-index/src/lib.rs index ceecff5d..b55d65d8 100644 --- a/ckb-index/src/lib.rs +++ b/ckb-index/src/lib.rs @@ -1,4 +1,5 @@ mod error; +#[allow(clippy::mutable_key_type)] mod index; mod kvdb; mod util; diff --git a/ckb-sdk-types/src/lib.rs b/ckb-sdk-types/src/lib.rs index 37f08066..b3b5f9ea 100644 --- a/ckb-sdk-types/src/lib.rs +++ b/ckb-sdk-types/src/lib.rs @@ -1 +1,2 @@ +#[allow(clippy::mutable_key_type)] pub mod transaction; diff --git a/ckb-sdk/src/lib.rs b/ckb-sdk/src/lib.rs index 5f585fea..a66b6c75 100644 --- a/ckb-sdk/src/lib.rs +++ b/ckb-sdk/src/lib.rs @@ -1,6 +1,8 @@ mod chain; mod error; +#[allow(clippy::mutable_key_type)] mod transaction; +#[allow(clippy::mutable_key_type)] mod tx_helper; mod types; diff --git a/src/main.rs b/src/main.rs index 12220fb7..2e3a5963 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,7 +33,9 @@ use utils::{ mod interactive; mod plugin; +#[allow(clippy::mutable_key_type)] mod subcommands; +#[allow(clippy::mutable_key_type)] mod utils; fn main() -> Result<(), io::Error> { diff --git a/src/subcommands/wallet/index.rs b/src/subcommands/wallet/index.rs index bedc3812..bcf7318a 100644 --- a/src/subcommands/wallet/index.rs +++ b/src/subcommands/wallet/index.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::thread; use std::time::{Duration, Instant}; -use ckb_index::{with_index_db, IndexDatabase}; +use ckb_index::{with_index_db, Error, IndexDatabase, IndexError}; use ckb_sdk::GenesisInfo; use ckb_sdk::HttpRpcClient; use ckb_types::{ @@ -106,7 +106,7 @@ fn process( } if tip_header.number() >= next_number { - let exit_opt = with_index_db(index_dir, genesis_hash.clone(), |backend, cf| { + match with_index_db(index_dir, genesis_hash.clone(), |backend, cf| { let mut db = IndexDatabase::from_db(backend, cf, network_type, genesis_info.clone(), false) .unwrap(); @@ -125,8 +125,7 @@ fn process( if let Some(next_block) = rpc_client.get_block_by_number(db.next_number().unwrap())? { - db.apply_next_block(next_block.into()) - .expect("Add block failed"); + db.apply_next_block(next_block.into())?; state .write() .processing(db.last_header().cloned(), tip_header.number()); @@ -140,10 +139,22 @@ fn process( .write() .processing(db.last_header().cloned(), tip_header.number()); Ok(None) - }) - .map_err(|err| err.to_string())?; - if let Some(exit) = exit_opt { - return Ok(exit); + }) { + Ok(Some(exit)) => { + return Ok(exit); + } + Ok(None) => {} + Err(Error::Index(IndexError::LongFork)) => { + log::error!( + "\n{}!\nIf you running a dev chain and have removed the database directory (\"ckb/data/db\"), please also remove ckb-cli's index directory:\n {:?}", + IndexError::LongFork, + index_dir.join(format!("{:#x}", genesis_hash)) + ); + return Ok(true); + } + Err(err) => { + return Err(err.to_string()); + } } } From d3f00b3412ba93ec6f2241df1ca8186263926a54 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Thu, 29 Oct 2020 18:13:47 +0800 Subject: [PATCH 03/18] feat: Add subcommand for rebuilding index database --- src/interactive.rs | 26 +++++++- src/main.rs | 17 ++++- src/subcommands/dao/mod.rs | 40 +++++------ src/subcommands/index.rs | 113 ++++++++++++++++++++++++++++++++ src/subcommands/mod.rs | 2 + src/subcommands/wallet/index.rs | 88 ++++++++++++++++++------- src/subcommands/wallet/mod.rs | 36 +++------- src/utils/index.rs | 33 ++++++++++ 8 files changed, 277 insertions(+), 78 deletions(-) create mode 100644 src/subcommands/index.rs diff --git a/src/interactive.rs b/src/interactive.rs index 0fe902b6..5b138872 100644 --- a/src/interactive.rs +++ b/src/interactive.rs @@ -1,10 +1,12 @@ use std::fs; use std::io::Write; use std::path::PathBuf; +use std::sync::Arc; use std::time::{Duration, Instant}; use ansi_term::Colour::Green; use ckb_types::{core::service::Request, core::BlockView}; +use ckb_util::RwLock; use regex::Regex; use rustyline::config::Configurer; use rustyline::error::ReadlineError; @@ -13,13 +15,14 @@ use serde_json::json; use crate::plugin::PluginManager; use crate::subcommands::{ - AccountSubCommand, CliSubCommand, DAOSubCommand, MockTxSubCommand, MoleculeSubCommand, - PluginSubCommand, RpcSubCommand, TxSubCommand, UtilSubCommand, WalletSubCommand, + AccountSubCommand, CliSubCommand, DAOSubCommand, IndexSubCommand, MockTxSubCommand, + MoleculeSubCommand, PluginSubCommand, RpcSubCommand, TxSubCommand, UtilSubCommand, + WalletSubCommand, }; use crate::utils::{ completer::CkbCompleter, config::GlobalConfig, - index::{IndexController, IndexRequest}, + index::{IndexController, IndexRequest, IndexThreadState}, other::{check_alerts, get_network_type, index_dirname}, printer::{ColorWhen, OutputFormat, Printable}, }; @@ -39,6 +42,7 @@ pub struct InteractiveEnv { rpc_client: HttpRpcClient, raw_rpc_client: RawHttpRpcClient, index_controller: IndexController, + index_state: Arc>, genesis_info: Option, } @@ -49,6 +53,7 @@ impl InteractiveEnv { plugin_mgr: PluginManager, key_store: KeyStore, index_controller: IndexController, + index_state: Arc>, ) -> Result { if !ckb_cli_dir.as_path().exists() { fs::create_dir(&ckb_cli_dir).map_err(|err| err.to_string())?; @@ -85,6 +90,7 @@ impl InteractiveEnv { rpc_client, raw_rpc_client, index_controller, + index_state, genesis_info: None, }) } @@ -387,6 +393,20 @@ impl InteractiveEnv { output.print(format, color); Ok(()) } + ("index", Some(sub_matches)) => { + let genesis_info = self.genesis_info()?; + let output = IndexSubCommand::new( + &mut self.rpc_client, + Some(genesis_info), + self.index_dir.clone(), + self.index_controller.clone(), + Arc::clone(&self.index_state), + wait_for_sync, + ) + .process(&sub_matches, debug)?; + output.print(format, color); + Ok(()) + } ("wallet", Some(sub_matches)) => { let genesis_info = self.genesis_info()?; let output = WalletSubCommand::new( diff --git a/src/main.rs b/src/main.rs index 2e3a5963..657ee90a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,8 +19,8 @@ use interactive::InteractiveEnv; use plugin::PluginManager; use subcommands::{ start_index_thread, AccountSubCommand, ApiServerSubCommand, CliSubCommand, DAOSubCommand, - MockTxSubCommand, MoleculeSubCommand, PluginSubCommand, RpcSubCommand, TxSubCommand, - UtilSubCommand, WalletSubCommand, + IndexSubCommand, MockTxSubCommand, MoleculeSubCommand, PluginSubCommand, RpcSubCommand, + TxSubCommand, UtilSubCommand, WalletSubCommand, }; use utils::other::get_genesis_info; use utils::{ @@ -106,6 +106,7 @@ fn main() -> Result<(), io::Error> { } let api_uri = config.get_url().to_string(); + let index_state_clone = Arc::clone(&index_state); let index_controller = start_index_thread(api_uri.as_str(), index_dir.clone(), index_state); let mut rpc_client = HttpRpcClient::new(api_uri.clone()); let mut raw_rpc_client = RawHttpRpcClient::new(api_uri.as_str()); @@ -159,6 +160,15 @@ fn main() -> Result<(), io::Error> { PluginSubCommand::new(&mut plugin_mgr).process(&sub_matches, debug) } ("molecule", Some(sub_matches)) => MoleculeSubCommand::new().process(&sub_matches, debug), + ("index", Some(sub_matches)) => IndexSubCommand::new( + &mut rpc_client, + None, + index_dir, + index_controller.clone(), + index_state_clone, + wait_for_sync, + ) + .process(&sub_matches, debug), ("wallet", Some(sub_matches)) => WalletSubCommand::new( &mut rpc_client, &mut plugin_mgr, @@ -188,6 +198,7 @@ fn main() -> Result<(), io::Error> { plugin_mgr, key_store, index_controller.clone(), + index_state_clone, ) .and_then(|mut env| env.start()) { @@ -262,6 +273,7 @@ pub fn build_cli<'a>(version_short: &'a str, version_long: &'a str) -> App<'a> { .subcommand(UtilSubCommand::subcommand("util")) .subcommand(PluginSubCommand::subcommand("plugin")) .subcommand(MoleculeSubCommand::subcommand("molecule")) + .subcommand(IndexSubCommand::subcommand("index")) .subcommand(WalletSubCommand::subcommand()) .subcommand(DAOSubCommand::subcommand()) .arg( @@ -379,6 +391,7 @@ pub fn build_interactive() -> App<'static> { .subcommand(UtilSubCommand::subcommand("util")) .subcommand(PluginSubCommand::subcommand("plugin")) .subcommand(MoleculeSubCommand::subcommand("molecule")) + .subcommand(IndexSubCommand::subcommand("index")) .subcommand(WalletSubCommand::subcommand()) .subcommand(DAOSubCommand::subcommand()) } diff --git a/src/subcommands/dao/mod.rs b/src/subcommands/dao/mod.rs index e2ae7c2a..3da882bf 100644 --- a/src/subcommands/dao/mod.rs +++ b/src/subcommands/dao/mod.rs @@ -1,14 +1,11 @@ use self::builder::DAOBuilder; use self::command::TransactArgs; use crate::plugin::{KeyStoreHandler, PluginManager, SignTarget}; -use crate::utils::index::IndexController; -use crate::utils::other::{ - get_max_mature_number, get_network_type, get_privkey_signer, is_mature, read_password, - sync_to_tip, -}; +use crate::utils::index::{with_db, IndexController}; +use crate::utils::other::{get_max_mature_number, get_privkey_signer, is_mature, read_password}; use byteorder::{ByteOrder, LittleEndian}; use ckb_hash::new_blake2b; -use ckb_index::{with_index_db, IndexDatabase, LiveCellInfo}; +use ckb_index::{IndexDatabase, LiveCellInfo}; use ckb_jsonrpc_types::{self as json_types, JsonBytes}; use ckb_sdk::{ constants::{MIN_SECP_CELL_CAPACITY, SIGHASH_TYPE_HASH}, @@ -122,7 +119,7 @@ impl<'a> DAOSubCommand<'a> { fn collect_dao_cells(&mut self, lock_hash: Byte32) -> Result, String> { let dao_type_hash = self.dao_type_hash().clone(); - self.with_db(|db, _| { + self.with_db(|db| { let cells_by_lock = db .get_live_cells_by_lock(lock_hash, Some(0), |_, _| (false, true)) .into_iter() @@ -161,7 +158,7 @@ impl<'a> DAOSubCommand<'a> { }; let cells: Vec = { - self.with_db(|db, _| { + self.with_db(|db| { db.get_live_cells_by_lock( Script::from(from_address.payload()).calc_script_hash(), None, @@ -302,29 +299,22 @@ impl<'a> DAOSubCommand<'a> { } fn check_db_ready(&mut self) -> Result<(), String> { - self.with_db(|_, _| ()) + self.with_db(|_| ()) } fn with_db(&mut self, func: F) -> Result where - F: FnOnce(IndexDatabase, &mut HttpRpcClient) -> T, + F: FnOnce(IndexDatabase) -> T, { - if self.wait_for_sync { - sync_to_tip(&self.index_controller)?; - } - let network_type = get_network_type(self.rpc_client)?; let genesis_info = self.genesis_info.clone(); - let genesis_hash: H256 = genesis_info.header().hash().unpack(); - with_index_db(&self.index_dir.clone(), genesis_hash, |backend, cf| { - let db = IndexDatabase::from_db(backend, cf, network_type, genesis_info, false)?; - Ok(func(db, self.rpc_client())) - }) - .map_err(|_err| { - format!( - "Index database may not ready, sync process: {}", - self.index_controller.state().read().to_string() - ) - }) + with_db( + func, + self.rpc_client, + genesis_info, + &self.index_dir, + self.index_controller.clone(), + self.wait_for_sync, + ) } fn transact_args(&self) -> &TransactArgs { diff --git a/src/subcommands/index.rs b/src/subcommands/index.rs new file mode 100644 index 00000000..62c12216 --- /dev/null +++ b/src/subcommands/index.rs @@ -0,0 +1,113 @@ +use std::path::PathBuf; +use std::sync::Arc; + +use ckb_index::IndexDatabase; +use ckb_sdk::{GenesisInfo, HttpRpcClient}; +use ckb_types::{ + core::{service::Request, BlockView}, + prelude::*, + H256, +}; +use ckb_util::RwLock; +use clap::{App, ArgMatches}; + +use super::{CliSubCommand, Output}; +use crate::utils::index::{with_db, IndexController, IndexRequest, IndexThreadState}; + +pub struct IndexSubCommand<'a> { + rpc_client: &'a mut HttpRpcClient, + genesis_info: Option, + index_dir: PathBuf, + index_controller: IndexController, + index_state: Arc>, + wait_for_sync: bool, +} + +impl<'a> IndexSubCommand<'a> { + pub fn new( + rpc_client: &'a mut HttpRpcClient, + genesis_info: Option, + index_dir: PathBuf, + index_controller: IndexController, + index_state: Arc>, + wait_for_sync: bool, + ) -> IndexSubCommand<'a> { + IndexSubCommand { + rpc_client, + genesis_info, + index_dir, + index_controller, + index_state, + wait_for_sync, + } + } + + pub fn subcommand(name: &'static str) -> App<'static> { + App::new(name) + .about("Index database management") + .subcommands(vec![ + App::new("db-metrics").about("Show index database metrics"), + App::new("current-database-info") + .about("Show current index database's basic information"), + App::new("rebuild-current-database") + .about("Remove and rebuild current index database"), + ]) + } + + fn genesis_info(&mut self) -> Result { + if self.genesis_info.is_none() { + let genesis_block: BlockView = self + .rpc_client + .get_block_by_number(0)? + .expect("Can not get genesis block?") + .into(); + self.genesis_info = Some(GenesisInfo::from_block(&genesis_block)?); + } + Ok(self.genesis_info.clone().unwrap()) + } + + fn with_db(&mut self, func: F) -> Result + where + F: FnOnce(IndexDatabase) -> T, + { + let genesis_info = self.genesis_info()?; + with_db( + func, + self.rpc_client, + genesis_info, + &self.index_dir, + self.index_controller.clone(), + self.wait_for_sync, + ) + } + + fn db_dir(&mut self) -> Result { + let genesis_info = self.genesis_info()?; + let genesis_hash: H256 = genesis_info.header().hash().unpack(); + Ok(self.index_dir.join(format!("{:#x}", genesis_hash))) + } +} + +impl<'a> CliSubCommand for IndexSubCommand<'a> { + fn process(&mut self, matches: &ArgMatches, _debug: bool) -> Result { + match matches.subcommand() { + ("current-database-info", _) => Ok(Output::new_output(serde_json::json!({ + "directory": self.db_dir()?.to_string_lossy(), + "state": self.index_state.read().to_string(), + }))), + ("rebuild-current-database", _) => { + Request::call( + self.index_controller.sender(), + IndexRequest::RebuildCurrentDB, + ); + Ok(Output::new_success()) + } + ("db-metrics", _) => { + let metrcis = self.with_db(|db| db.get_metrics(None))?; + let resp = serde_json::to_value(metrcis).map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } + _ => Err(Self::subcommand("index").generate_usage()), + } + } +} diff --git a/src/subcommands/mod.rs b/src/subcommands/mod.rs index ad464a61..fc04887c 100644 --- a/src/subcommands/mod.rs +++ b/src/subcommands/mod.rs @@ -1,6 +1,7 @@ pub mod account; pub mod api_server; pub mod dao; +pub mod index; pub mod mock_tx; pub mod molecule; pub mod plugin; @@ -17,6 +18,7 @@ pub use self::tui::TuiSubCommand; pub use account::AccountSubCommand; pub use api_server::ApiServerSubCommand; pub use dao::DAOSubCommand; +pub use index::IndexSubCommand; pub use mock_tx::MockTxSubCommand; pub use molecule::MoleculeSubCommand; pub use plugin::PluginSubCommand; diff --git a/src/subcommands/wallet/index.rs b/src/subcommands/wallet/index.rs index bcf7318a..a7999049 100644 --- a/src/subcommands/wallet/index.rs +++ b/src/subcommands/wallet/index.rs @@ -1,3 +1,4 @@ +use std::fs; use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; @@ -35,12 +36,24 @@ pub fn start_index_thread( loop { // Wait first request match try_recv(&receiver, &mut rpc_client) { - Some(true) => { + Some((true, rebuild)) => { + if rebuild { + if let Err(err) = remove_db(&index_dir, &mut rpc_client) { + log::error!("remove database failed: {}", err); + } + } state.write().stop(); log::info!("Index database thread stopped"); return; } - Some(false) => break, + Some((false, rebuild)) => { + if rebuild { + if let Err(err) = remove_db(&index_dir, &mut rpc_client) { + log::error!("remove database failed: {}", err); + } + } + break; + } None => thread::sleep(Duration::from_millis(100)), } } @@ -53,12 +66,23 @@ pub fn start_index_thread( &state, &shutdown_clone, ) { - Ok(true) => { + Ok((true, rebuild)) => { + if rebuild { + if let Err(err) = remove_db(&index_dir, &mut rpc_client) { + log::error!("remove database failed: {}", err); + } + } state.write().stop(); log::info!("Index database thread stopped"); break; } - Ok(false) => {} + Ok((false, rebuild)) => { + if rebuild { + if let Err(err) = remove_db(&index_dir, &mut rpc_client) { + log::error!("remove database failed: {}", err); + } + } + } Err(err) => { state.write().error(err.clone()); log::info!("rpc call or db error: {:?}", err); @@ -81,9 +105,9 @@ fn process( index_dir: &PathBuf, state: &Arc>, shutdown: &Arc, -) -> Result { - if let Some(exit) = try_recv(&receiver, rpc_client) { - return Ok(exit); +) -> Result<(bool, bool), String> { + if let Some((exit, rebuild)) = try_recv(&receiver, rpc_client) { + return Ok((exit, rebuild)); } state.write().start_init(); @@ -117,10 +141,10 @@ fn process( db.update_tip(tip_header.clone()); while tip_header.number() > db.last_number().unwrap() { if shutdown.load(Ordering::Relaxed) { - return Ok(Some(true)); + return Ok(Some((true, false))); } - if let Some(exit) = try_recv(&receiver, rpc_client) { - return Ok(Some(exit)); + if let Some((exit, rebuild)) = try_recv(&receiver, rpc_client) { + return Ok(Some((exit, rebuild))); } if let Some(next_block) = rpc_client.get_block_by_number(db.next_number().unwrap())? @@ -140,17 +164,23 @@ fn process( .processing(db.last_header().cloned(), tip_header.number()); Ok(None) }) { - Ok(Some(exit)) => { - return Ok(exit); + Ok(Some((exit, rebuild))) => { + return Ok((exit, rebuild)); } Ok(None) => {} Err(Error::Index(IndexError::LongFork)) => { log::error!( - "\n{}!\nIf you running a dev chain and have removed the database directory (\"ckb/data/db\"), please also remove ckb-cli's index directory:\n {:?}", + r#" +{}! +If you running a dev chain and have removed the database directory (\"ckb/data/db\"), please also remove ckb-cli's index directory: + {:?} + +Or you can use follow command to rebuild index database: + ckb-cli index rebuild-current-database"#, IndexError::LongFork, index_dir.join(format!("{:#x}", genesis_hash)) ); - return Ok(true); + return Ok((true, false)); } Err(err) => { return Err(err.to_string()); @@ -159,25 +189,38 @@ fn process( } if shutdown.load(Ordering::Relaxed) { - return Ok(true); + return Ok((true, false)); } - if let Some(exit) = try_recv(&receiver, rpc_client) { - return Ok(exit); + if let Some((exit, rebuild)) = try_recv(&receiver, rpc_client) { + return Ok((exit, rebuild)); } thread::sleep(Duration::from_millis(100)); } } +fn remove_db(index_dir: &PathBuf, rpc_client: &mut HttpRpcClient) -> Result<(), String> { + let genesis_block: BlockView = rpc_client + .get_block_by_number(0)? + .expect("Can not get genesis block?") + .into(); + let genesis_info = GenesisInfo::from_block(&genesis_block).unwrap(); + let genesis_hash: H256 = genesis_info.header().hash().unpack(); + let db_dir = index_dir.join(format!("{:#x}", genesis_hash)); + log::info!("remove index database: {:?}", db_dir); + fs::remove_dir_all(&db_dir).map_err(|err| err.to_string())?; + Ok(()) +} + fn try_recv( receiver: &Receiver>, rpc_client: &mut HttpRpcClient, -) -> Option { +) -> Option<(bool, bool)> { match receiver.try_recv() { Ok(request) => Some(process_request(request, rpc_client)), Err(err) => { if err.is_disconnected() { log::info!("Sender dropped, exit index thread"); - Some(true) + Some((true, false)) } else { None } @@ -188,7 +231,7 @@ fn try_recv( fn process_request( request: Request, rpc_client: &mut HttpRpcClient, -) -> bool { +) -> (bool, bool) { let Request { responder, arguments, @@ -198,8 +241,9 @@ fn process_request( if url != rpc_client.url() { *rpc_client = HttpRpcClient::new(url); } - responder.send(IndexResponse::Ok).is_err() + (responder.send(IndexResponse::Ok).is_err(), false) } - IndexRequest::Kick => false, + IndexRequest::RebuildCurrentDB => (responder.send(IndexResponse::Ok).is_err(), true), + IndexRequest::Kick => (false, false), } } diff --git a/src/subcommands/wallet/mod.rs b/src/subcommands/wallet/mod.rs index 381f166e..fd3b9692 100644 --- a/src/subcommands/wallet/mod.rs +++ b/src/subcommands/wallet/mod.rs @@ -13,7 +13,7 @@ use ckb_types::{ prelude::*, H160, H256, }; -use clap::{App, AppSettings, Arg, ArgMatches}; +use clap::{App, Arg, ArgMatches}; use serde::{Deserialize, Serialize}; use super::{CliSubCommand, Output}; @@ -24,7 +24,7 @@ use crate::utils::{ AddressParser, ArgParser, CapacityParser, FixedHashParser, FromStrParser, PrivkeyPathParser, PrivkeyWrapper, }, - index::IndexController, + index::{with_db, IndexController}, other::{ check_capacity, get_address, get_arg_value, get_live_cell_with_cache, get_max_mature_number, get_network_type, get_privkey_signer, get_to_data, is_mature, @@ -90,22 +90,15 @@ impl<'a> WalletSubCommand<'a> { where F: FnOnce(IndexDatabase) -> T, { - if self.wait_for_sync { - sync_to_tip(&self.index_controller)?; - } - let network_type = get_network_type(self.rpc_client)?; let genesis_info = self.genesis_info()?; - let genesis_hash: H256 = genesis_info.header().hash().unpack(); - with_index_db(&self.index_dir, genesis_hash, |backend, cf| { - let db = IndexDatabase::from_db(backend, cf, network_type, genesis_info, false)?; - Ok(func(db)) - }) - .map_err(|_err| { - format!( - "Index database may not ready, sync process: {}", - self.index_controller.state().read().to_string() - ) - }) + with_db( + func, + self.rpc_client, + genesis_info, + &self.index_dir, + self.index_controller.clone(), + self.wait_for_sync, + ) } pub fn subcommand() -> App<'static> { @@ -162,10 +155,6 @@ impl<'a> WalletSubCommand<'a> { .long("fast-mode") .about("Only visit current range (by --from and --to) of live cells"), ), - // Move to index subcommand - App::new("db-metrics") - .about("Show index database metrics") - .setting(AppSettings::Hidden), App::new("top-capacity") .about("Show top n capacity owned by lock script hash") .arg(arg::top_n()), @@ -789,11 +778,6 @@ impl<'a> CliSubCommand for WalletSubCommand<'a> { })?; Ok(Output::new_output(resp)) } - ("db-metrics", _) => { - let metrcis = self.with_db(|db| db.get_metrics(None))?; - let resp = serde_json::to_value(metrcis).map_err(|err| err.to_string())?; - Ok(Output::new_output(resp)) - } _ => Err(Self::subcommand().generate_usage()), } } diff --git a/src/utils/index.rs b/src/utils/index.rs index dd8a6ec7..e398194c 100644 --- a/src/utils/index.rs +++ b/src/utils/index.rs @@ -1,9 +1,13 @@ use std::fmt; +use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::{Duration, Instant}; +use super::other::{get_network_type, sync_to_tip}; +use ckb_index::{with_index_db, IndexDatabase}; +use ckb_sdk::{GenesisInfo, HttpRpcClient}; use ckb_types::{ core::{service::Request, HeaderView}, prelude::*, @@ -15,6 +19,7 @@ use serde_derive::{Deserialize, Serialize}; pub enum IndexRequest { Kick, + RebuildCurrentDB, UpdateUrl(String), } @@ -198,3 +203,31 @@ impl IndexController { } } } + +pub fn with_db( + func: F, + rpc_client: &mut HttpRpcClient, + genesis_info: GenesisInfo, + index_dir: &PathBuf, + index_controller: IndexController, + wait_for_sync: bool, +) -> Result +where + F: FnOnce(IndexDatabase) -> T, +{ + if wait_for_sync { + sync_to_tip(&index_controller)?; + } + let network_type = get_network_type(rpc_client)?; + let genesis_hash: H256 = genesis_info.header().hash().unpack(); + with_index_db(&index_dir, genesis_hash, |backend, cf| { + let db = IndexDatabase::from_db(backend, cf, network_type, genesis_info, false)?; + Ok(func(db)) + }) + .map_err(|_err| { + format!( + "Index database may not ready, sync process: {}", + index_controller.state().read().to_string() + ) + }) +} From db7de0c306126bc7537db8b7559078d8162d959a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2020 21:23:11 +0000 Subject: [PATCH 04/18] chore(deps): bump regex from 1.3.9 to 1.4.2 Bumps [regex](https://github.com/rust-lang/regex) from 1.3.9 to 1.4.2. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.3.9...1.4.2) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e066c41..9e47e5a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2386,9 +2386,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.9" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" dependencies = [ "aho-corasick", "memchr", @@ -2398,9 +2398,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" [[package]] name = "remove_dir_all" From a5eb37e99e539d7b85b2d7b08b71e255f3b94858 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Fri, 23 Oct 2020 15:42:42 +0800 Subject: [PATCH 05/18] fix: Fix `account bip44-addresses` subcommand force require password --- ckb-index/src/lib.rs | 1 + src/main.rs | 2 ++ src/plugin/builtin.rs | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ckb-index/src/lib.rs b/ckb-index/src/lib.rs index ceecff5d..b55d65d8 100644 --- a/ckb-index/src/lib.rs +++ b/ckb-index/src/lib.rs @@ -1,4 +1,5 @@ mod error; +#[allow(clippy::mutable_key_type)] mod index; mod kvdb; mod util; diff --git a/src/main.rs b/src/main.rs index 12220fb7..2e3a5963 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,7 +33,9 @@ use utils::{ mod interactive; mod plugin; +#[allow(clippy::mutable_key_type)] mod subcommands; +#[allow(clippy::mutable_key_type)] mod utils; fn main() -> Result<(), io::Error> { diff --git a/src/plugin/builtin.rs b/src/plugin/builtin.rs index 48dfcd90..1f2d7052 100644 --- a/src/plugin/builtin.rs +++ b/src/plugin/builtin.rs @@ -108,13 +108,13 @@ impl DefaultKeyStore { change_max_len, password, } => { - let password = - password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; keystore .get_ckb_root(&hash160, true) .cloned() .map_or_else( || { + let password = + password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; keystore .ckb_root_with_password(&hash160, password.as_bytes()) .map_err(|err| err.to_string()) @@ -135,13 +135,13 @@ impl DefaultKeyStore { change_length, password, } => { - let password = - password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; keystore .get_ckb_root(&hash160, true) .cloned() .map_or_else( || { + let password = + password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; keystore .ckb_root_with_password(&hash160, password.as_bytes()) .map_err(|err| err.to_string()) From 24099bb4db85810b67a4d8f83ad950c886460130 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Fri, 23 Oct 2020 16:12:02 +0800 Subject: [PATCH 06/18] fix: Handle get account list from plugin failed --- src/plugin/builtin.rs | 82 ++++++++++++++++++++----------------------- src/plugin/manager.rs | 22 +++++++----- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/src/plugin/builtin.rs b/src/plugin/builtin.rs index 1f2d7052..ce047201 100644 --- a/src/plugin/builtin.rs +++ b/src/plugin/builtin.rs @@ -107,26 +107,24 @@ impl DefaultKeyStore { change_last, change_max_len, password, - } => { - keystore - .get_ckb_root(&hash160, true) - .cloned() - .map_or_else( - || { - let password = - password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; - keystore - .ckb_root_with_password(&hash160, password.as_bytes()) - .map_err(|err| err.to_string()) - }, - Ok, - ) - .map(|ckb_root| { - ckb_root.derived_key_set(external_max_len, &change_last, change_max_len) - })? - .map(serilize_key_set) - .map_err(|err| err.to_string()) - } + } => keystore + .get_ckb_root(&hash160, true) + .cloned() + .map_or_else( + || { + let password = password + .ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; + keystore + .ckb_root_with_password(&hash160, password.as_bytes()) + .map_err(|err| err.to_string()) + }, + Ok, + ) + .map(|ckb_root| { + ckb_root.derived_key_set(external_max_len, &change_last, change_max_len) + })? + .map(serilize_key_set) + .map_err(|err| err.to_string()), KeyStoreRequest::DerivedKeySetByIndex { hash160, external_start, @@ -134,30 +132,28 @@ impl DefaultKeyStore { change_start, change_length, password, - } => { - keystore - .get_ckb_root(&hash160, true) - .cloned() - .map_or_else( - || { - let password = - password.ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; - keystore - .ckb_root_with_password(&hash160, password.as_bytes()) - .map_err(|err| err.to_string()) - }, - Ok, + } => keystore + .get_ckb_root(&hash160, true) + .cloned() + .map_or_else( + || { + let password = password + .ok_or_else(|| String::from(ERROR_KEYSTORE_REQUIRE_PASSWORD))?; + keystore + .ckb_root_with_password(&hash160, password.as_bytes()) + .map_err(|err| err.to_string()) + }, + Ok, + ) + .map(|ckb_root| { + ckb_root.derived_key_set_by_index( + external_start, + external_length, + change_start, + change_length, ) - .map(|ckb_root| { - ckb_root.derived_key_set_by_index( - external_start, - external_length, - change_start, - change_length, - ) - }) - .map(serilize_key_set) - } + }) + .map(serilize_key_set), KeyStoreRequest::ListAccount => { let mut accounts = keystore.get_accounts().iter().collect::>(); accounts.sort_by(|a, b| a.1.cmp(&b.1)); diff --git a/src/plugin/manager.rs b/src/plugin/manager.rs index 959e4b07..0173de3a 100644 --- a/src/plugin/manager.rs +++ b/src/plugin/manager.rs @@ -1294,14 +1294,20 @@ impl KeyStoreHandler { return Err("Mismatch default keystore response".to_string()); } if let Some(cfg) = self.actived_plugin() { - if let PluginResponse::BytesVec(accounts) = self.call(request)? { - all_accounts.extend( - accounts - .into_iter() - .map(|data| (data.into_bytes(), format!("[plugin]: {}", cfg.name))), - ); - } else { - return Err("Mismatch plugin keystore response".to_string()); + match self.call(request) { + Ok(PluginResponse::BytesVec(accounts)) => { + all_accounts.extend( + accounts + .into_iter() + .map(|data| (data.into_bytes(), format!("[plugin]: {}", cfg.name))), + ); + } + Ok(_) => { + return Err("Mismatch plugin keystore response".to_string()); + } + Err(err) => { + log::info!("Send request to plugin({}) failed: {}", cfg.name, err); + } } } Ok(all_accounts) From 35597179839552feaf145bf4f3efd12990dc33c7 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Fri, 23 Oct 2020 17:00:11 +0800 Subject: [PATCH 07/18] fix: Check account existence before send keystore request --- src/plugin/manager.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugin/manager.rs b/src/plugin/manager.rs index 0173de3a..731ad2a5 100644 --- a/src/plugin/manager.rs +++ b/src/plugin/manager.rs @@ -1229,6 +1229,7 @@ impl KeyStoreHandler { } if default_only || hash160_opt + .clone() .map(|hash160| self.has_account_in_default(hash160)) .transpose()? == Some(true) @@ -1243,6 +1244,11 @@ impl KeyStoreHandler { }; return result; } + if let Some(hash160) = hash160_opt { + if !self.has_account(hash160.clone())? { + return Err(format!("Account not found: {:#x}", hash160)); + } + } let request = ServiceRequest::Request { is_from_plugin: false, @@ -1265,6 +1271,20 @@ impl KeyStoreHandler { } } + pub fn has_account(&self, hash160: H160) -> Result { + let request = ServiceRequest::Request { + is_from_plugin: false, + plugin_name: String::from("default_keystore"), + request: PluginRequest::KeyStore(KeyStoreRequest::HasAccount(hash160)), + }; + match Request::call(&self.service_handler, request) { + Some(ServiceResponse::Response(PluginResponse::Error(error))) => Err(error.message), + Some(ServiceResponse::Response(PluginResponse::Boolean(has))) => Ok(has), + Some(_) => Err(String::from("Mismatch plugin response")), + None => Err(String::from("Send request error")), + } + } + pub fn has_account_in_default(&self, hash160: H160) -> Result { let request = PluginRequest::KeyStore(KeyStoreRequest::HasAccount(hash160)); if let Some((_, PluginResponse::Boolean(has))) = From 59f578d5fed373e55091d2381c1193b46e87aa96 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 16:48:19 +0800 Subject: [PATCH 08/18] chore: Update ckb to v0.39.0-rc1 --- Cargo.lock | 192 +++++++++++++++---------------------- Cargo.toml | 24 ++--- Makefile | 2 +- ckb-index/Cargo.toml | 4 +- ckb-sdk-types/Cargo.toml | 14 +-- ckb-sdk/Cargo.toml | 16 ++-- plugin-protocol/Cargo.toml | 4 +- test/Cargo.toml | 12 +-- test/src/spec/dao.rs | 12 +-- 9 files changed, 123 insertions(+), 157 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ec48cc9..990542e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,6 +189,12 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "blake2b-ref" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95916998c798756098a4eb1b3f2cd510659705a9817bf203d61abd30fbec3e7b" + [[package]] name = "blake2b-rs" version = "0.1.5" @@ -320,13 +326,13 @@ dependencies = [ [[package]] name = "ckb-build-info" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" [[package]] name = "ckb-chain-spec" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-crypto", "ckb-dao-utils", @@ -344,15 +350,15 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "0.38.0" +version = "0.39.0" dependencies = [ "ansi_term", "atty", @@ -418,8 +424,8 @@ dependencies = [ [[package]] name = "ckb-crypto" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-fixed-hash", "failure", @@ -431,30 +437,30 @@ dependencies = [ [[package]] name = "ckb-dao-utils" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "byteorder", "ckb-error", "ckb-types", - "enum-display-derive", + "derive_more", "failure", ] [[package]] name = "ckb-error" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-occupied-capacity", - "enum-display-derive", + "derive_more", "failure", ] [[package]] name = "ckb-fixed-hash" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -462,8 +468,8 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "failure", "faster-hex 0.4.1", @@ -472,8 +478,8 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-macros" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-fixed-hash-core", "proc-macro2 1.0.24", @@ -483,15 +489,16 @@ dependencies = [ [[package]] name = "ckb-hash" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ + "blake2b-ref", "blake2b-rs", ] [[package]] name = "ckb-index" -version = "0.38.0" +version = "0.39.0" dependencies = [ "bincode", "ckb-rocksdb", @@ -505,8 +512,8 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-types", "faster-hex 0.4.1", @@ -528,16 +535,16 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "log 0.4.11", ] [[package]] name = "ckb-occupied-capacity" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -545,16 +552,16 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-occupied-capacity-core", "quote 1.0.3", @@ -563,8 +570,8 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "byteorder", "ckb-hash", @@ -576,16 +583,17 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "numext-fixed-uint", + "serde", ] [[package]] name = "ckb-resource" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -609,8 +617,8 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "byteorder", "ckb-chain-spec", @@ -629,7 +637,7 @@ dependencies = [ [[package]] name = "ckb-sdk" -version = "0.38.0" +version = "0.39.0" dependencies = [ "aes-ctr", "bech32", @@ -660,7 +668,7 @@ dependencies = [ [[package]] name = "ckb-sdk-types" -version = "0.38.0" +version = "0.39.0" dependencies = [ "ckb-crypto", "ckb-error", @@ -687,16 +695,16 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "bit-vec", "bytes 0.5.4", @@ -715,8 +723,8 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" dependencies = [ "linked-hash-map", "parking_lot 0.7.1", @@ -725,9 +733,9 @@ dependencies = [ [[package]] name = "ckb-vm" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c8acac1ef10d936825955474c2a12c5bbde9b824a450b3b6dfe3724112d8ae5" +checksum = "bfc2fb181a6653bb13315dc7f60fbe32cd3d697553b24687613da984faf2a2c5" dependencies = [ "byteorder", "bytes 0.5.4", @@ -736,15 +744,15 @@ dependencies = [ "derive_more", "goblin", "libc", - "memmap", + "mapr", "scroll", ] [[package]] name = "ckb-vm-definitions" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e91a4ae2eb8a79ad9ba78471bff0eb82ea313a4d6a04b2d454c6553b13fa9" +checksum = "ea76d3867d00736c64876ab0cd304be73691b91990a90ebbf100d36af85fdb05" [[package]] name = "clap" @@ -1022,16 +1030,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "enum-display-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f76eb63c4bfc6fce5000f106254701b741fc9a65ee08445fde0ff39e583f1c" -dependencies = [ - "quote 0.3.15", - "syn 0.11.11", -] - [[package]] name = "env_logger" version = "0.6.2" @@ -1603,6 +1601,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "mapr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a28a55dbc005b2f6f123c4058933d57add373d362f6fd3a76aab4fe6973500" +dependencies = [ + "libc", + "winapi 0.3.8", +] + [[package]] name = "matches" version = "0.1.8" @@ -1621,16 +1629,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi 0.3.8", -] - [[package]] name = "memoffset" version = "0.5.4" @@ -2132,12 +2130,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" - [[package]] name = "quote" version = "0.6.13" @@ -2572,18 +2564,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.17.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2932dc07acd2066ff2e3921a4419606b220ba6cd03a9935123856cc534877056" +checksum = "c6179428c22c73ac0fbb7b5579a56353ce78ba29759b3b8575183336ea74cdfb" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.1.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab2c26f0d3552a0f12e639ae8a64afc2e3db9c52fe32f5fc6c289d38519f220" +checksum = "11553d210db090930f4432bea123b31f70bbf693ace14504ea2a35e796c28dd2" dependencies = [ "cc", ] @@ -2787,17 +2779,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -dependencies = [ - "quote 0.3.15", - "synom", - "unicode-xid 0.0.4", -] - [[package]] name = "syn" version = "0.15.44" @@ -2831,15 +2812,6 @@ dependencies = [ "syn 1.0.48", ] -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -dependencies = [ - "unicode-xid 0.0.4", -] - [[package]] name = "synstructure" version = "0.12.3" @@ -3140,9 +3112,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] @@ -3223,12 +3195,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" - [[package]] name = "unicode-xid" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index bc5ac39f..de7efc1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,20 @@ [package] name = "ckb-cli" -version = "0.38.0" +version = "0.39.0" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" [dependencies] -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } ckb-sdk = { path = "ckb-sdk" } ckb-index = { path = "ckb-index" } plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol" } @@ -23,7 +23,7 @@ jsonrpc-core = "10.1" jsonrpc-derive = "10.1" jsonrpc-http-server = "10.1" jsonrpc-server-utils = "10.1" -secp256k1 = {version = "0.17.0" } +secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" env_logger = "0.6" crossbeam-channel = "0.3" @@ -57,7 +57,7 @@ tui = "0.6.0" termion = "1.5" [build-dependencies] -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } [workspace] members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"] diff --git a/Makefile b/Makefile index 8c4148c8..4277ce7b 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ci: fmt clippy test security-audit git diff --exit-code Cargo.lock integration: - bash devtools/ci/integration.sh v0.38.0-rc1 + bash devtools/ci/integration.sh v0.39.0-rc1 prod: ## Build binary with release profile. cargo build --release diff --git a/ckb-index/Cargo.toml b/ckb-index/Cargo.toml index a5391a7f..bc0456d3 100644 --- a/ckb-index/Cargo.toml +++ b/ckb-index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-index" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -11,6 +11,6 @@ serde_derive = "1.0" bincode = "1.1.4" log = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } ckb-sdk = { path = "../ckb-sdk" } rocksdb = { package = "ckb-rocksdb", version = "=0.13.0", features = ["snappy"] } diff --git a/ckb-sdk-types/Cargo.toml b/ckb-sdk-types/Cargo.toml index f83c2bc2..7d13543c 100644 --- a/ckb-sdk-types/Cargo.toml +++ b/ckb-sdk-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk-types" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -9,11 +9,11 @@ license = "MIT" serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } [dev-dependencies] -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index a80c7c6d..8bbd0411 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -12,7 +12,7 @@ serde_json = "1.0" bech32 = "0.6.0" log = "0.4.6" reqwest = "0.9" -secp256k1 = "0.17.0" +secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" fnv = "1.0.3" aes-ctr = "0.3.0" @@ -25,10 +25,10 @@ uuid = { version = "0.7.4", features = ["v4"] } chrono = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } ckb-sdk-types = { path = "../ckb-sdk-types" } diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index f3974e51..49cd9dbd 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" [dependencies] ckb-index = { path = "../ckb-index" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/test/Cargo.toml b/test/Cargo.toml index 416c6205..ab6cc002 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cli-test" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian "] edition = "2018" @@ -14,11 +14,11 @@ env_logger = "0.6" toml = "0.5.0" serde_yaml = "0.8.9" ckb-sdk = { path = "../ckb-sdk" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", features=["with_sentry"], tag = "v0.39.0-rc1" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } regex = "1.1.6" # Prevent this from interfering with workspaces diff --git a/test/src/spec/dao.rs b/test/src/spec/dao.rs index 91436eef..a9489fb4 100644 --- a/test/src/spec/dao.rs +++ b/test/src/spec/dao.rs @@ -46,8 +46,8 @@ impl Spec for DaoPrepareOne { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } } @@ -93,8 +93,8 @@ impl Spec for DaoPrepareMultiple { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } } @@ -135,8 +135,8 @@ impl Spec for DaoWithdrawMultiple { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } } From ad3afb714b45cea5c05ceef42889ae71db99af13 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 17:36:40 +0800 Subject: [PATCH 09/18] feat: Add get_consensus and get_raw_tx_pool rpc methods --- ckb-sdk/src/rpc/client.rs | 23 +++++- ckb-sdk/src/rpc/types.rs | 151 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 4 deletions(-) diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index 6aabaf09..501971e7 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -1,9 +1,9 @@ use ckb_jsonrpc_types::{ BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellOutputWithOutPoint, - CellTransaction, CellWithStatus, ChainInfo, EpochNumber, EpochView, ExtraLoggerConfig, - HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, MainLoggerConfig, OutPoint, - PeerState, RemoteNode, Script, Timestamp, Transaction, TransactionProof, TransactionWithStatus, - TxPoolInfo, Uint64, Version, + CellTransaction, CellWithStatus, ChainInfo, Consensus, EpochNumber, EpochView, + ExtraLoggerConfig, HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, + MainLoggerConfig, OutPoint, PeerState, RemoteNode, Script, Timestamp, Transaction, + TransactionProof, TransactionWithStatus, TxPoolInfo, TxPoolVerbosity, Uint64, Version, }; use super::types; @@ -87,6 +87,7 @@ jsonrpc!(pub struct RawHttpRpcClient { ) -> TransactionProof; pub fn verify_transaction_proof(&mut self, tx_proof: TransactionProof) -> Vec; pub fn get_fork_block(&mut self, block_hash: H256) -> Option; + pub fn get_consensus(&mut self) -> Consensus; // Indexer pub fn deindex_lock_hash(&mut self, lock_hash: H256) -> (); @@ -132,6 +133,7 @@ jsonrpc!(pub struct RawHttpRpcClient { // Pool pub fn send_transaction(&mut self, tx: Transaction) -> H256; pub fn tx_pool_info(&mut self) -> TxPoolInfo; + pub fn get_raw_tx_pool(&mut self) -> TxPoolVerbosity; // Stats pub fn get_blockchain_info(&mut self) -> ChainInfo; @@ -294,6 +296,12 @@ impl HttpRpcClient { .map(|opt| opt.map(Into::into)) .map_err(|err| err.to_string()) } + pub fn get_consensus(&mut self) -> Result { + self.client + .get_consensus() + .map(Into::into) + .map_err(|err| err.to_string()) + } // Indexer #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] @@ -424,6 +432,13 @@ impl HttpRpcClient { .map_err(|err| err.to_string()) } + pub fn get_raw_tx_pool(&mut self) -> Result { + self.client + .get_raw_tx_pool() + .map(Into::into) + .map_err(|err| err.to_string()) + } + // Stats pub fn get_blockchain_info(&mut self) -> Result { self.client diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index 01be16d6..d2d505cc 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -1,4 +1,5 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; +use std::collections::HashMap; use std::convert::TryFrom; pub use ckb_jsonrpc_types::{ @@ -13,6 +14,7 @@ use crate::constants::{DAO_TYPE_HASH, MULTISIG_TYPE_HASH, SIGHASH_TYPE_HASH}; type Version = u32; type BlockNumber = u64; type EpochNumber = u64; +type Cycle = u64; type AlertId = u32; type AlertPriority = u32; type Uint32 = u32; @@ -655,6 +657,102 @@ impl From for rpc_types::MerkleProof { } } +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct ProposalWindow { + /// The closest distance between the proposal and the commitment. + pub closest: BlockNumber, + /// The farthest distance between the proposal and the commitment. + pub farthest: BlockNumber, +} +impl From for ProposalWindow { + fn from(json: rpc_types::ProposalWindow) -> ProposalWindow { + ProposalWindow { + closest: json.closest.into(), + farthest: json.farthest.into(), + } + } +} + +/// Consensus defines various parameters that influence chain consensus +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct Consensus { + /// Names the network. + pub id: String, + /// The genesis block hash + pub genesis_hash: H256, + /// The dao type hash + pub dao_type_hash: Option, + /// The secp256k1_blake160_sighash_all_type_hash + pub secp256k1_blake160_sighash_all_type_hash: Option, + /// The secp256k1_blake160_multisig_all_type_hash + pub secp256k1_blake160_multisig_all_type_hash: Option, + /// The initial primary_epoch_reward + pub initial_primary_epoch_reward: Capacity, + /// The secondary primary_epoch_reward + pub secondary_epoch_reward: Capacity, + /// The maximum amount of uncles allowed for a block + pub max_uncles_num: Uint64, + /// The expected orphan_rate + pub orphan_rate_target: core::RationalU256, + /// The expected epoch_duration + pub epoch_duration_target: Uint64, + /// The two-step-transaction-confirmation proposal window + pub tx_proposal_window: ProposalWindow, + /// The two-step-transaction-confirmation proposer reward ratio + pub proposer_reward_ratio: core::RationalU256, + /// The Cellbase maturity + pub cellbase_maturity: EpochNumberWithFraction, + /// This parameter indicates the count of past blocks used in the median time calculation + pub median_time_block_count: Uint64, + /// Maximum cycles that all the scripts in all the commit transactions can take + pub max_block_cycles: Cycle, + /// Maximum number of bytes to use for the entire block + pub max_block_bytes: Uint64, + /// The block version number supported + pub block_version: Version, + /// The tx version number supported + pub tx_version: Version, + /// The "TYPE_ID" in hex + pub type_id_code_hash: H256, + /// The Limit to the number of proposals per block + pub max_block_proposals_limit: Uint64, + /// Primary reward is cut in half every halving_interval epoch + pub primary_epoch_reward_halving_interval: Uint64, + /// Keep difficulty be permanent if the pow is dummy + pub permanent_difficulty_in_dummy: bool, +} +impl From for Consensus { + fn from(json: rpc_types::Consensus) -> Consensus { + Consensus { + id: json.id, + genesis_hash: json.genesis_hash, + dao_type_hash: json.dao_type_hash, + secp256k1_blake160_sighash_all_type_hash: json.secp256k1_blake160_sighash_all_type_hash, + secp256k1_blake160_multisig_all_type_hash: json + .secp256k1_blake160_multisig_all_type_hash, + initial_primary_epoch_reward: json.initial_primary_epoch_reward.into(), + secondary_epoch_reward: json.secondary_epoch_reward.into(), + max_uncles_num: json.max_uncles_num.into(), + orphan_rate_target: json.orphan_rate_target, + epoch_duration_target: json.epoch_duration_target.into(), + tx_proposal_window: json.tx_proposal_window.into(), + proposer_reward_ratio: json.proposer_reward_ratio, + cellbase_maturity: json.cellbase_maturity.into(), + median_time_block_count: json.median_time_block_count.into(), + max_block_cycles: json.max_block_cycles.into(), + max_block_bytes: json.max_block_bytes.into(), + block_version: json.block_version.into(), + tx_version: json.tx_version.into(), + type_id_code_hash: json.type_id_code_hash, + max_block_proposals_limit: json.max_block_proposals_limit.into(), + primary_epoch_reward_halving_interval: json + .primary_epoch_reward_halving_interval + .into(), + permanent_difficulty_in_dummy: json.permanent_difficulty_in_dummy, + } + } +} + // ========= // cell.rs // ========= @@ -1052,6 +1150,59 @@ impl From for TxPoolInfo { } } +/// Transaction verbose info +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Debug)] +pub struct TxVerbosity { + /// Consumed cycles. + pub cycles: Uint64, + /// The transaction serialized size in block. + pub size: Uint64, + /// The transaction fee. + pub fee: Capacity, + /// Size of in-tx-pool ancestor transactions + pub ancestors_size: Uint64, + /// Cycles of in-tx-pool ancestor transactions + pub ancestors_cycles: Uint64, + /// Number of in-tx-pool ancestor transactions + pub ancestors_count: Uint64, +} +impl From for TxVerbosity { + fn from(json: rpc_types::TxVerbosity) -> TxVerbosity { + TxVerbosity { + cycles: json.cycles.into(), + size: json.size.into(), + fee: json.fee.into(), + ancestors_size: json.ancestors_size.into(), + ancestors_cycles: json.ancestors_cycles.into(), + ancestors_count: json.ancestors_count.into(), + } + } +} + +#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct RawTxPool { + /// Pending tx verbose info + pub pending: HashMap, + /// Proposed tx verbose info + pub proposed: HashMap, +} +impl From for RawTxPool { + fn from(json: rpc_types::TxPoolVerbosity) -> RawTxPool { + RawTxPool { + pending: json + .pending + .into_iter() + .map(|(key, value)| (key, value.into())) + .collect(), + proposed: json + .proposed + .into_iter() + .map(|(key, value)| (key, value.into())) + .collect(), + } + } +} + // ========= // sync.rs // ========= From 19fd55453f3f1ae8f75bc3db9c9f15c91abdb7f7 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 17:50:50 +0800 Subject: [PATCH 10/18] feat: Add get_consensus and get_raw_tx_pool rpc methods to subcommands --- src/subcommands/rpc.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 0b3bda12..01bdfcd0 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -183,6 +183,8 @@ impl<'a> RpcSubCommand<'a> { App::new("get_fork_block") .about("Returns the information about a fork block by hash") .arg(arg_hash.clone().about("The fork block hash")), + App::new("get_consensus") + .about("Return various consensus parameters"), // [Indexer] App::new("deindex_lock_hash") .arg(arg_hash.clone().about("Lock script hash")) @@ -275,6 +277,7 @@ impl<'a> RpcSubCommand<'a> { App::new("ping_peers").about("Requests that a ping is sent to all connected peers, to measure ping time"), // [Pool] App::new("tx_pool_info").about("Get transaction pool information"), + App::new("get_raw_tx_pool").about("Returns all transaction ids in tx pool as a json array of string transaction ids"), // [`Stats`] App::new("get_blockchain_info").about("Get chain information"), // [`IntegrationTest`] @@ -600,6 +603,19 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { Ok(Output::new_output(resp)) } } + ("get_consensus", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + if is_raw_data { + let resp = self + .raw_rpc_client + .get_consensus() + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.get_consensus()?; + Ok(Output::new_output(resp)) + } + } // [Indexer] ("deindex_lock_hash", Some(m)) => { let hash: H256 = FixedHashParser::::default().from_matches(m, "hash")?; @@ -803,6 +819,19 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { Ok(Output::new_output(resp)) } } + ("get_raw_tx_pool", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + if is_raw_data { + let resp = self + .raw_rpc_client + .get_raw_tx_pool() + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.get_raw_tx_pool()?; + Ok(Output::new_output(resp)) + } + } // [Stats] ("get_blockchain_info", Some(m)) => { let is_raw_data = is_raw_data || m.is_present("raw-data"); From 881808fcfa5e3437a8c78ff5d8a9b70f655f039f Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 18:49:41 +0800 Subject: [PATCH 11/18] fix: Fix RawTxPool strucutre --- ckb-sdk/src/rpc/client.rs | 10 +++++----- ckb-sdk/src/rpc/types.rs | 36 ++++++++++++++++++++++++++++++------ src/subcommands/rpc.rs | 9 ++++++--- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index 501971e7..b1bf4f8c 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -2,8 +2,8 @@ use ckb_jsonrpc_types::{ BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellOutputWithOutPoint, CellTransaction, CellWithStatus, ChainInfo, Consensus, EpochNumber, EpochView, ExtraLoggerConfig, HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, - MainLoggerConfig, OutPoint, PeerState, RemoteNode, Script, Timestamp, Transaction, - TransactionProof, TransactionWithStatus, TxPoolInfo, TxPoolVerbosity, Uint64, Version, + MainLoggerConfig, OutPoint, PeerState, RawTxPool, RemoteNode, Script, Timestamp, Transaction, + TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, }; use super::types; @@ -133,7 +133,7 @@ jsonrpc!(pub struct RawHttpRpcClient { // Pool pub fn send_transaction(&mut self, tx: Transaction) -> H256; pub fn tx_pool_info(&mut self) -> TxPoolInfo; - pub fn get_raw_tx_pool(&mut self) -> TxPoolVerbosity; + pub fn get_raw_tx_pool(&mut self, verbose: Option) -> RawTxPool; // Stats pub fn get_blockchain_info(&mut self) -> ChainInfo; @@ -432,9 +432,9 @@ impl HttpRpcClient { .map_err(|err| err.to_string()) } - pub fn get_raw_tx_pool(&mut self) -> Result { + pub fn get_raw_tx_pool(&mut self, verbose: Option) -> Result { self.client - .get_raw_tx_pool() + .get_raw_tx_pool(verbose) .map(Into::into) .map_err(|err| err.to_string()) } diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index d2d505cc..69c391d5 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -3,8 +3,8 @@ use std::collections::HashMap; use std::convert::TryFrom; pub use ckb_jsonrpc_types::{ - self as rpc_types, Byte32, DepType, JsonBytes, ProposalShortId, ScriptHashType, TxStatus, - Uint128, + self as rpc_types, Byte32, DepType, JsonBytes, ProposalShortId, ScriptHashType, TxPoolIds, + TxStatus, Uint128, }; use ckb_types::{core, packed, prelude::*, H256, U256}; @@ -1180,15 +1180,15 @@ impl From for TxVerbosity { } #[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Debug)] -pub struct RawTxPool { +pub struct TxPoolVerbosity { /// Pending tx verbose info pub pending: HashMap, /// Proposed tx verbose info pub proposed: HashMap, } -impl From for RawTxPool { - fn from(json: rpc_types::TxPoolVerbosity) -> RawTxPool { - RawTxPool { +impl From for TxPoolVerbosity { + fn from(json: rpc_types::TxPoolVerbosity) -> TxPoolVerbosity { + TxPoolVerbosity { pending: json .pending .into_iter() @@ -1203,6 +1203,30 @@ impl From for RawTxPool { } } +/// All transactions in tx-pool. +/// +/// `RawTxPool` is equivalent to [`TxPoolIds`][] `|` [`TxPoolVerbosity`][]. +/// +/// [`TxPoolIds`]: struct.TxPoolIds.html +/// [`TxPoolVerbosity`]: struct.TxPoolVerbosity.html +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +#[serde(untagged)] +pub enum RawTxPool { + /// verbose = false + Ids(TxPoolIds), + /// verbose = true + Verbose(TxPoolVerbosity), +} + +impl From for RawTxPool { + fn from(json: rpc_types::RawTxPool) -> RawTxPool { + match json { + rpc_types::RawTxPool::Ids(ids) => RawTxPool::Ids(ids), + rpc_types::RawTxPool::Verbose(verbose) => RawTxPool::Verbose(verbose.into()), + } + } +} + // ========= // sync.rs // ========= diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 01bdfcd0..7d4df06c 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -277,7 +277,9 @@ impl<'a> RpcSubCommand<'a> { App::new("ping_peers").about("Requests that a ping is sent to all connected peers, to measure ping time"), // [Pool] App::new("tx_pool_info").about("Get transaction pool information"), - App::new("get_raw_tx_pool").about("Returns all transaction ids in tx pool as a json array of string transaction ids"), + App::new("get_raw_tx_pool") + .about("Returns all transaction ids in tx pool as a json array of string transaction ids") + .arg(Arg::with_name("verbose").long("verbose").about("True for a json object, false for array of transaction ids")), // [`Stats`] App::new("get_blockchain_info").about("Get chain information"), // [`IntegrationTest`] @@ -821,14 +823,15 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { } ("get_raw_tx_pool", Some(m)) => { let is_raw_data = is_raw_data || m.is_present("raw-data"); + let verbose = m.is_present("verbose"); if is_raw_data { let resp = self .raw_rpc_client - .get_raw_tx_pool() + .get_raw_tx_pool(Some(verbose)) .map_err(|err| err.to_string())?; Ok(Output::new_output(resp)) } else { - let resp = self.rpc_client.get_raw_tx_pool()?; + let resp = self.rpc_client.get_raw_tx_pool(Some(verbose))?; Ok(Output::new_output(resp)) } } From b6ce3c6a20a3e67332caadcedaf96eeeb9dc4f33 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 21:16:16 +0800 Subject: [PATCH 12/18] chore: Remove Cargo.lock before clippy check in test directory --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4277ce7b..2398594a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ fmt: clippy: RUSTFLAGS='-F warnings' cargo clippy --all --tests -- ${CLIPPY_OPTS} - cd test && RUSTFLAGS='-F warnings' cargo clippy --all -- ${CLIPPY_OPTS} + cp -f Cargo.lock test/Cargo.lock && cd test && RUSTFLAGS='-F warnings' cargo clippy --all -- ${CLIPPY_OPTS} test: RUSTFLAGS='-F warnings' RUST_BACKTRACE=full cargo test --all From d13a2531a08ce3df8563ec179230583147cbfd7f Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Tue, 8 Dec 2020 23:59:44 +0800 Subject: [PATCH 13/18] chore: Unify the naming --- src/subcommands/index.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/subcommands/index.rs b/src/subcommands/index.rs index 62c12216..754f38d0 100644 --- a/src/subcommands/index.rs +++ b/src/subcommands/index.rs @@ -47,10 +47,9 @@ impl<'a> IndexSubCommand<'a> { .about("Index database management") .subcommands(vec![ App::new("db-metrics").about("Show index database metrics"), - App::new("current-database-info") + App::new("current-db-info") .about("Show current index database's basic information"), - App::new("rebuild-current-database") - .about("Remove and rebuild current index database"), + App::new("rebuild-current-db").about("Remove and rebuild current index database"), ]) } @@ -91,11 +90,11 @@ impl<'a> IndexSubCommand<'a> { impl<'a> CliSubCommand for IndexSubCommand<'a> { fn process(&mut self, matches: &ArgMatches, _debug: bool) -> Result { match matches.subcommand() { - ("current-database-info", _) => Ok(Output::new_output(serde_json::json!({ + ("current-db-info", _) => Ok(Output::new_output(serde_json::json!({ "directory": self.db_dir()?.to_string_lossy(), "state": self.index_state.read().to_string(), }))), - ("rebuild-current-database", _) => { + ("rebuild-current-db", _) => { Request::call( self.index_controller.sender(), IndexRequest::RebuildCurrentDB, From 1c6b5a3b3c46b87e552e1fdc70507f3b6f1b9be9 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Wed, 9 Dec 2020 11:34:11 +0800 Subject: [PATCH 14/18] chore: Update Cargo.lock in test directory when run clippy --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index be0ec8ce..d274a023 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ fmt: clippy: RUSTFLAGS='-F warnings' cargo clippy --all --tests -- ${CLIPPY_OPTS} - cd test && RUSTFLAGS='-F warnings' cargo clippy --all -- ${CLIPPY_OPTS} + cp -f Cargo.lock test/Cargo.lock && cd test && RUSTFLAGS='-F warnings' cargo clippy --all -- ${CLIPPY_OPTS} test: RUSTFLAGS='-F warnings' RUST_BACKTRACE=full cargo test --all From b82c4fc165e5c668a6af0e40ba29470bb6f7df86 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Wed, 9 Dec 2020 14:40:08 +0800 Subject: [PATCH 15/18] fix: Fix keystore cache inconsistent --- Cargo.lock | 8 ++++---- ckb-sdk/src/wallet/keystore/mod.rs | 3 ++- src/subcommands/account.rs | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ec48cc9..a8880fef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1706,9 +1706,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -1747,9 +1747,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.33" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +checksum = "d7cf75f38f16cb05ea017784dc6dbfd354f76c223dba37701734c4f5a9337d02" dependencies = [ "cfg-if", "libc", diff --git a/ckb-sdk/src/wallet/keystore/mod.rs b/ckb-sdk/src/wallet/keystore/mod.rs index 7c9b208e..91b6bfd5 100644 --- a/ckb-sdk/src/wallet/keystore/mod.rs +++ b/ckb-sdk/src/wallet/keystore/mod.rs @@ -72,6 +72,7 @@ impl KeyStore { let abs_path = self.storage.store_key(key.filename(), &key, password)?; let hash160 = key.hash160().clone(); self.files.insert(hash160.clone(), abs_path); + self.ckb_roots.insert(hash160.clone(), key.ckb_root()); Ok(hash160) } pub fn get_accounts(&mut self) -> &HashMap { @@ -294,7 +295,7 @@ impl KeyStore { } // NOTE: assume refresh keystore directory is not a hot action - fn refresh_dir(&mut self) -> Result<(), Error> { + pub fn refresh_dir(&mut self) -> Result<(), Error> { let mut files = HashMap::default(); let mut ckb_roots = HashMap::default(); for entry in fs::read_dir(&self.keys_dir)? { diff --git a/src/subcommands/account.rs b/src/subcommands/account.rs index b0f36354..d4d3561b 100644 --- a/src/subcommands/account.rs +++ b/src/subcommands/account.rs @@ -184,6 +184,9 @@ impl<'a> CliSubCommand for AccountSubCommand<'a> { let only_mainnet_address = m.is_present("only-mainnet-address"); let only_testnet_address = m.is_present("only-testnet-address"); let partial_fields = only_mainnet_address || only_testnet_address; + self.key_store + .refresh_dir() + .map_err(|err| err.to_string())?; let resp = accounts .into_iter() .enumerate() From abb370b138d5f549cf9e5ea0331a8d3ba2fbcc34 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Thu, 17 Dec 2020 15:30:54 +0800 Subject: [PATCH 16/18] chore: Update ckb to v0.39.0-rc2 --- Cargo.lock | 63 +++++++++++++++++--------------- Cargo.toml | 20 +++++----- Makefile | 2 +- ckb-index/Cargo.toml | 2 +- ckb-sdk-types/Cargo.toml | 12 +++--- ckb-sdk-types/src/transaction.rs | 10 ++++- ckb-sdk/Cargo.toml | 13 ++++--- ckb-sdk/src/transaction.rs | 6 +-- plugin-protocol/Cargo.toml | 4 +- test/Cargo.toml | 10 ++--- 10 files changed, 76 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 990542e4..eca27252 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,6 +58,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "anyhow" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" + [[package]] name = "arrayref" version = "0.3.6" @@ -327,12 +333,12 @@ dependencies = [ [[package]] name = "ckb-build-info" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" [[package]] name = "ckb-chain-spec" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-crypto", "ckb-dao-utils", @@ -343,7 +349,6 @@ dependencies = [ "ckb-rational", "ckb-resource", "ckb-types", - "failure", "serde", "toml", ] @@ -351,7 +356,7 @@ dependencies = [ [[package]] name = "ckb-channel" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "crossbeam-channel", ] @@ -425,42 +430,41 @@ dependencies = [ [[package]] name = "ckb-crypto" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash", - "failure", "faster-hex 0.4.1", "lazy_static", "rand 0.6.5", "secp256k1", + "thiserror", ] [[package]] name = "ckb-dao-utils" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-error", "ckb-types", - "derive_more", - "failure", ] [[package]] name = "ckb-error" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ + "anyhow", "ckb-occupied-capacity", "derive_more", - "failure", + "thiserror", ] [[package]] name = "ckb-fixed-hash" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -469,17 +473,17 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ - "failure", "faster-hex 0.4.1", "serde", + "thiserror", ] [[package]] name = "ckb-fixed-hash-macros" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash-core", "proc-macro2 1.0.24", @@ -490,7 +494,7 @@ dependencies = [ [[package]] name = "ckb-hash" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -513,7 +517,7 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-types", "faster-hex 0.4.1", @@ -536,7 +540,7 @@ dependencies = [ [[package]] name = "ckb-logger" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "log 0.4.11", ] @@ -544,7 +548,7 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -553,7 +557,7 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "serde", ] @@ -561,7 +565,7 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-macros" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-occupied-capacity-core", "quote 1.0.3", @@ -571,7 +575,7 @@ dependencies = [ [[package]] name = "ckb-pow" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-hash", @@ -584,7 +588,7 @@ dependencies = [ [[package]] name = "ckb-rational" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "numext-fixed-uint", "serde", @@ -593,7 +597,7 @@ dependencies = [ [[package]] name = "ckb-resource" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -618,7 +622,7 @@ dependencies = [ [[package]] name = "ckb-script" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-chain-spec", @@ -629,7 +633,6 @@ dependencies = [ "ckb-types", "ckb-vm", "ckb-vm-definitions", - "failure", "faster-hex 0.4.1", "goblin", "serde", @@ -645,6 +648,7 @@ dependencies = [ "byteorder", "chrono", "ckb-crypto", + "ckb-error", "ckb-hash", "ckb-jsonrpc-types", "ckb-resource", @@ -696,7 +700,7 @@ dependencies = [ [[package]] name = "ckb-traits" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-types", ] @@ -704,7 +708,7 @@ dependencies = [ [[package]] name = "ckb-types" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "bit-vec", "bytes 0.5.4", @@ -714,7 +718,6 @@ dependencies = [ "ckb-hash", "ckb-occupied-capacity", "ckb-rational", - "failure", "merkle-cbt", "molecule", "numext-fixed-uint", @@ -724,7 +727,7 @@ dependencies = [ [[package]] name = "ckb-util" version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc1#6752ba1bb88ba1f02ffa7dbbfe336cafcc852f04" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "linked-hash-map", "parking_lot 0.7.1", diff --git a/Cargo.toml b/Cargo.toml index de7efc1a..2e2201a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,15 +6,15 @@ authors = ["Linfeng Qian ", "Nervos Core Dev Option<(Bytes, Byte32)> { + fn load_cell_data(&self, cell: &CellMeta) -> Option { cell.mem_cell_data .as_ref() .map(ToOwned::to_owned) .or_else(|| self.get_cell_data(&cell.out_point)) } - fn get_cell_data(&self, out_point: &OutPoint) -> Option<(Bytes, Byte32)> { + fn get_cell_data(&self, out_point: &OutPoint) -> Option { self.required_cells .get(out_point) .and_then(|cell_meta| cell_meta.mem_cell_data.clone()) } + + fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option { + self.required_cells + .get(out_point) + .and_then(|cell_meta| cell_meta.mem_cell_data_hash.clone()) + } } impl HeaderProvider for Resource { diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index 8bbd0411..a103c3f9 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -25,10 +25,11 @@ uuid = { version = "0.7.4", features = ["v4"] } chrono = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } ckb-sdk-types = { path = "../ckb-sdk-types" } diff --git a/ckb-sdk/src/transaction.rs b/ckb-sdk/src/transaction.rs index b77820de..1bffc150 100644 --- a/ckb-sdk/src/transaction.rs +++ b/ckb-sdk/src/transaction.rs @@ -1,3 +1,4 @@ +use ckb_error::OtherError; use ckb_hash::new_blake2b; use ckb_jsonrpc_types as rpc_types; use ckb_script::TransactionScriptsVerifier; @@ -8,7 +9,6 @@ use ckb_types::{ prelude::*, H160, H256, }; -use failure::Error as FailureError; use fnv::FnvHashSet; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; @@ -180,7 +180,7 @@ impl<'a> MockTransactionHelper<'a> { let hash_type = lock .hash_type() .try_into() - .map_err(|err: FailureError| err.to_string())?; + .map_err(|err: OtherError| err.to_string())?; insert_dep(hash_type, &lock.code_hash())?; } for output in tx.outputs().into_iter() { @@ -188,7 +188,7 @@ impl<'a> MockTransactionHelper<'a> { let hash_type = script .hash_type() .try_into() - .map_err(|err: FailureError| err.to_string())?; + .map_err(|err: OtherError| err.to_string())?; insert_dep(hash_type, &script.code_hash())?; } } diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index 49cd9dbd..1f9767d5 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" [dependencies] ckb-index = { path = "../ckb-index" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/test/Cargo.toml b/test/Cargo.toml index ab6cc002..8860d96b 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -14,11 +14,11 @@ env_logger = "0.6" toml = "0.5.0" serde_yaml = "0.8.9" ckb-sdk = { path = "../ckb-sdk" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", features=["with_sentry"], tag = "v0.39.0-rc1" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1", features = ["secp"] } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } regex = "1.1.6" # Prevent this from interfering with workspaces From 46679ec0e9262a2c174fbd3c39dfea738de628b1 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Mon, 22 Feb 2021 16:19:10 +0800 Subject: [PATCH 17/18] chore: update ckb to v0.40.0-rc2 BREAKING CHANGE: Remove several rpc methods: get_cells_by_lock_hash, get_live_cells_by_lock_hash, get_transactions_by_lock_hash, index_lock_hash, deindex_lock_hash, get_lock_hash_index_states, get_capacity_by_lock_hash --- Cargo.lock | 2070 +++++++++++---------- Cargo.toml | 36 +- Makefile | 2 +- ckb-index/Cargo.toml | 4 +- ckb-sdk-types/Cargo.toml | 14 +- ckb-sdk-types/src/transaction.rs | 7 +- ckb-sdk/Cargo.toml | 20 +- ckb-sdk/src/rpc/client.rs | 104 +- ckb-sdk/src/rpc/mod.rs | 9 +- ckb-sdk/src/rpc/types.rs | 93 - ckb-sdk/src/wallet/keystore/passphrase.rs | 4 +- plugin-protocol/Cargo.toml | 4 +- src/subcommands/rpc.rs | 203 +- src/subcommands/tui/state.rs | 3 +- test/Cargo.toml | 14 +- 15 files changed, 1170 insertions(+), 1417 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ccf4f40e..23ccbbd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,50 +1,57 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "adler32" -version = "1.0.4" +name = "addr2line" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" [[package]] name = "aes-ctr" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" +checksum = "7729c3cde54d67063be556aeac75a81330d802f0259500ca40cb52967f975763" dependencies = [ "aes-soft", "aesni", + "cipher", "ctr", - "stream-cipher", ] [[package]] name = "aes-soft" -version = "0.3.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ - "block-cipher-trait", - "byteorder", - "opaque-debug", + "cipher", + "opaque-debug 0.3.0", ] [[package]] name = "aesni" -version = "0.6.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ - "block-cipher-trait", - "opaque-debug", - "stream-cipher", + "cipher", + "opaque-debug 0.3.0", ] [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -55,14 +62,14 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "anyhow" -version = "1.0.35" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" +checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "arrayref" @@ -72,9 +79,9 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "atty" @@ -84,7 +91,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -95,32 +102,24 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.46" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" dependencies = [ - "backtrace-sys", - "cfg-if", + "addr2line", + "cfg-if 1.0.0", "libc", + "miniz_oxide", + "object", "rustc-demangle", ] -[[package]] -name = "backtrace-sys" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "base64" version = "0.9.3" @@ -133,18 +132,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - -[[package]] -name = "base64" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bech32" @@ -192,7 +182,7 @@ dependencies = [ "byte-tools", "crypto-mac", "digest", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -212,9 +202,9 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" dependencies = [ "arrayref", "arrayvec", @@ -230,16 +220,7 @@ dependencies = [ "block-padding", "byte-tools", "byteorder", - "generic-array", -] - -[[package]] -name = "block-cipher-trait" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" -dependencies = [ - "generic-array", + "generic-array 0.12.3", ] [[package]] @@ -259,13 +240,19 @@ checksum = "c95ee6bba9d950218b6cc910cf62bc9e0a171d0f4537e3627b0f54d08549b188" [[package]] name = "bstr" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ "memchr", ] +[[package]] +name = "bumpalo" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" + [[package]] name = "byte-tools" version = "0.3.1" @@ -274,9 +261,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "bytes" @@ -285,19 +272,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" dependencies = [ "byteorder", - "either", "iovec", ] [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" dependencies = [ "serde", ] +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + [[package]] name = "cassowary" version = "0.3.0" @@ -306,11 +298,11 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.0.41" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" dependencies = [ - "rayon", + "jobserver", ] [[package]] @@ -319,26 +311,43 @@ 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.11" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", "num-traits", "time", + "winapi 0.3.9", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.4", ] [[package]] name = "ckb-build-info" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" [[package]] name = "ckb-chain-spec" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-crypto", "ckb-dao-utils", @@ -355,15 +364,15 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "0.39.0" +version = "0.40.0" dependencies = [ "ansi_term", "atty", @@ -392,12 +401,12 @@ dependencies = [ "faster-hex 0.4.1", "ipnetwork", "itertools", - "jsonrpc-client-core", - "jsonrpc-core 10.1.0", + "jsonrpc-core 17.0.0", + "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-http-server", "jsonrpc-server-utils", - "log 0.4.11", + "log", "parity-multiaddr", "regex", "rpassword", @@ -429,21 +438,21 @@ dependencies = [ [[package]] name = "ckb-crypto" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-fixed-hash", "faster-hex 0.4.1", "lazy_static", - "rand 0.6.5", + "rand 0.7.3", "secp256k1", "thiserror", ] [[package]] name = "ckb-dao-utils" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "byteorder", "ckb-error", @@ -452,8 +461,8 @@ dependencies = [ [[package]] name = "ckb-error" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "anyhow", "ckb-occupied-capacity", @@ -463,8 +472,8 @@ dependencies = [ [[package]] name = "ckb-fixed-hash" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -472,8 +481,8 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "faster-hex 0.4.1", "serde", @@ -482,19 +491,19 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-macros" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-fixed-hash-core", - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "ckb-hash" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -502,35 +511,35 @@ dependencies = [ [[package]] name = "ckb-index" -version = "0.39.0" +version = "0.40.0" dependencies = [ "bincode", "ckb-rocksdb", "ckb-sdk", "ckb-types", "failure", - "log 0.4.11", + "log", "serde", "serde_derive", ] [[package]] name = "ckb-jsonrpc-types" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-types", "faster-hex 0.4.1", - "jsonrpc-core 14.0.5", + "jsonrpc-core 14.2.0", "serde", "serde_json", ] [[package]] name = "ckb-librocksdb-sys" -version = "6.7.3" +version = "6.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5adffc9a78875e74c158e5e717fca7e292e455ab83519943a5e5e3483ebb6ca6" +checksum = "6a78d3b9b5fd3b4990ddd2083f6a6d4389b6c8e603a4f2896914165113beed2d" dependencies = [ "cc", "glob", @@ -539,16 +548,16 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ - "log 0.4.11", + "log", ] [[package]] name = "ckb-occupied-capacity" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -556,39 +565,39 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-occupied-capacity-core", - "quote 1.0.3", - "syn 1.0.48", + "quote", + "syn", ] [[package]] name = "ckb-pow" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "byteorder", "ckb-hash", "ckb-types", "eaglesong", - "log 0.4.11", + "log", "serde", ] [[package]] name = "ckb-rational" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "numext-fixed-uint", "serde", @@ -596,8 +605,8 @@ dependencies = [ [[package]] name = "ckb-resource" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -621,8 +630,8 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "byteorder", "ckb-chain-spec", @@ -640,7 +649,7 @@ dependencies = [ [[package]] name = "ckb-sdk" -version = "0.39.0" +version = "0.40.0" dependencies = [ "aes-ctr", "bech32", @@ -658,7 +667,7 @@ dependencies = [ "failure", "faster-hex 0.4.1", "fnv", - "log 0.4.11", + "log", "rand 0.6.5", "reqwest", "scrypt", @@ -672,7 +681,7 @@ dependencies = [ [[package]] name = "ckb-sdk-types" -version = "0.39.0" +version = "0.40.0" dependencies = [ "ckb-crypto", "ckb-error", @@ -699,19 +708,19 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "bit-vec", - "bytes 0.5.4", + "bytes 0.5.6", "ckb-channel", "ckb-error", "ckb-fixed-hash", @@ -726,11 +735,11 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.39.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" +version = "0.40.0-rc2" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.40.0-rc2#a0c9661adc6a5fa85276c29208496b7f137e5f6a" dependencies = [ "linked-hash-map", - "parking_lot 0.7.1", + "parking_lot 0.10.2", "regex", ] @@ -741,7 +750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfc2fb181a6653bb13315dc7f60fbe32cd3d697553b24687613da984faf2a2c5" dependencies = [ "byteorder", - "bytes 0.5.4", + "bytes 0.5.6", "cc", "ckb-vm-definitions", "derive_more", @@ -778,15 +787,15 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.0.0-beta.1" +version = "3.0.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb51c9e75b94452505acd21d929323f5a5c6c4735a852adbd39ef5fb1b014f30" +checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -815,7 +824,7 @@ checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" dependencies = [ "atty", "lazy_static", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -824,39 +833,11 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "cookie" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" -dependencies = [ - "time", - "url 1.7.2", -] - -[[package]] -name = "cookie_store" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c" -dependencies = [ - "cookie", - "failure", - "idna 0.1.5", - "log 0.4.11", - "publicsuffix", - "serde", - "serde_json", - "time", - "try_from", - "url 1.7.2", -] - [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ "core-foundation-sys", "libc", @@ -864,17 +845,17 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -886,61 +867,26 @@ dependencies = [ "crossbeam-utils 0.6.6", ] -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg 1.0.0", - "cfg-if", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard 1.1.0", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" -dependencies = [ - "cfg-if", - "crossbeam-utils 0.7.2", -] - [[package]] name = "crossbeam-utils" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "lazy_static", ] [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "bae8f328835f8f5a6ceb6a7842a7f2d0c03692adb5c889347235d59194731fe3" dependencies = [ - "autocfg 1.0.0", - "cfg-if", + "autocfg 1.0.1", + "cfg-if 1.0.0", "lazy_static", + "loom", ] [[package]] @@ -955,35 +901,34 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array", + "generic-array 0.12.3", "subtle", ] [[package]] name = "ctr" -version = "0.3.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ - "block-cipher-trait", - "stream-cipher", + "cipher", ] [[package]] name = "data-encoding" -version = "2.2.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c0346158a19b3627234e15596f5e465c360fcdb97d817bcb255e0510f5a788" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "derive_more" -version = "0.99.5" +version = "0.99.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" +checksum = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -992,7 +937,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", ] [[package]] @@ -1003,14 +948,14 @@ checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" dependencies = [ "libc", "redox_users", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "dtoa" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" +checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" [[package]] name = "eaglesong" @@ -1020,17 +965,17 @@ checksum = "8d978bd5d343e8ab9b5c0fc8d93ff9c602fdc96616ffff9c05ac7a155419b824" [[package]] name = "either" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "encoding_rs" -version = "0.8.22" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -1041,26 +986,16 @@ checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" dependencies = [ "atty", "humantime", - "log 0.4.11", + "log", "regex", "termcolor", ] -[[package]] -name = "error-chain" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" -dependencies = [ - "backtrace", - "version_check", -] - [[package]] name = "failure" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" dependencies = [ "backtrace", "failure_derive", @@ -1068,13 +1003,13 @@ dependencies = [ [[package]] name = "failure_derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", "synstructure", ] @@ -1098,11 +1033,11 @@ checksum = "348138dd23e03bb0018caef99647fb1a5befec5ff4b501991de88f09854d4c28" [[package]] name = "flate2" -version = "1.0.14" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" +checksum = "cd3aec53de10fe96d7d8c565eb17f2c687bb5518a2ec453b5b1252964526abe0" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crc32fast", "libc", "miniz_oxide", @@ -1129,6 +1064,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding 2.1.0", +] + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1153,20 +1098,120 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] -name = "futures-cpupool" -version = "0.1.8" +name = "futures" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" + +[[package]] +name = "futures-executor" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ - "futures", + "futures-core", + "futures-task", + "futures-util", "num_cpus", ] +[[package]] +name = "futures-io" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" + +[[package]] +name = "futures-macro" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" + +[[package]] +name = "futures-task" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +dependencies = [ + "futures 0.1.30", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.4", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "generator" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fed24fd1e18827652b4d55652899a1e9da8e54d91624dc3437a5bc3a9f9a9c" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "winapi 0.3.9", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -1176,17 +1221,33 @@ 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.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", ] +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + [[package]] name = "glob" version = "0.2.11" @@ -1195,69 +1256,97 @@ checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "globset" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120" +checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" dependencies = [ "aho-corasick", "bstr", "fnv", - "log 0.4.11", + "log", "regex", ] [[package]] name = "goblin" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd5e3132801a1ac34ac53b97acde50c4685414dd2f291b9ea52afa6f07468c8" +checksum = "d20fd25aa456527ce4f544271ae4fea65d2eda4a6561ea56f39fb3ee4f7e3884" dependencies = [ - "log 0.4.11", + "log", "plain", "scroll", ] [[package]] name = "h2" -version = "0.1.26" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" dependencies = [ - "byteorder", - "bytes 0.4.12", + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 0.2.25", + "tokio-util 0.3.1", + "tracing", + "tracing-futures", +] + +[[package]] +name = "h2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" +dependencies = [ + "bytes 1.0.1", "fnv", - "futures", + "futures-core", + "futures-sink", + "futures-util", "http", "indexmap", - "log 0.4.11", "slab", - "string", - "tokio-io", + "tokio 1.2.0", + "tokio-util 0.6.3", + "tracing", + "tracing-futures", ] +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" + [[package]] name = "heapsize" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.10" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -1274,32 +1363,46 @@ dependencies = [ [[package]] name = "http" -version = "0.1.21" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +checksum = "7245cd7449cc792608c3c8a9eaf69bd4eabbabf802713748fd739c98b82f0747" dependencies = [ - "bytes 0.4.12", + "bytes 1.0.1", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ - "bytes 0.4.12", - "futures", + "bytes 0.5.6", + "http", +] + +[[package]] +name = "http-body" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994" +dependencies = [ + "bytes 1.0.1", "http", - "tokio-buf", ] [[package]] name = "httparse" -version = "1.3.4" +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 = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" [[package]] name = "humantime" @@ -1312,45 +1415,63 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.35" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" dependencies = [ - "bytes 0.4.12", - "futures", - "futures-cpupool", - "h2", + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.2.7", "http", - "http-body", + "http-body 0.3.1", "httparse", - "iovec", + "httpdate", "itoa", - "log 0.4.11", - "net2", - "rustc_version", - "time", - "tokio", - "tokio-buf", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", + "pin-project", + "socket2", + "tokio 0.2.25", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" +dependencies = [ + "bytes 1.0.1", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.0", + "http", + "http-body 0.4.0", + "httparse", + "httpdate", + "itoa", + "pin-project", + "socket2", + "tokio 1.2.0", + "tower-service", + "tracing", "want", ] [[package]] name = "hyper-tls" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 0.4.12", - "futures", - "hyper", + "bytes 1.0.1", + "hyper 0.14.4", "native-tls", - "tokio-io", + "tokio 1.2.0", + "tokio-native-tls", ] [[package]] @@ -1366,9 +1487,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" dependencies = [ "matches", "unicode-bidi", @@ -1398,22 +1519,38 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.3.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", + "hashbrown", ] [[package]] -name = "iovec" -version = "0.1.4" +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 = "iovec" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ "libc", ] +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + [[package]] name = "ipnetwork" version = "0.14.0" @@ -1434,45 +1571,52 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] -name = "jsonrpc-client-core" -version = "0.5.0" +name = "jobserver" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29cb249837420fb0cee7fb0fbf1d22679e121b160e71bb5e0d90b9df241c23e" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" dependencies = [ - "error-chain", - "futures", - "jsonrpc-core 8.0.1", - "log 0.4.11", - "serde", - "serde_json", + "libc", ] [[package]] -name = "jsonrpc-core" -version = "8.0.1" +name = "js-sys" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" dependencies = [ - "futures", - "log 0.3.9", + "wasm-bindgen", +] + +[[package]] +name = "jsonrpc-client-transports" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b6c6ad01c7354d60de493148c30ac8a82b759e22ae678c8705e9b8e0c566a4" +dependencies = [ + "derive_more", + "futures 0.3.12", + "jsonrpc-core 17.0.0", + "jsonrpc-pubsub", + "log", "serde", - "serde_derive", "serde_json", + "url 1.7.2", ] [[package]] name = "jsonrpc-core" -version = "10.1.0" +version = "14.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc15eef5f8b6bef5ac5f7440a957ff95d036e2f98706947741bfc93d1976db4c" +checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" dependencies = [ - "futures", - "log 0.4.11", + "futures 0.1.30", + "log", "serde", "serde_derive", "serde_json", @@ -1480,56 +1624,84 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "14.0.5" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3b688648f1ef5d5072229e2d672ecb92cbff7d1c79bcf3fd5898f3f3df0970" +checksum = "07569945133257ff557eb37b015497104cea61a2c9edaf126c1cbd6e8332397f" dependencies = [ - "futures", - "log 0.4.11", + "futures 0.3.12", + "log", "serde", "serde_derive", "serde_json", ] +[[package]] +name = "jsonrpc-core-client" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ac9d56dc729912796637c30f475bbf834594607b27740dfea6e5fa7ba40d1f1" +dependencies = [ + "futures 0.3.12", + "jsonrpc-client-transports", +] + [[package]] name = "jsonrpc-derive" -version = "10.1.0" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dae61ca8a3b047fb11309b00661bc56837085bd07e46f907b9c562c0b03e68" +checksum = "b68ba7e76e5c7796cfa4d2a30e83986550c34404c6d40551c902ca6f7bd4a137" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "jsonrpc-http-server" -version = "10.1.0" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d2a00824306155b8ef57fe957f31b8cd8ad24262f15cf911d84dcf9a3f206d" +checksum = "eff2303c4f0562afcbd2dae75e3e21815095f8994749a80fbcd365877e44ed64" dependencies = [ - "hyper", - "jsonrpc-core 10.1.0", + "futures 0.3.12", + "hyper 0.13.10", + "jsonrpc-core 17.0.0", "jsonrpc-server-utils", - "log 0.4.11", + "log", "net2", + "parking_lot 0.11.1", "unicase", ] +[[package]] +name = "jsonrpc-pubsub" +version = "17.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c48dbebce7a9c88ab272a4db7d6478aa4c6d9596e6c086366e89efc4e9ed89e" +dependencies = [ + "futures 0.3.12", + "jsonrpc-core 17.0.0", + "lazy_static", + "log", + "parking_lot 0.11.1", + "rand 0.7.3", + "serde", +] + [[package]] name = "jsonrpc-server-utils" -version = "10.1.0" +version = "17.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9527f01ef25f251d64082cbefc0c6d6f367349afe6848ef908a674e06b2bdd3" +checksum = "f4207cce738bf713a82525065b750a008f28351324f438f56b33d698ada95bb4" dependencies = [ - "bytes 0.4.12", + "bytes 0.5.6", + "futures 0.3.12", "globset", - "jsonrpc-core 10.1.0", + "jsonrpc-core 17.0.0", "lazy_static", - "log 0.4.11", - "num_cpus", - "tokio", - "tokio-codec", + "log", + "tokio 0.2.25", + "tokio-util 0.3.1", "unicase", ] @@ -1557,51 +1729,52 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.68" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" +checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" [[package]] name = "linked-hash-map" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.1.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "owning_ref", - "scopeguard 0.3.3", + "scopeguard", ] [[package]] name = "lock_api" -version = "0.3.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" dependencies = [ - "scopeguard 1.1.0", + "scopeguard", ] [[package]] name = "log" -version = "0.3.9" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "log 0.4.11", + "cfg-if 1.0.0", ] [[package]] -name = "log" -version = "0.4.11" +name = "loom" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", + "generator", + "scoped-tls", ] [[package]] @@ -1611,7 +1784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46a28a55dbc005b2f6f123c4058933d57add373d362f6fd3a76aab4fe6973500" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1620,26 +1793,11 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memoffset" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" -dependencies = [ - "autocfg 1.0.0", -] +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "merkle-cbt" @@ -1647,7 +1805,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f1ac8428ec02d6caa5a79c15e851d84d5dc7a00df0429a8aa860d104f0a81be" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -1656,53 +1814,46 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" -version = "0.3.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" dependencies = [ - "adler32", + "adler", + "autocfg 1.0.1", ] [[package]] name = "mio" -version = "0.6.21" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", "kernel32-sys", "libc", - "log 0.4.11", - "miow", + "log", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", ] [[package]] -name = "mio-uds" -version = "0.6.7" +name = "mio" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +checksum = "dc250d6848c90d719ea2ce34546fb5df7af1d3fd189d10bf7bad80bfcebecd95" dependencies = [ - "iovec", "libc", - "mio", + "log", + "miow 0.3.6", + "ntapi", + "winapi 0.3.9", ] [[package]] @@ -1717,26 +1868,36 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +dependencies = [ + "socket2", + "winapi 0.3.9", +] + [[package]] name = "molecule" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "663f76cc52219e5957e2f5563cce9d89f98aa8503c9c898b5c412d97df663998" dependencies = [ - "bytes 0.5.4", - "cfg-if", + "bytes 0.5.6", + "cfg-if 0.1.10", "faster-hex 0.4.1", ] [[package]] name = "native-tls" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" dependencies = [ "lazy_static", "libc", - "log 0.4.11", + "log", "openssl", "openssl-probe", "openssl-sys", @@ -1748,13 +1909,13 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.36" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cf75f38f16cb05ea017784dc6dbfd354f76c223dba37701734c4f5a9337d02" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -1765,35 +1926,44 @@ checksum = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", "void", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "num-integer" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", "libc", @@ -1805,9 +1975,9 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "621fe0f044729f810c6815cdd77e8f5e0cd803ce4f6a38380ebfc1322af98661" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1840,9 +2010,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0200f8d55c36ec1b6a8cf810115be85d4814f045e0097dfd50033ba25adb4c9e" dependencies = [ "numext-fixed-uint-core", - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1851,11 +2021,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +[[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.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" [[package]] name = "opaque-debug" @@ -1863,14 +2039,20 @@ 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.28" +version = "0.10.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52" +checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" dependencies = [ "bitflags", - "cfg-if", + "cfg-if 1.0.0", "foreign-types", "lazy_static", "libc", @@ -1885,11 +2067,11 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.54" +version = "0.9.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986" +checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "cc", "libc", "pkg-config", @@ -1898,18 +2080,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced912e1439b63a8172b943887c33373f226a4a9cfab95d09c0e3c44851d04d4" - -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] +checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" [[package]] name = "parity-multiaddr" @@ -1945,51 +2118,51 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.7.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api 0.1.5", - "parking_lot_core 0.4.0", + "lock_api 0.3.4", + "parking_lot_core 0.7.2", ] [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ - "lock_api 0.3.3", - "parking_lot_core 0.6.2", - "rustc_version", + "instant", + "lock_api 0.4.2", + "parking_lot_core 0.8.3", ] [[package]] name = "parking_lot_core" -version = "0.4.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ + "cfg-if 0.1.10", + "cloudabi", "libc", - "rand 0.6.5", - "rustc_version", - "smallvec 0.6.13", - "winapi 0.3.8", + "redox_syscall 0.1.57", + "smallvec", + "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" dependencies = [ - "cfg-if", - "cloudabi", + "cfg-if 1.0.0", + "instant", "libc", - "redox_syscall", - "rustc_version", - "smallvec 0.6.13", - "winapi 0.3.8", + "redox_syscall 0.2.5", + "smallvec", + "winapi 0.3.9", ] [[package]] @@ -2052,11 +2225,49 @@ dependencies = [ "siphasher", ] +[[package]] +name = "pin-project" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" +dependencies = [ + "pin-project-internal", +] + +[[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.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" + +[[package]] +name = "pin-project-lite" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" + +[[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.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "plain" @@ -2066,65 +2277,62 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "ppv-lite86" -version = "0.2.6" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + +[[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-error" -version = "0.4.12" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", "version_check", ] [[package]] name = "proc-macro-error-attr" -version = "0.4.12" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", - "syn-mid", + "proc-macro2", + "quote", "version_check", ] [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "proc-macro-hack" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] -name = "proc-macro2" -version = "1.0.24" +name = "proc-macro-nested" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" -dependencies = [ - "unicode-xid 0.2.0", -] +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] -name = "publicsuffix" -version = "1.5.4" +name = "proc-macro2" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "error-chain", - "idna 0.2.0", - "lazy_static", - "regex", - "url 2.1.1", + "unicode-xid", ] [[package]] @@ -2135,20 +2343,11 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "0.6.13" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 0.4.30", -] - -[[package]] -name = "quote" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" -dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2", ] [[package]] @@ -2161,7 +2360,7 @@ dependencies = [ "fuchsia-cprng", "libc", "rand_core 0.3.1", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2178,9 +2377,9 @@ dependencies = [ "rand_isaac", "rand_jitter", "rand_os", - "rand_pcg", + "rand_pcg 0.1.2", "rand_xorshift", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2194,6 +2393,7 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc 0.2.0", + "rand_pcg 0.2.1", ] [[package]] @@ -2275,7 +2475,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ "libc", "rand_core 0.4.2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2289,7 +2489,7 @@ dependencies = [ "libc", "rand_core 0.4.2", "rdrand", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -2303,36 +2503,21 @@ dependencies = [ ] [[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rayon" -version = "1.3.0" +name = "rand_pcg" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "crossbeam-deque", - "either", - "rayon-core", + "rand_core 0.5.1", ] [[package]] -name = "rayon-core" -version = "1.7.0" +name = "rand_xorshift" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils 0.7.2", - "lazy_static", - "num_cpus", + "rand_core 0.3.1", ] [[package]] @@ -2346,35 +2531,44 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +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_termios" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall", + "redox_syscall 0.2.5", ] [[package]] name = "redox_users" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.1.57", "rust-argon2", ] [[package]] name = "regex" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ "aho-corasick", "memchr", @@ -2384,50 +2578,51 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.21" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "remove_dir_all" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "reqwest" -version = "0.9.24" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88643aea3c1343c804950d7bf983bd2067f5ab59db6d613a08e05572f2714ab" +checksum = "0460542b551950620a3648c6aa23318ac6b3cd779114bd873209e6e8b5eb1c34" dependencies = [ - "base64 0.10.1", - "bytes 0.4.12", - "cookie", - "cookie_store", + "base64 0.13.0", + "bytes 1.0.1", "encoding_rs", - "flate2", - "futures", + "futures-core", + "futures-util", "http", - "hyper", + "http-body 0.4.0", + "hyper 0.14.4", "hyper-tls", - "log 0.4.11", + "ipnet", + "js-sys", + "lazy_static", + "log", "mime", - "mime_guess", "native-tls", + "percent-encoding 2.1.0", + "pin-project-lite 0.2.4", "serde", "serde_json", "serde_urlencoded", - "time", - "tokio", - "tokio-executor", - "tokio-io", - "tokio-threadpool", - "tokio-timer", - "url 1.7.2", - "uuid", + "tokio 1.2.0", + "tokio-native-tls", + "url 2.2.1", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", "winreg", ] @@ -2444,30 +2639,27 @@ dependencies = [ [[package]] name = "rust-argon2" -version = "0.7.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" dependencies = [ - "base64 0.11.0", + "base64 0.13.0", "blake2b_simd", "constant_time_eq", - "crossbeam-utils 0.7.2", + "crossbeam-utils 0.8.2", ] [[package]] name = "rustc-demangle" -version = "0.1.16" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustversion" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] +checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" [[package]] name = "rustyline" @@ -2477,20 +2669,20 @@ checksum = "0f47ea1ceb347d2deae482d655dc8eef4bd82363d3329baffa3818bd76fea48b" dependencies = [ "dirs", "libc", - "log 0.4.11", + "log", "memchr", "nix", "unicode-segmentation", "unicode-width", "utf8parse", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "ryu" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "safemem" @@ -2509,19 +2701,19 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] -name = "scopeguard" -version = "0.3.3" +name = "scoped-tls" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" [[package]] name = "scopeguard" @@ -2531,22 +2723,22 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scroll" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb2332cb595d33f7edd5700f4cbf94892e680c7f0ae56adab58a35190b66cb1" +checksum = "fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec" dependencies = [ "scroll_derive", ] [[package]] name = "scroll_derive" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" +checksum = "aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -2585,9 +2777,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" dependencies = [ "bitflags", "core-foundation", @@ -2598,54 +2790,39 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.4.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" 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.105" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.105" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.50" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78a7a12c167809363ec3bd7329fc0a3369056996de43c4b37ef3cd54a6ce4867" +checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" dependencies = [ "itoa", "ryu", @@ -2654,21 +2831,21 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.5.5" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url 1.7.2", ] [[package]] name = "serde_yaml" -version = "0.8.12" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c7a592a1ec97c9c1c68d75b6e537dcbf60c7618e038e7841e00af1d9ccf0c4" +checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" dependencies = [ "dtoa", "linked-hash-map", @@ -2685,19 +2862,19 @@ dependencies = [ "block-buffer", "digest", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] name = "sha2" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ "block-buffer", "digest", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -2710,7 +2887,7 @@ dependencies = [ "byte-tools", "digest", "keccak", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] @@ -2733,41 +2910,19 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "smallvec" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" - -[[package]] -name = "stable_deref_trait" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" - -[[package]] -name = "stream-cipher" -version = "0.3.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" -dependencies = [ - "generic-array", -] +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] -name = "string" -version = "0.2.1" +name = "socket2" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "bytes 0.4.12", + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", ] [[package]] @@ -2784,47 +2939,25 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" -dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "unicode-xid 0.2.0", -] - -[[package]] -name = "syn-mid" -version = "0.5.0" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] name = "synstructure" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", - "unicode-xid 0.2.0", + "proc-macro2", + "quote", + "syn", + "unicode-xid", ] [[package]] @@ -2833,32 +2966,32 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "rand 0.7.3", - "redox_syscall", + "redox_syscall 0.1.57", "remove_dir_all", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] [[package]] name = "termion" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", "numtoa", - "redox_syscall", + "redox_syscall 0.2.5", "redox_termios", ] @@ -2873,42 +3006,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.3", - "syn 1.0.48", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "thread_local" -version = "1.0.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ - "lazy_static", + "once_cell", ] [[package]] name = "time" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", - "redox_syscall", - "winapi 0.3.8", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi 0.3.9", ] [[package]] @@ -2921,221 +3054,142 @@ dependencies = [ ] [[package]] -name = "tokio" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" -dependencies = [ - "bytes 0.4.12", - "futures", - "mio", - "num_cpus", - "tokio-codec", - "tokio-current-thread", - "tokio-executor", - "tokio-fs", - "tokio-io", - "tokio-reactor", - "tokio-sync", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "tokio-udp", - "tokio-uds", -] - -[[package]] -name = "tokio-buf" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" -dependencies = [ - "bytes 0.4.12", - "either", - "futures", -] - -[[package]] -name = "tokio-codec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" -dependencies = [ - "bytes 0.4.12", - "futures", - "tokio-io", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" +name = "tinyvec" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" dependencies = [ - "futures", - "tokio-executor", + "tinyvec_macros", ] [[package]] -name = "tokio-executor" -version = "0.1.10" +name = "tinyvec_macros" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures", -] +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] -name = "tokio-fs" -version = "0.1.7" +name = "tokio" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ - "futures", - "tokio-io", - "tokio-threadpool", + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "memchr", + "mio 0.6.23", + "num_cpus", + "pin-project-lite 0.1.11", + "slab", ] [[package]] -name = "tokio-io" -version = "0.1.13" +name = "tokio" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +checksum = "e8190d04c665ea9e6b6a0dc45523ade572c088d2e6566244c1122671dbf4ae3a" dependencies = [ - "bytes 0.4.12", - "futures", - "log 0.4.11", + "autocfg 1.0.1", + "bytes 1.0.1", + "libc", + "memchr", + "mio 0.7.8", + "num_cpus", + "pin-project-lite 0.2.4", ] [[package]] -name = "tokio-reactor" -version = "0.1.12" +name = "tokio-native-tls" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ - "crossbeam-utils 0.7.2", - "futures", - "lazy_static", - "log 0.4.11", - "mio", - "num_cpus", - "parking_lot 0.9.0", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", + "native-tls", + "tokio 1.2.0", ] [[package]] -name = "tokio-sync" -version = "0.1.8" +name = "tokio-util" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "fnv", - "futures", + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.11", + "tokio 0.2.25", ] [[package]] -name = "tokio-tcp" -version = "0.1.4" +name = "tokio-util" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +checksum = "ebb7cb2f00c5ae8df755b252306272cd1790d39728363936e01827e11f0b017b" dependencies = [ - "bytes 0.4.12", - "futures", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", + "bytes 1.0.1", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.2.4", + "tokio 1.2.0", ] [[package]] -name = "tokio-threadpool" -version = "0.1.18" +name = "toml" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils 0.7.2", - "futures", - "lazy_static", - "log 0.4.11", - "num_cpus", - "slab", - "tokio-executor", + "serde", ] [[package]] -name = "tokio-timer" -version = "0.2.13" +name = "tower-service" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures", - "slab", - "tokio-executor", -] +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] -name = "tokio-udp" -version = "0.1.6" +name = "tracing" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" +checksum = "f77d3842f76ca899ff2dbcf231c5c65813dea431301d6eb686279c15c4464f12" dependencies = [ - "bytes 0.4.12", - "futures", - "log 0.4.11", - "mio", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "cfg-if 1.0.0", + "log", + "pin-project-lite 0.2.4", + "tracing-core", ] [[package]] -name = "tokio-uds" -version = "0.2.6" +name = "tracing-core" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5076db410d6fdc6523df7595447629099a1fdc47b3d9f896220780fa48faf798" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" dependencies = [ - "bytes 0.4.12", - "futures", - "iovec", - "libc", - "log 0.4.11", - "mio", - "mio-uds", - "tokio-codec", - "tokio-io", - "tokio-reactor", + "lazy_static", ] [[package]] -name = "toml" -version = "0.5.7" +name = "tracing-futures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "serde", + "pin-project", + "tracing", ] [[package]] name = "try-lock" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" - -[[package]] -name = "try_from" -version = "0.3.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b" -dependencies = [ - "cfg-if", -] +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "tui" @@ -3147,7 +3201,7 @@ dependencies = [ "cassowary", "either", "itertools", - "log 0.4.11", + "log", "termion", "unicode-segmentation", "unicode-width", @@ -3155,9 +3209,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.11.2" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "unicase" @@ -3179,36 +3233,30 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.12" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ - "smallvec 1.2.0", + "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" - -[[package]] -name = "unicode-xid" -version = "0.1.0" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unsigned-varint" @@ -3229,11 +3277,12 @@ dependencies = [ [[package]] name = "url" -version = "2.1.1" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ - "idna 0.2.0", + "form_urlencoded", + "idna 0.2.2", "matches", "percent-encoding 2.1.0", ] @@ -3255,21 +3304,21 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" [[package]] name = "vec_map" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "void" @@ -3284,18 +3333,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi 0.3.8", + "winapi 0.3.9", "winapi-util", ] [[package]] name = "want" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "futures", - "log 0.4.11", + "log", "try-lock", ] @@ -3305,6 +3353,90 @@ 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.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +dependencies = [ + "cfg-if 1.0.0", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" + +[[package]] +name = "web-sys" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.2.8" @@ -3313,9 +3445,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -3335,11 +3467,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3350,11 +3482,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winreg" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -3369,9 +3501,9 @@ dependencies = [ [[package]] name = "yaml-rust" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] diff --git a/Cargo.toml b/Cargo.toml index 2e2201a2..ab6cb297 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,34 +1,34 @@ [package] name = "ckb-cli" -version = "0.39.0" +version = "0.40.0" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" [dependencies] -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2", features = ["secp"] } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } ckb-sdk = { path = "ckb-sdk" } ckb-index = { path = "ckb-index" } plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol" } -jsonrpc-client-core = "0.5.0" -jsonrpc-core = "10.1" -jsonrpc-derive = "10.1" -jsonrpc-http-server = "10.1" -jsonrpc-server-utils = "10.1" +jsonrpc-core-client = "17" +jsonrpc-core = "17" +jsonrpc-derive = "17" +jsonrpc-http-server = "17" +jsonrpc-server-utils = "17" secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" env_logger = "0.6" crossbeam-channel = "0.3" -clap = "3.0.0-beta.1" -clap_generate = "3.0.0-beta.1" +clap = "=3.0.0-beta.1" +clap_generate = "=3.0.0-beta.1" serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" serde_json = "1.0" @@ -57,7 +57,7 @@ tui = "0.6.0" termion = "1.5" [build-dependencies] -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } [workspace] members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"] diff --git a/Makefile b/Makefile index 76f05acc..f9a182d5 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ci: fmt clippy test security-audit git diff --exit-code Cargo.lock integration: - bash devtools/ci/integration.sh v0.39.0-rc2 + bash devtools/ci/integration.sh v0.40.0-rc2 prod: ## Build binary with release profile. cargo build --release diff --git a/ckb-index/Cargo.toml b/ckb-index/Cargo.toml index 4faf4bbc..0c476438 100644 --- a/ckb-index/Cargo.toml +++ b/ckb-index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-index" -version = "0.39.0" +version = "0.40.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -11,6 +11,6 @@ serde_derive = "1.0" bincode = "1.1.4" log = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } ckb-sdk = { path = "../ckb-sdk" } rocksdb = { package = "ckb-rocksdb", version = "=0.13.0", features = ["snappy"] } diff --git a/ckb-sdk-types/Cargo.toml b/ckb-sdk-types/Cargo.toml index d95ab93b..cb62b248 100644 --- a/ckb-sdk-types/Cargo.toml +++ b/ckb-sdk-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk-types" -version = "0.39.0" +version = "0.40.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -9,11 +9,11 @@ license = "MIT" serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } [dev-dependencies] -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2", features = ["secp"] } diff --git a/ckb-sdk-types/src/transaction.rs b/ckb-sdk-types/src/transaction.rs index 0f436b96..5e87a44a 100644 --- a/ckb-sdk-types/src/transaction.rs +++ b/ckb-sdk-types/src/transaction.rs @@ -202,9 +202,12 @@ impl Resource { } impl<'a> HeaderChecker for Resource { - fn check_valid(&self, block_hash: &Byte32) -> Result<(), ckb_error::Error> { + fn check_valid( + &self, + block_hash: &Byte32, + ) -> Result<(), ckb_types::core::error::OutPointError> { if !self.required_headers.contains_key(block_hash) { - return Err(OutPointError::InvalidHeader(block_hash.clone()).into()); + return Err(OutPointError::InvalidHeader(block_hash.clone())); } Ok(()) } diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index a103c3f9..0f6756fe 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "0.39.0" +version = "0.40.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -11,11 +11,11 @@ serde_derive = "1.0" serde_json = "1.0" bech32 = "0.6.0" log = "0.4.6" -reqwest = "0.9" +reqwest = { version = "0.11", features = ["json", "blocking"] } secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" fnv = "1.0.3" -aes-ctr = "0.3.0" +aes-ctr = "0.6.0" scrypt = "0.2.0" rand = "0.6.5" tiny-keccak = "1.4" @@ -25,11 +25,11 @@ uuid = { version = "0.7.4", features = ["v4"] } chrono = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.40.0-rc2", features = ["secp"] } ckb-sdk-types = { path = "../ckb-sdk-types" } diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index b1bf4f8c..abbefa1a 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -1,9 +1,8 @@ use ckb_jsonrpc_types::{ - BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellOutputWithOutPoint, - CellTransaction, CellWithStatus, ChainInfo, Consensus, EpochNumber, EpochView, - ExtraLoggerConfig, HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, - MainLoggerConfig, OutPoint, PeerState, RawTxPool, RemoteNode, Script, Timestamp, Transaction, - TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, + BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellWithStatus, + ChainInfo, Consensus, EpochNumber, EpochView, ExtraLoggerConfig, HeaderView, JsonBytes, + LocalNode, MainLoggerConfig, OutPoint, PeerState, RawTxPool, RemoteNode, Script, Timestamp, + Transaction, TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, }; use super::types; @@ -20,7 +19,7 @@ macro_rules! jsonrpc { ) => ( $(#[$struct_attr])* pub struct $struct_name { - pub client: reqwest::Client, + pub client: reqwest::blocking::Client, pub url: reqwest::Url, pub id: u64, } @@ -28,7 +27,7 @@ macro_rules! jsonrpc { impl $struct_name { pub fn new(uri: &str) -> Self { let url = reqwest::Url::parse(uri).expect("ckb uri, e.g. \"http://127.0.0.1:8114\""); - $struct_name { url, id: 0, client: reqwest::Client::new(), } + $struct_name { url, id: 0, client: reqwest::blocking::Client::new(), } } $( @@ -44,7 +43,7 @@ macro_rules! jsonrpc { req_json.insert("method".to_owned(), serde_json::json!(method)); req_json.insert("params".to_owned(), params); - let mut resp = $selff.client.post($selff.url.clone()).json(&req_json).send()?; + let resp = $selff.client.post($selff.url.clone()).json(&req_json).send()?; let output = resp.json::()?; match output { ckb_jsonrpc_types::response::Output::Success(success) => { @@ -71,7 +70,6 @@ jsonrpc!(pub struct RawHttpRpcClient { pub fn get_block_by_number(&mut self, number: BlockNumber) -> Option; pub fn get_block_hash(&mut self, number: BlockNumber) -> Option; pub fn get_cellbase_output_capacity_details(&mut self, hash: H256) -> Option; - pub fn get_cells_by_lock_hash(&mut self, lock_hash: H256, from: BlockNumber, to: BlockNumber) -> Vec; pub fn get_current_epoch(&mut self) -> EpochView; pub fn get_epoch_by_number(&mut self, number: EpochNumber) -> Option; pub fn get_header(&mut self, hash: H256) -> Option; @@ -89,28 +87,6 @@ jsonrpc!(pub struct RawHttpRpcClient { pub fn get_fork_block(&mut self, block_hash: H256) -> Option; pub fn get_consensus(&mut self) -> Consensus; - // Indexer - pub fn deindex_lock_hash(&mut self, lock_hash: H256) -> (); - pub fn get_live_cells_by_lock_hash( - &mut self, - lock_hash: H256, - page: Uint64, - per_page: Uint64, - reverse_order: Option - ) -> Vec; - pub fn get_transactions_by_lock_hash( - &mut self, - lock_hash: H256, - page: Uint64, - per_page: Uint64, - reverse_order: Option - ) -> Vec; - pub fn index_lock_hash( - &mut self, - lock_hash: H256, - index_from: Option - ) -> LockHashIndexState; - // Net pub fn get_banned_addresses(&mut self) -> Vec; pub fn get_peers(&mut self) -> Vec; @@ -203,17 +179,6 @@ impl HttpRpcClient { .map(|opt| opt.map(Into::into)) .map_err(|err| err.to_string()) } - pub fn get_cells_by_lock_hash( - &mut self, - lock_hash: H256, - from: u64, - to: u64, - ) -> Result, String> { - self.client - .get_cells_by_lock_hash(lock_hash, BlockNumber::from(from), BlockNumber::from(to)) - .map(|vec| vec.into_iter().map(Into::into).collect()) - .map_err(|err| err.to_string()) - } pub fn get_current_epoch(&mut self) -> Result { self.client .get_current_epoch() @@ -303,61 +268,6 @@ impl HttpRpcClient { .map_err(|err| err.to_string()) } - // Indexer - #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] - pub fn deindex_lock_hash(&mut self, lock_hash: H256) -> Result<(), String> { - self.client - .deindex_lock_hash(lock_hash) - .map_err(|err| err.to_string()) - } - #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] - pub fn get_live_cells_by_lock_hash( - &mut self, - lock_hash: H256, - page: u64, - per_page: u64, - reverse_order: Option, - ) -> Result, String> { - self.client - .get_live_cells_by_lock_hash( - lock_hash, - Uint64::from(page), - Uint64::from(per_page), - reverse_order, - ) - .map(|vec| vec.into_iter().map(Into::into).collect()) - .map_err(|err| err.to_string()) - } - #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] - pub fn get_transactions_by_lock_hash( - &mut self, - lock_hash: H256, - page: u64, - per_page: u64, - reverse_order: Option, - ) -> Result, String> { - self.client - .get_transactions_by_lock_hash( - lock_hash, - Uint64::from(page), - Uint64::from(per_page), - reverse_order, - ) - .map(|vec| vec.into_iter().map(Into::into).collect()) - .map_err(|err| err.to_string()) - } - #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] - pub fn index_lock_hash( - &mut self, - lock_hash: H256, - index_from: Option, - ) -> Result { - self.client - .index_lock_hash(lock_hash, index_from.map(BlockNumber::from)) - .map(Into::into) - .map_err(|err| err.to_string()) - } - // Net pub fn get_banned_addresses(&mut self) -> Result, String> { self.client diff --git a/ckb-sdk/src/rpc/mod.rs b/ckb-sdk/src/rpc/mod.rs index 229cac14..453338ff 100644 --- a/ckb-sdk/src/rpc/mod.rs +++ b/ckb-sdk/src/rpc/mod.rs @@ -6,9 +6,8 @@ pub use client::{HttpRpcClient, RawHttpRpcClient}; pub use primitive::{Capacity, EpochNumberWithFraction, Since, Timestamp}; pub use types::{ Alert, AlertMessage, BannedAddr, Block, BlockReward, BlockView, Byte32, CellDep, CellInput, - CellOutput, CellOutputWithOutPoint, CellTransaction, ChainInfo, DepType, EpochView, Header, - HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, MerkleProof, NodeAddress, - OutPoint, ProposalShortId, RemoteNode, Script, ScriptHashType, Transaction, TransactionPoint, - TransactionProof, TransactionView, TransactionWithStatus, TxPoolInfo, TxStatus, Uint128, - UncleBlock, UncleBlockView, + CellOutput, ChainInfo, DepType, EpochView, Header, HeaderView, JsonBytes, LocalNode, + MerkleProof, NodeAddress, OutPoint, ProposalShortId, RemoteNode, Script, ScriptHashType, + Transaction, TransactionProof, TransactionView, TransactionWithStatus, TxPoolInfo, TxStatus, + Uint128, UncleBlock, UncleBlockView, }; diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index 69c391d5..80622f05 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -756,31 +756,6 @@ impl From for Consensus { // ========= // cell.rs // ========= -#[derive(Debug, Serialize, Deserialize)] -pub struct CellOutputWithOutPoint { - pub out_point: OutPoint, - pub block_hash: H256, - pub capacity: Capacity, - pub lock: Script, - #[serde(rename = "type")] - pub type_: Option