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 0.9.0",
"ethcore-util 0.9.0", "ethcore-util 0.9.0",
"ethsync 0.1.0", "ethsync 0.1.0",
"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)",
"jsonrpc-http-server 1.1.0 (git+https://github.com/debris/jsonrpc-http-server)", "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)", "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 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_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)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -346,21 +346,21 @@ dependencies = [
[[package]] [[package]]
name = "jsonrpc-core" name = "jsonrpc-core"
version = "1.1.1" version = "1.1.2"
source = "git+https://github.com/debris/jsonrpc-core#f59f462d29f75849d1af1958500730349c93d239" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"serde 0.6.12 (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_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]] [[package]]
name = "jsonrpc-http-server" name = "jsonrpc-http-server"
version = "1.1.0" version = "1.1.2"
source = "git+https://github.com/debris/jsonrpc-http-server#23ee2d14331a1fcfe9b9d58cbfa3f49a15ad2326" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"hyper 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "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]] [[package]]
@ -626,7 +626,7 @@ dependencies = [
[[package]] [[package]]
name = "serde_codegen" name = "serde_codegen"
version = "0.6.13" version = "0.6.13"
source = "git+https://github.com/debris/serde#f1fcd7ed1f3f610c7df0ede2a6928fbc05cf4efb" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"aster 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "quasi 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -645,9 +645,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_macros" name = "serde_macros"
version = "0.6.13" version = "0.6.13"
source = "git+https://github.com/debris/serde#f1fcd7ed1f3f610c7df0ede2a6928fbc05cf4efb" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ 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]] [[package]]

View File

@ -19,7 +19,7 @@
# install rocksdb # install rocksdb
add-apt-repository ppa:ethcore/ethcore add-apt-repository ppa:ethcore/ethcore
apt-get update apt-get update
apt-get install -y --force-yes librocksdb apt-get install -y --force-yes librocksdb-dev
# install multirust # install multirust
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --yes

View File

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

View File

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

View File

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

View File

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

View File

@ -160,3 +160,14 @@ fn propagade_blocks() {
// NEW_BLOCK_PACKET // NEW_BLOCK_PACKET
assert_eq!(0x07, net.peer(0).queue[0].packet_id); 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 { pub fn block_hash_delta_minus(&mut self, delta: usize) -> H256 {
let blocks_read = self.numbers.read().unwrap(); let blocks_read = self.numbers.read().unwrap();
let index = blocks_read.len() - delta; let index = blocks_read.len() - delta;