Struct redstone::core::config::Config

source ·
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

Auto-generated by derive_getters::Getters.

source

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.

source

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.

source

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.

source

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.

source

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).

source

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

source

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 with redstone::network::Error otherwise.

Trait Implementations§

source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C, Env> From<Config> for RedStoneConfigImpl<C, Env>

source§

fn from(value: Config) -> Self

Converts to this type from the input type.
source§

impl Validator for Config

source§

fn feed_index(&self, feed_id: FeedId) -> Option<usize>

Retrieves the index of a given data feed. Read more
source§

fn signer_index(&self, signer: &SignerAddress) -> Option<usize>

Retrieves the index of a given signer. Read more
source§

fn validate_signer_count_threshold( &self, index: usize, values: &[Option<Value>], ) -> Result<Vec<Value>, Error>

Validates the signer count threshold for a given index within a set of values. Read more
source§

fn validate_timestamp( &self, index: usize, timestamp: TimestampMillis, ) -> Result<TimestampMillis, Error>

Validates the timestamp for a given index. Read more

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§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts 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 more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> ContextualTryInto<U> for T
where U: ContextualTryFrom<T>,

§

type Error = <U as ContextualTryFrom<T>>::Error

§

type Context = <U as ContextualTryFrom<T>>::Context

§

fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<X, Y> LabelledResolve<Y> for X
where Y: LabelledResolveFrom<X>,

§

fn labelled_resolve( self, resolver: &impl LabelResolver<<Y as LabelledResolvable>::ResolverOutput>, ) -> Y

§

impl<X, Y> Resolve<Y> for X
where Y: ResolveFrom<X>,

§

fn resolve(self) -> Y

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V