pub struct ResourceControlPolicy {Show 32 fields
pub wasm_fuel_unit: Amount,
pub evm_fuel_unit: Amount,
pub read_operation: Amount,
pub write_operation: Amount,
pub byte_runtime: Amount,
pub byte_read: Amount,
pub byte_written: Amount,
pub blob_read: Amount,
pub blob_published: Amount,
pub blob_byte_read: Amount,
pub blob_byte_published: Amount,
pub byte_stored: Amount,
pub operation: Amount,
pub operation_byte: Amount,
pub message: Amount,
pub message_byte: Amount,
pub service_as_oracle_query: Amount,
pub http_request: Amount,
pub maximum_wasm_fuel_per_block: u64,
pub maximum_evm_fuel_per_block: u64,
pub maximum_service_oracle_execution_ms: u64,
pub maximum_block_size: u64,
pub maximum_bytecode_size: u64,
pub maximum_blob_size: u64,
pub maximum_published_blobs: u64,
pub maximum_block_proposal_size: u64,
pub maximum_bytes_read_per_block: u64,
pub maximum_bytes_written_per_block: u64,
pub maximum_oracle_response_bytes: u64,
pub maximum_http_response_bytes: u64,
pub http_request_timeout_ms: u64,
pub http_request_allow_list: BTreeSet<String>,
}Expand description
A collection of prices and limits associated with block execution.
Fields§
§wasm_fuel_unit: AmountThe price per unit of fuel (aka gas) for Wasm execution.
evm_fuel_unit: AmountThe price per unit of fuel (aka gas) for EVM execution.
read_operation: AmountThe price of one read operation.
write_operation: AmountThe price of one write operation.
byte_runtime: AmountThe price of accessing one byte from the runtime.
byte_read: AmountThe price of reading a byte.
byte_written: AmountThe price of writing a byte
blob_read: AmountThe base price to read a blob.
blob_published: AmountThe base price to publish a blob.
blob_byte_read: AmountThe price to read a blob, per byte.
blob_byte_published: AmountThe price to publish a blob, per byte.
byte_stored: AmountThe price of increasing storage by a byte.
operation: AmountThe base price of adding an operation to a block.
operation_byte: AmountThe additional price for each byte in the argument of a user operation.
message: AmountThe base price of sending a message from a block.
message_byte: AmountThe additional price for each byte in the argument of a user message.
service_as_oracle_query: AmountThe price per query to a service as an oracle.
http_request: AmountThe price for a performing an HTTP request.
maximum_wasm_fuel_per_block: u64The maximum amount of Wasm fuel a block can consume.
maximum_evm_fuel_per_block: u64The maximum amount of EVM fuel a block can consume.
maximum_service_oracle_execution_ms: u64The maximum time in milliseconds that a block can spend executing services as oracles.
maximum_block_size: u64The maximum size of a block. This includes the block proposal itself as well as the execution outcome.
maximum_bytecode_size: u64The maximum size of decompressed contract or service bytecode, in bytes.
maximum_blob_size: u64The maximum size of a blob.
maximum_published_blobs: u64The maximum number of published blobs per block.
maximum_block_proposal_size: u64The maximum size of a block proposal.
maximum_bytes_read_per_block: u64The maximum data to read per block
maximum_bytes_written_per_block: u64The maximum data to write per block
maximum_oracle_response_bytes: u64The maximum size in bytes of an oracle response.
maximum_http_response_bytes: u64The maximum size in bytes of a received HTTP response.
http_request_timeout_ms: u64The maximum amount of time allowed to wait for an HTTP response.
http_request_allow_list: BTreeSet<String>The list of hosts that contracts and services can send HTTP requests to.
Implementations§
Source§impl ResourceControlPolicy
impl ResourceControlPolicy
Sourcepub fn no_fees() -> Self
pub fn no_fees() -> Self
Creates a policy with no cost for anything.
This can be used in tests or benchmarks.
Sourcepub fn maximum_fuel_per_block(&self, vm_runtime: VmRuntime) -> u64
pub fn maximum_fuel_per_block(&self, vm_runtime: VmRuntime) -> u64
The maximum fuel per block according to the VmRuntime.
pub fn total_price( &self, resources: &Resources, ) -> Result<Amount, ArithmeticError>
pub fn check_blob_size( &self, content: &BlobContent, ) -> Result<(), ExecutionError>
Trait Implementations§
Source§impl Clone for ResourceControlPolicy
impl Clone for ResourceControlPolicy
Source§fn clone(&self) -> ResourceControlPolicy
fn clone(&self) -> ResourceControlPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceControlPolicy
impl Debug for ResourceControlPolicy
Source§impl Default for ResourceControlPolicy
impl Default for ResourceControlPolicy
Source§impl<'de> Deserialize<'de> for ResourceControlPolicy
impl<'de> Deserialize<'de> for ResourceControlPolicy
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>,
Source§impl Display for ResourceControlPolicy
impl Display for ResourceControlPolicy
Source§impl Hash for ResourceControlPolicy
impl Hash for ResourceControlPolicy
Source§impl InputType for ResourceControlPolicy
impl InputType for ResourceControlPolicy
Source§type RawValueType = ResourceControlPolicy
type RawValueType = ResourceControlPolicy
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§fn parse(value: Option<Value>) -> InputValueResult<Self>
fn parse(value: Option<Value>) -> InputValueResult<Self>
Value. None represents undefined.Source§fn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Source§impl OutputType for ResourceControlPolicy
impl OutputType for ResourceControlPolicy
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§async fn resolve(
&self,
_: &ContextSelectionSet<'_>,
_field: &Positioned<Field>,
) -> ServerResult<Value>
async fn resolve( &self, _: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>
async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Source§impl PartialEq for ResourceControlPolicy
impl PartialEq for ResourceControlPolicy
Source§impl ScalarType for ResourceControlPolicy
impl ScalarType for ResourceControlPolicy
Source§impl Serialize for ResourceControlPolicy
impl Serialize for ResourceControlPolicy
impl Eq for ResourceControlPolicy
impl StructuralPartialEq for ResourceControlPolicy
Auto Trait Implementations§
impl Freeze for ResourceControlPolicy
impl RefUnwindSafe for ResourceControlPolicy
impl Send for ResourceControlPolicy
impl Sync for ResourceControlPolicy
impl Unpin for ResourceControlPolicy
impl UnwindSafe for ResourceControlPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.