From bc0d134bb43c65a5b82bd18c311319c7036d2c8d Mon Sep 17 00:00:00 2001 From: Afri Schoedon <5chdn@users.noreply.github.com> Date: Tue, 5 Jun 2018 22:10:05 +0200 Subject: [PATCH] parity-version: bump stable to 1.10.6 (#8805) * parity-version: bump stable to 1.10.6 * Disallow unsigned transactions in case EIP-86 is disabled (#8802) * Disallow unsigned transactions in case EIP-86 is disabled * Add tests for verification * Add disallow unsigned transactions test in machine * Fix tests --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- ethcore/src/ethereum/mod.rs | 3 +++ ethcore/src/machine.rs | 24 ++++++++++++++++++++++++ ethcore/src/verification/verification.rs | 20 ++++++++++++++++++++ ethcore/transaction/src/transaction.rs | 4 ++++ mac/Parity.pkgproj | 2 +- nsis/installer.nsi | 2 +- util/version/Cargo.toml | 4 ++-- 9 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f696f759..e51079e0d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1867,7 +1867,7 @@ dependencies = [ [[package]] name = "parity" -version = "1.10.5" +version = "1.10.6" dependencies = [ "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1915,7 +1915,7 @@ dependencies = [ "parity-rpc 1.9.0", "parity-rpc-client 1.4.0", "parity-updater 1.9.0", - "parity-version 1.10.5", + "parity-version 1.10.6", "parity-whisper 0.1.0", "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", @@ -1964,7 +1964,7 @@ dependencies = [ "parity-reactor 0.1.0", "parity-ui 1.9.0", "parity-ui-deprecation 1.10.0", - "parity-version 1.10.5", + "parity-version 1.10.6", "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2115,7 +2115,7 @@ dependencies = [ "order-stat 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", "parity-updater 1.9.0", - "parity-version 1.10.5", + "parity-version 1.10.6", "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2232,7 +2232,7 @@ dependencies = [ "ethsync 1.9.0", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.9.0", - "parity-version 1.10.5", + "parity-version 1.10.6", "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2241,7 +2241,7 @@ dependencies = [ [[package]] name = "parity-version" -version = "1.10.5" +version = "1.10.6" dependencies = [ "ethcore-bytes 0.1.0", "rlp 0.2.1", diff --git a/Cargo.toml b/Cargo.toml index d71e8b9fa..58a094ca4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ description = "Parity Ethereum client" name = "parity" # NOTE Make sure to update util/version/Cargo.toml as well -version = "1.10.5" +version = "1.10.6" license = "GPL-3.0" authors = ["Parity Technologies "] diff --git a/ethcore/src/ethereum/mod.rs b/ethcore/src/ethereum/mod.rs index 03a7a1ad1..d447a76e6 100644 --- a/ethcore/src/ethereum/mod.rs +++ b/ethcore/src/ethereum/mod.rs @@ -91,6 +91,9 @@ pub fn new_morden<'a, T: Into>>(params: T) -> Spec { /// Create a new Foundation Frontier-era chain spec as though it never changes to Homestead. pub fn new_frontier_test() -> Spec { load(None, include_bytes!("../../res/ethereum/frontier_test.json")) } +/// Create a new Ropsten chain spec. +pub fn new_ropsten_test() -> Spec { load(None, include_bytes!("../../res/ethereum/ropsten.json")) } + /// Create a new Foundation Homestead-era chain spec as though it never changed from Frontier. pub fn new_homestead_test() -> Spec { load(None, include_bytes!("../../res/ethereum/homestead_test.json")) } diff --git a/ethcore/src/machine.rs b/ethcore/src/machine.rs index e7db3fbe4..dbf58116a 100644 --- a/ethcore/src/machine.rs +++ b/ethcore/src/machine.rs @@ -473,6 +473,30 @@ fn round_block_gas_limit(gas_limit: U256, lower_limit: U256, upper_limit: U256) mod tests { use super::*; + #[test] + fn should_disallow_unsigned_transactions() { + use tests::helpers::get_default_ethash_extensions; + + let rlp = "ea80843b9aca0083015f90948921ebb5f79e9e3920abe571004d0b1d5119c154865af3107a400080038080".into(); + let transaction: UnverifiedTransaction = ::rlp::decode(&::rustc_hex::FromHex::from_hex(rlp).unwrap()); + let spec = ::ethereum::new_ropsten_test(); + let ethparams = get_default_ethash_extensions(); + + let machine = EthereumMachine::with_ethash_extensions( + spec.params().clone(), + Default::default(), + ethparams, + ); + let mut header = ::header::Header::new(); + header.set_number(15); + + let res = machine.verify_transaction_basic(&transaction, &header); + match res { + Err(Error::Transaction(transaction::Error::InvalidSignature(_))) => (), + e => panic!("Expected: Transaction Invalid Signature, Got: {:?}", e), + } + } + #[test] fn ethash_gas_limit_is_multiple_of_determinant() { use ethereum_types::U256; diff --git a/ethcore/src/verification/verification.rs b/ethcore/src/verification/verification.rs index d9f901ddf..e56d2b1d4 100644 --- a/ethcore/src/verification/verification.rs +++ b/ethcore/src/verification/verification.rs @@ -340,6 +340,7 @@ mod tests { use hash::keccak; use engines::EthEngine; use error::BlockError::*; + use error::Error; use ethkey::{Random, Generator}; use spec::{CommonParams, Spec}; use tests::helpers::{create_test_block_with_data, create_test_block}; @@ -556,7 +557,17 @@ mod tests { nonce: U256::from(2) }.sign(keypair.secret(), None); + let tr3 = Transaction { + action: Action::Call(0x0.into()), + value: U256::from(0), + data: Bytes::new(), + gas: U256::from(30_000), + gas_price: U256::from(0), + nonce: U256::zero(), + }.null_sign(0); + let good_transactions = [ tr1.clone(), tr2.clone() ]; + let eip86_transactions = [ tr3.clone() ]; let diff_inc = U256::from(0x40); @@ -592,6 +603,7 @@ mod tests { uncles_rlp.append_list(&good_uncles); let good_uncles_hash = keccak(uncles_rlp.as_raw()); let good_transactions_root = ordered_trie_root(good_transactions.iter().map(|t| ::rlp::encode::(t))); + let eip86_transactions_root = ordered_trie_root(eip86_transactions.iter().map(|t| ::rlp::encode::(t))); let mut parent = good.clone(); parent.set_number(9); @@ -612,6 +624,14 @@ mod tests { check_ok(basic_test(&create_test_block(&good), engine)); + let mut bad_header = good.clone(); + bad_header.set_transactions_root(eip86_transactions_root.clone()); + bad_header.set_uncles_hash(good_uncles_hash.clone()); + match basic_test(&create_test_block_with_data(&bad_header, &eip86_transactions, &good_uncles), engine) { + Err(Error::Transaction(ref e)) if e == &::ethkey::Error::InvalidSignature.into() => (), + e => panic!("Block verification failed.\nExpected: Transaction Error (Invalid Signature)\nGot: {:?}", e), + } + let mut header = good.clone(); header.set_transactions_root(good_transactions_root.clone()); header.set_uncles_hash(good_uncles_hash.clone()); diff --git a/ethcore/transaction/src/transaction.rs b/ethcore/transaction/src/transaction.rs index f206c549a..a117af551 100644 --- a/ethcore/transaction/src/transaction.rs +++ b/ethcore/transaction/src/transaction.rs @@ -392,6 +392,10 @@ impl UnverifiedTransaction { if check_low_s && !(allow_empty_signature && self.is_unsigned()) { self.check_low_s()?; } + // Disallow unsigned transactions in case EIP-86 is disabled. + if !allow_empty_signature && self.is_unsigned() { + return Err(ethkey::Error::InvalidSignature.into()); + } // EIP-86: Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account 0. if allow_empty_signature && self.is_unsigned() && !(self.gas_price.is_zero() && self.value.is_zero() && self.nonce.is_zero()) { return Err(ethkey::Error::InvalidSignature.into()) diff --git a/mac/Parity.pkgproj b/mac/Parity.pkgproj index 716d51dee..6eac7406d 100755 --- a/mac/Parity.pkgproj +++ b/mac/Parity.pkgproj @@ -462,7 +462,7 @@ OVERWRITE_PERMISSIONS VERSION - 1.10.5 + 1.10.6 UUID 2DCD5B81-7BAF-4DA1-9251-6274B089FD36 diff --git a/nsis/installer.nsi b/nsis/installer.nsi index fb54c65c2..b9af5d85c 100644 --- a/nsis/installer.nsi +++ b/nsis/installer.nsi @@ -10,7 +10,7 @@ !define DESCRIPTION "Fast, light, robust Ethereum implementation" !define VERSIONMAJOR 1 !define VERSIONMINOR 10 -!define VERSIONBUILD 5 +!define VERSIONBUILD 6 !define ARGS "" !define FIRST_START_ARGS "--mode=passive ui" diff --git a/util/version/Cargo.toml b/util/version/Cargo.toml index 8ad1ac03c..499adefbc 100644 --- a/util/version/Cargo.toml +++ b/util/version/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "parity-version" # NOTE: this value is used for Parity version string (via env CARGO_PKG_VERSION) -version = "1.10.5" +version = "1.10.6" authors = ["Parity Technologies "] build = "build.rs" @@ -13,7 +13,7 @@ build = "build.rs" track = "stable" # Indicates a critical release in this track (i.e. consensus issue) -critical = false +critical = true # Latest supported fork blocks for various networks. Used ONLY by auto-updater. [package.metadata.forks]