Skip to main content

ComputeBudget

Struct ComputeBudget 

Source
pub struct ComputeBudget {
Show 37 fields pub compute_unit_limit: u64, pub log_64_units: u64, pub create_program_address_units: u64, pub invoke_units: u64, pub max_invoke_stack_height: usize, pub max_instruction_trace_length: usize, pub sha256_base_cost: u64, pub sha256_byte_cost: u64, pub sha256_max_slices: u64, pub max_call_depth: usize, pub stack_frame_size: usize, pub log_pubkey_units: u64, pub max_cpi_instruction_size: usize, pub cpi_bytes_per_unit: u64, pub sysvar_base_cost: u64, pub secp256k1_recover_cost: u64, pub syscall_base_cost: u64, pub curve25519_edwards_validate_point_cost: u64, pub curve25519_edwards_add_cost: u64, pub curve25519_edwards_subtract_cost: u64, pub curve25519_edwards_multiply_cost: u64, pub curve25519_edwards_msm_base_cost: u64, pub curve25519_edwards_msm_incremental_cost: u64, pub curve25519_ristretto_validate_point_cost: u64, pub curve25519_ristretto_add_cost: u64, pub curve25519_ristretto_subtract_cost: u64, pub curve25519_ristretto_multiply_cost: u64, pub curve25519_ristretto_msm_base_cost: u64, pub curve25519_ristretto_msm_incremental_cost: u64, pub heap_size: Option<usize>, pub heap_cost: u64, pub mem_op_base_cost: u64, pub alt_bn128_addition_cost: u64, pub alt_bn128_multiplication_cost: u64, pub alt_bn128_pairing_one_pair_cost_first: u64, pub alt_bn128_pairing_one_pair_cost_other: u64, pub big_modular_exponentiation_cost: u64,
}

Fields§

§compute_unit_limit: u64

Number of compute units that a transaction or individual instruction is allowed to consume. Compute units are consumed by program execution, resources they use, etc…

§log_64_units: u64

Number of compute units consumed by a log_u64 call

§create_program_address_units: u64

Number of compute units consumed by a create_program_address call

§invoke_units: u64

Number of compute units consumed by an invoke call (not including the cost incurred by the called program)

§max_invoke_stack_height: usize

Maximum program instruction invocation stack height. Invocation stack height starts at 1 for transaction instructions and the stack height is incremented each time a program invokes an instruction and decremented when a program returns.

§max_instruction_trace_length: usize

Maximum cross-program invocation and instructions per transaction

§sha256_base_cost: u64

Base number of compute units consumed to call SHA256

§sha256_byte_cost: u64

Incremental number of units consumed by SHA256 (based on bytes)

§sha256_max_slices: u64

Maximum number of slices hashed per syscall

§max_call_depth: usize

Maximum SBF to BPF call depth

§stack_frame_size: usize

Size of a stack frame in bytes, must match the size specified in the LLVM SBF backend

§log_pubkey_units: u64

Number of compute units consumed by logging a Pubkey

§max_cpi_instruction_size: usize

Maximum cross-program invocation instruction size

§cpi_bytes_per_unit: u64

Number of account data bytes per compute unit charged during a cross-program invocation

§sysvar_base_cost: u64

Base number of compute units consumed to get a sysvar

§secp256k1_recover_cost: u64

Number of compute units consumed to call secp256k1_recover

§syscall_base_cost: u64

Number of compute units consumed to do a syscall without any work

§curve25519_edwards_validate_point_cost: u64

Number of compute units consumed to validate a curve25519 edwards point

§curve25519_edwards_add_cost: u64

Number of compute units consumed to add two curve25519 edwards points

§curve25519_edwards_subtract_cost: u64

Number of compute units consumed to subtract two curve25519 edwards points

§curve25519_edwards_multiply_cost: u64

Number of compute units consumed to multiply a curve25519 edwards point

§curve25519_edwards_msm_base_cost: u64

Number of compute units consumed for a multiscalar multiplication (msm) of edwards points. The total cost is calculated as msm_base_cost + (length - 1) * msm_incremental_cost.

§curve25519_edwards_msm_incremental_cost: u64

Number of compute units consumed for a multiscalar multiplication (msm) of edwards points. The total cost is calculated as msm_base_cost + (length - 1) * msm_incremental_cost.

§curve25519_ristretto_validate_point_cost: u64

Number of compute units consumed to validate a curve25519 ristretto point

§curve25519_ristretto_add_cost: u64

Number of compute units consumed to add two curve25519 ristretto points

§curve25519_ristretto_subtract_cost: u64

Number of compute units consumed to subtract two curve25519 ristretto points

§curve25519_ristretto_multiply_cost: u64

Number of compute units consumed to multiply a curve25519 ristretto point

§curve25519_ristretto_msm_base_cost: u64

Number of compute units consumed for a multiscalar multiplication (msm) of ristretto points. The total cost is calculated as msm_base_cost + (length - 1) * msm_incremental_cost.

§curve25519_ristretto_msm_incremental_cost: u64

Number of compute units consumed for a multiscalar multiplication (msm) of ristretto points. The total cost is calculated as msm_base_cost + (length - 1) * msm_incremental_cost.

§heap_size: Option<usize>

Optional program heap region size, if None then loader default

§heap_cost: u64

Number of compute units per additional 32k heap above the default (~.5 us per 32k at 15 units/us rounded up)

§mem_op_base_cost: u64

Memory operation syscall base cost

§alt_bn128_addition_cost: u64

Number of compute units consumed to call alt_bn128_addition

§alt_bn128_multiplication_cost: u64

Number of compute units consumed to call alt_bn128_multiplication.

§alt_bn128_pairing_one_pair_cost_first: u64

Total cost will be alt_bn128_pairing_one_pair_cost_first

  • alt_bn128_pairing_one_pair_cost_other * (num_elems - 1)
§alt_bn128_pairing_one_pair_cost_other: u64§big_modular_exponentiation_cost: u64

Big integer modular exponentiation cost

Implementations§

Source§

impl ComputeBudget

Source

pub fn new(compute_unit_limit: u64) -> Self

Source

pub fn process_instructions<'a>( &mut self, instructions: impl Iterator<Item = (&'a Pubkey, &'a CompiledInstruction)>, default_units_per_instruction: bool, support_request_units_deprecated: bool, enable_request_heap_frame_ix: bool, ) -> Result<PrioritizationFeeDetails, TransactionError>

Trait Implementations§

Source§

impl AbiExample for ComputeBudget

Available on RUSTC_WITH_SPECIALIZATION only.
Source§

fn example() -> Self

Source§

impl Clone for ComputeBudget

Source§

fn clone(&self) -> ComputeBudget

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 Copy for ComputeBudget

Source§

impl Debug for ComputeBudget

Source§

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

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

impl Default for ComputeBudget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ComputeBudget

Source§

impl PartialEq for ComputeBudget

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ComputeBudget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

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

Source§

fn vzip(self) -> V

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