Skip to content

Commit bee1e5c

Browse files
author
Andronik Ordian
committed
Merge branch 'master' of https://github.com/paritytech/parity into warp_sync_on_light_client
* 'master' of https://github.com/paritytech/parity: CI: Fixes for Android Pipeline (openethereum#8745) Remove NetworkService::config() (openethereum#8653) Fix XOR distance calculation in discovery Kademlia impl (openethereum#8589) Print warnings when fetching pending blocks (openethereum#8711) Fix PoW blockchains sealing notifications in chain_new_blocks (openethereum#8656) Remove -k/--insecure option from curl installer (openethereum#8719) ease tiny-keccak version requirements (1.4.1 -> 1.4) (openethereum#8726) bump tinykeccak to 1.4 (openethereum#8728) Remove a couple of unnecessary `transmute()` (openethereum#8736) Fix some nits using clippy (openethereum#8731) Add 'interface' option to cli (openethereum#8699)
2 parents 402b5ac + 27f3f42 commit bee1e5c

File tree

30 files changed

+368
-197
lines changed

30 files changed

+368
-197
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ android-armv7:
190190
- triggers
191191
script:
192192
- cargo build --target=armv7-linux-androideabi
193-
- if [ $(arm-linux-androideabi-objdump -x ./target/armv7-linux-androideabi/debug/parity | grep -i 'c++_shared' | wc -l) -ne 0]; then echo "FAIL!!" fi
194193
tags:
195194
- rust-arm
195+
allow_failure: true
196196
artifacts:
197197
paths:
198198
- parity.zip

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ first.
138138
## Simple one-line installer for Mac and Ubuntu
139139

140140
```bash
141-
bash <(curl https://get.parity.io -Lk)
141+
bash <(curl https://get.parity.io -L)
142142
```
143143

144144
The one-line installer always defaults to the latest beta release. To install a stable release, run:
145145

146146
```bash
147-
bash <(curl https://get.parity.io -Lk) -r stable
147+
bash <(curl https://get.parity.io -L) -r stable
148148
```
149149

150150
## Start Parity

ethash/src/compute.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ use seed_compute::SeedHashCompute;
2525
use shared::*;
2626
use std::io;
2727

28-
use std::mem;
28+
use std::{mem, ptr};
2929
use std::path::Path;
30-
use std::ptr;
3130

3231
const MIX_WORDS: usize = ETHASH_MIX_BYTES / 4;
3332
const MIX_NODES: usize = MIX_WORDS / NODE_WORDS;
@@ -111,7 +110,7 @@ pub fn quick_get_difficulty(header_hash: &H256, nonce: u64, mix_hash: &H256) ->
111110
let mut buf: [u8; 64 + 32] = mem::uninitialized();
112111

113112
ptr::copy_nonoverlapping(header_hash.as_ptr(), buf.as_mut_ptr(), 32);
114-
ptr::copy_nonoverlapping(mem::transmute(&nonce), buf[32..].as_mut_ptr(), 8);
113+
ptr::copy_nonoverlapping(&nonce as *const u64 as *const u8, buf[32..].as_mut_ptr(), 8);
115114

116115
keccak_512::unchecked(buf.as_mut_ptr(), 64, buf.as_ptr(), 40);
117116
ptr::copy_nonoverlapping(mix_hash.as_ptr(), buf[64..].as_mut_ptr(), 32);

ethcore/crypto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ ethereum-types = "0.3"
88
quick-error = "1.2"
99
ring = "0.12"
1010
rust-crypto = "0.2.36"
11-
tiny-keccak = "1.3"
11+
tiny-keccak = "1.4"
1212

ethcore/private-tx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ rustc-hex = "1.0"
3333
serde = "1.0"
3434
serde_derive = "1.0"
3535
serde_json = "1.0"
36-
tiny-keccak = "1.3"
36+
tiny-keccak = "1.4"
3737
url = "1"

ethcore/src/client/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ impl ImportSealedBlock for Client {
21812181
route
21822182
};
21832183
let route = ChainRoute::from([route].as_ref());
2184-
self.importer.miner.chain_new_blocks(self, &[h.clone()], &[], route.enacted(), route.retracted(), true);
2184+
self.importer.miner.chain_new_blocks(self, &[h.clone()], &[], route.enacted(), route.retracted(), self.engine.seals_internally().is_some());
21852185
self.notify(|notify| {
21862186
notify.new_blocks(
21872187
vec![h.clone()],

ethcore/src/miner/miner.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,12 @@ impl Miner {
290290
{
291291
self.sealing.lock().queue
292292
.peek_last_ref()
293-
.and_then(|b| if b.block().header().number() > latest_block_number {
294-
Some(f(b))
295-
} else {
296-
None
293+
.and_then(|b| {
294+
if b.block().header().number() > latest_block_number {
295+
Some(f(b))
296+
} else {
297+
None
298+
}
297299
})
298300
}
299301

ethcore/sync/src/api.rs

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use std::sync::Arc;
1818
use std::collections::{HashMap, BTreeMap};
1919
use std::io;
20+
use std::ops::Range;
2021
use std::time::Duration;
2122
use bytes::Bytes;
2223
use devp2p::NetworkService;
@@ -453,11 +454,18 @@ impl ChainNotify for EthSync {
453454
}
454455

455456
fn start(&self) {
456-
match self.network.start().map_err(Into::into) {
457-
Err(ErrorKind::Io(ref e)) if e.kind() == io::ErrorKind::AddrInUse => warn!("Network port {:?} is already in use, make sure that another instance of an Ethereum client is not running or change the port using the --port option.", self.network.config().listen_address.expect("Listen address is not set.")),
458-
Err(err) => warn!("Error starting network: {}", err),
457+
match self.network.start() {
458+
Err((err, listen_address)) => {
459+
match err.into() {
460+
ErrorKind::Io(ref e) if e.kind() == io::ErrorKind::AddrInUse => {
461+
warn!("Network port {:?} is already in use, make sure that another instance of an Ethereum client is not running or change the port using the --port option.", listen_address.expect("Listen address is not set."))
462+
},
463+
err => warn!("Error starting network: {}", err),
464+
}
465+
},
459466
_ => {},
460467
}
468+
461469
self.network.register_protocol(self.eth_handler.clone(), self.subprotocol_name, &[ETH_PROTOCOL_VERSION_62, ETH_PROTOCOL_VERSION_63])
462470
.unwrap_or_else(|e| warn!("Error registering ethereum protocol: {:?}", e));
463471
// register the warp sync subprotocol
@@ -521,8 +529,10 @@ pub trait ManageNetwork : Send + Sync {
521529
fn start_network(&self);
522530
/// Stop network
523531
fn stop_network(&self);
524-
/// Query the current configuration of the network
525-
fn network_config(&self) -> NetworkConfiguration;
532+
/// Returns the minimum and maximum peers.
533+
/// Note that `range.end` is *exclusive*.
534+
// TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)
535+
fn num_peers_range(&self) -> Range<u32>;
526536
/// Get network context for protocol.
527537
fn with_proto_context(&self, proto: ProtocolId, f: &mut FnMut(&NetworkContext));
528538
}
@@ -562,8 +572,8 @@ impl ManageNetwork for EthSync {
562572
self.stop();
563573
}
564574

565-
fn network_config(&self) -> NetworkConfiguration {
566-
NetworkConfiguration::from(self.network.config().clone())
575+
fn num_peers_range(&self) -> Range<u32> {
576+
self.network.num_peers_range()
567577
}
568578

569579
fn with_proto_context(&self, proto: ProtocolId, f: &mut FnMut(&NetworkContext)) {
@@ -821,11 +831,15 @@ impl ManageNetwork for LightSync {
821831
}
822832

823833
fn start_network(&self) {
824-
match self.network.start().map_err(Into::into) {
825-
Err(ErrorKind::Io(ref e)) if e.kind() == io::ErrorKind::AddrInUse => {
826-
warn!("Network port {:?} is already in use, make sure that another instance of an Ethereum client is not running or change the port using the --port option.", self.network.config().listen_address.expect("Listen address is not set."))
827-
}
828-
Err(err) => warn!("Error starting network: {}", err),
834+
match self.network.start() {
835+
Err((err, listen_address)) => {
836+
match err.into() {
837+
ErrorKind::Io(ref e) if e.kind() == io::ErrorKind::AddrInUse => {
838+
warn!("Network port {:?} is already in use, make sure that another instance of an Ethereum client is not running or change the port using the --port option.", listen_address.expect("Listen address is not set."))
839+
},
840+
err => warn!("Error starting network: {}", err),
841+
}
842+
},
829843
_ => {},
830844
}
831845

@@ -844,8 +858,8 @@ impl ManageNetwork for LightSync {
844858
self.network.stop();
845859
}
846860

847-
fn network_config(&self) -> NetworkConfiguration {
848-
NetworkConfiguration::from(self.network.config().clone())
861+
fn num_peers_range(&self) -> Range<u32> {
862+
self.network.num_peers_range()
849863
}
850864

851865
fn with_proto_context(&self, proto: ProtocolId, f: &mut FnMut(&NetworkContext)) {
@@ -861,12 +875,13 @@ impl LightSyncProvider for LightSync {
861875
} else {
862876
self.proto.peer_count()
863877
};
864-
let config = self.network_config();
878+
let peers_range = self.num_peers_range();
879+
debug_assert!(peers_range.end > peers_range.start);
865880
PeerNumbers {
866881
connected: connected,
867882
active: active,
868-
max: config.max_peers as usize,
869-
min: config.min_peers as usize,
883+
max: peers_range.end as usize - 1,
884+
min: peers_range.start as usize,
870885
}
871886
}
872887

ethkey/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ parity-wordlist = "1.2"
1616
quick-error = "1.2"
1717
rand = "0.4"
1818
rustc-hex = "1.0"
19-
tiny-keccak = "1.3"
19+
tiny-keccak = "1.4"

ethstore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ serde = "1.0"
1212
serde_json = "1.0"
1313
serde_derive = "1.0"
1414
rustc-hex = "1.0"
15-
tiny-keccak = "1.3"
15+
tiny-keccak = "1.4"
1616
time = "0.1.34"
1717
itertools = "0.5"
1818
parking_lot = "0.5"

0 commit comments

Comments
 (0)