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

This commit is contained in:
aggstam
2022-05-04 16:49:22 +03:00
parent 8d6c696e3a
commit 5127263cd3
5 changed files with 14 additions and 14 deletions

View File

@@ -67,8 +67,8 @@ async fn api_service_init(executor: Arc<Executor<'_>>, config: &ConsensusdConfig
/// RPCAPI:
/// 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) {
let state_path = expand_path(&config.state_path).unwrap();
let id = config.id;
@@ -90,7 +90,7 @@ fn proposal_task(config: &ConsensusdConfig) {
if proposed_block.is_none() {
println!("Node is not the epoch leader. Sleeping till next epoch...");
} else {
// TODO: Proposed block broadcast.
// Missing: Proposed block broadcast.
println!("Node is the epoch leader. Proposed block: {:?}", proposed_block);
}

View File

@@ -86,9 +86,9 @@ impl APIService {
/// 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", "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 {
let args = params.as_array().unwrap();
@@ -114,7 +114,7 @@ impl APIService {
serde_json::to_value(self.id).unwrap(),
))
} else {
// TODO: Proposed block broadcast.
// Missing: Proposed block broadcast.
JsonResult::Resp(jsonresp(
json!((state.public_key, x)),
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.
/// --> {"jsonrpc": "2.0", "method": "receive_proposed_block", "params": [PublicKey, Vote, 1], "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 {
let args = params.as_array().unwrap();
@@ -166,7 +166,7 @@ impl APIService {
serde_json::to_value(self.id).unwrap(),
))
} else {
// TODO: Vote broadcast.
// Missing: Vote broadcast.
JsonResult::Resp(jsonresp(
json!((state.public_key, x)),
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.
/// --> {"jsonrpc": "2.0", "method": "receive_vote", "params": [PublicKey, Vote, 1], "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 {
let args = params.as_array().unwrap();

View File

@@ -40,7 +40,7 @@ pub struct State {
impl 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);
State {
id,

View File

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

View File

@@ -127,7 +127,7 @@ pub struct ValidatorState {
impl ValidatorState {
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 db = sled::open(db_path)?;
let public = PublicKey::from_secret(secret);