Merge branch 'master' of github.com:ethcore/parity into discovery

This commit is contained in:
arkpar 2016-02-15 16:03:34 +01:00
commit 30968925ee
8 changed files with 41 additions and 19 deletions

24
Cargo.lock generated
View File

@ -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]]

View File

@ -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

View File

@ -3,7 +3,7 @@
"engineName": "Ethash",
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xf4240fff",
"frontierCompatibilityModeLimit": "0x10c8e0",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",

View File

@ -3,7 +3,7 @@
"engineName": "Ethash",
"params": {
"accountStartNonce": "0x00",
"frontierCompatibilityModeLimit": "0xf4240fff",
"frontierCompatibilityModeLimit": "0x10c8e0",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",

View File

@ -3,7 +3,7 @@
"engineName": "Ethash",
"params": {
"accountStartNonce": "0x0100000",
"frontierCompatibilityModeLimit": "0xdbba0",
"frontierCompatibilityModeLimit": "0x10c8e0",
"maximumExtraDataSize": "0x20",
"tieBreakingGas": false,
"minGasLimit": "0x1388",

View File

@ -9,10 +9,10 @@ authors = ["Ethcore <admin@ethcore.io"]
[dependencies]
serde = "0.6.7"
serde_macros = { git = "https://github.com/debris/serde", path = "serde_macros" }
serde_macros = "0.6.13"
serde_json = "0.6.0"
jsonrpc-core = { git = "https://github.com/debris/jsonrpc-core" }
jsonrpc-http-server = { git = "https://github.com/debris/jsonrpc-http-server" }
jsonrpc-core = "1.1.2"
jsonrpc-http-server = "1.1.2"
ethcore-util = { path = "../util" }
ethcore = { path = "../ethcore" }
ethsync = { path = "../sync" }

View File

@ -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);
}

View File

@ -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;