pub struct OracleTally {
pub request_id: [u8; 32],
pub commits: HashMap<Vec<u8>, [u8; 32]>,
pub reveals: HashMap<Vec<u8>, (Vec<u8>, u16)>,
pub committed_stake: u64,
pub total_stake: u64,
pub commit_phase_closed: bool,
}Expand description
Pending tally for a single oracle request - accumulates commits and reveals as validators submit them. Lives in State::oracle_pending.
Fields§
§request_id: [u8; 32]§commits: HashMap<Vec<u8>, [u8; 32]>validator_pk -> commit_hash
reveals: HashMap<Vec<u8>, (Vec<u8>, u16)>validator_pk -> (response_body, status)
committed_stake: u64Total stake committed so far (numerator, total stake denominator).
total_stake: u64§commit_phase_closed: boolTrue once commit phase is open to reveals.
Implementations§
Source§impl OracleTally
impl OracleTally
Sourcepub fn try_finalize(
&self,
staking: &StakingState,
) -> Option<(Vec<u8>, u16, u64, u64)>
pub fn try_finalize( &self, staking: &StakingState, ) -> Option<(Vec<u8>, u16, u64, u64)>
Try to find a response_body that has >= gp::get_u64(gp::PARAM_ORACLE_REVEAL_QUORUM_PERCENT) of stake. Returns Some((body, status, agreeing_stake, total_stake)) if quorum reached.
pub fn try_finalize_with_format( &self, staking: &StakingState, response_format: UrlResponseFormat, ) -> Option<(Vec<u8>, u16, u64, u64)>
Sourcepub fn commit_quorum_reached(&self) -> bool
pub fn commit_quorum_reached(&self) -> bool
True if enough stake has committed to open the reveal window.
Trait Implementations§
Source§impl Clone for OracleTally
impl Clone for OracleTally
Source§fn clone(&self) -> OracleTally
fn clone(&self) -> OracleTally
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OracleTally
impl Debug for OracleTally
Source§impl Default for OracleTally
impl Default for OracleTally
Source§fn default() -> OracleTally
fn default() -> OracleTally
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for OracleTally
impl<'de> Deserialize<'de> for OracleTally
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OracleTally
impl RefUnwindSafe for OracleTally
impl Send for OracleTally
impl Sync for OracleTally
impl Unpin for OracleTally
impl UnsafeUnpin for OracleTally
impl UnwindSafe for OracleTally
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more