pub struct ResourceControlPolicy {Show 15 fields
pub block: Amount,
pub fuel_unit: Amount,
pub read_operation: Amount,
pub write_operation: Amount,
pub byte_read: Amount,
pub byte_written: Amount,
pub byte_stored: Amount,
pub operation: Amount,
pub operation_byte: Amount,
pub message: Amount,
pub message_byte: Amount,
pub maximum_fuel_per_block: u64,
pub maximum_executed_block_size: u64,
pub maximum_bytes_read_per_block: u64,
pub maximum_bytes_written_per_block: u64,
}
Expand description
A collection of prices and limits associated with block execution.
Fields§
§block: Amount
The base price for creating a new block.
fuel_unit: Amount
The price per unit of fuel (aka gas) for VM execution.
read_operation: Amount
The price of one read operation.
write_operation: Amount
The price of one write operation.
byte_read: Amount
The price of reading a byte.
byte_written: Amount
The price of writing a byte
byte_stored: Amount
The price of increasing storage by a byte.
operation: Amount
The base price of adding an operation to a block.
operation_byte: Amount
The additional price for each byte in the argument of a user operation.
message: Amount
The base price of sending a message from a block.
message_byte: Amount
The additional price for each byte in the argument of a user message.
maximum_fuel_per_block: u64
The maximum amount of fuel a block can consume.
maximum_executed_block_size: u64
The maximum size of an executed block. This includes the block proposal itself as well as the execution outcome.
maximum_bytes_read_per_block: u64
The maximum data to read per block
maximum_bytes_written_per_block: u64
The maximum data to write per block
Implementations§
Source§impl ResourceControlPolicy
impl ResourceControlPolicy
pub fn block_price(&self) -> Amount
pub fn total_price( &self, resources: &Resources, ) -> Result<Amount, ArithmeticError>
Source§impl ResourceControlPolicy
impl ResourceControlPolicy
Sourcepub fn only_fuel() -> Self
pub fn only_fuel() -> Self
Creates a policy with no cost for anything except fuel.
This can be used in tests that need whole numbers in their chain balance and don’t expect to execute any Wasm code.
Sourcepub fn fuel_and_block() -> Self
pub fn fuel_and_block() -> Self
Creates a policy with no cost for anything except fuel, and 0.001 per block.
This can be used in tests that don’t expect to execute any Wasm code, and that keep track of how many blocks were created.
Sourcepub fn all_categories() -> Self
pub fn all_categories() -> Self
Creates a policy where all categories have a small non-zero cost.
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 PartialEq for ResourceControlPolicy
impl PartialEq for ResourceControlPolicy
Source§impl Serialize for ResourceControlPolicy
impl Serialize for ResourceControlPolicy
impl Eq for ResourceControlPolicy
impl InputObjectType 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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
.