From 874dcdd840986e4513e4fc77485f7f2abf6208a5 Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 15 Feb 2016 10:47:56 +0100 Subject: [PATCH 1/3] back to cargo crates --- Cargo.lock | 24 ++++++++++++------------ rpc/Cargo.toml | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 684389f7d..c451a6477 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,12 +190,12 @@ dependencies = [ "ethcore 0.9.0", "ethcore-util 0.9.0", "ethsync 0.1.0", - "jsonrpc-core 1.1.1 (git+https://github.com/debris/jsonrpc-core)", - "jsonrpc-http-server 1.1.0 (git+https://github.com/debris/jsonrpc-http-server)", + "jsonrpc-core 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-http-server 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_macros 0.6.13 (git+https://github.com/debris/serde)", + "serde_macros 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -346,21 +346,21 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "1.1.1" -source = "git+https://github.com/debris/jsonrpc-core#f59f462d29f75849d1af1958500730349c93d239" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_macros 0.6.13 (git+https://github.com/debris/serde)", + "serde_macros 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jsonrpc-http-server" -version = "1.1.0" -source = "git+https://github.com/debris/jsonrpc-http-server#23ee2d14331a1fcfe9b9d58cbfa3f49a15ad2326" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 1.1.1 (git+https://github.com/debris/jsonrpc-core)", + "jsonrpc-core 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -626,7 +626,7 @@ dependencies = [ [[package]] name = "serde_codegen" version = "0.6.13" -source = "git+https://github.com/debris/serde#f1fcd7ed1f3f610c7df0ede2a6928fbc05cf4efb" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aster 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "quasi 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -645,9 +645,9 @@ dependencies = [ [[package]] name = "serde_macros" version = "0.6.13" -source = "git+https://github.com/debris/serde#f1fcd7ed1f3f610c7df0ede2a6928fbc05cf4efb" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_codegen 0.6.13 (git+https://github.com/debris/serde)", + "serde_codegen 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index c506d44b3..0bb255d98 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -9,10 +9,10 @@ authors = ["Ethcore Date: Mon, 15 Feb 2016 13:34:58 +0100 Subject: [PATCH 2/3] Added test for restart on malformed block --- sync/src/tests/chain.rs | 11 +++++++++++ sync/src/tests/helpers.rs | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/sync/src/tests/chain.rs b/sync/src/tests/chain.rs index 5ee5df831..1dd9a1e78 100644 --- a/sync/src/tests/chain.rs +++ b/sync/src/tests/chain.rs @@ -160,3 +160,14 @@ fn propagade_blocks() { // NEW_BLOCK_PACKET assert_eq!(0x07, net.peer(0).queue[0].packet_id); } + +#[test] +fn restart_on_malformed_block() { + let mut net = TestNet::new(2); + net.peer_mut(1).chain.add_blocks(10, false); + net.peer_mut(1).chain.corrupt_block(6); + net.sync_steps(10); + + assert_eq!(net.peer(0).chain.chain_info().best_block_number, 4); +} + diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index d8cd5e54a..c561b65a3 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -71,6 +71,17 @@ impl TestBlockChainClient { } } + pub fn corrupt_block(&mut self, n: BlockNumber) { + let hash = self.block_hash(BlockId::Number(n)).unwrap(); + let mut header: BlockHeader = decode(&self.block_header(BlockId::Number(n)).unwrap()); + header.parent_hash = H256::new(); + let mut rlp = RlpStream::new_list(3); + rlp.append(&header); + rlp.append_raw(&rlp::NULL_RLP, 1); + rlp.append_raw(&rlp::NULL_RLP, 1); + self.blocks.write().unwrap().insert(hash, rlp.out()); + } + pub fn block_hash_delta_minus(&mut self, delta: usize) -> H256 { let blocks_read = self.numbers.read().unwrap(); let index = blocks_read.len() - delta; From 38a568e42691742e9845a157895d1a852690ddd1 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Feb 2016 13:49:44 +0100 Subject: [PATCH 3/3] Use 1100000 as the homestead transition, fix build instructions. --- README.md | 2 +- ethcore/res/ethereum/frontier.json | 2 +- ethcore/res/ethereum/frontier_like_test.json | 2 +- ethcore/res/ethereum/morden.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ef5dce19..2ffb28f45 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ # install rocksdb add-apt-repository ppa:ethcore/ethcore apt-get update -apt-get install -y --force-yes librocksdb +apt-get install -y --force-yes librocksdb-dev # install multirust curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes diff --git a/ethcore/res/ethereum/frontier.json b/ethcore/res/ethereum/frontier.json index e01c4bb3f..6e31a2fce 100644 --- a/ethcore/res/ethereum/frontier.json +++ b/ethcore/res/ethereum/frontier.json @@ -3,7 +3,7 @@ "engineName": "Ethash", "params": { "accountStartNonce": "0x00", - "frontierCompatibilityModeLimit": "0xf4240fff", + "frontierCompatibilityModeLimit": "0x10c8e0", "maximumExtraDataSize": "0x20", "tieBreakingGas": false, "minGasLimit": "0x1388", diff --git a/ethcore/res/ethereum/frontier_like_test.json b/ethcore/res/ethereum/frontier_like_test.json index 7ab6a58f4..553bb8018 100644 --- a/ethcore/res/ethereum/frontier_like_test.json +++ b/ethcore/res/ethereum/frontier_like_test.json @@ -3,7 +3,7 @@ "engineName": "Ethash", "params": { "accountStartNonce": "0x00", - "frontierCompatibilityModeLimit": "0xf4240fff", + "frontierCompatibilityModeLimit": "0x10c8e0", "maximumExtraDataSize": "0x20", "tieBreakingGas": false, "minGasLimit": "0x1388", diff --git a/ethcore/res/ethereum/morden.json b/ethcore/res/ethereum/morden.json index cdcf8c7dc..0d0c2489d 100644 --- a/ethcore/res/ethereum/morden.json +++ b/ethcore/res/ethereum/morden.json @@ -3,7 +3,7 @@ "engineName": "Ethash", "params": { "accountStartNonce": "0x0100000", - "frontierCompatibilityModeLimit": "0xdbba0", + "frontierCompatibilityModeLimit": "0x10c8e0", "maximumExtraDataSize": "0x20", "tieBreakingGas": false, "minGasLimit": "0x1388",