Revert "bin/tau: add some saftey checks"

This reverts commit 6f5bf9fb41.
This commit is contained in:
Dastan-glitch
2022-05-25 22:52:38 +00:00
parent 0be7b7facf
commit 66a4ec0394
3 changed files with 1 additions and 30 deletions

View File

@@ -4,11 +4,7 @@ use serde_json::{json, Value};
use darkfi::{util::Timestamp, Error};
use crate::{
error::{TaudError, TaudResult},
task_info::TaskInfo,
JsonRpcInterface,
};
use crate::{error::TaudResult, task_info::TaskInfo, JsonRpcInterface};
#[derive(Clone, Debug, Serialize, Deserialize)]
struct BaseTaskInfo {
@@ -38,11 +34,6 @@ impl JsonRpcInterface {
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
pub async fn add(&self, params: Value) -> TaudResult<Value> {
debug!(target: "tau", "JsonRpc::add() params {}", params);
if !params.is_array() {
return Err(TaudError::InvalidData("params is not an array".into()))
}
let args = params.as_array().unwrap();
let task: BaseTaskInfo = serde_json::from_value(args[0].clone())?;

View File

@@ -26,11 +26,6 @@ impl JsonRpcInterface {
// <-- {"jsonrpc": "2.0", "result": "task", "id": 1}
pub async fn get_task_by_id(&self, params: Value) -> TaudResult<Value> {
debug!(target: "tau", "JsonRpc::get_task_by_id() params {}", params);
if !params.is_array() {
return Err(TaudError::InvalidData("params is not an array".into()))
}
let args = params.as_array().unwrap();
if args.len() != 1 {

View File

@@ -16,11 +16,6 @@ impl JsonRpcInterface {
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
pub async fn update(&self, params: Value) -> TaudResult<Value> {
debug!(target: "tau", "JsonRpc::update() params {}", params);
if !params.is_array() {
return Err(TaudError::InvalidData("params is not an array".into()))
}
let args = params.as_array().unwrap();
if args.len() != 2 {
@@ -42,11 +37,6 @@ impl JsonRpcInterface {
// TODO: BUG: Validate that the state string is correct and not something arbitrary
debug!(target: "tau", "JsonRpc::set_state() params {}", params);
if !params.is_array() {
return Err(TaudError::InvalidData("params is not an array".into()))
}
let args = params.as_array().unwrap();
if args.len() != 2 {
@@ -69,11 +59,6 @@ impl JsonRpcInterface {
// <-- {"jsonrpc": "2.0", "result": true, "id": 1}
pub async fn set_comment(&self, params: Value) -> TaudResult<Value> {
debug!(target: "tau", "JsonRpc::set_comment() params {}", params);
if !params.is_array() {
return Err(TaudError::InvalidData("params is not an array".into()))
}
let args = params.as_array().unwrap();
if args.len() != 2 {