Struct sov_chain_state::ChainState
source · pub struct ChainState<C: Context, Da: DaSpec> { /* private fields */ }
Expand description
A new module:
- Must derive
ModuleInfo
- Must contain
[address]
field - Can contain any number of
#[state]
or[module]
fields
Implementations§
source§impl<C: Context, Da: DaSpec> ChainState<C, Da>
impl<C: Context, Da: DaSpec> ChainState<C, Da>
sourcepub fn get_slot_height(
&self,
working_set: &mut WorkingSet<C::Storage>
) -> TransitionHeight
pub fn get_slot_height( &self, working_set: &mut WorkingSet<C::Storage> ) -> TransitionHeight
Returns transition height in the current slot
sourcepub fn get_genesis_hash(
&self,
working_set: &mut WorkingSet<C::Storage>
) -> Option<[u8; 32]>
pub fn get_genesis_hash( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<[u8; 32]>
Return the genesis hash of the module.
sourcepub fn get_genesis_height(
&self,
working_set: &mut WorkingSet<C::Storage>
) -> Option<TransitionHeight>
pub fn get_genesis_height( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<TransitionHeight>
Returns the genesis height of the module.
sourcepub fn get_in_progress_transition(
&self,
working_set: &mut WorkingSet<C::Storage>
) -> Option<TransitionInProgress<Da>>
pub fn get_in_progress_transition( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<TransitionInProgress<Da>>
Returns the transition in progress of the module.
sourcepub fn get_historical_transitions(
&self,
transition_num: TransitionHeight,
working_set: &mut WorkingSet<C::Storage>
) -> Option<StateTransitionId<Da>>
pub fn get_historical_transitions( &self, transition_num: TransitionHeight, working_set: &mut WorkingSet<C::Storage> ) -> Option<StateTransitionId<Da>>
Returns the completed transition associated with the provided transition_num
.
Trait Implementations§
source§impl<C: Clone + Context, Da: Clone + DaSpec> Clone for ChainState<C, Da>where
C::Address: Clone,
impl<C: Clone + Context, Da: Clone + DaSpec> Clone for ChainState<C, Da>where C::Address: Clone,
source§fn clone(&self) -> ChainState<C, Da>
fn clone(&self) -> ChainState<C, Da>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<C: Context, Da: DaSpec> Module for ChainState<C, Da>
impl<C: Context, Da: DaSpec> Module for ChainState<C, Da>
§type Config = ChainStateConfig
type Config = ChainStateConfig
Configuration for the genesis method.
§type CallMessage = NonInstantiable
type CallMessage = NonInstantiable
Module defined argument to the call method.
source§fn genesis(
&self,
config: &Self::Config,
working_set: &mut WorkingSet<C::Storage>
) -> Result<(), Error>
fn genesis( &self, config: &Self::Config, working_set: &mut WorkingSet<C::Storage> ) -> Result<(), Error>
Genesis is called when a rollup is deployed and can be used to set initial state values in the module.
source§fn call(
&self,
_message: Self::CallMessage,
_context: &Self::Context,
_working_set: &mut WorkingSet<<Self::Context as Spec>::Storage>
) -> Result<CallResponse, Error>
fn call( &self, _message: Self::CallMessage, _context: &Self::Context, _working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> ) -> Result<CallResponse, Error>
Call allows interaction with the module and invokes state changes.
It takes a module defined type and a context as parameters.
source§impl<C: Context, Da: DaSpec> ModuleInfo for ChainState<C, Da>
impl<C: Context, Da: DaSpec> ModuleInfo for ChainState<C, Da>
source§impl<C: Context, Da: DaSpec> SlotHooks<Da> for ChainState<C, Da>
impl<C: Context, Da: DaSpec> SlotHooks<Da> for ChainState<C, Da>
type Context = C
fn begin_slot_hook( &self, slot_header: &Da::BlockHeader, validity_condition: &Da::ValidityCondition, working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> )
fn end_slot_hook( &self, _working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> )
fn finalize_slot_hook( &self, _root_hash: [u8; 32], _accesorry_working_set: &mut AccessoryWorkingSet<'_, <Self::Context as Spec>::Storage> )
Auto Trait Implementations§
impl<C, Da> RefUnwindSafe for ChainState<C, Da>where <C as Spec>::Address: RefUnwindSafe, <Da as DaSpec>::SlotHash: RefUnwindSafe, <Da as DaSpec>::ValidityCondition: RefUnwindSafe,
impl<C, Da> Send for ChainState<C, Da>
impl<C, Da> Sync for ChainState<C, Da>
impl<C, Da> Unpin for ChainState<C, Da>where <C as Spec>::Address: Unpin, <Da as DaSpec>::SlotHash: Unpin, <Da as DaSpec>::ValidityCondition: Unpin,
impl<C, Da> UnwindSafe for ChainState<C, Da>where <C as Spec>::Address: UnwindSafe, <Da as DaSpec>::SlotHash: UnwindSafe, <Da as DaSpec>::ValidityCondition: UnwindSafe,
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