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>

source

pub fn get_slot_height( &self, working_set: &mut WorkingSet<C::Storage> ) -> TransitionHeight

Returns transition height in the current slot

source

pub fn get_genesis_hash( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<[u8; 32]>

Return the genesis hash of the module.

source

pub fn get_genesis_height( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<TransitionHeight>

Returns the genesis height of the module.

source

pub fn get_in_progress_transition( &self, working_set: &mut WorkingSet<C::Storage> ) -> Option<TransitionInProgress<Da>>

Returns the transition in progress of the module.

source

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,

source§

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)

Performs copy-assignment from source. Read more
source§

impl<C: Context, Da: DaSpec> Default for ChainState<C, Da>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<C: Context, Da: DaSpec> Module for ChainState<C, Da>

§

type Context = C

Execution context.
§

type Config = ChainStateConfig

Configuration for the genesis method.
§

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>

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>

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>

§

type Context = C

source§

fn prefix(&self) -> Prefix

Returns the prefix of the module.
source§

fn address(&self) -> &<Self::Context as Spec>::Address

Returns address of the module.
source§

fn dependencies(&self) -> Vec<&<Self::Context as Spec>::Address>

Returns addresses of all the other modules this module is dependent on
source§

impl<C: Context, Da: DaSpec> SlotHooks<Da> for ChainState<C, Da>

§

type Context = C

source§

fn begin_slot_hook( &self, slot_header: &Da::BlockHeader, validity_condition: &Da::ValidityCondition, working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> )

source§

fn end_slot_hook( &self, _working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> )

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Genesis for Twhere T: Module,

§

type Context = <T as Module>::Context

§

type Config = <T as Module>::Config

Initial configuration for the module.
source§

fn genesis( &self, config: &<T as Genesis>::Config, working_set: &mut WorkingSet<<<T as Genesis>::Context as Spec>::Storage> ) -> Result<(), Error>

Initializes the state of the rollup.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more