Przeglądaj źródła

script/research: renamed redundant TODOs to Missing in consensusd, streamlet_rust and validatord

aggstam 4 lat temu
rodzic
commit
5127263cd3

+ 3 - 3
script/research/consensusd/src/main.rs

@@ -67,8 +67,8 @@ async fn api_service_init(executor: Arc<Executor<'_>>, config: &ConsensusdConfig
 
 
 /// RPCAPI:
 /// RPCAPI:
 /// Node checks if its the current slot leader and generates the slot Block (represented as a Vote structure).
 /// Node checks if its the current slot leader and generates the slot Block (represented as a Vote structure).
-/// TODO: 1. Nodes count not hard coded.
-///       2. Proposed block broadcast.
+/// Missing: 1. Nodes count not hard coded.
+///          2. Proposed block broadcast.
 fn proposal_task(config: &ConsensusdConfig) {
 fn proposal_task(config: &ConsensusdConfig) {
     let state_path = expand_path(&config.state_path).unwrap();
     let state_path = expand_path(&config.state_path).unwrap();
     let id = config.id;
     let id = config.id;
@@ -90,7 +90,7 @@ fn proposal_task(config: &ConsensusdConfig) {
         if proposed_block.is_none() {
         if proposed_block.is_none() {
             println!("Node is not the epoch leader. Sleeping till next epoch...");
             println!("Node is not the epoch leader. Sleeping till next epoch...");
         } else {
         } else {
-            // TODO: Proposed block broadcast.
+            // Missing: Proposed block broadcast.
             println!("Node is the epoch leader. Proposed block: {:?}", proposed_block);
             println!("Node is the epoch leader. Proposed block: {:?}", proposed_block);
         }
         }
 
 

+ 8 - 8
script/research/consensusd/src/service/api_service.rs

@@ -86,9 +86,9 @@ impl APIService {
     /// Node checks if its the current slot leader and generates the slot Block (represented as a Vote structure).
     /// Node checks if its the current slot leader and generates the slot Block (represented as a Vote structure).
     /// --> {"jsonrpc": "2.0", "method": "consensus_task", "params": [1], "id": 0}
     /// --> {"jsonrpc": "2.0", "method": "consensus_task", "params": [1], "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": [PublicKey, Vote], "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": [PublicKey, Vote], "id": 0}
-    /// TODO: 1, This should be a scheduled task.
-    ///       2. Nodes count not from request.
-    ///       3. Proposed block broadcast.
+    /// Missing: 1, This should be a scheduled task.
+    ///          2. Nodes count not from request.
+    ///          3. Proposed block broadcast.
     async fn consensus_task(&self, params: Value) -> JsonResult {
     async fn consensus_task(&self, params: Value) -> JsonResult {
         let args = params.as_array().unwrap();
         let args = params.as_array().unwrap();
 
 
@@ -114,7 +114,7 @@ impl APIService {
                         serde_json::to_value(self.id).unwrap(),
                         serde_json::to_value(self.id).unwrap(),
                     ))
                     ))
                 } else {
                 } else {
-                    // TODO: Proposed block broadcast.
+                    // Missing: Proposed block broadcast.
                     JsonResult::Resp(jsonresp(
                     JsonResult::Resp(jsonresp(
                         json!((state.public_key, x)),
                         json!((state.public_key, x)),
                         serde_json::to_value(self.id).unwrap(),
                         serde_json::to_value(self.id).unwrap(),
@@ -134,8 +134,8 @@ impl APIService {
     /// Node receives a proposed block, verifies it and stores it in its current state.
     /// Node receives a proposed block, verifies it and stores it in its current state.
     /// --> {"jsonrpc": "2.0", "method": "receive_proposed_block", "params": [PublicKey, Vote, 1], "id": 0}
     /// --> {"jsonrpc": "2.0", "method": "receive_proposed_block", "params": [PublicKey, Vote, 1], "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": [PublicKey, Vote], "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": [PublicKey, Vote], "id": 0}
-    /// TODO: 1. Nodes count not from request.
-    ///       2. Vote broadcast.
+    /// Missing: 1. Nodes count not from request.
+    ///          2. Vote broadcast.
     async fn receive_proposed_block(&self, params: Value) -> JsonResult {
     async fn receive_proposed_block(&self, params: Value) -> JsonResult {
         let args = params.as_array().unwrap();
         let args = params.as_array().unwrap();
 
 
@@ -166,7 +166,7 @@ impl APIService {
                         serde_json::to_value(self.id).unwrap(),
                         serde_json::to_value(self.id).unwrap(),
                     ))
                     ))
                 } else {
                 } else {
-                    // TODO: Vote broadcast.
+                    // Missing: Vote broadcast.
                     JsonResult::Resp(jsonresp(
                     JsonResult::Resp(jsonresp(
                         json!((state.public_key, x)),
                         json!((state.public_key, x)),
                         serde_json::to_value(self.id).unwrap(),
                         serde_json::to_value(self.id).unwrap(),
@@ -186,7 +186,7 @@ impl APIService {
     /// Node receives a block vote and perform the consensus protocol corresponding functions, based on its current state.
     /// Node receives a block vote and perform the consensus protocol corresponding functions, based on its current state.
     /// --> {"jsonrpc": "2.0", "method": "receive_vote", "params": [PublicKey, Vote, 1], "id": 0}
     /// --> {"jsonrpc": "2.0", "method": "receive_vote", "params": [PublicKey, Vote, 1], "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": true, "id": 0}
     /// <-- {"jsonrpc": "2.0", "result": true, "id": 0}
-    /// TODO: 1. Nodes count not from request.
+    /// Missing: 1. Nodes count not from request.
     async fn receive_vote(&self, params: Value) -> JsonResult {
     async fn receive_vote(&self, params: Value) -> JsonResult {
         let args = params.as_array().unwrap();
         let args = params.as_array().unwrap();
 
 

+ 1 - 1
script/research/consensusd/src/service/state.rs

@@ -40,7 +40,7 @@ pub struct State {
 
 
 impl State {
 impl State {
     pub fn new(id: u64, genesis_time: Timestamp, init_block: Block) -> State {
     pub fn new(id: u64, genesis_time: Timestamp, init_block: Block) -> State {
-        // TODO: clock sync
+        // Missing: clock sync
         let secret = SecretKey::random(&mut OsRng);
         let secret = SecretKey::random(&mut OsRng);
         State {
         State {
             id,
             id,

+ 1 - 1
script/research/streamlet_rust/src/structures/node.rs

@@ -40,7 +40,7 @@ pub struct Node {
 
 
 impl Node {
 impl Node {
     pub fn new(id: u64, genesis_time: Instant, init_block: Block) -> Node {
     pub fn new(id: u64, genesis_time: Instant, init_block: Block) -> Node {
-        // TODO: clock sync
+        // Missing: clock sync
         const K: u32 = 11;
         const K: u32 = 11;
         let secret = SecretKey::random(&mut OsRng);
         let secret = SecretKey::random(&mut OsRng);
         Node {
         Node {

+ 1 - 1
script/research/validatord/src/consensus/state.rs

@@ -127,7 +127,7 @@ pub struct ValidatorState {
 
 
 impl ValidatorState {
 impl ValidatorState {
     pub fn new(db_path: PathBuf, id: u64, genesis: i64) -> Result<ValidatorStatePtr> {
     pub fn new(db_path: PathBuf, id: u64, genesis: i64) -> Result<ValidatorStatePtr> {
-        // TODO: clock sync
+        // Missing: clock sync
         let secret = SecretKey::random(&mut OsRng);
         let secret = SecretKey::random(&mut OsRng);
         let db = sled::open(db_path)?;
         let db = sled::open(db_path)?;
         let public = PublicKey::from_secret(secret);
         let public = PublicKey::from_secret(secret);