Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Use new parity-snappy and parity-rocksdb crates
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm committed Aug 29, 2018
1 parent 78b3b32 commit e678b0b
Show file tree
Hide file tree
Showing 25 changed files with 1,156 additions and 1,077 deletions.
2,159 changes: 1,119 additions & 1,040 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ethcore-private-tx = { path = "ethcore/private-tx" }
ethcore-service = { path = "ethcore/service" }
ethcore-sync = { path = "ethcore/sync" }
ethcore-transaction = { path = "ethcore/transaction" }
ethereum-types = "0.3"
ethereum-types = "0.4"
node-filter = { path = "ethcore/node_filter" }
ethkey = { path = "ethkey" }
rlp = { version = "0.2.4", features = ["ethereum"] }
Expand All @@ -63,7 +63,7 @@ panic_hook = { path = "util/panic_hook" }
keccak-hash = "0.1"
migration-rocksdb = { path = "util/migration-rocksdb" }
kvdb = "0.1"
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
kvdb-rocksdb = "0.1.2-beta.0"
journaldb = { path = "util/journaldb" }
mem = { path = "util/mem" }

Expand Down
4 changes: 2 additions & 2 deletions ethcore/light/src/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ mod tests {

assert_eq!(txq.queued_senders(), vec![sender]);

txq.cull(sender, 1);
txq.cull(sender, 1.into());

assert_eq!(txq.queued_senders(), vec![]);
assert!(txq.by_hash.is_empty());
Expand Down Expand Up @@ -535,7 +535,7 @@ mod tests {
let tx_b: PendingTransaction = Transaction::default().fake_sign(sender).into();
let tx_a: PendingTransaction = {
let mut tx_a = Transaction::default();
tx_a.gas_price = tx_b.gas_price + 1.into();
tx_a.gas_price = tx_b.gas_price + 1;
tx_a.fake_sign(sender).into()
};

Expand Down
1 change: 1 addition & 0 deletions ethcore/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ethcore = { path = ".." }
ethcore-io = { path = "../../util/io" }
ethcore-private-tx = { path = "../private-tx" }
ethcore-sync = { path = "../sync" }
kvdb = "0.1"
kvdb-rocksdb = "0.1.2-beta.0"
log = "0.4"
stop-guard = { path = "../../util/stop-guard" }
Expand Down
2 changes: 1 addition & 1 deletion ethstore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ time = "0.1.34"
itertools = "0.5"
parking_lot = "0.6"
parity-crypto = "0.1"
ethereum-types = "0.3"
ethereum-types = "0.4"
dir = { path = "../util/dir" }
smallvec = "0.4"
parity-wordlist = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion evmbin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ethcore = { path = "../ethcore", features = ["test-helpers", "json-tests"] }
ethjson = { path = "../json" }
parity-bytes = "0.1"
ethcore-transaction = { path = "../ethcore/transaction" }
ethereum-types = "0.3"
ethereum-types = "0.4"
evm = { path = "../ethcore/evm" }
panic_hook = { path = "../util/panic_hook" }
rustc-hex = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions parity/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
(report.blocks_imported * 1000) as u64 / ms,
report.transactions_applied,
(report.transactions_applied * 1000) as u64 / ms,
report.gas_processed / From::from(1_000_000),
(report.gas_processed / From::from(ms * 1000)).low_u64(),
report.gas_processed / 1_000_000,
(report.gas_processed / (ms * 1000)).low_u64(),
);
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions parity/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use dir::helpers::replace_home;
use upgrade::{upgrade, upgrade_data_paths};
use sync::{validate_node_url, self};
use db::migrate;
use parity_path;
use path;
use ethkey::Password;

pub fn to_duration(s: &str) -> Result<Duration, String> {
Expand Down Expand Up @@ -455,7 +455,7 @@ but the first password is trimmed
#[test]
#[cfg(not(windows))]
fn test_geth_ipc_path() {
use parity_path;
use path;
assert_eq!(geth_ipc_path(true), path::ethereum::with_testnet("geth.ipc").to_str().unwrap().to_owned());
assert_eq!(geth_ipc_path(false), path::ethereum::with_default("geth.ipc").to_str().unwrap().to_owned());
}
Expand Down
2 changes: 1 addition & 1 deletion parity/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl<T: InformantData> Informant<T> {
format!("{} blk/s {} tx/s {} Mgas/s",
paint(Yellow.bold(), format!("{:7.2}", (client_report.blocks_imported * 1000) as f64 / elapsed.as_milliseconds() as f64)),
paint(Yellow.bold(), format!("{:6.1}", (client_report.transactions_applied * 1000) as f64 / elapsed.as_milliseconds() as f64)),
paint(Yellow.bold(), format!("{:4}", (client_report.gas_processed / From::from(elapsed.as_milliseconds() * 1000)).low_u64()))
paint(Yellow.bold(), format!("{:4}", (client_report.gas_processed / (elapsed.as_milliseconds() * 1000)).low_u64()))
)
} else {
format!("{} hdr/s",
Expand Down
2 changes: 1 addition & 1 deletion parity/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern crate parity_rpc;
extern crate parity_updater as updater;
extern crate parity_version;
extern crate parity_whisper;
extern crate parity_path;
extern crate parity_path as path;
extern crate rpc_cli;
extern crate node_filter;
extern crate keccak_hash as hash;
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/helpers/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl Dispatcher for LightDispatcher {
to: request.to,
nonce: request.nonce,
gas_price: gas_price,
gas: request.gas.unwrap_or_else(|| gas_limit / 3.into()),
gas: request.gas.unwrap_or_else(|| gas_limit / 3),
value: request.value.unwrap_or_else(|| 0.into()),
data: request.data.unwrap_or_else(Vec::new),
condition: request.condition,
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/helpers/fake_sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn sign_call(request: CallRequest) -> Result<SignedTransaction, Error> {
let max_gas = U256::from(50_000_000);
let gas = match request.gas {
Some(gas) => gas,
None => max_gas * 10,
None => max_gas * 10u32,
};
let from = request.from.unwrap_or(0.into());

Expand Down
6 changes: 3 additions & 3 deletions rpc/src/v1/helpers/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl SenderReservations {
pub fn reserve_nonce(&mut self, minimal: U256) -> Reserved {
// Update prospective value
let dropped = self.dropped.swap(0, atomic::Ordering::SeqCst);
let prospective_value = cmp::max(minimal, self.prospective_value - dropped.into());
self.prospective_value = prospective_value + 1.into();
let prospective_value = cmp::max(minimal, self.prospective_value - dropped);
self.prospective_value = prospective_value + 1;

let (next, rx) = oneshot::channel();
let next = Some(next);
Expand Down Expand Up @@ -236,7 +236,7 @@ impl Ready {
pub fn mark_used(mut self) {
let next = self.next.take().expect("Nonce can be marked as used only once; qed");
self.next_sent.store(true, atomic::Ordering::SeqCst);
next.send(self.value + 1.into()).expect(Self::RECV_PROOF);
next.send(self.value + 1).expect(Self::RECV_PROOF);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/tests/helpers/miner_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl TestMinerService {
pub fn increment_nonce(&self, address: &Address) {
let mut next_nonces = self.next_nonces.write();
let nonce = next_nonces.entry(*address).or_insert_with(|| 0.into());
*nonce = *nonce + 1.into();
*nonce = *nonce + 1;
}
}

Expand Down
10 changes: 5 additions & 5 deletions secret_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ parity-crypto = "0.1"
ethcore-logger = { path = "../logger" }
ethcore-sync = { path = "../ethcore/sync" }
ethcore-transaction = { path = "../ethcore/transaction" }
ethereum-types = "0.3"
ethereum-types = "0.4"
kvdb = "0.1"
keccak-hash = "0.1"
ethkey = { path = "../ethkey" }
lazy_static = "1.0"
ethabi = "5.1"
ethabi-derive = "5.0"
ethabi-contract = "5.0"
ethabi = "5.1.2"
ethabi-derive = "5.1.3"
ethabi-contract = "5.1.1"

[dev-dependencies]
ethcore = { path = "../ethcore", features = ["test-helpers"] }
tempdir = "0.3"
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
kvdb-rocksdb = "0.1.2-beta.0"
4 changes: 2 additions & 2 deletions secret_store/src/key_server_cluster/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,15 @@ pub fn serialize_ecdsa_signature(nonce_public: &Public, signature_r: Secret, mut
let mut signature_v = {
let nonce_public_x = public_x(nonce_public);
let nonce_public_y: U256 = public_y(nonce_public).into();
let nonce_public_y_is_odd = !(nonce_public_y % 2.into()).is_zero();
let nonce_public_y_is_odd = !(nonce_public_y % 2).is_zero();
let bit0 = if nonce_public_y_is_odd { 1u8 } else { 0u8 };
let bit1 = if nonce_public_x != *signature_r { 2u8 } else { 0u8 };
bit0 | bit1
};

// fix high S
let curve_order = math::curve_order();
let curve_order_half = curve_order / 2.into();
let curve_order_half = curve_order / 2;
let s_numeric: U256 = (*signature_s).into();
if s_numeric > curve_order_half {
let signature_s_hash: H256 = (curve_order - s_numeric).into();
Expand Down
4 changes: 2 additions & 2 deletions secret_store/src/listener/service_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ impl<F> Iterator for PendingRequestsIterator<F> where F: Fn(U256) -> Option<(boo
}

let index = self.index.clone();
self.index = self.index + 1.into();
self.index = self.index + 1;

(self.read_request)(index)
}
Expand Down Expand Up @@ -691,7 +691,7 @@ impl DocumentKeyShadowRetrievalService {
for participant in participants {
let participant_index = Self::map_key_server_address(client, contract_address, contract, participant.clone())
.map_err(|e| format!("Error searching for {} participant: {}", participant, e))?;
participants_mask = participants_mask | (U256::one() << participant_index.into());
participants_mask = participants_mask | (U256::one() << participant_index);
}
Ok(contract.functions()
.document_key_personal_retrieved()
Expand Down
4 changes: 2 additions & 2 deletions secret_store/src/listener/service_contract_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ fn is_processed_by_this_key_server(key_server_set: &KeyServerSet, node: &NodeId,
};

let server_key_id_value: U256 = server_key_id.into();
let range_interval = U256::max_value() / total_servers_count.into();
let range_begin = (range_interval + 1.into()) * this_server_index as u32;
let range_interval = U256::max_value() / total_servers_count;
let range_begin = (range_interval + 1) * this_server_index as u32;
let range_end = range_begin.saturating_add(range_interval);

server_key_id_value >= range_begin && server_key_id_value <= range_end
Expand Down
2 changes: 1 addition & 1 deletion util/migration-rocksdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
log = "0.4"
macros = { path = "../macros" }
kvdb = "0.1"
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
kvdb-rocksdb = "0.1.2-beta.0"

[dev-dependencies]
tempdir = "0.3"
2 changes: 1 addition & 1 deletion util/network-devp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rlp = { version = "0.2.4", features = ["ethereum"] }
parity-path = "0.1"
ipnetwork = "0.12.6"
keccak-hash = "0.1"
snappy = { git = "https://github.com/paritytech/rust-snappy" }
parity-snappy = "0.1.0-beta.0"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion util/network-devp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extern crate ipnetwork;
extern crate keccak_hash as hash;
extern crate serde;
extern crate serde_json;
extern crate snappy;
extern crate parity_snappy;

#[macro_use]
extern crate error_chain;
Expand Down
2 changes: 1 addition & 1 deletion util/network-devp2p/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use network::{Error, ErrorKind, DisconnectReason, SessionInfo, ProtocolId, PeerC
use network::SessionCapabilityInfo;
use host::*;
use node_table::NodeId;
use snappy;
use parity_snappy as snappy;

// Timeout must be less than (interval - 1).
const PING_TIMEOUT: Duration = Duration::from_secs(60);
Expand Down
3 changes: 1 addition & 2 deletions util/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ ethkey = { path = "../../ethkey" }
ipnetwork = "0.12.6"
rlp = { version = "0.2.4", features = ["ethereum"] }
libc = "0.2"
snappy = { git = "https://github.com/paritytech/rust-snappy" }

parity-snappy = "0.1.0-beta.0"

[dev-dependencies]
assert_matches = "1.2"
2 changes: 1 addition & 1 deletion util/network/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use std::{io, net, fmt};
use libc::{ENFILE, EMFILE};
use io::IoError;
use {rlp, ethkey, crypto, snappy};
use {rlp, ethkey, crypto, parity_snappy as snappy};

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DisconnectReason
Expand Down
2 changes: 1 addition & 1 deletion util/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern crate ethereum_types;
extern crate ethkey;
extern crate rlp;
extern crate ipnetwork;
extern crate snappy;
extern crate parity_snappy;
extern crate libc;

#[cfg(test)] #[macro_use]
Expand Down

0 comments on commit e678b0b

Please sign in to comment.