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

Commit c313039

Browse files
dvdplmdebris
authored andcommitted
Update a few parity-common dependencies (#9663)
* Update a few parity-common dependencies * cleanup * cleanup * revert update of ethereum/tests * better reporting of network rlp errors * Use rlp 0.3.0-beta.1 * fix util function get_dummy_blocks * Already a Vec * encode_list returns vec already * Address grumble * No need for betas * Fix double spaces
1 parent 73db5dd commit c313039

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+365
-351
lines changed

Cargo.lock

Lines changed: 63 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ethcore-transaction = { path = "ethcore/transaction" }
4646
ethereum-types = "0.4"
4747
node-filter = { path = "ethcore/node_filter" }
4848
ethkey = { path = "ethkey" }
49-
rlp = { version = "0.2.4", features = ["ethereum"] }
49+
rlp = { version = "0.3.0", features = ["ethereum"] }
5050
rpc-cli = { path = "rpc_cli" }
5151
parity-hash-fetch = { path = "hash-fetch" }
5252
parity-ipfs-api = { path = "ipfs" }

ethcore/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ crossbeam = "0.3"
1616
ethash = { path = "../ethash" }
1717
ethcore-bloom-journal = { path = "../util/bloom" }
1818
parity-bytes = "0.1"
19-
hashdb = "0.2.1"
20-
memorydb = "0.2.1"
21-
patricia-trie = "0.2"
19+
hashdb = "0.3.0"
20+
memorydb = "0.3.0"
21+
patricia-trie = "0.3.0"
2222
patricia-trie-ethereum = { path = "../util/patricia-trie-ethereum" }
2323
parity-crypto = "0.1"
2424
error-chain = { version = "0.12", default-features = false }
@@ -47,7 +47,7 @@ parity-machine = { path = "../machine" }
4747
parking_lot = "0.6"
4848
rayon = "1.0"
4949
rand = "0.4"
50-
rlp = { version = "0.2.4", features = ["ethereum"] }
50+
rlp = { version = "0.3.0", features = ["ethereum"] }
5151
rlp_compress = { path = "../util/rlp_compress" }
5252
rlp_derive = { path = "../util/rlp_derive" }
5353
kvdb = "0.1"

ethcore/light/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ ethcore = { path = ".."}
1212
parity-bytes = "0.1"
1313
ethcore-transaction = { path = "../transaction" }
1414
ethereum-types = "0.4"
15-
memorydb = "0.2.1"
16-
patricia-trie = "0.2"
15+
memorydb = "0.3.0"
16+
patricia-trie = "0.3.0"
1717
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
1818
ethcore-network = { path = "../../util/network" }
1919
ethcore-io = { path = "../../util/io" }
20-
hashdb = "0.2.1"
20+
hashdb = "0.3.0"
2121
heapsize = "0.4"
2222
vm = { path = "../vm" }
2323
fastmap = { path = "../../util/fastmap" }
24-
rlp = { version = "0.2.4", features = ["ethereum"] }
24+
rlp = { version = "0.3.0", features = ["ethereum"] }
2525
rlp_derive = { path = "../../util/rlp_derive" }
2626
smallvec = "0.6"
2727
futures = "0.1"

ethcore/light/src/cht.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use ethcore::ids::BlockId;
2727
use ethereum_types::{H256, U256};
2828
use hashdb::HashDB;
2929
use keccak_hasher::KeccakHasher;
30+
use kvdb::DBValue;
3031
use memorydb::MemoryDB;
3132
use bytes::Bytes;
3233
use trie::{TrieMut, Trie, Recorder};
@@ -52,13 +53,13 @@ pub const SIZE: u64 = 2048;
5253
/// A canonical hash trie. This is generic over any database it can query.
5354
/// See module docs for more details.
5455
#[derive(Debug, Clone)]
55-
pub struct CHT<DB: HashDB<KeccakHasher>> {
56+
pub struct CHT<DB: HashDB<KeccakHasher, DBValue>> {
5657
db: DB,
5758
root: H256, // the root of this CHT.
5859
number: u64,
5960
}
6061

61-
impl<DB: HashDB<KeccakHasher>> CHT<DB> {
62+
impl<DB: HashDB<KeccakHasher, DBValue>> CHT<DB> {
6263
/// Query the root of the CHT.
6364
pub fn root(&self) -> H256 { self.root }
6465

@@ -92,10 +93,10 @@ pub struct BlockInfo {
9293
/// Build an in-memory CHT from a closure which provides necessary information
9394
/// about blocks. If the fetcher ever fails to provide the info, the CHT
9495
/// will not be generated.
95-
pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher>>>
96+
pub fn build<F>(cht_num: u64, mut fetcher: F) -> Option<CHT<MemoryDB<KeccakHasher, DBValue>>>
9697
where F: FnMut(BlockId) -> Option<BlockInfo>
9798
{
98-
let mut db = MemoryDB::<KeccakHasher>::new();
99+
let mut db = MemoryDB::<KeccakHasher, DBValue>::new();
99100

100101
// start from the last block by number and work backwards.
101102
let last_num = start_number(cht_num + 1) - 1;
@@ -134,7 +135,7 @@ pub fn compute_root<I>(cht_num: u64, iterable: I) -> Option<H256>
134135
let start_num = start_number(cht_num) as usize;
135136

136137
for (i, (h, td)) in iterable.into_iter().take(SIZE as usize).enumerate() {
137-
v.push((key!(i + start_num).into_vec(), val!(h, td).into_vec()))
138+
v.push((key!(i + start_num), val!(h, td)))
138139
}
139140

140141
if v.len() == SIZE as usize {
@@ -149,7 +150,7 @@ pub fn compute_root<I>(cht_num: u64, iterable: I) -> Option<H256>
149150
/// verify the given trie branch and extract the canonical hash and total difficulty.
150151
// TODO: better support for partially-checked queries.
151152
pub fn check_proof(proof: &[Bytes], num: u64, root: H256) -> Option<(H256, U256)> {
152-
let mut db = MemoryDB::<KeccakHasher>::new();
153+
let mut db = MemoryDB::<KeccakHasher, DBValue>::new();
153154

154155
for node in proof { db.insert(&node[..]); }
155156
let res = match TrieDB::new(&db, &root) {

ethcore/light/src/client/header_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl HeaderChain {
218218
) -> Result<Self, Error> {
219219
let mut live_epoch_proofs = ::std::collections::HashMap::default();
220220

221-
let genesis = ::rlp::encode(&spec.genesis_header()).into_vec();
221+
let genesis = ::rlp::encode(&spec.genesis_header());
222222
let decoded_header = spec.genesis_header();
223223

224224
let chain = if let Some(current) = db.get(col, CURRENT_KEY)? {

ethcore/light/src/net/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Provider for TestProvider {
150150

151151
fn storage_proof(&self, req: request::CompleteStorageRequest) -> Option<request::StorageResponse> {
152152
Some(StorageResponse {
153-
proof: vec![::rlp::encode(&req.key_hash).into_vec()],
153+
proof: vec![::rlp::encode(&req.key_hash)],
154154
value: req.key_hash | req.address_hash,
155155
})
156156
}

ethcore/light/src/on_demand/request.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ mod tests {
11561156
header.set_number(10_000);
11571157
header.set_extra_data(b"test_header".to_vec());
11581158
let hash = header.hash();
1159-
let raw_header = encoded::Header::new(::rlp::encode(&header).into_vec());
1159+
let raw_header = encoded::Header::new(::rlp::encode(&header));
11601160

11611161
let cache = Mutex::new(make_cache());
11621162
assert!(HeaderByHash(hash.into()).check_response(&cache, &hash.into(), &[raw_header]).is_ok())
@@ -1177,14 +1177,14 @@ mod tests {
11771177
headers.reverse(); // because responses are in reverse order
11781178

11791179
let raw_headers = headers.iter()
1180-
.map(|hdr| encoded::Header::new(::rlp::encode(hdr).into_vec()))
1180+
.map(|hdr| encoded::Header::new(::rlp::encode(hdr)))
11811181
.collect::<Vec<_>>();
11821182

11831183
let mut invalid_successor = Header::new();
11841184
invalid_successor.set_number(11);
11851185
invalid_successor.set_parent_hash(headers[1].hash());
11861186

1187-
let raw_invalid_successor = encoded::Header::new(::rlp::encode(&invalid_successor).into_vec());
1187+
let raw_invalid_successor = encoded::Header::new(::rlp::encode(&invalid_successor));
11881188

11891189
let cache = Mutex::new(make_cache());
11901190

@@ -1247,10 +1247,10 @@ mod tests {
12471247
let mut body_stream = RlpStream::new_list(2);
12481248
body_stream.begin_list(0).begin_list(0);
12491249

1250-
let req = Body(encoded::Header::new(::rlp::encode(&header).into_vec()).into());
1250+
let req = Body(encoded::Header::new(::rlp::encode(&header)).into());
12511251

12521252
let cache = Mutex::new(make_cache());
1253-
let response = encoded::Body::new(body_stream.drain().into_vec());
1253+
let response = encoded::Body::new(body_stream.drain());
12541254
assert!(req.check_response(&cache, &response).is_ok())
12551255
}
12561256

@@ -1270,7 +1270,7 @@ mod tests {
12701270

12711271
header.set_receipts_root(receipts_root);
12721272

1273-
let req = BlockReceipts(encoded::Header::new(::rlp::encode(&header).into_vec()).into());
1273+
let req = BlockReceipts(encoded::Header::new(::rlp::encode(&header)).into());
12741274

12751275
let cache = Mutex::new(make_cache());
12761276
assert!(req.check_response(&cache, &receipts).is_ok())
@@ -1318,7 +1318,7 @@ mod tests {
13181318
header.set_state_root(root.clone());
13191319

13201320
let req = Account {
1321-
header: encoded::Header::new(::rlp::encode(&header).into_vec()).into(),
1321+
header: encoded::Header::new(::rlp::encode(&header)).into(),
13221322
address: addr,
13231323
};
13241324

@@ -1332,7 +1332,7 @@ mod tests {
13321332
let code_hash = keccak(&code);
13331333
let header = Header::new();
13341334
let req = Code {
1335-
header: encoded::Header::new(::rlp::encode(&header).into_vec()).into(),
1335+
header: encoded::Header::new(::rlp::encode(&header)).into(),
13361336
code_hash: code_hash.into(),
13371337
};
13381338

ethcore/light/src/types/request/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ mod tests {
16761676
let full_req = Request::Headers(req.clone());
16771677
let res = HeadersResponse {
16781678
headers: vec![
1679-
::ethcore::encoded::Header::new(::rlp::encode(&Header::default()).into_vec())
1679+
::ethcore::encoded::Header::new(::rlp::encode(&Header::default()))
16801680
]
16811681
};
16821682
let full_res = Response::Headers(res.clone());

ethcore/private-tx/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ heapsize = "0.4"
2626
keccak-hash = "0.1.2"
2727
log = "0.4"
2828
parking_lot = "0.6"
29-
patricia-trie = "0.2"
29+
patricia-trie = "0.3.0"
3030
patricia-trie-ethereum = { path = "../../util/patricia-trie-ethereum" }
3131
rand = "0.3"
32-
rlp = { version = "0.2.4", features = ["ethereum"] }
32+
rlp = { version = "0.3.0", features = ["ethereum"] }
3333
rlp_derive = { path = "../../util/rlp_derive" }
3434
rustc-hex = "1.0"
3535
serde = "1.0"

ethcore/private-tx/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Provider where {
220220
let private_state_hash = self.calculate_state_hash(&private_state, contract_nonce);
221221
trace!(target: "privatetx", "Hashed effective private state for sender: {:?}", private_state_hash);
222222
self.transactions_for_signing.write().add_transaction(private.hash(), signed_transaction, contract_validators, private_state, contract_nonce)?;
223-
self.broadcast_private_transaction(private.hash(), private.rlp_bytes().into_vec());
223+
self.broadcast_private_transaction(private.hash(), private.rlp_bytes());
224224
Ok(Receipt {
225225
hash: tx_hash,
226226
contract_address: Some(contract),
@@ -259,13 +259,13 @@ impl Provider where {
259259
match transaction.validator_account {
260260
None => {
261261
trace!(target: "privatetx", "Propagating transaction further");
262-
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec());
262+
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes());
263263
return Ok(());
264264
}
265265
Some(validator_account) => {
266266
if !self.validator_accounts.contains(&validator_account) {
267267
trace!(target: "privatetx", "Propagating transaction further");
268-
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes().into_vec());
268+
self.broadcast_private_transaction(private_hash, transaction.private_transaction.rlp_bytes());
269269
return Ok(());
270270
}
271271
let tx_action = transaction.transaction.action.clone();
@@ -291,7 +291,7 @@ impl Provider where {
291291
let signed_state = signed_state.expect("Error was checked before");
292292
let signed_private_transaction = SignedPrivateTransaction::new(private_hash, signed_state, None);
293293
trace!(target: "privatetx", "Sending signature for private transaction: {:?}", signed_private_transaction);
294-
self.broadcast_signed_private_transaction(signed_private_transaction.hash(), signed_private_transaction.rlp_bytes().into_vec());
294+
self.broadcast_signed_private_transaction(signed_private_transaction.hash(), signed_private_transaction.rlp_bytes());
295295
} else {
296296
bail!("Incorrect type of action for the transaction");
297297
}
@@ -316,7 +316,7 @@ impl Provider where {
316316
let desc = match self.transactions_for_signing.read().get(&private_hash) {
317317
None => {
318318
// Not our transaction, broadcast further to peers
319-
self.broadcast_signed_private_transaction(signed_tx.hash(), signed_tx.rlp_bytes().into_vec());
319+
self.broadcast_signed_private_transaction(signed_tx.hash(), signed_tx.rlp_bytes());
320320
return Ok(());
321321
},
322322
Some(desc) => desc,

ethcore/src/account_db.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ impl Default for Factory {
5858
impl Factory {
5959
/// Create a read-only accountdb.
6060
/// This will panic when write operations are called.
61-
pub fn readonly<'db>(&self, db: &'db HashDB<KeccakHasher>, address_hash: H256) -> Box<HashDB<KeccakHasher> + 'db> {
61+
pub fn readonly<'db>(&self, db: &'db HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Box<HashDB<KeccakHasher, DBValue> + 'db> {
6262
match *self {
6363
Factory::Mangled => Box::new(AccountDB::from_hash(db, address_hash)),
6464
Factory::Plain => Box::new(Wrapping(db)),
6565
}
6666
}
6767

6868
/// Create a new mutable hashdb.
69-
pub fn create<'db>(&self, db: &'db mut HashDB<KeccakHasher>, address_hash: H256) -> Box<HashDB<KeccakHasher> + 'db> {
69+
pub fn create<'db>(&self, db: &'db mut HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Box<HashDB<KeccakHasher, DBValue> + 'db> {
7070
match *self {
7171
Factory::Mangled => Box::new(AccountDBMut::from_hash(db, address_hash)),
7272
Factory::Plain => Box::new(WrappingMut(db)),
@@ -78,32 +78,32 @@ impl Factory {
7878
/// DB backend wrapper for Account trie
7979
/// Transforms trie node keys for the database
8080
pub struct AccountDB<'db> {
81-
db: &'db HashDB<KeccakHasher>,
81+
db: &'db HashDB<KeccakHasher, DBValue>,
8282
address_hash: H256,
8383
}
8484

8585
impl<'db> AccountDB<'db> {
8686
/// Create a new AccountDB from an address.
8787
#[cfg(test)]
88-
pub fn new(db: &'db HashDB<KeccakHasher>, address: &Address) -> Self {
88+
pub fn new(db: &'db HashDB<KeccakHasher, DBValue>, address: &Address) -> Self {
8989
Self::from_hash(db, keccak(address))
9090
}
9191

9292
/// Create a new AcountDB from an address' hash.
93-
pub fn from_hash(db: &'db HashDB<KeccakHasher>, address_hash: H256) -> Self {
93+
pub fn from_hash(db: &'db HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Self {
9494
AccountDB {
9595
db: db,
9696
address_hash: address_hash,
9797
}
9898
}
9999
}
100100

101-
impl<'db> AsHashDB<KeccakHasher> for AccountDB<'db> {
102-
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
103-
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
101+
impl<'db> AsHashDB<KeccakHasher, DBValue> for AccountDB<'db> {
102+
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
103+
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
104104
}
105105

106-
impl<'db> HashDB<KeccakHasher> for AccountDB<'db> {
106+
impl<'db> HashDB<KeccakHasher, DBValue> for AccountDB<'db> {
107107
fn keys(&self) -> HashMap<H256, i32> {
108108
unimplemented!()
109109
}
@@ -137,19 +137,19 @@ impl<'db> HashDB<KeccakHasher> for AccountDB<'db> {
137137

138138
/// DB backend wrapper for Account trie
139139
pub struct AccountDBMut<'db> {
140-
db: &'db mut HashDB<KeccakHasher>,
140+
db: &'db mut HashDB<KeccakHasher, DBValue>,
141141
address_hash: H256,
142142
}
143143

144144
impl<'db> AccountDBMut<'db> {
145145
/// Create a new AccountDB from an address.
146146
#[cfg(test)]
147-
pub fn new(db: &'db mut HashDB<KeccakHasher>, address: &Address) -> Self {
147+
pub fn new(db: &'db mut HashDB<KeccakHasher, DBValue>, address: &Address) -> Self {
148148
Self::from_hash(db, keccak(address))
149149
}
150150

151151
/// Create a new AcountDB from an address' hash.
152-
pub fn from_hash(db: &'db mut HashDB<KeccakHasher>, address_hash: H256) -> Self {
152+
pub fn from_hash(db: &'db mut HashDB<KeccakHasher, DBValue>, address_hash: H256) -> Self {
153153
AccountDBMut {
154154
db: db,
155155
address_hash: address_hash,
@@ -162,7 +162,7 @@ impl<'db> AccountDBMut<'db> {
162162
}
163163
}
164164

165-
impl<'db> HashDB<KeccakHasher> for AccountDBMut<'db>{
165+
impl<'db> HashDB<KeccakHasher, DBValue> for AccountDBMut<'db>{
166166
fn keys(&self) -> HashMap<H256, i32> {
167167
unimplemented!()
168168
}
@@ -208,19 +208,19 @@ impl<'db> HashDB<KeccakHasher> for AccountDBMut<'db>{
208208
}
209209
}
210210

211-
impl<'db> AsHashDB<KeccakHasher> for AccountDBMut<'db> {
212-
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
213-
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
211+
impl<'db> AsHashDB<KeccakHasher, DBValue> for AccountDBMut<'db> {
212+
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
213+
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
214214
}
215215

216-
struct Wrapping<'db>(&'db HashDB<KeccakHasher>);
216+
struct Wrapping<'db>(&'db HashDB<KeccakHasher, DBValue>);
217217

218-
impl<'db> AsHashDB<KeccakHasher> for Wrapping<'db> {
219-
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
220-
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
218+
impl<'db> AsHashDB<KeccakHasher, DBValue> for Wrapping<'db> {
219+
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
220+
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
221221
}
222222

223-
impl<'db> HashDB<KeccakHasher> for Wrapping<'db> {
223+
impl<'db> HashDB<KeccakHasher, DBValue> for Wrapping<'db> {
224224
fn keys(&self) -> HashMap<H256, i32> {
225225
unimplemented!()
226226
}
@@ -252,13 +252,13 @@ impl<'db> HashDB<KeccakHasher> for Wrapping<'db> {
252252
}
253253
}
254254

255-
struct WrappingMut<'db>(&'db mut HashDB<KeccakHasher>);
256-
impl<'db> AsHashDB<KeccakHasher> for WrappingMut<'db> {
257-
fn as_hashdb(&self) -> &HashDB<KeccakHasher> { self }
258-
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher> { self }
255+
struct WrappingMut<'db>(&'db mut HashDB<KeccakHasher, DBValue>);
256+
impl<'db> AsHashDB<KeccakHasher, DBValue> for WrappingMut<'db> {
257+
fn as_hashdb(&self) -> &HashDB<KeccakHasher, DBValue> { self }
258+
fn as_hashdb_mut(&mut self) -> &mut HashDB<KeccakHasher, DBValue> { self }
259259
}
260260

261-
impl<'db> HashDB<KeccakHasher> for WrappingMut<'db>{
261+
impl<'db> HashDB<KeccakHasher, DBValue> for WrappingMut<'db>{
262262
fn keys(&self) -> HashMap<H256, i32> {
263263
unimplemented!()
264264
}

0 commit comments

Comments
 (0)