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

Commit 7dc4d34

Browse files
authored
Backports for 2.0.5 stable (#9519)
* parity-version: mark 2.0.5 track stable * deps: bump fs-swap to 0.2.4 * Remove initial token for WS. (#9545) * version: mark release critical * Increase Gas-floor-target and Gas Cap (#9564) + Gas-floor-target increased to 8M by default + Gas-cap increased to 10M by default * Improve P2P discovery (#9526) * Add `target` to Rust traces * network-devp2p: Don't remove discovery peer in main sync * network-p2p: Refresh discovery more often * Update Peer discovery protocol * Run discovery more often when not enough nodes connected * Start the first discovery early * Update fast discovery rate * Fix tests * Fix `ping` tests * Fixing remote Node address ; adding PingPong round * Fix tests: update new +1 PingPong round * Increase slow Discovery rate Check in flight FindNode before pings * Add `deprecated` to deprecated_echo_hash * Refactor `discovery_round` branching * net_version caches network_id to avoid redundant aquire of sync read lock (#9544) * net_version caches network_id to avoid redundant aquire of sync read lock, #8746 * use lower_hex display formatting for net_peerCount rpc method
1 parent 47d7197 commit 7dc4d34

File tree

13 files changed

+287
-216
lines changed

13 files changed

+287
-216
lines changed

Cargo.lock

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Parity Ethereum client"
33
name = "parity-ethereum"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "2.0.4"
5+
version = "2.0.5"
66
license = "GPL-3.0"
77
authors = ["Parity Technologies <admin@parity.io>"]
88

ethcore/sync/src/chain/propagator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl SyncPropagator {
202202
let appended = packet.append_raw_checked(&transaction.drain(), 1, MAX_TRANSACTION_PACKET_SIZE);
203203
if !appended {
204204
// Maximal packet size reached just proceed with sending
205-
debug!("Transaction packet size limit reached. Sending incomplete set of {}/{} transactions.", pushed, to_send.len());
205+
debug!(target: "sync", "Transaction packet size limit reached. Sending incomplete set of {}/{} transactions.", pushed, to_send.len());
206206
to_send = to_send.into_iter().take(pushed).collect();
207207
break;
208208
}

parity/cli/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -700,11 +700,11 @@ usage! {
700700
"--price-update-period=[T]",
701701
"T will be allowed to pass between each gas price update. T may be daily, hourly, a number of seconds, or a time string of the form \"2 days\", \"30 minutes\" etc..",
702702

703-
ARG arg_gas_floor_target: (String) = "4700000", or |c: &Config| c.mining.as_ref()?.gas_floor_target.clone(),
703+
ARG arg_gas_floor_target: (String) = "8000000", or |c: &Config| c.mining.as_ref()?.gas_floor_target.clone(),
704704
"--gas-floor-target=[GAS]",
705705
"Amount of gas per block to target when sealing a new block.",
706706

707-
ARG arg_gas_cap: (String) = "6283184", or |c: &Config| c.mining.as_ref()?.gas_cap.clone(),
707+
ARG arg_gas_cap: (String) = "10000000", or |c: &Config| c.mining.as_ref()?.gas_cap.clone(),
708708
"--gas-cap=[GAS]",
709709
"A cap on how large we will raise the gas limit per block due to transaction volume.",
710710

@@ -1712,7 +1712,7 @@ mod tests {
17121712
arg_reseal_max_period: 60000u64,
17131713
flag_reseal_on_uncle: false,
17141714
arg_work_queue_size: 20usize,
1715-
arg_tx_gas_limit: Some("6283184".into()),
1715+
arg_tx_gas_limit: Some("10000000".into()),
17161716
arg_tx_time_limit: Some(100u64),
17171717
arg_relay_set: "cheap".into(),
17181718
arg_min_gas_price: Some(0u64),
@@ -1721,8 +1721,8 @@ mod tests {
17211721
arg_poll_lifetime: 60u32,
17221722
arg_usd_per_eth: "auto".into(),
17231723
arg_price_update_period: "hourly".into(),
1724-
arg_gas_floor_target: "4700000".into(),
1725-
arg_gas_cap: "6283184".into(),
1724+
arg_gas_floor_target: "8000000".into(),
1725+
arg_gas_cap: "10000000".into(),
17261726
arg_extra_data: Some("Parity".into()),
17271727
flag_tx_queue_no_unfamiliar_locals: false,
17281728
arg_tx_queue_size: 8192usize,

parity/cli/tests/config.full.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ min_gas_price = 0
125125
usd_per_tx = "0.0001"
126126
usd_per_eth = "auto"
127127
price_update_period = "hourly"
128-
gas_floor_target = "4700000"
129-
gas_cap = "6283184"
128+
gas_floor_target = "8000000"
129+
gas_cap = "10000000"
130130
tx_queue_size = 8192
131131
tx_queue_gas = "off"
132132
tx_queue_strategy = "gas_factor"
133133
tx_queue_ban_count = 1
134134
tx_queue_ban_time = 180 #s
135-
tx_gas_limit = "6283184"
135+
tx_gas_limit = "10000000"
136136
tx_time_limit = 100 #ms
137137
tx_queue_no_unfamiliar_locals = false
138138
extra_data = "Parity"

parity/params.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl Default for MinerExtras {
286286
author: Default::default(),
287287
engine_signer: Default::default(),
288288
extra_data: version_data(),
289-
gas_range_target: (4_700_000.into(), 6_283_184.into()),
289+
gas_range_target: (8_000_000.into(), 10_000_000.into()),
290290
work_notify: Default::default(),
291291
}
292292
}

rpc/src/authcodes.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ impl TimeProvider for DefaultTimeProvider {
5050
const TIME_THRESHOLD: u64 = 7;
5151
/// minimal length of hash
5252
const TOKEN_LENGTH: usize = 16;
53-
/// special "initial" token used for authorization when there are no tokens yet.
54-
const INITIAL_TOKEN: &'static str = "initial";
5553
/// Separator between fields in serialized tokens file.
5654
const SEPARATOR: &'static str = ";";
5755
/// Number of seconds to keep unused tokens.
@@ -163,16 +161,6 @@ impl<T: TimeProvider> AuthCodes<T> {
163161

164162
let as_token = |code| keccak(format!("{}:{}", code, time));
165163

166-
// Check if it's the initial token.
167-
if self.is_empty() {
168-
let initial = &as_token(INITIAL_TOKEN) == hash;
169-
// Initial token can be used only once.
170-
if initial {
171-
let _ = self.generate_new();
172-
}
173-
return initial;
174-
}
175-
176164
// look for code
177165
for code in &mut self.codes {
178166
if &as_token(&code.code) == hash {
@@ -239,7 +227,7 @@ mod tests {
239227
}
240228

241229
#[test]
242-
fn should_return_true_if_code_is_initial_and_store_is_empty() {
230+
fn should_return_false_even_if_code_is_initial_and_store_is_empty() {
243231
// given
244232
let code = "initial";
245233
let time = 99;
@@ -250,7 +238,7 @@ mod tests {
250238
let res2 = codes.is_valid(&generate_hash(code, time), time);
251239

252240
// then
253-
assert_eq!(res1, true);
241+
assert_eq!(res1, false);
254242
assert_eq!(res2, false);
255243
}
256244

rpc/src/tests/ws.rs

+3-20
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ mod testing {
136136
}
137137

138138
#[test]
139-
fn should_allow_initial_connection_but_only_once() {
139+
fn should_not_allow_initial_connection_even_once() {
140140
// given
141141
let (server, port, authcodes) = serve();
142142
let code = "initial";
@@ -160,26 +160,9 @@ mod testing {
160160
timestamp,
161161
)
162162
);
163-
let response2 = http_client::request(server.addr(),
164-
&format!("\
165-
GET / HTTP/1.1\r\n\
166-
Host: 127.0.0.1:{}\r\n\
167-
Connection: Close\r\n\
168-
Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\n\
169-
Sec-WebSocket-Protocol:{:?}_{}\r\n\
170-
Sec-WebSocket-Version: 13\r\n\
171-
\r\n\
172-
{{}}
173-
",
174-
port,
175-
keccak(format!("{}:{}", code, timestamp)),
176-
timestamp,
177-
)
178-
);
179163

180164
// then
181-
assert_eq!(response1.status, "HTTP/1.1 101 Switching Protocols".to_owned());
182-
assert_eq!(response2.status, "HTTP/1.1 403 Forbidden".to_owned());
183-
http_client::assert_security_headers_present(&response2.headers, None);
165+
assert_eq!(response1.status, "HTTP/1.1 403 Forbidden".to_owned());
166+
http_client::assert_security_headers_present(&response1.headers, None);
184167
}
185168
}

rpc/src/v1/impls/net.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,31 @@ use v1::traits::Net;
2222

2323
/// Net rpc implementation.
2424
pub struct NetClient<S: ?Sized> {
25-
sync: Arc<S>
25+
sync: Arc<S>,
26+
/// Cached `network_id`.
27+
///
28+
/// We cache it to avoid redundant aquire of sync read lock.
29+
/// https://github.com/paritytech/parity-ethereum/issues/8746
30+
network_id: u64,
2631
}
2732

2833
impl<S: ?Sized> NetClient<S> where S: SyncProvider {
2934
/// Creates new NetClient.
3035
pub fn new(sync: &Arc<S>) -> Self {
3136
NetClient {
3237
sync: sync.clone(),
38+
network_id: sync.status().network_id,
3339
}
3440
}
3541
}
3642

3743
impl<S: ?Sized> Net for NetClient<S> where S: SyncProvider + 'static {
3844
fn version(&self) -> Result<String> {
39-
Ok(format!("{}", self.sync.status().network_id).to_owned())
45+
Ok(format!("{}", self.network_id))
4046
}
4147

4248
fn peer_count(&self) -> Result<String> {
43-
Ok(format!("0x{:x}", self.sync.status().num_peers as u64).to_owned())
49+
Ok(format!("{:#x}", self.sync.status().num_peers as u64))
4450
}
4551

4652
fn is_listening(&self) -> Result<bool> {

0 commit comments

Comments
 (0)