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

Commit

Permalink
Backports to 1.11.8-stable (#9144)
Browse files Browse the repository at this point in the history
* parity-version: bump stable to 1.11.8

* 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

* 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

* ethcore: update to parity-wasm 0.31

* rpc: fix broken merge
  • Loading branch information
5chdn authored Jul 25, 2018
1 parent 085035f commit c754a02
Show file tree
Hide file tree
Showing 25 changed files with 400 additions and 278 deletions.
309 changes: 166 additions & 143 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Parity Ethereum client"
name = "parity"
# NOTE Make sure to update util/version/Cargo.toml as well
version = "1.11.7"
version = "1.11.8"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]

Expand Down
4 changes: 2 additions & 2 deletions docker/hub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:14.04
FROM ubuntu:xenial
MAINTAINER Parity Technologies <devops@parity.io>
WORKDIR /build
#ENV for build TAG
Expand Down Expand Up @@ -41,7 +41,6 @@ cd /build&&git clone https://github.com/paritytech/parity && \
git pull&& \
git checkout $BUILD_TAG && \
cargo build --verbose --release --features final && \
#ls /build/parity/target/release/parity && \
strip /build/parity/target/release/parity && \
file /build/parity/target/release/parity&&mkdir -p /parity&& cp /build/parity/target/release/parity /parity&&\
#cleanup Docker image
Expand All @@ -52,6 +51,7 @@ cd /build&&git clone https://github.com/paritytech/parity && \
# add-apt-repository
software-properties-common \
make \
cmake \
curl \
wget \
git \
Expand Down
46 changes: 32 additions & 14 deletions ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,9 +1149,10 @@ impl Engine<EthereumMachine> for AuthorityRound {

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

if let err @ Err(_) = validate_empty_steps() {
self.validators.report_benign(header.author(), set_number, header.number());
return err;
match validate_empty_steps() {
Ok(len) => len,
Err(err) => {
self.validators.report_benign(header.author(), set_number, header.number());
return Err(err);
},
}

} else {
self.report_skipped(header, step, parent_step, &*validators, set_number);

0
};

if header.number() >= self.validate_score_transition {
let expected_difficulty = calculate_score(parent_step.into(), step.into(), empty_steps_len.into());
if header.difficulty() != &expected_difficulty {
return Err(From::from(BlockError::InvalidDifficulty(Mismatch { expected: expected_difficulty, found: header.difficulty().clone() })));
}
}

Ok(())
Expand Down Expand Up @@ -1408,7 +1420,7 @@ mod tests {
use engines::{Seal, Engine, EngineError, EthEngine};
use engines::validator_set::TestSet;
use error::{Error, ErrorKind};
use super::{AuthorityRoundParams, AuthorityRound, EmptyStep, SealedEmptyStep};
use super::{AuthorityRoundParams, AuthorityRound, EmptyStep, SealedEmptyStep, calculate_score};

#[test]
fn has_valid_metadata() {
Expand Down Expand Up @@ -1514,12 +1526,15 @@ mod tests {

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

let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
// Two validators.
// Spec starts with step 2.
header.set_difficulty(calculate_score(U256::from(0), U256::from(2), U256::zero()));
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
header.set_seal(vec![encode(&2usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
assert!(engine.verify_block_external(&header).is_err());
header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero()));
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
assert!(engine.verify_block_external(&header).is_ok());
Expand All @@ -1540,9 +1555,10 @@ mod tests {

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

let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
// Two validators.
// Spec starts with step 2.
header.set_difficulty(calculate_score(U256::from(0), U256::from(1), U256::zero()));
let signature = tap.sign(addr, Some("0".into()), header.bare_hash()).unwrap();
header.set_seal(vec![encode(&1usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
assert!(engine.verify_block_external(&header).is_ok());
Expand All @@ -1569,8 +1585,10 @@ mod tests {
// Two validators.
// Spec starts with step 2.
header.set_seal(vec![encode(&5usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
header.set_difficulty(calculate_score(U256::from(4), U256::from(5), U256::zero()));
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
header.set_seal(vec![encode(&3usize).into_vec(), encode(&(&*signature as &[u8])).into_vec()]);
header.set_difficulty(calculate_score(U256::from(4), U256::from(3), U256::zero()));
assert!(engine.verify_block_family(&header, &parent_header).is_err());
}

Expand Down Expand Up @@ -1604,6 +1622,7 @@ mod tests {
parent_header.set_seal(vec![encode(&1usize).into_vec()]);
parent_header.set_gas_limit("222222".parse::<U256>().unwrap());
let mut header: Header = Header::default();
header.set_difficulty(calculate_score(U256::from(1), U256::from(3), U256::zero()));
header.set_gas_limit("222222".parse::<U256>().unwrap());
header.set_seal(vec![encode(&3usize).into_vec()]);

Expand Down Expand Up @@ -1963,16 +1982,15 @@ mod tests {
let empty_step3 = sealed_empty_step(engine, 3, &parent_header.hash());

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

assert!(match engine.verify_block_family(&header, &parent_header) {
Ok(_) => true,
_ => false,
});
assert!(engine.verify_block_family(&header, &parent_header).is_ok());
}

#[test]
Expand Down
10 changes: 6 additions & 4 deletions ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,10 +1026,12 @@ impl miner::MinerService for Miner {

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

match self.engine.seals_internally() {
Expand Down
24 changes: 16 additions & 8 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn fmt_err<F: ::std::fmt::Display>(f: F) -> String {

/// Parameters common to ethereum-like blockchains.
/// NOTE: when adding bugfix hard-fork parameters,
/// add to `contains_bugfix_hard_fork`
/// add to `nonzero_bugfix_hard_fork`
///
/// we define a "bugfix" hard fork as any hard fork which
/// you would put on-by-default in a new chain.
Expand Down Expand Up @@ -166,13 +166,21 @@ impl CommonParams {
}
}

/// Whether these params contain any bug-fix hard forks.
pub fn contains_bugfix_hard_fork(&self) -> bool {
self.eip98_transition != 0 && self.eip155_transition != 0 &&
self.validate_receipts_transition != 0 && self.eip86_transition != 0 &&
self.eip140_transition != 0 && self.eip210_transition != 0 &&
self.eip211_transition != 0 && self.eip214_transition != 0 &&
self.validate_chain_id_transition != 0 && self.dust_protection_transition != 0
/// Return Some if the current parameters contain a bugfix hard fork not on block 0.
pub fn nonzero_bugfix_hard_fork(&self) -> Option<&str> {
if self.eip155_transition != 0 {
return Some("eip155Transition");
}

if self.validate_receipts_transition != 0 {
return Some("validateReceiptsTransition");
}

if self.validate_chain_id_transition != 0 {
return Some("validateChainIdTransition");
}

None
}
}

Expand Down
4 changes: 2 additions & 2 deletions ethcore/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
byteorder = "1.0"
ethereum-types = "0.3"
log = "0.3"
parity-wasm = "0.27"
parity-wasm = "0.31"
libc = "0.2"
pwasm-utils = "0.1"
pwasm-utils = "0.2.2"
vm = { path = "../vm" }
ethcore-logger = { path = "../../logger" }
wasmi = { version = "0.2" }
2 changes: 1 addition & 1 deletion ethcore/wasm/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn gas_rules(wasm_costs: &vm::WasmCosts) -> rules::Set {
rules::Set::new(
wasm_costs.regular,
{
let mut vals = ::std::collections::HashMap::with_capacity(8);
let mut vals = ::std::collections::BTreeMap::new();
vals.insert(rules::InstructionType::Load, rules::Metering::Fixed(wasm_costs.mem as u32));
vals.insert(rules::InstructionType::Store, rules::Metering::Fixed(wasm_costs.mem as u32));
vals.insert(rules::InstructionType::Div, rules::Metering::Fixed(wasm_costs.div as u32));
Expand Down
2 changes: 1 addition & 1 deletion mac/Parity.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>VERSION</key>
<string>1.11.7</string>
<string>1.11.8</string>
</dict>
<key>UUID</key>
<string>2DCD5B81-7BAF-4DA1-9251-6274B089FD36</string>
Expand Down
4 changes: 4 additions & 0 deletions miner/src/pool/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ impl txpool::Scoring<VerifiedTransaction> for NonceAndGasPrice {
}
}
}

fn should_ignore_sender_limit(&self, new: &VerifiedTransaction) -> bool {
new.priority().is_local()
}
}

#[cfg(test)]
Expand Down
11 changes: 5 additions & 6 deletions miner/src/pool/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ fn should_never_drop_local_transactions_from_different_senders() {
let r1 = txq.import(TestClient::new(), vec![tx1].local());
let r2 = txq.import(TestClient::new(), vec![tx2].local());
assert_eq!(r1, vec![Ok(())]);
// max-per-sender is reached, that's ok.
assert_eq!(r2, vec![Err(transaction::Error::LimitReached)]);
assert_eq!(txq.status().status.transaction_count, 1);
assert_eq!(r2, vec![Ok(())]);
assert_eq!(txq.status().status.transaction_count, 2);

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

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

#[test]
Expand Down
2 changes: 1 addition & 1 deletion nsis/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
!define DESCRIPTION "Fast, light, robust Ethereum implementation"
!define VERSIONMAJOR 1
!define VERSIONMINOR 11
!define VERSIONBUILD 7
!define VERSIONBUILD 8
!define ARGS ""
!define FIRST_START_ARGS "--mode=passive ui"

Expand Down
14 changes: 7 additions & 7 deletions parity/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use io::{TimerToken, IoContext, IoHandler};
use light::Cache as LightDataCache;
use light::client::{LightChainClient, LightChainNotify};
use number_prefix::{binary_prefix, Standalone, Prefixed};
use parity_rpc::{is_major_importing};
use parity_rpc::is_major_importing_or_waiting;
use parity_rpc::informant::RpcStats;
use ethereum_types::H256;
use bytes::Bytes;
Expand Down Expand Up @@ -128,7 +128,7 @@ impl InformantData for FullNodeInformantData {

fn is_major_importing(&self) -> bool {
let state = self.sync.as_ref().map(|sync| sync.status().state);
is_major_importing(state, self.client.queue_info())
is_major_importing_or_waiting(state, self.client.queue_info(), false)
}

fn report(&self) -> Report {
Expand All @@ -142,23 +142,23 @@ impl InformantData for FullNodeInformantData {
cache_sizes.insert("queue", queue_info.mem_used);
cache_sizes.insert("chain", blockchain_cache_info.total());

let (importing, sync_info) = match (self.sync.as_ref(), self.net.as_ref()) {
let importing = self.is_major_importing();
let sync_info = match (self.sync.as_ref(), self.net.as_ref()) {
(Some(sync), Some(net)) => {
let status = sync.status();
let net_config = net.network_config();

cache_sizes.insert("sync", status.mem_used);

let importing = is_major_importing(Some(status.state), queue_info.clone());
(importing, Some(SyncInfo {
Some(SyncInfo {
last_imported_block_number: status.last_imported_block_number.unwrap_or(chain_info.best_block_number),
last_imported_old_block_number: status.last_imported_old_block_number,
num_peers: status.num_peers,
max_peers: status.current_max_peers(net_config.min_peers, net_config.max_peers),
snapshot_sync: status.is_snapshot_syncing(),
}))
})
}
_ => (is_major_importing(self.sync.as_ref().map(|s| s.status().state), queue_info.clone()), None),
_ => None
};

Report {
Expand Down
2 changes: 1 addition & 1 deletion parity/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub fn fatdb_switch_to_bool(switch: Switch, user_defaults: &UserDefaults, _algor
}

pub fn mode_switch_to_bool(switch: Option<Mode>, user_defaults: &UserDefaults) -> Result<Mode, String> {
Ok(switch.unwrap_or(user_defaults.mode.clone()))
Ok(switch.unwrap_or(user_defaults.mode().clone()))
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,13 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
user_defaults.pruning = algorithm;
user_defaults.tracing = tracing;
user_defaults.fat_db = fat_db;
user_defaults.mode = mode;
user_defaults.set_mode(mode);
user_defaults.save(&user_defaults_path)?;

// tell client how to save the default mode if it gets changed.
client.on_user_defaults_change(move |mode: Option<Mode>| {
if let Some(mode) = mode {
user_defaults.mode = mode;
user_defaults.set_mode(mode);
}
let _ = user_defaults.save(&user_defaults_path); // discard failures - there's nothing we can do
});
Expand Down
Loading

0 comments on commit c754a02

Please sign in to comment.