Skip to content

Commit

Permalink
Add compute node consensus frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed May 3, 2018
1 parent e1f8118 commit 1319c30
Show file tree
Hide file tree
Showing 15 changed files with 944 additions and 299 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* gRPC message types and conversion convention established.
* Registry interface / centralized implementation added.
* Make contract client sharable between threads.
* Use new consensus interface in the compute node.

# 0.1.0-alpha.4

Expand Down
1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ futures-sgx = { git = "https://github.com/ekiden/futures-rs" }
[target.'cfg(not(target_env = "sgx"))'.dependencies]
rand = "0.4.2"
futures = "0.1"
futures-cpupool = "0.1"

[dev-dependencies]
serde_json = { git = "https://github.com/ekiden/json" }
22 changes: 22 additions & 0 deletions common/src/futures.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! Future types used in Ekiden.
extern crate futures as extern_futures;
#[cfg(not(target_env = "sgx"))]
pub extern crate futures_cpupool as cpupool;

pub use self::extern_futures::*;
#[cfg(not(target_env = "sgx"))]
use self::future::Executor as OldExecutor;

use super::error::Error;

Expand All @@ -10,3 +14,21 @@ pub type BoxFuture<T> = Box<Future<Item = T, Error = Error> + Send>;

/// Stream type for use in Ekiden.
pub type BoxStream<T> = Box<Stream<Item = T, Error = Error> + Send>;

/// A task executor.
///
/// # Note
///
/// Once we transition to futures 0.2+ this trait will no longer be needed as there
/// is already a similar trait there.
pub trait Executor {
/// Spawn the given task, polling it until completion.
fn spawn(&mut self, f: Box<Future<Item = (), Error = ()> + Send>);
}

#[cfg(not(target_env = "sgx"))]
impl Executor for cpupool::CpuPool {
fn spawn(&mut self, f: Box<Future<Item = (), Error = ()> + Send>) {
self.execute(f).unwrap();
}
}
2 changes: 1 addition & 1 deletion common/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl Into<api::Signature> for Signature {
}

/// Signature from a committee node.
#[derive(Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
pub struct Signed<T> {
/// Signed value.
value: T,
Expand Down
5 changes: 4 additions & 1 deletion compute/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ekiden-core = { path = "../core/common", version = "0.1.0-alpha.4" }
ekiden-untrusted = { path = "../core/untrusted", version = "0.1.0-alpha.4" }
ekiden-rpc-client = { path = "../rpc/client", version = "0.1.0-alpha.4" }
ekiden-compute-api = { path = "./api", version = "0.1.0-alpha.4" }
# TODO: Remove ekiden-consensus-api depndency once we use the new consensus API.
# TODO: Remove ekiden-consensus-api depndency once we use the new storage API.
ekiden-consensus-api = { path = "../consensus/api", version = "0.1.0-alpha.4" }
ekiden-consensus-base = { path = "../consensus/base", version = "0.1.0-alpha.4" }
ekiden-consensus-dummy = { path = "../consensus/dummy", version = "0.1.0-alpha.4" }
Expand All @@ -27,6 +27,9 @@ hyper = "0.11"
tokio-core = "0.1"
grpcio = "0.2.2"
lru-cache = "0.1.1"
log = "0.4"
pretty_env_logger = "0.2"
futures-timer = "0.1.1"

[build-dependencies]
ekiden-tools = { path = "../tools", version = "0.1.0-alpha.4" }
Expand Down
Loading

0 comments on commit 1319c30

Please sign in to comment.