Struct casper_execution_engine::core::engine_state::EngineState   [−][src]
pub struct EngineState<S> { /* fields omitted */ }Expand description
Main implementation of an execution engine state.
Takes an engine’s configuration and a provider of a state (aka the global state) to operate on. Methods implemented on this structure are the external API intended to be used by the users such as the node, test framework, and others.
Implementations
Flushes the LMDB environment to disk when manual sync is enabled in the config.toml.
Creates new engine state.
Returns engine config.
Updates current engine config with a new instance.
pub fn commit_genesis(
    &self, 
    correlation_id: CorrelationId, 
    genesis_config_hash: Digest, 
    protocol_version: ProtocolVersion, 
    ee_config: &ExecConfig
) -> Result<GenesisSuccess, Error>
pub fn commit_genesis(
    &self, 
    correlation_id: CorrelationId, 
    genesis_config_hash: Digest, 
    protocol_version: ProtocolVersion, 
    ee_config: &ExecConfig
) -> Result<GenesisSuccess, Error>
Commits genesis process.
This process is run only once per network to initiate the system. By definition users are unable to execute smart contracts on a network without a genesis.
Takes genesis configuration passed through ExecConfig and creates the system contracts,
sets up the genesis accounts, and sets up the auction state based on that. At the end of
the process, SystemContractRegistry is persisted under the special global state space
Key::SystemContractRegistry.
Returns a GenesisSuccess for a successful operation, or an error otherwise.
pub fn commit_upgrade(
    &self, 
    correlation_id: CorrelationId, 
    upgrade_config: UpgradeConfig
) -> Result<UpgradeSuccess, Error>
pub fn commit_upgrade(
    &self, 
    correlation_id: CorrelationId, 
    upgrade_config: UpgradeConfig
) -> Result<UpgradeSuccess, Error>
Creates a new tracking copy instance.
pub fn run_query(
    &self, 
    correlation_id: CorrelationId, 
    query_request: QueryRequest
) -> Result<QueryResult, Error>
pub fn run_query(
    &self, 
    correlation_id: CorrelationId, 
    query_request: QueryRequest
) -> Result<QueryResult, Error>
Executes a query.
For a given root Key it does a path lookup through the named keys.
Returns the value stored under a URef wrapped in a QueryResult.
pub fn run_execute(
    &self, 
    correlation_id: CorrelationId, 
    exec_request: ExecuteRequest
) -> Result<ExecutionResults, Error>
pub fn run_execute(
    &self, 
    correlation_id: CorrelationId, 
    exec_request: ExecuteRequest
) -> Result<ExecutionResults, Error>
Runs a deploy execution request.
For each deploy stored in the request it will execute it.
Currently a special shortcut is taken to distinguish a native transfer, from a deploy.
Return execution results which contains results from each deploy ran.
pub fn get_purse_balance(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest, 
    purse_uref: URef
) -> Result<BalanceResult, Error>
pub fn get_purse_balance(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest, 
    purse_uref: URef
) -> Result<BalanceResult, Error>
Get the balance of a passed purse referenced by its URef.
pub fn transfer(
    &self, 
    correlation_id: CorrelationId, 
    executor: &Executor, 
    protocol_version: ProtocolVersion, 
    prestate_hash: Digest, 
    blocktime: BlockTime, 
    deploy_item: DeployItem, 
    proposer: PublicKey
) -> Result<ExecutionResult, Error>
pub fn transfer(
    &self, 
    correlation_id: CorrelationId, 
    executor: &Executor, 
    protocol_version: ProtocolVersion, 
    prestate_hash: Digest, 
    blocktime: BlockTime, 
    deploy_item: DeployItem, 
    proposer: PublicKey
) -> Result<ExecutionResult, Error>
Executes a native transfer.
Native transfers do not involve WASM at all, and also skip executing payment code. Therefore this is the fastest and cheapest way to transfer tokens from account to account.
Returns an ExecutionResult for a successful native transfer.
pub fn deploy(
    &self, 
    correlation_id: CorrelationId, 
    executor: &Executor, 
    protocol_version: ProtocolVersion, 
    prestate_hash: Digest, 
    blocktime: BlockTime, 
    deploy_item: DeployItem, 
    proposer: PublicKey
) -> Result<ExecutionResult, Error>
pub fn deploy(
    &self, 
    correlation_id: CorrelationId, 
    executor: &Executor, 
    protocol_version: ProtocolVersion, 
    prestate_hash: Digest, 
    blocktime: BlockTime, 
    deploy_item: DeployItem, 
    proposer: PublicKey
) -> Result<ExecutionResult, Error>
Executes a deploy.
A deploy execution consists of running the payment code, which is expected to deposit funds
into the payment purse, and then running the session code with a specific gas limit. For
running payment code, we lock MAX_PAYMENT amount of motes from the user as collateral.
If both the payment code and the session code execute successfully, a fraction of the
unspent collateral will be transferred back to the proposer of the deploy, as specified
in the request.
Returns ExecutionResult, or an error condition.
pub fn apply_effect(
    &self, 
    correlation_id: CorrelationId, 
    pre_state_hash: Digest, 
    effects: AdditiveMap<Key, Transform>
) -> Result<Digest, Error> where
    Error: From<S::Error>, 
pub fn apply_effect(
    &self, 
    correlation_id: CorrelationId, 
    pre_state_hash: Digest, 
    effects: AdditiveMap<Key, Transform>
) -> Result<Digest, Error> where
    Error: From<S::Error>, 
Apply effects of the execution.
This is also refered to as “committing” the effects into the global state. This method has to be run after an execution has been made to persists the effects of it.
Returns new state root hash.
Gets a trie object for given state root hash.
pub fn put_trie_and_find_missing_descendant_trie_keys(
    &self, 
    correlation_id: CorrelationId, 
    trie: &Trie<Key, StoredValue>
) -> Result<Vec<Digest>, Error> where
    Error: From<S::Error>, 
pub fn put_trie_and_find_missing_descendant_trie_keys(
    &self, 
    correlation_id: CorrelationId, 
    trie: &Trie<Key, StoredValue>
) -> Result<Vec<Digest>, Error> where
    Error: From<S::Error>, 
Puts a trie and finds missing descendant trie keys.
Performs a lookup for a list of missing root hashes.
pub fn get_era_validators(
    &self, 
    correlation_id: CorrelationId, 
    get_era_validators_request: GetEraValidatorsRequest
) -> Result<EraValidators, GetEraValidatorsError>
pub fn get_era_validators(
    &self, 
    correlation_id: CorrelationId, 
    get_era_validators_request: GetEraValidatorsRequest
) -> Result<EraValidators, GetEraValidatorsError>
Obtains validator weights for given era.
pub fn get_bids(
    &self, 
    correlation_id: CorrelationId, 
    get_bids_request: GetBidsRequest
) -> Result<GetBidsResult, Error>
pub fn get_bids(
    &self, 
    correlation_id: CorrelationId, 
    get_bids_request: GetBidsRequest
) -> Result<GetBidsResult, Error>
Gets current bids from the auction system.
pub fn commit_step(
    &self, 
    correlation_id: CorrelationId, 
    step_request: StepRequest
) -> Result<StepSuccess, StepError>
pub fn commit_step(
    &self, 
    correlation_id: CorrelationId, 
    step_request: StepRequest
) -> Result<StepSuccess, StepError>
Executes a step request.
pub fn get_balance(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest, 
    public_key: PublicKey
) -> Result<BalanceResult, Error>
pub fn get_balance(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest, 
    public_key: PublicKey
) -> Result<BalanceResult, Error>
Gets the balance of a given public key.
pub fn get_system_mint_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
pub fn get_system_mint_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
Returns mint system contract hash.
pub fn get_system_auction_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
pub fn get_system_auction_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
Returns auction system contract hash.
pub fn get_handle_payment_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
pub fn get_handle_payment_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
Returns handle payment system contract hash.
pub fn get_standard_payment_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
pub fn get_standard_payment_hash(
    &self, 
    correlation_id: CorrelationId, 
    state_hash: Digest
) -> Result<ContractHash, Error>
Returns standard payment system contract hash.
Trait Implementations
Auto Trait Implementations
impl<S> RefUnwindSafe for EngineState<S> where
    S: RefUnwindSafe, 
impl<S> Send for EngineState<S> where
    S: Send, 
impl<S> Sync for EngineState<S> where
    S: Sync, 
impl<S> Unpin for EngineState<S> where
    S: Unpin, 
impl<S> UnwindSafe for EngineState<S> where
    S: UnwindSafe, 
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
    T: Any, 
impl<T> Downcast for T where
    T: Any, 
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s. Read more
fn fmt_binary(self) -> FmtBinary<Self> where
    Self: Binary, 
fn fmt_binary(self) -> FmtBinary<Self> where
    Self: Binary, 
Causes self to use its Binary implementation when Debug-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
    Self: Display, 
fn fmt_display(self) -> FmtDisplay<Self> where
    Self: Display, 
Causes self to use its Display implementation when
Debug-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
    Self: LowerExp, 
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
    Self: LowerExp, 
Causes self to use its LowerExp implementation when
Debug-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
    Self: LowerHex, 
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
    Self: LowerHex, 
Causes self to use its LowerHex implementation when
Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
    Self: Pointer, 
fn fmt_pointer(self) -> FmtPointer<Self> where
    Self: Pointer, 
Causes self to use its Pointer implementation when
Debug-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
    Self: UpperExp, 
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
    Self: UpperExp, 
Causes self to use its UpperExp implementation when
Debug-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
    Self: UpperHex, 
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
    Self: UpperHex, 
Causes self to use its UpperHex implementation when
Debug-formatted. Read more
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: AsRef<T>,
    T: 'a,
    R: 'a, 
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: AsRef<T>,
    T: 'a,
    R: 'a, 
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
    Self: AsMut<T>,
    T: 'a,
    R: 'a, 
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
    Self: AsMut<T>,
    T: 'a,
    R: 'a, 
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: Borrow<T>,
    T: 'a,
    R: 'a, 
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: Borrow<T>,
    T: 'a,
    R: 'a, 
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
    &'a mut self, 
    func: impl FnOnce(&'a mut T) -> R
) -> R where
    Self: BorrowMut<T>,
    T: 'a,
    R: 'a, 
fn pipe_borrow_mut<'a, T, R>(
    &'a mut self, 
    func: impl FnOnce(&'a mut T) -> R
) -> R where
    Self: BorrowMut<T>,
    T: 'a,
    R: 'a, 
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
    Self: Deref,
    R: 'a, 
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
    Self: Deref,
    R: 'a, 
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
    &'a mut self, 
    func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
    Self: DerefMut,
    R: 'a, 
fn pipe_deref_mut<'a, R>(
    &'a mut self, 
    func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
    Self: DerefMut,
    R: 'a, 
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more
Provides immutable access for inspection. Read more
Calls tap in debug builds, and does nothing in release builds.
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
    F: FnOnce(&mut Self) -> R, 
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
    F: FnOnce(&mut Self) -> R, 
Calls tap_mut in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
    U: ?Sized, 
impl<T, U> TapAsRef<U> for T where
    U: ?Sized, 
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
    Self: AsRef<T>,
    F: FnOnce(&T) -> R, 
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
    Self: AsRef<T>,
    F: FnOnce(&T) -> R, 
Calls tap_ref in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 
fn tap_ref_mut<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 
Calls tap_ref_mut in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
    U: ?Sized, 
impl<T, U> TapBorrow<U> for T where
    U: ?Sized, 
fn tap_borrow<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 
fn tap_borrow<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 
Calls tap_borrow in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 
Calls tap_borrow_mut in debug builds, and does nothing in release
builds. Read more
Immutably dereferences self for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
    Self: Deref,
    F: FnOnce(&Self::Target) -> R, 
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
    Self: Deref,
    F: FnOnce(&Self::Target) -> R, 
Calls tap_deref in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 
fn tap_deref_mut<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 
Mutably dereferences self for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 
Calls tap_deref_mut in debug builds, and does nothing in release
builds. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more