pub struct Config { /* private fields */ }
Expand description
Configuration for a RedStone payload processor.
Specifies the parameters necessary for the verification and aggregation of values from various data points passed by the RedStone payload.
Implementations§
source§impl Config
impl Config
Auto-generated by derive_getters::Getters
.
sourcepub fn signer_count_threshold(&self) -> &u8
pub fn signer_count_threshold(&self) -> &u8
The minimum number of signers required validating the data.
Specifies how many unique signers (from different addresses) are required for the data to be considered valid and trustworthy.
sourcepub fn signers(&self) -> &Vec<SignerAddress>
pub fn signers(&self) -> &Vec<SignerAddress>
List of identifiers for signers authorized to sign the data.
Each signer is identified by a unique, network-specific byte string (Bytes
),
which represents their address.
sourcepub fn feed_ids(&self) -> &Vec<FeedId>
pub fn feed_ids(&self) -> &Vec<FeedId>
Identifiers for the data feeds from which values are aggregated.
Each data feed id is represented by the FeedId
type.
sourcepub fn block_timestamp(&self) -> &TimestampMillis
pub fn block_timestamp(&self) -> &TimestampMillis
The current block time in timestamp format, used for verifying data timeliness.
The value’s been expressed in milliseconds since the Unix epoch (January 1, 1970) and allows for determining whether the data is current in the context of blockchain time.
sourcepub fn max_timestamp_delay_ms(&self) -> &TimestampMillis
pub fn max_timestamp_delay_ms(&self) -> &TimestampMillis
The maximum delay of the package in regards to the current block in the blockchain.
The value’s been expressed in milliseconds since the Unix epoch (January 1, 1970).
sourcepub fn max_timestamp_ahead_ms(&self) -> &TimestampMillis
pub fn max_timestamp_ahead_ms(&self) -> &TimestampMillis
The maximum time package was created ahead of the current block in the blockchain.
The value’s been expressed in milliseconds since the Unix epoch (January 1, 1970).
source§impl Config
impl Config
sourcepub fn try_new(
signer_count_threshold: u8,
signers: Vec<SignerAddress>,
feed_ids: Vec<FeedId>,
block_timestamp: TimestampMillis,
max_timestamp_delay_ms: Option<TimestampMillis>,
max_timestamp_ahead_ms: Option<TimestampMillis>,
) -> Result<Self, Error>
pub fn try_new( signer_count_threshold: u8, signers: Vec<SignerAddress>, feed_ids: Vec<FeedId>, block_timestamp: TimestampMillis, max_timestamp_delay_ms: Option<TimestampMillis>, max_timestamp_ahead_ms: Option<TimestampMillis>, ) -> Result<Self, Error>
Verifies all members of the config.
This method checks whether all config members are correct.
§Arguments
signer_count_threshold
- The minimum number of signers required validating the data.signers
- List of identifiers for signers authorized to sign the data.feed_ids
- Identifiers for the data feeds from which values are aggregated.block_timestamp
- The current block time in timestamp format, used for verifying data timeliness.max_timestamp_delay_ms
- Maximum delay of the package against the current block timestamp. If None is provided then default config value is used.max_timestamp_ahead_ms
- Maximum ahead of time of the package against current block timestamp. If None is provided then default config value is used.
§Returns
- Success
Self
if arguments to the functions are correct or cresponding Err withredstone::network::Error
otherwise.
Trait Implementations§
source§impl<C, Env> From<Config> for RedStoneConfigImpl<C, Env>
impl<C, Env> From<Config> for RedStoneConfigImpl<C, Env>
source§impl Validator for Config
impl Validator for Config
source§fn feed_index(&self, feed_id: FeedId) -> Option<usize>
fn feed_index(&self, feed_id: FeedId) -> Option<usize>
source§fn signer_index(&self, signer: &SignerAddress) -> Option<usize>
fn signer_index(&self, signer: &SignerAddress) -> Option<usize>
source§fn validate_signer_count_threshold(
&self,
index: usize,
values: &[Option<Value>],
) -> Result<Vec<Value>, Error>
fn validate_signer_count_threshold( &self, index: usize, values: &[Option<Value>], ) -> Result<Vec<Value>, Error>
source§fn validate_timestamp(
&self,
index: usize,
timestamp: TimestampMillis,
) -> Result<TimestampMillis, Error>
fn validate_timestamp( &self, index: usize, timestamp: TimestampMillis, ) -> Result<TimestampMillis, Error>
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more