You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: Why have any of these checks in the API. Shouldn't they all be in the Smart Contract Logic.
use anyhow::{anyhow,Result};use banyan_shared::{eth::EthClient, proofs, proofs::window, types::*};use log::info;use rocket::serde::{Deserialize,Serialize};use serde_json::from_str;use std::io::Cursor;use std::sync::Arc;#[derive(Serialize,Deserialize,Debug,Clone)]pubstructChainlinkRequestData{pubdeal_id:String,}#[derive(Serialize,Deserialize,Debug,Clone)]pubstructResponseData{pubdeal_id:DealID,pubsuccess_count:u64,pubnum_windows:u64,pubstatus:u16,pubresult:String,}#[derive(Serialize,Deserialize,Debug,Clone)]pubstructChainlinkResponse{pubdata:ResponseData,}pubstructWebserverState(pubArc<EthClient>);/* Function to construct an error response to return to Chainlink */fnconstruct_error(deal_id:DealID,reason:String) -> ChainlinkResponse{ChainlinkResponse{data:ResponseData{
deal_id,success_count:0,num_windows:0,status:0,result: reason,},}}/// this validates the deal based on a deal_id, returns a json response of either the success count and num_windows,/// or an error message to be turned into Json<ChainlinkResponse> in the caller!/// TODO fix logging... :|pub(crate)asyncfn validate_deal_internal(provider:Arc<EthClient>,input_data:ChainlinkRequestData,) -> Result<ChainlinkResponse>{let deal_id = from_str(&input_data.deal_id)?;let deal_info = provider
.get_offer(deal_id).await.map_err(|e| anyhow!("Error in get_deal: {:?}", e))?;// checking that deal is either finished or cancelledlet current_block_num = provider
.get_latest_block_num().await.map_err(|e| anyhow!("Couldn't get most recent block number: {e}"))?;// TODO: Why have any of these checks in the API. Shouldn't they all be in the Smart Contract Logic.let deal_over = EthClient::deal_over(current_block_num, deal_info.clone());let deal_cancelled = false;// TODO need to figure out how to get this// this refuses to do the validation computations unless the deal is done with or cancelled
The text was updated successfully, but these errors were encountered:
chainlink-proof-validator/src/validate.rs
Line 61 in 1f4e01d
The text was updated successfully, but these errors were encountered: