mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
rm oracle reference
This commit is contained in:
parent
7726e7bef4
commit
8fb9b155b5
@ -679,7 +679,7 @@ In this case, all response values are of the same magnitude, which is encouragin
|
||||
|
||||
## Summary
|
||||
|
||||
We developed a model to decentralize EVM hosting providers for our DApps and implemented a stylized solution with Fluence and Aqua. Specifically, we queried multiple centralized hosted EVM providers using the open Ethereum JSON-RPC API and settled on pulling the `latest` block as an indicator of reliability and "liveness" as opposed to, say, (stale) caches, unreachability or nefarious behavior.
|
||||
We developed a model to decentralize blockchain APIs for our DApps and implemented a stylized solution with Fluence and Aqua. Specifically, we queried multiple centralized hosted EVM providers using the open Ethereum JSON-RPC API and settled on pulling the `latest` block as an indicator of reliability and "liveness" as opposed to, say, (stale) caches, unreachability or nefarious behavior.
|
||||
|
||||
Along our journey, we pretty much touched on every possible chokepoint and discussed what a feasible approach to a quorum might look like. However, we made a couple significant omissions:
|
||||
|
||||
|
@ -31,7 +31,7 @@ fn mode<'a>(data: impl ExactSizeIterator<Item = &'a EVMResult>) -> (u32, u64) {
|
||||
.entry(
|
||||
match serde_json::from_str::<serde_json::Value>(&value.stdout) {
|
||||
Ok(r) => r["block-height"].as_u64().unwrap(),
|
||||
Err(e) => 0 as u64,
|
||||
Err(_e) => 0 as u64,
|
||||
},
|
||||
)
|
||||
.or_insert(0) += 1;
|
||||
@ -65,7 +65,7 @@ pub struct EVMResult {
|
||||
|
||||
#[marine]
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Oracle {
|
||||
pub struct Quorum {
|
||||
pub n: u32,
|
||||
pub mode: u64,
|
||||
pub freq: u32,
|
||||
@ -73,9 +73,9 @@ pub struct Oracle {
|
||||
}
|
||||
|
||||
#[marine]
|
||||
pub fn point_estimate(data: Vec<EVMResult>, min_points: u32) -> Oracle {
|
||||
pub fn point_estimate(data: Vec<EVMResult>, min_points: u32) -> Quorum {
|
||||
if data.len() < min_points as usize {
|
||||
return Oracle {
|
||||
return Quorum {
|
||||
err_str: format!(
|
||||
"Expected at least {} points but only got {}.",
|
||||
min_points,
|
||||
@ -86,7 +86,7 @@ pub fn point_estimate(data: Vec<EVMResult>, min_points: u32) -> Oracle {
|
||||
}
|
||||
|
||||
if data.len() < 1 {
|
||||
return Oracle {
|
||||
return Quorum {
|
||||
err_str: format!("Expected at least one timestamp."),
|
||||
..<_>::default()
|
||||
};
|
||||
@ -94,7 +94,7 @@ pub fn point_estimate(data: Vec<EVMResult>, min_points: u32) -> Oracle {
|
||||
|
||||
let (freq, mode) = mode(data.iter());
|
||||
|
||||
Oracle {
|
||||
Quorum {
|
||||
n: data.len() as u32,
|
||||
mode,
|
||||
freq,
|
||||
|
Loading…
Reference in New Issue
Block a user