Skip to content

Commit

Permalink
Merge duplicated code and support printing component memory usage. (C…
Browse files Browse the repository at this point in the history
…onflux-Chain#1508)

* Merge duplicated code and upport printing component memory usage.

* Add back Runtime.

* Fix comments.

* Fix more.

* fix comments.
  • Loading branch information
peilun-conflux authored Jun 9, 2020
1 parent 3ac91d3 commit 160e87d
Show file tree
Hide file tree
Showing 17 changed files with 796 additions and 1,014 deletions.
521 changes: 274 additions & 247 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,10 @@ path = "tools/tg_config_gen/main.rs"
# Use workspace section to allow test all cases under root folder (cargo test --all).
[workspace]

#[patch.crates-io]
#kvdb-rocksdb = {path = "./db/src/kvdb-rocksdb"}

[features]
deadlock_detection = ["parking_lot/deadlock_detection"]

#[replace]
#"bzip2-sys:0.1.6"={git = "https://github.com/alexcrichton/bzip2-rs.git"}

[patch.crates-io]
bzip2-sys = { git = "https://github.com/alexcrichton/bzip2-rs.git", commit = "461d6691" }
sqlite3-sys = { git = "https://github.com/Conflux-Chain/sqlite3-sys.git", rev = "1de8e5998f7c2d919336660b8ef4e8f52ac43844" }

[profile.test]
Expand Down
2 changes: 2 additions & 0 deletions accounts/cfxkey/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ serde = "1.0"
serde_derive = "1.0"
tiny-keccak = "1.4"
zeroize = "1.0.0"
malloc_size_of_derive = {path = "../../util/malloc_size_of_derive"}
malloc_size_of = {path = "../../util/malloc_size_of"}
3 changes: 2 additions & 1 deletion accounts/cfxkey/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use super::{Address, Error, Public, Secret, SECP256K1};
use cfx_types::address_util::AddressUtil;
use malloc_size_of_derive::MallocSizeOf as DeriveMallocSizeOf;
use parity_crypto::Keccak256 as _;
use secp256k1::key;
use std::fmt;
Expand All @@ -30,7 +31,7 @@ pub fn public_to_address(public: &Public) -> Address {
result
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, DeriveMallocSizeOf)]
/// secp256k1 key pair
pub struct KeyPair {
secret: Secret,
Expand Down
2 changes: 2 additions & 0 deletions accounts/cfxkey/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extern crate parity_crypto;
extern crate parity_wordlist;
#[macro_use]
extern crate quick_error;
extern crate malloc_size_of;
extern crate malloc_size_of_derive;
extern crate rand;
extern crate rustc_hex;
extern crate secp256k1;
Expand Down
3 changes: 2 additions & 1 deletion accounts/cfxkey/src/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.

use ethereum_types::H256;
use malloc_size_of_derive::MallocSizeOf as DeriveMallocSizeOf;
use secp256k1::{constants::SECRET_KEY_SIZE as SECP256K1_SECRET_KEY_SIZE, key};
use std::{fmt, ops::Deref, str::FromStr};
use zeroize::Zeroize;
use Error;
use SECP256K1;

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, DeriveMallocSizeOf)]
pub struct Secret {
inner: H256,
}
Expand Down
1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ futures = { version = "0.3.3", features = ["compat"] }
rayon = "1.2.0"
throttling = { path = "../util/throttling" }
tokio-timer = "0.2.13"
malloc_size_of = {path = "../util/malloc_size_of"}

[dev-dependencies]
criterion = "0.2"
Expand Down
Loading

0 comments on commit 160e87d

Please sign in to comment.