Backporting to beta (#3149)

* The front-end for each hard-fork, also EIP-160.

* Address EIP161 a/c

* Include EIP-161b

* EIP-161 part d.

* Fix test build.

* Fix one test, add another.

* Fix use of bloom & renaming.

* Fixed tests

* Initial groundwork for EIP-155

* Fix minor bug.

* Fix all tests finally.

* Rest of EIP-155.

* Add tests for EIP-155 algorithm.

Update transaction tests validation.

* Address grumbles.

* Remove unused code.

* Resolve IPC issues

* Fixed tests

* ipc backports

* Fixing random test failures (#2577)

* Fix SUICIDE gas mechanism and add consensus tests.

* Remove commented code.

* Set Frontier hardfork block number

* Transaction tests,

* Fixed tests

* Removed banning queue
This commit is contained in:
Arkadiy Paronyan
2016-11-03 22:40:43 +01:00
committed by Gav Wood
parent 78d3f5fce9
commit 6a4408cebc
76 changed files with 732 additions and 314 deletions

View File

@@ -18,7 +18,7 @@ use std::sync::Arc;
use std::collections::HashMap;
use network::{NetworkProtocolHandler, NetworkService, NetworkContext, PeerId,
NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, NetworkError};
use util::{U256, H256, Secret, Populatable, Bytes};
use util::{H256, Secret, Populatable, Bytes};
use io::{TimerToken};
use ethcore::client::{BlockChainClient, ChainNotify};
use ethcore::header::BlockNumber;
@@ -40,7 +40,9 @@ pub struct SyncConfig {
/// Max blocks to download ahead
pub max_download_ahead_blocks: usize,
/// Network ID
pub network_id: U256,
pub network_id: usize,
/// Main "eth" subprotocol name.
pub subprotocol_name: [u8; 3],
/// Fork block to check
pub fork_block: Option<(BlockNumber, H256)>,
}
@@ -49,7 +51,8 @@ impl Default for SyncConfig {
fn default() -> SyncConfig {
SyncConfig {
max_download_ahead_blocks: 20000,
network_id: U256::from(1),
network_id: 1,
subprotocol_name: *b"eth",
fork_block: None,
}
}
@@ -90,8 +93,6 @@ impl EthSync {
}
}
#[derive(Ipc)]
#[ipc(client_ident="SyncClient")]
impl SyncProvider for EthSync {
/// Get sync status
fn status(&self) -> SyncStatus {
@@ -185,8 +186,6 @@ pub trait ManageNetwork : Send + Sync {
}
#[derive(Ipc)]
#[ipc(client_ident="NetworkManagerClient")]
impl ManageNetwork for EthSync {
fn accept_unreserved_peers(&self) {
self.network.set_non_reserved_mode(NonReservedPeerMode::Accept);

View File

@@ -163,7 +163,7 @@ pub struct SyncStatus {
/// Syncing protocol version. That's the maximum protocol version we connect to.
pub protocol_version: u8,
/// The underlying p2p network version.
pub network_id: U256,
pub network_id: usize,
/// `BlockChain` height for the moment the sync started.
pub start_block_number: BlockNumber,
/// Last fully downloaded and imported block number (if any).
@@ -226,7 +226,7 @@ struct PeerInfo {
/// Peer chain genesis hash
genesis: H256,
/// Peer network id
network_id: U256,
network_id: usize,
/// Peer best block hash
latest_hash: H256,
/// Peer total difficulty if known
@@ -285,7 +285,7 @@ pub struct ChainSync {
/// Block parents imported this round (hash, parent)
round_parents: VecDeque<(H256, H256)>,
/// Network ID
network_id: U256,
network_id: usize,
/// Optional fork block to check
fork_block: Option<(BlockNumber, H256)>,
}
@@ -1737,7 +1737,7 @@ mod tests {
PeerInfo {
protocol_version: 0,
genesis: H256::zero(),
network_id: U256::zero(),
network_id: 0,
latest_hash: peer_latest_hash,
difficulty: None,
asking: PeerAsking::Nothing,

View File

@@ -91,7 +91,7 @@ mod api {
include!(concat!(env!("OUT_DIR"), "/api.rs"));
}
pub use api::{EthSync, SyncProvider, SyncClient, NetworkManagerClient, ManageNetwork, SyncConfig,
pub use api::{EthSync, SyncProvider, ManageNetwork, SyncConfig,
ServiceConfiguration, NetworkConfiguration};
pub use chain::{SyncStatus, SyncState};
pub use network::{is_valid_node_url, NonReservedPeerMode, NetworkError};