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

Commit e7dc0be

Browse files
authored
Backports to 2.0.1-beta (#9145)
* parity-version: bump beta to 2.0.1 * ci: update version strings for snaps * Be more graceful on Aura difficulty validation (#9164) * Be more graceful on Aura difficulty validation * test: rejects_step_backwards * test: proposer_switching * test: rejects_future_block * test: reports_skipped * test: verify_empty_seal_steps * Remove node-health (#9119) * Remove node-health * Remove ntp_servers * Add --ntp-servers as legacy instead of removing it * Add --ntp-servers to deprecated args * Remove unused stuff * Remove _legacy_ntp_servers * parity: fix UserDefaults json parser (#9189) * parity: fix UserDefaults json parser * parity: use serde_derive for UserDefaults * parity: support deserialization of old UserDefault json format * parity: make UserDefaults serde backwards compatible * parity: tabify indentation in UserDefaults * Fix bugfix hard fork logic (#9138) * Fix bugfix hard fork logic * Remove dustProtectionTransition from bugfix category EIP-168 is not enabled by default * Remove unnecessary 'static * Disable per-sender limit for local transactions. (#9148) * Disable per-sender limit for local transactions. * Add a missing new line. * rpc: fix is_major_importing sync state condition (#9112) * rpc: fix is_major_importing sync state condition * rpc: fix informant printout when waiting for peers * fix verification in ethcore-sync collect_blocks (#9135) * docker: update hub dockerfile (#9173) * update Dockerfile for hub update to Ubuntu Xenial 16.04 fix cmake version * docker: fix tab indentation in hub dockerfile * rpc: fix broken merge * rcp: remove node_health leftover from merge * rpc: remove dapps leftover from merge
1 parent 6eae372 commit e7dc0be

File tree

37 files changed

+300
-963
lines changed

37 files changed

+300
-963
lines changed

Cargo.lock

Lines changed: 59 additions & 96 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 & 2 deletions
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.0"
5+
version = "2.0.1"
66
license = "GPL-3.0"
77
authors = ["Parity Technologies <admin@parity.io>"]
88

@@ -46,7 +46,6 @@ ethcore-transaction = { path = "ethcore/transaction" }
4646
ethereum-types = "0.3"
4747
node-filter = { path = "ethcore/node_filter" }
4848
ethkey = { path = "ethkey" }
49-
node-health = { path = "node-health" }
5049
rlp = { git = "https://github.com/paritytech/parity-common" }
5150
rpc-cli = { path = "rpc_cli" }
5251
parity-hash-fetch = { path = "hash-fetch" }

docker/hub/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:14.04
1+
FROM ubuntu:xenial
22
MAINTAINER Parity Technologies <devops@parity.io>
33
WORKDIR /build
44
#ENV for build TAG
@@ -41,7 +41,6 @@ cd /build&&git clone https://github.com/paritytech/parity && \
4141
git pull&& \
4242
git checkout $BUILD_TAG && \
4343
cargo build --verbose --release --features final && \
44-
#ls /build/parity/target/release/parity && \
4544
strip /build/parity/target/release/parity && \
4645
file /build/parity/target/release/parity&&mkdir -p /parity&& cp /build/parity/target/release/parity /parity&&\
4746
#cleanup Docker image
@@ -52,6 +51,7 @@ cd /build&&git clone https://github.com/paritytech/parity && \
5251
# add-apt-repository
5352
software-properties-common \
5453
make \
54+
cmake \
5555
curl \
5656
wget \
5757
git \

ethcore/src/engines/authority_round/mod.rs

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,9 +1149,10 @@ impl Engine<EthereumMachine> for AuthorityRound {
11491149

11501150
// If empty step messages are enabled we will validate the messages in the seal, missing messages are not
11511151
// reported as there's no way to tell whether the empty step message was never sent or simply not included.
1152-
if header.number() >= self.empty_steps_transition {
1153-
let validate_empty_steps = || -> Result<(), Error> {
1152+
let empty_steps_len = if header.number() >= self.empty_steps_transition {
1153+
let validate_empty_steps = || -> Result<usize, Error> {
11541154
let empty_steps = header_empty_steps(header)?;
1155+
let empty_steps_len = empty_steps.len();
11551156
for empty_step in empty_steps {
11561157
if empty_step.step <= parent_step || empty_step.step >= step {
11571158
Err(EngineError::InsufficientProof(
@@ -1168,16 +1169,27 @@ impl Engine<EthereumMachine> for AuthorityRound {
11681169
format!("invalid empty step proof: {:?}", empty_step)))?;
11691170
}
11701171
}
1171-
Ok(())
1172+
Ok(empty_steps_len)
11721173
};
11731174

1174-
if let err @ Err(_) = validate_empty_steps() {
1175-
self.validators.report_benign(header.author(), set_number, header.number());
1176-
return err;
1175+
match validate_empty_steps() {
1176+
Ok(len) => len,
1177+
Err(err) => {
1178+
self.validators.report_benign(header.author(), set_number, header.number());
1179+
return Err(err);
1180+
},
11771181
}
1178-
11791182
} else {
11801183
self.report_skipped(header, step, parent_step, &*validators, set_number);
1184+
1185+
0
1186+
};
1187+
1188+
if header.number() >= self.validate_score_transition {
1189+
let expected_difficulty = calculate_score(parent_step.into(), step.into(), empty_steps_len.into());
1190+
if header.difficulty() != &expected_difficulty {
1191+
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: expected_difficulty, found: header.difficulty().clone() })));
1192+
}
11811193
}
11821194

11831195
Ok(())
@@ -1412,7 +1424,7 @@ mod tests {
14121424
use engines::{Seal, Engine, EngineError, EthEngine};
14131425
use engines::validator_set::TestSet;
14141426
use error::{Error, ErrorKind};
1415-
use super::{AuthorityRoundParams, AuthorityRound, EmptyStep, SealedEmptyStep};
1427+
use super::{AuthorityRoundParams, AuthorityRound, EmptyStep, SealedEmptyStep, calculate_score};
14161428

14171429
#[test]
14181430
fn has_valid_metadata() {
@@ -1518,12 +1530,15 @@ mod tests {
15181530

15191531
let engine = Spec::new_test_round().engine;
15201532

1521-
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
15221533
// Two validators.
15231534
// Spec starts with step 2.
1535+
header.set_difficulty(calculate_score(U256::from(0), U256::from(2), U256::zero()));
1536+
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
15241537
header.set_seal(vec![encode(&2usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
15251538
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
15261539
assert!(engine.verify_block_external(&header).is_err());
1540+
header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero()));
1541+
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
15271542
header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
15281543
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
15291544
assert!(engine.verify_block_external(&header).is_ok());
@@ -1544,9 +1559,10 @@ mod tests {
15441559

15451560
let engine = Spec::new_test_round().engine;
15461561

1547-
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
15481562
// Two validators.
15491563
// Spec starts with step 2.
1564+
header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero()));
1565+
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
15501566
header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
15511567
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
15521568
assert!(engine.verify_block_external(&header).is_ok());
@@ -1573,8 +1589,10 @@ mod tests {
15731589
// Two validators.
15741590
// Spec starts with step 2.
15751591
header.set_seal(vec![encode(&5usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
1592+
header.set_difficulty(calculate_score(U256::from(4), U256::from(5), U256::zero()));
15761593
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
15771594
header.set_seal(vec![encode(&3usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
1595+
header.set_difficulty(calculate_score(U256::from(4), U256::from(3), U256::zero()));
15781596
assert!(engine.verify_block_family(&header, &parent_header).is_err());
15791597
}
15801598

@@ -1608,6 +1626,7 @@ mod tests {
16081626
parent_header.set_seal(vec![encode(&1usize).into_vec()]);
16091627
parent_header.set_gas_limit("222222".parse::<U256>().unwrap());
16101628
let mut header: Header = Header::default();
1629+
header.set_difficulty(calculate_score(U256::from(1), U256::from(3), U256::zero()));
16111630
header.set_gas_limit("222222".parse::<U256>().unwrap());
16121631
header.set_seal(vec![encode(&3usize).into_vec()]);
16131632

@@ -1967,16 +1986,15 @@ mod tests {
19671986
let empty_step3 = sealed_empty_step(engine, 3, &parent_header.hash());
19681987

19691988
let empty_steps = vec![empty_step2, empty_step3];
1989+
header.set_difficulty(calculate_score(U256::from(0), U256::from(4), U256::from(2)));
1990+
let signature = tap.sign(addr1, Some("1".into()), header.bare_hash()).unwrap();
19701991
header.set_seal(vec![
19711992
encode(&4usize).into_vec(),
19721993
encode(&(&*signature as &[u8])).into_vec(),
19731994
::rlp::encode_list(&empty_steps).into_vec(),
19741995
]);
19751996

1976-
assert!(match engine.verify_block_family(&header, &parent_header) {
1977-
Ok(_) => true,
1978-
_ => false,
1979-
});
1997+
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
19801998
}
19811999

19822000
#[test]

ethcore/src/miner/miner.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,10 +1055,12 @@ impl miner::MinerService for Miner {
10551055

10561056
// refuse to seal the first block of the chain if it contains hard forks
10571057
// which should be on by default.
1058-
if block.block().header().number() == 1 && self.engine.params().contains_bugfix_hard_fork() {
1059-
warn!("Your chain specification contains one or more hard forks which are required to be \
1060-
on by default. Please remove these forks and start your chain again.");
1061-
return;
1058+
if block.block().header().number() == 1 {
1059+
if let Some(name) = self.engine.params().nonzero_bugfix_hard_fork() {
1060+
warn!("Your chain specification contains one or more hard forks which are required to be \
1061+
on by default. Please remove these forks and start your chain again: {}.", name);
1062+
return;
1063+
}
10621064
}
10631065

10641066
match self.engine.seals_internally() {

ethcore/src/spec/spec.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn fmt_err<F: ::std::fmt::Display>(f: F) -> String {
5757

5858
/// Parameters common to ethereum-like blockchains.
5959
/// NOTE: when adding bugfix hard-fork parameters,
60-
/// add to `contains_bugfix_hard_fork`
60+
/// add to `nonzero_bugfix_hard_fork`
6161
///
6262
/// we define a "bugfix" hard fork as any hard fork which
6363
/// you would put on-by-default in a new chain.
@@ -188,13 +188,21 @@ impl CommonParams {
188188
}
189189
}
190190

191-
/// Whether these params contain any bug-fix hard forks.
192-
pub fn contains_bugfix_hard_fork(&self) -> bool {
193-
self.eip98_transition != 0 && self.eip155_transition != 0 &&
194-
self.validate_receipts_transition != 0 && self.eip86_transition != 0 &&
195-
self.eip140_transition != 0 && self.eip210_transition != 0 &&
196-
self.eip211_transition != 0 && self.eip214_transition != 0 &&
197-
self.validate_chain_id_transition != 0 && self.dust_protection_transition != 0
191+
/// Return Some if the current parameters contain a bugfix hard fork not on block 0.
192+
pub fn nonzero_bugfix_hard_fork(&self) -> Option<&str> {
193+
if self.eip155_transition != 0 {
194+
return Some("eip155Transition");
195+
}
196+
197+
if self.validate_receipts_transition != 0 {
198+
return Some("validateReceiptsTransition");
199+
}
200+
201+
if self.validate_chain_id_transition != 0 {
202+
return Some("validateChainIdTransition");
203+
}
204+
205+
None
198206
}
199207
}
200208

miner/src/pool/scoring.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ impl txpool::Scoring<VerifiedTransaction> for NonceAndGasPrice {
143143
}
144144
}
145145
}
146+
147+
fn should_ignore_sender_limit(&self, new: &VerifiedTransaction) -> bool {
148+
new.priority().is_local()
149+
}
146150
}
147151

148152
#[cfg(test)]

miner/src/pool/tests/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,11 @@ fn should_never_drop_local_transactions_from_different_senders() {
116116
let r1 = txq.import(TestClient::new(), vec![tx1].local());
117117
let r2 = txq.import(TestClient::new(), vec![tx2].local());
118118
assert_eq!(r1, vec![Ok(())]);
119-
// max-per-sender is reached, that's ok.
120-
assert_eq!(r2, vec![Err(transaction::Error::LimitReached)]);
121-
assert_eq!(txq.status().status.transaction_count, 1);
119+
assert_eq!(r2, vec![Ok(())]);
120+
assert_eq!(txq.status().status.transaction_count, 2);
122121

123122
// then
124-
assert_eq!(txq.next_nonce(TestClient::new(), &sender), Some(nonce + 1.into()));
123+
assert_eq!(txq.next_nonce(TestClient::new(), &sender), Some(nonce + 2.into()));
125124

126125
// when
127126
let tx1 = Tx::gas_price(2).signed();
@@ -134,8 +133,8 @@ fn should_never_drop_local_transactions_from_different_senders() {
134133
// then
135134
assert_eq!(res, vec![Ok(()), Ok(())]);
136135
assert_eq!(res2, vec![Ok(()), Ok(())]);
137-
assert_eq!(txq.status().status.transaction_count, 5);
138-
assert_eq!(txq.next_nonce(TestClient::new(), &sender), Some(nonce + 1.into()));
136+
assert_eq!(txq.status().status.transaction_count, 6);
137+
assert_eq!(txq.next_nonce(TestClient::new(), &sender), Some(nonce + 2.into()));
139138
}
140139

141140
#[test]

node-health/Cargo.toml

Lines changed: 0 additions & 18 deletions
This file was deleted.

node-health/src/health.rs

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)