diff --git a/Cargo.lock b/Cargo.lock index 7614cf0f0..7ce4305c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "jsonrpc-core" version = "8.0.1" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1428,7 +1428,7 @@ dependencies = [ [[package]] name = "jsonrpc-http-server" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", @@ -1441,19 +1441,19 @@ dependencies = [ [[package]] name = "jsonrpc-ipc-server" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc?rev=7c9bbe3bc45d8e72a92b0951acc877da228abd50)", + "parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc?rev=c0f80b40399d7f08ef1e6869569640eb28645f56)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-macros" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "jsonrpc-pubsub 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", @@ -1463,7 +1463,7 @@ dependencies = [ [[package]] name = "jsonrpc-pubsub" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1473,7 +1473,7 @@ dependencies = [ [[package]] name = "jsonrpc-server-utils" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1481,12 +1481,13 @@ dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-tcp-server" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", "jsonrpc-server-utils 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", @@ -1498,7 +1499,7 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" version = "8.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#811b0204cadd9c9ffb5c0e205f1694d57f550a7d" +source = "git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11#a1b2bb742ce16d1168669ffb13ffe856e8131228" dependencies = [ "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 8.0.1 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.11)", @@ -2007,7 +2008,7 @@ version = "1.12.0" dependencies = [ "jni 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "panic_hook 0.1.0", - "parity-ethereum 2.1.3", + "parity-ethereum 2.1.4", ] [[package]] @@ -2023,7 +2024,7 @@ dependencies = [ [[package]] name = "parity-ethereum" -version = "2.1.3" +version = "2.1.4" dependencies = [ "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2073,7 +2074,7 @@ dependencies = [ "parity-rpc 1.12.0", "parity-rpc-client 1.4.0", "parity-updater 1.12.0", - "parity-version 2.1.3", + "parity-version 2.1.4", "parity-whisper 0.1.0", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2238,7 +2239,7 @@ dependencies = [ "parity-crypto 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-reactor 0.1.0", "parity-updater 1.12.0", - "parity-version 2.1.3", + "parity-version 2.1.4", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "patricia-trie 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2296,7 +2297,7 @@ dependencies = [ [[package]] name = "parity-tokio-ipc" version = "0.1.5" -source = "git+https://github.com/nikvolf/parity-tokio-ipc?rev=7c9bbe3bc45d8e72a92b0951acc877da228abd50#2af3e5b6b746552d8181069a2c6be068377df1de" +source = "git+https://github.com/nikvolf/parity-tokio-ipc?rev=c0f80b40399d7f08ef1e6869569640eb28645f56#c0f80b40399d7f08ef1e6869569640eb28645f56" dependencies = [ "bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2308,6 +2309,7 @@ dependencies = [ "tokio-io 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-named-pipes 0.1.0 (git+https://github.com/nikvolf/tokio-named-pipes)", "tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2327,7 +2329,7 @@ dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.12.0", "parity-path 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-version 2.1.3", + "parity-version 2.1.4", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2337,7 +2339,7 @@ dependencies = [ [[package]] name = "parity-version" -version = "2.1.3" +version = "2.1.4" dependencies = [ "parity-bytes 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rlp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4059,7 +4061,7 @@ dependencies = [ "checksum parity-rocksdb-sys 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0e59eda423021494a6cf1be74f6989add403f53157409993f794e17b123cab51" "checksum parity-snappy 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c5f9d149b13134b8b354d93a92830efcbee6fe5b73a2e6e540fe70d4dd8a63" "checksum parity-snappy-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c2086caac40c79289cb70d7e1c64f5888e1c53f5d38399d3e95101493739f423" -"checksum parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc?rev=7c9bbe3bc45d8e72a92b0951acc877da228abd50)" = "" +"checksum parity-tokio-ipc 0.1.5 (git+https://github.com/nikvolf/parity-tokio-ipc?rev=c0f80b40399d7f08ef1e6869569640eb28645f56)" = "" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parity-wordlist 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0dec124478845b142f68b446cbee953d14d4b41f1bc0425024417720dce693" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" diff --git a/Cargo.toml b/Cargo.toml index a56a4d1fb..ec2118056 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ description = "Parity Ethereum client" name = "parity-ethereum" # NOTE Make sure to update util/version/Cargo.toml as well -version = "2.1.3" +version = "2.1.4" license = "GPL-3.0" authors = ["Parity Technologies "] diff --git a/ethcore/res/ethereum/ropsten.json b/ethcore/res/ethereum/ropsten.json index 6e8d9a76e..264e6ee97 100644 --- a/ethcore/res/ethereum/ropsten.json +++ b/ethcore/res/ethereum/ropsten.json @@ -28,8 +28,8 @@ "maximumExtraDataSize": "0x20", "minGasLimit": "0x1388", "networkID" : "0x3", - "forkBlock": 3383558, - "forkCanonHash": "0x6b4b80d65951375a70bc1ecf9a270d152dd355454d57869abbae2e42c213e0f3", + "forkBlock": "0x40E80F", + "forkCanonHash": "0x3e12d5c0f8d63fbc5831cc7f7273bd824fa4d0a9a4102d65d99a7ea5604abc00", "maxCodeSize": 24576, "maxCodeSizeTransition": 10, "eip150Transition": 0, diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 9fa943cd7..e9b6f5b16 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -1495,7 +1495,7 @@ impl Call for Client { let sender = t.sender(); let options = || TransactOptions::with_tracing().dont_check_nonce(); - let cond = |gas| { + let exec = |gas| { let mut tx = t.as_unsigned().clone(); tx.gas = gas; let tx = tx.fake_sign(sender); @@ -1503,22 +1503,28 @@ impl Call for Client { let mut clone = state.clone(); let machine = self.engine.machine(); let schedule = machine.schedule(env_info.number); - Ok(Executive::new(&mut clone, &env_info, &machine, &schedule) + Executive::new(&mut clone, &env_info, &machine, &schedule) .transact_virtual(&tx, options()) + .ok() .map(|r| r.exception.is_none()) - .unwrap_or(false)) }; - if !cond(upper)? { + let cond = |gas| exec(gas).unwrap_or(false); + + if !cond(upper) { upper = max_upper; - if !cond(upper)? { - trace!(target: "estimate_gas", "estimate_gas failed with {}", upper); - let err = ExecutionError::Internal(format!("Requires higher than upper limit of {}", upper)); - return Err(err.into()) + match exec(upper) { + Some(false) => return Err(CallError::Exceptional), + None => { + trace!(target: "estimate_gas", "estimate_gas failed with {}", upper); + let err = ExecutionError::Internal(format!("Requires higher than upper limit of {}", upper)); + return Err(err.into()) + }, + _ => {}, } } let lower = t.gas_required(&self.engine.schedule(env_info.number)).into(); - if cond(lower)? { + if cond(lower) { trace!(target: "estimate_gas", "estimate_gas succeeded with {}", lower); return Ok(lower) } @@ -1527,12 +1533,12 @@ impl Call for Client { /// Returns the lowest value between `lower` and `upper` for which `cond` returns true. /// We assert: `cond(lower) = false`, `cond(upper) = true` fn binary_chop(mut lower: U256, mut upper: U256, mut cond: F) -> Result - where F: FnMut(U256) -> Result + where F: FnMut(U256) -> bool { while upper - lower > 1.into() { let mid = (lower + upper) / 2; trace!(target: "estimate_gas", "{} .. {} .. {}", lower, mid, upper); - let c = cond(mid)?; + let c = cond(mid); match c { true => upper = mid, false => lower = mid, diff --git a/ethcore/sync/src/block_sync.rs b/ethcore/sync/src/block_sync.rs index bf3ffd858..7cca71b02 100644 --- a/ethcore/sync/src/block_sync.rs +++ b/ethcore/sync/src/block_sync.rs @@ -136,8 +136,6 @@ pub struct BlockDownloader { target_hash: Option, /// Probing range for seeking common best block. retract_step: u64, - /// Whether reorg should be limited. - limit_reorg: bool, /// consecutive useless headers this round useless_headers_count: usize, } @@ -146,12 +144,12 @@ impl BlockDownloader { /// Create a new instance of syncing strategy. /// For BlockSet::NewBlocks this won't reorganize to before the last kept state. pub fn new(block_set: BlockSet, start_hash: &H256, start_number: BlockNumber) -> Self { - let (limit_reorg, sync_receipts) = match block_set { - BlockSet::NewBlocks => (true, false), - BlockSet::OldBlocks => (false, true) + let sync_receipts = match block_set { + BlockSet::NewBlocks => false, + BlockSet::OldBlocks => true }; BlockDownloader { - block_set: block_set, + block_set, state: State::Idle, highest_block: None, last_imported_block: start_number, @@ -164,7 +162,6 @@ impl BlockDownloader { download_receipts: sync_receipts, target_hash: None, retract_step: 1, - limit_reorg: limit_reorg, useless_headers_count: 0, } } @@ -321,12 +318,20 @@ impl BlockDownloader { self.state = State::Blocks; return Ok(DownloadAction::Reset); } else { + trace_sync!(self, "No useful subchain heads received, expected hash {:?}", expected_hash); let best = io.chain().chain_info().best_block_number; let oldest_reorg = io.chain().pruning_info().earliest_state; let last = self.last_imported_block; - if self.limit_reorg && best > last && (last == 0 || last < oldest_reorg) { - trace_sync!(self, "No common block, disabling peer"); - return Err(BlockDownloaderImportError::Invalid); + match self.block_set { + BlockSet::NewBlocks if best > last && (last == 0 || last < oldest_reorg) => { + trace_sync!(self, "No common block, disabling peer"); + return Err(BlockDownloaderImportError::Invalid) + }, + BlockSet::OldBlocks => { + trace_sync!(self, "Expected some useful headers for downloading OldBlocks. Try a different peer"); + return Err(BlockDownloaderImportError::Useless) + }, + _ => (), } } }, @@ -429,7 +434,7 @@ impl BlockDownloader { } else { let best = io.chain().chain_info().best_block_number; let oldest_reorg = io.chain().pruning_info().earliest_state; - if self.limit_reorg && best > start && start < oldest_reorg { + if self.block_set == BlockSet::NewBlocks && best > start && start < oldest_reorg { debug_sync!(self, "Could not revert to previous ancient block, last: {} ({})", start, start_hash); self.reset(); } else { diff --git a/ethcore/transaction/src/transaction.rs b/ethcore/transaction/src/transaction.rs index f5034c4b2..ee37f6852 100644 --- a/ethcore/transaction/src/transaction.rs +++ b/ethcore/transaction/src/transaction.rs @@ -90,8 +90,8 @@ pub mod signature { match v { v if v == 27 => 0, v if v == 28 => 1, - v if v > 36 => ((v - 1) % 2) as u8, - _ => 4 + v if v >= 35 => ((v - 1) % 2) as u8, + _ => 4 } } } @@ -364,7 +364,7 @@ impl UnverifiedTransaction { pub fn chain_id(&self) -> Option { match self.v { v if self.is_unsigned() => Some(v), - v if v > 36 => Some((v - 35) / 2), + v if v >= 35 => Some((v - 35) / 2), _ => None, } } @@ -583,6 +583,27 @@ mod tests { assert_eq!(t.chain_id(), None); } + #[test] + fn signing_eip155_zero_chainid() { + use ethkey::{Random, Generator}; + + let key = Random.generate().unwrap(); + let t = Transaction { + action: Action::Create, + nonce: U256::from(42), + gas_price: U256::from(3000), + gas: U256::from(50_000), + value: U256::from(1), + data: b"Hello!".to_vec() + }; + + let hash = t.hash(Some(0)); + let sig = ::ethkey::sign(&key.secret(), &hash).unwrap(); + let u = t.with_signature(sig, Some(0)); + + assert!(SignedTransaction::new(u).is_ok()); + } + #[test] fn signing() { use ethkey::{Random, Generator}; diff --git a/parity/run.rs b/parity/run.rs index dfcd95b15..5d7075ed2 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -961,6 +961,11 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str, account_settings, ); + // Add development account if running dev chain: + if let SpecType::Dev = *spec { + insert_dev_account(&account_provider); + } + for a in cfg.unlocked_accounts { // Check if the account exists if !account_provider.has_account(a) { @@ -977,11 +982,6 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str, } } - // Add development account if running dev chain: - if let SpecType::Dev = *spec { - insert_dev_account(&account_provider); - } - Ok(account_provider) } diff --git a/scripts/gitlab/build-windows.sh b/scripts/gitlab/build-windows.sh index b0570b917..afd4c64a6 100755 --- a/scripts/gitlab/build-windows.sh +++ b/scripts/gitlab/build-windows.sh @@ -5,8 +5,6 @@ set -u # treat unset variables as error set INCLUDE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt" set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64" -rustup default stable-x86_64-pc-windows-msvc - echo "__________Show ENVIROMENT__________" echo "CI_SERVER_NAME: " $CI_SERVER_NAME echo "CARGO_HOME: " $CARGO_HOME diff --git a/util/version/Cargo.toml b/util/version/Cargo.toml index 905d6be59..16e01e3ec 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 Ethereum version string (via env CARGO_PKG_VERSION) -version = "2.1.3" +version = "2.1.4" authors = ["Parity Technologies "] build = "build.rs" @@ -16,9 +16,9 @@ track = "beta" # Latest supported fork blocks. # Indicates a critical release in this track (i.e. consensus issue). [package.metadata.networks] -foundation = { forkBlock = 4370000, critical = true } -ropsten = { forkBlock = 10, critical = true } -kovan = { forkBlock = 6600000, critical = true } +foundation = { forkBlock = 4370000, critical = false } +ropsten = { forkBlock = 4230000, critical = false } +kovan = { forkBlock = 6600000, critical = false } [dependencies] parity-bytes = "0.1"