Struct sp_state_machine::StateMachine
source · pub struct StateMachine<'a, B, H, Exec>{ /* private fields */ }
Expand description
The substrate state machine.
Implementations§
source§impl<'a, B, H, Exec> StateMachine<'a, B, H, Exec>
impl<'a, B, H, Exec> StateMachine<'a, B, H, Exec>
sourcepub fn new(
backend: &'a B,
overlay: &'a mut OverlayedChanges<H>,
exec: &'a Exec,
method: &'a str,
call_data: &'a [u8],
extensions: &'a mut Extensions,
runtime_code: &'a RuntimeCode<'_>,
context: CallContext
) -> Self
pub fn new( backend: &'a B, overlay: &'a mut OverlayedChanges<H>, exec: &'a Exec, method: &'a str, call_data: &'a [u8], extensions: &'a mut Extensions, runtime_code: &'a RuntimeCode<'_>, context: CallContext ) -> Self
Creates new substrate state machine.
sourcepub fn set_parent_hash(self, parent_hash: H::Out) -> Self
pub fn set_parent_hash(self, parent_hash: H::Out) -> Self
Set the given parent_hash
as the hash of the parent block.
This will be used for improved logging.
sourcepub fn execute(&mut self) -> Result<Vec<u8>, Box<dyn Error>>
pub fn execute(&mut self) -> Result<Vec<u8>, Box<dyn Error>>
Execute a call using the given state backend, overlayed changes, and call executor.
On an error, no prospective changes are written to the overlay.
Note: changes to code will be in place if this call is made again. For running partial blocks (e.g. a transaction at a time), ensure a different method is used.
Returns the SCALE encoded result of the executed function.
Trait Implementations§
Auto Trait Implementations§
impl<'a, B, H, Exec> !RefUnwindSafe for StateMachine<'a, B, H, Exec>
impl<'a, B, H, Exec> !Send for StateMachine<'a, B, H, Exec>
impl<'a, B, H, Exec> !Sync for StateMachine<'a, B, H, Exec>
impl<'a, B, H, Exec> Unpin for StateMachine<'a, B, H, Exec>
impl<'a, B, H, Exec> !UnwindSafe for StateMachine<'a, B, H, Exec>
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
Mutably borrows from an owned value. Read more
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, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.