Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
remove ipc codegen from ethcore
Browse files Browse the repository at this point in the history
  • Loading branch information
debris committed Oct 16, 2017
1 parent 6f914d1 commit fa019bd
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 215 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ license = "GPL-3.0"
name = "ethcore"
version = "1.9.0"
authors = ["Parity Technologies <[email protected]>"]
build = "build.rs"

[build-dependencies]
"ethcore-ipc-codegen" = { path = "../ipc/codegen" }

[dependencies]
ansi_term = "0.9"
Expand All @@ -26,8 +22,6 @@ memorydb = { path = "../util/memorydb" }
patricia_trie = { path = "../util/patricia_trie" }
ethcore-devtools = { path = "../devtools" }
ethcore-io = { path = "../util/io" }
ethcore-ipc = { path = "../ipc/rpc" }
ethcore-ipc-nano = { path = "../ipc/nano" }
ethcore-logger = { path = "../logger" }
ethcore-stratum = { path = "../stratum" }
ethcore-util = { path = "../util" }
Expand Down
23 changes: 0 additions & 23 deletions ethcore/build.rs

This file was deleted.

4 changes: 0 additions & 4 deletions ethcore/src/client/chain_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use ipc::IpcConfig;
use bigint::hash::H256;
use bytes::Bytes;

/// Represents what has to be handled by actor listening to chain events
#[ipc]
pub trait ChainNotify : Send + Sync {
/// fires when chain has new blocks.
fn new_blocks(
Expand Down Expand Up @@ -57,5 +55,3 @@ pub trait ChainNotify : Send + Sync {
// does nothing by default
}
}

impl IpcConfig for ChainNotify { }
19 changes: 2 additions & 17 deletions ethcore/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ pub use vm::{LastHashes, EnvInfo};
pub use error::{BlockImportError, TransactionImportError, TransactionImportResult};
pub use verification::VerifierType;

/// IPC interfaces
#[cfg(feature="ipc")]
pub mod remote {
pub use super::traits::RemoteClient;
pub use super::chain_notify::ChainNotifyClient;
}

mod traits {
#![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues
include!(concat!(env!("OUT_DIR"), "/traits.rs"));
}

pub mod chain_notify {
//! Chain notify interface
#![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues
include!(concat!(env!("OUT_DIR"), "/chain_notify.rs"));
}
mod traits;

mod chain_notify;
4 changes: 0 additions & 4 deletions ethcore/src/client/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use evm::{Factory as EvmFactory, Schedule};
use executive::Executed;
use filter::Filter;
use header::{BlockNumber};
use ipc::IpcConfig;
use log_entry::LocalizedLogEntry;
use receipt::LocalizedReceipt;
use trace::LocalizedTrace;
Expand All @@ -49,7 +48,6 @@ use types::block_status::BlockStatus;
use types::mode::Mode;
use types::pruning_info::PruningInfo;

#[ipc(client_ident="RemoteClient")]
/// Blockchain database client. Owns and manages a blockchain and a block queue.
pub trait BlockChainClient : Sync + Send {

Expand Down Expand Up @@ -287,8 +285,6 @@ pub trait BlockChainClient : Sync + Send {
fn eip86_transition(&self) -> u64;
}

impl IpcConfig for BlockChainClient { }

/// Extended client interface used for mining
pub trait MiningBlockChainClient: BlockChainClient {
/// Returns OpenBlock prepared for closing.
Expand Down
19 changes: 0 additions & 19 deletions ethcore/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use io::*;
use header::BlockNumber;
use basic_types::LogBloom;
use client::Error as ClientError;
use ipc::binary::{BinaryConvertError, BinaryConvertable};
use snapshot::Error as SnapshotError;
use engines::EngineError;
use ethkey::Error as EthkeyError;
Expand Down Expand Up @@ -486,21 +485,3 @@ impl<E> From<Box<E>> for Error where Error: From<E> {
Error::from(*err)
}
}

binary_fixed_size!(BlockError);
binary_fixed_size!(ImportError);
binary_fixed_size!(TransactionError);

// TODO: uncomment below once https://github.com/rust-lang/rust/issues/27336 sorted.
/*#![feature(concat_idents)]
macro_rules! assimilate {
($name:ident) => (
impl From<concat_idents!($name, Error)> for Error {
fn from(err: concat_idents!($name, Error)) -> Error {
Error:: $name (err)
}
}
)
}
assimilate!(FromHex);
assimilate!(BaseData);*/
3 changes: 0 additions & 3 deletions ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ extern crate ethash;
extern crate ethcore_bloom_journal as bloom_journal;
extern crate ethcore_devtools as devtools;
extern crate ethcore_io as io;
extern crate ethcore_ipc_nano as nanoipc;
extern crate ethcore_bigint as bigint;
extern crate ethcore_bytes as bytes;
extern crate ethcore_logger;
Expand Down Expand Up @@ -139,8 +138,6 @@ extern crate macros;
extern crate log;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate ethcore_ipc as ipc;
#[cfg_attr(test, macro_use)]
extern crate evm;

Expand Down
39 changes: 1 addition & 38 deletions ethcore/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ use miner::Miner;

use snapshot::{ManifestData, RestorationStatus};
use snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
use std::sync::atomic::AtomicBool;
use ansi_term::Colour;

#[cfg(feature="ipc")]
use nanoipc;

/// Message type for external and internal events
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum ClientIoMessage {
Expand Down Expand Up @@ -73,7 +69,7 @@ impl ClientService {
spec: &Spec,
client_path: &Path,
snapshot_path: &Path,
ipc_path: &Path,
_ipc_path: &Path,
miner: Arc<Miner>,
) -> Result<ClientService, Error>
{
Expand Down Expand Up @@ -121,7 +117,6 @@ impl ClientService {
spec.engine.register_client(Arc::downgrade(&client) as _);

let stop_guard = ::devtools::StopGuard::new();
run_ipc(ipc_path, client.clone(), snapshot.clone(), stop_guard.share());

Ok(ClientService {
io_service: Arc::new(io_service),
Expand Down Expand Up @@ -229,38 +224,6 @@ impl IoHandler<ClientIoMessage> for ClientIoHandler {
}
}

#[cfg(feature="ipc")]
fn run_ipc(base_path: &Path, client: Arc<Client>, snapshot_service: Arc<SnapshotService>, stop: Arc<AtomicBool>) {
let mut path = base_path.to_owned();
path.push("parity-chain.ipc");
let socket_addr = format!("ipc://{}", path.to_string_lossy());
let s = stop.clone();
::std::thread::spawn(move || {
let mut worker = nanoipc::Worker::new(&(client as Arc<BlockChainClient>));
worker.add_reqrep(&socket_addr).expect("Ipc expected to initialize with no issues");

while !s.load(::std::sync::atomic::Ordering::Relaxed) {
worker.poll();
}
});

let mut path = base_path.to_owned();
path.push("parity-snapshot.ipc");
let socket_addr = format!("ipc://{}", path.to_string_lossy());
::std::thread::spawn(move || {
let mut worker = nanoipc::Worker::new(&(snapshot_service as Arc<::snapshot::SnapshotService>));
worker.add_reqrep(&socket_addr).expect("Ipc expected to initialize with no issues");

while !stop.load(::std::sync::atomic::Ordering::Relaxed) {
worker.poll();
}
});
}

#[cfg(not(feature="ipc"))]
fn run_ipc(_base_path: &Path, _client: Arc<Client>, _snapshot_service: Arc<SnapshotService>, _stop: Arc<AtomicBool>) {
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
11 changes: 1 addition & 10 deletions ethcore/src/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,7 @@ mod watcher;
#[cfg(test)]
mod tests;

/// IPC interfaces
#[cfg(feature="ipc")]
pub mod remote {
pub use super::traits::RemoteSnapshotService;
}

mod traits {
#![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues
include!(concat!(env!("OUT_DIR"), "/snapshot_service_trait.rs"));
}
mod traits;

// Try to have chunks be around 4MB (before compression)
const PREFERRED_CHUNK_SIZE: usize = 4 * 1024 * 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
use super::{ManifestData, RestorationStatus};
use bigint::hash::H256;
use bytes::Bytes;
use ipc::IpcConfig;

/// The interface for a snapshot network service.
/// This handles:
/// - restoration of snapshots to temporary databases.
/// - responding to queries for snapshot manifests and chunks
#[ipc(client_ident="RemoteSnapshotService")]
pub trait SnapshotService : Sync + Send {
/// Query the most recent manifest data.
fn manifest(&self) -> Option<ManifestData>;
Expand Down Expand Up @@ -54,5 +52,3 @@ pub trait SnapshotService : Sync + Send {
/// no-op if currently restoring.
fn restore_block_chunk(&self, hash: H256, chunk: Bytes);
}

impl IpcConfig for SnapshotService { }
4 changes: 0 additions & 4 deletions ethcore/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ pub mod helpers;
mod client;
mod evm;
mod trace;

#[cfg(feature="ipc")]
mod rpc;

78 changes: 0 additions & 78 deletions ethcore/src/tests/rpc.rs

This file was deleted.

2 changes: 0 additions & 2 deletions ethcore/types/src/account_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl<T> Diff<T> where T: Eq {
}

#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "ipc", binary)]
/// Account diff.
pub struct AccountDiff {
/// Change in balance, allowed to be `Diff::Same`.
Expand All @@ -65,7 +64,6 @@ pub struct AccountDiff {
}

#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "ipc", binary)]
/// Change in existance type.
// TODO: include other types of change.
pub enum Existance {
Expand Down

0 comments on commit fa019bd

Please sign in to comment.