From 86bfe732b70fb0c9630c436b93735e2b1568e717 Mon Sep 17 00:00:00 2001 From: jamesray1 <16969914+jamesray1@users.noreply.github.com> Date: Fri, 13 Apr 2018 13:49:42 +1000 Subject: [PATCH 1/2] ignore tests that are stubs or depend on the SMC. --- Cargo.toml | 4 ---- diagrams/ml.dot | 14 +++++++------- src/lib.rs | 4 +--- src/main.rs | 16 ---------------- src/notary.rs | 3 +++ src/smc_listener.rs | 3 +++ 6 files changed, 14 insertions(+), 30 deletions(-) delete mode 100644 src/main.rs diff --git a/Cargo.toml b/Cargo.toml index a07ec07..6d094a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,10 +15,6 @@ license = "Unlicense" repository = "https://github.com/Drops-of-Diamond/diamond_drops" build = "build.rs" -[lib] -name = "diamond_drops" -path = "src/lib.rs" - [dependencies] ethereum-types = "0.3.0" ethcore-bytes = "0.1.0" diff --git a/diagrams/ml.dot b/diagrams/ml.dot index 691bbb2..811b308 100644 --- a/diagrams/ml.dot +++ b/diagrams/ml.dot @@ -1,13 +1,13 @@ digraph ml { - ndConfigType[label="{<<<Enumeration>>>\nConfigType|Mode\nNil}"][shape="record"]; - ndMode[label="{<<<Enumeration>>>\nMode|Proposer\nNotary\nBoth|+ value(&self) -> String}"][shape="record"]; - ndConfig[label="{<<<Structure>>>\nConfig|+ mode: Mode|+ new(mode: Mode) -> Config}"][shape="record"]; - ndCollation[label="{<<<Structure>>>\nCollation|- header: header::Header\n- body: body::Body|+ new(header: header::Header, body: body::Body) -> Collation}"][shape="record"]; ndHeader[label="{<<<Structure>>>\nHeader|- shard_id: ethereum_types::U256\n- proposer_address: ethereum_types::Address\n- chunk_root: ethereum_types::H256\n- period: ethereum_types::U256|+ new(shard_id: ethereum_types::U256, chunk_root: ethereum_types::H256, period: ethereum_types::U256, proposer_address: ethereum_types::Address) -> Header\n+ hash(&self) -> ethereum_types::H256}"][shape="record"]; + ndCollation[label="{<<<Structure>>>\nCollation|- header: header::Header\n- body: body::Body|+ new(header: header::Header, body: body::Body) -> Collation}"][shape="record"]; ndMessage[label="{<<<Enumeration>>>\nMessage|Selected\nShardId\nCollation\nProposal}"][shape="record"]; - ndNotary[label="{<<<Structure>>>\nNotary|- selected: bool\n- shard_id: ethereum_types::U256\n- collation_vectors: HashMap<ethereum_types::U256, Vec<collation::Collation>>\n- listener: mpsc::Receiver<message::Message>|+ new(listener: mpsc::Receiver<message::Message>) -> Notary\n+ run(&mut self)\n- store_collation(&mut self, collation: collation::Collation)\n- store_proposal(&mut self, collation: collation::Collation)\n- get_availability(&mut self)\n- submit_vote(&self)}"][shape="record"]; ndSMCListener[label="{<<<Structure>>>\nSMCListener|- period: usize\n- notary_sender: mpsc::Sender<message::Message>|+ new(notary_sender: mpsc::Sender<message::Message>) -> SMCListener\n- register(&self, addr: Address) -> Result<bool, &\'static str>\n- get_selected_notaries(&self, shard_id: usize) -> Vec<Address>}"][shape="record"]; - ndMode -> ndConfig[label=""][style="dashed"][arrowhead="diamond"]; - ndCollation -> ndNotary[label=""][style="dashed"][arrowhead="vee"]; + ndNotary[label="{<<<Structure>>>\nNotary|- selected: bool\n- shard_id: ethereum_types::U256\n- collation_vectors: HashMap<ethereum_types::U256, Vec<collation::Collation>>\n- listener: mpsc::Receiver<message::Message>|+ new(listener: mpsc::Receiver<message::Message>) -> Notary\n+ run(&mut self)\n- store_collation(&mut self, collation: collation::Collation)\n- store_proposal(&mut self, collation: collation::Collation)\n- get_availability(&mut self)\n- submit_vote(&self)}"][shape="record"]; + ndMode[label="{<<<Enumeration>>>\nMode|Proposer\nNotary\nBoth|+ value(&self) -> String}"][shape="record"]; + ndConfig[label="{<<<Structure>>>\nConfig|+ mode: Mode|+ new(mode: Mode) -> Config}"][shape="record"]; + ndConfigType[label="{<<<Enumeration>>>\nConfigType|Mode\nNil}"][shape="record"]; ndHeader -> ndCollation[label=""][style="dashed"][arrowhead="vee"]; + ndCollation -> ndNotary[label=""][style="dashed"][arrowhead="vee"]; + ndMode -> ndConfig[label=""][style="dashed"][arrowhead="diamond"]; } diff --git a/src/lib.rs b/src/lib.rs index 9e7ce15..88a2c5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,6 +94,4 @@ pub fn run(config: cli::config::Config) -> () { Err(e) => { panic!("Failed notary thread join {:?}", e); } } } -} - - +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index a4b836b..0000000 --- a/src/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -extern crate diamond_drops; -use diamond_drops::cli; - -use std::env; -use std::process; - -fn main() { - let args = env::args().skip(1).collect::>(); - - let config = cli::args::parse_args(args).unwrap_or_else(|err| { - eprintln!("Problem parsing arguments: {}", err); - process::exit(1); - }); - - diamond_drops::run(config); -} diff --git a/src/notary.rs b/src/notary.rs index d8c9e25..5db996a 100644 --- a/src/notary.rs +++ b/src/notary.rs @@ -107,16 +107,19 @@ mod tests { } #[test] + #[ignore] fn it_stores_proposals() { assert!(false); } #[test] + #[ignore] fn it_selects_vote() { assert!(false); } #[test] + #[ignore] fn it_submits_vote() { assert!(false); } diff --git a/src/smc_listener.rs b/src/smc_listener.rs index b4b671e..67ed665 100644 --- a/src/smc_listener.rs +++ b/src/smc_listener.rs @@ -29,6 +29,7 @@ mod tests { use super::*; #[test] + #[ignore] fn it_registers() { let (tx, rx) = mpsc::channel(); let smc = SMCListener::new(tx); @@ -39,6 +40,7 @@ mod tests { } #[test] + #[ignore] fn it_gets_selected_notaries() { let (tx, rx) = mpsc::channel(); let smc = SMCListener::new(tx); @@ -53,6 +55,7 @@ mod tests { } #[test] + #[ignore] fn it_listens_for_smc_events() { assert!(false); } From d380e1db3c60c40b1e7129ed8ba527b37b3276d4 Mon Sep 17 00:00:00 2001 From: jamesray1 <16969914+jamesray1@users.noreply.github.com> Date: Fri, 13 Apr 2018 14:33:19 +1000 Subject: [PATCH 2/2] Add src/bin, bin/bin.rs --- src/bin/bin.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/bin/bin.rs diff --git a/src/bin/bin.rs b/src/bin/bin.rs new file mode 100644 index 0000000..8a3a019 --- /dev/null +++ b/src/bin/bin.rs @@ -0,0 +1,18 @@ +extern crate diamond_drops; + +use diamond_drops::cli; +use diamond_drops::run; + +use std::env; +use std::process; + +fn main() { + let args = env::args().skip(1).collect::>(); + + let config = cli::args::parse_args(args).unwrap_or_else(|err| { + eprintln!("Problem parsing arguments: {}", err); + process::exit(1); + }); + + run(config); +} \ No newline at end of file