Skip to main content

TargetRexProgram

Enum TargetRexProgram 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum TargetRexProgram { HttpGet { url: RexUrl, filter: Option<Vec<HttpFilter>>, headers: Headers, }, HttpPost { url: RexUrl, filter: Option<Vec<HttpFilter>>, body: RexValue, content_type: String, headers: Headers, }, Time = 2, Number = 3, SecretKeyGeneration { committee_id: String, committee_members: Vec<String>, }, SecretKeyEncryption { target_tee_id: String, secret_data: Vec<u8>, committee_id: String, }, SecretKeyDecryption { encrypted_data: Vec<u8>, source_committee_id: String, }, WebSocket(WebSocketOperation), Wasm { bytecode_account: Pubkey, input: Vec<RexValue>, program_index: Option<u32>, }, }
Expand description

Enum that represents the target REX Program of the REX request.

Discriminant values are fixed to ensure stable serialization across builds with different feature flags.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

HttpGet

HTTP GET request to the REX. The URL is specified in the RexDutyRequest. The URL must be an HTTPS URL. The filter is optional, and if provided, it is used to filter the response.

Fields

§headers: Headers
§

HttpPost

HTTP POST request to the REX. The URL is specified in the RexDutyRequest. The URL must be an HTTPS URL. This REX type is restricted to single-validator assignment to prevent duplicate operations on non-idempotent endpoints.

Fields

§content_type: String
§headers: Headers
§

Time = 2

Get the current time from several NIST servers.

§

Number = 3

Only used for testing purposes, to simulate an REX that always returns a fixed value. TODO: remove this variant with a cfg testing flag.

§

SecretKeyGeneration

Generate a shared secret key within a committee of TEEs. The manager TEE generates the key and distributes it to all committee members.

Fields

§committee_id: String
§committee_members: Vec<String>
§

SecretKeyEncryption

Encrypt a secret key for a target TEE using their public key. This is used to share keys with TEEs outside the original committee.

Fields

§target_tee_id: String
§secret_data: Vec<u8>
§committee_id: String
§

SecretKeyDecryption

Decrypt a secret key that was encrypted for this TEE. This is used by TEEs to access keys shared with them.

Fields

§encrypted_data: Vec<u8>
§source_committee_id: String
§

WebSocket(WebSocketOperation)

WebSocket REX operations for persistent connections

§

Wasm

Execute WASM bytecode inside the TEE. The bytecode must be a WASI-compatible component deployed to an on-chain account.

Fields

§bytecode_account: Pubkey

Account pubkey containing the deployed WASM component(s)

§input: Vec<RexValue>

Per-argument input data for the WASM module. Each entry is one argument, independently Plain (borsh-serialized) or Encrypted (HPKE ciphertext the TEE decrypts). The TEE decrypts each Encrypted entry and concatenates all bytes into a borsh tuple. From CLI: pass base64-encoded bytes (single plain argument).

§program_index: Option<u32>

Index into the program table within the account (defaults to 0)

Implementations§

Source§

impl TargetRexProgram

Source

pub fn websocket_op(&self) -> Option<WebSocketOperation>

Extracts the WebSocket operation if this is a WebSocket target.

Source

pub fn encrypted_payloads(&self) -> Box<dyn Iterator<Item = &[u8]> + '_>

Ciphertext bytes of every field on this program that can carry an encrypted payload: the encrypted URL, body, WebSocket Send message(s), or WASM input(s). Single source of truth for which fields are ciphertext carriers; the version-gated routing (Router::dkg_payload_bytes) and the on-chain ciphertext-match check (encrypted_payload_iter) build on this and additionally require the DKG_PAYLOAD_VERSION byte (a constant that lives above this crate, so it is applied by those callers).

Source

pub fn is_dkg_encrypted(&self) -> bool

True if this program carries any encrypted payload, meaning the duty cannot be served by a direct fetch and must go through the threshold-decryption committee + combine pipeline before any result can exist. Used to size the encrypted duty’s collection window (DutyRequest::inner); does not inspect DKG_PAYLOAD_VERSION — encryption alone is sufficient (and conservative) for that purpose.

Source§

impl TargetRexProgram

Source

pub fn is_websocket(&self) -> bool

Returns true if this is a WebSocket operation.

Trait Implementations§

Source§

impl AsRef<str> for TargetRexProgram

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for TargetRexProgram

Source§

fn clone(&self) -> TargetRexProgram

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TargetRexProgram

Source§

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

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

impl<'de> Deserialize<'de> for TargetRexProgram

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TargetRexProgram, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TargetRexProgram

Source§

impl FromStr for TargetRexProgram

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str( s: &str, ) -> Result<TargetRexProgram, <TargetRexProgram as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for TargetRexProgram

Source§

fn eq(&self, other: &TargetRexProgram) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TargetRexProgram

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TargetRexProgram

Auto Trait Implementations§

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more