pub struct AppTemplate<C: Context, Da: DaSpec, Vm, RT: Runtime<C, Da>> {
    pub current_storage: C::Storage,
    pub runtime: RT,
    /* private fields */
}
Expand description

An implementation of the StateTransitionFunction that is specifically designed to work with the module-system.

Fields§

§current_storage: C::Storage

State storage used by the rollup.

§runtime: RT

The runtime includes all the modules that the rollup supports.

Implementations§

source§

impl<C, Vm, Da, RT> AppTemplate<C, Da, Vm, RT>where C: Context, Da: DaSpec, RT: Runtime<C, Da>,

source

pub fn new(storage: C::Storage, runtime: RT) -> Self

AppTemplate constructor.

Trait Implementations§

source§

impl<C, RT, Vm, Da> StateTransitionFunction<Vm, Da> for AppTemplate<C, Da, Vm, RT>where C: Context, Da: DaSpec, Vm: Zkvm, RT: Runtime<C, Da>,

§

type StateRoot = RootHash

Root hash of state merkle tree
§

type InitialState = <RT as Genesis>::Config

The initial state of the rollup.
§

type TxReceiptContents = TxEffect

The contents of a transaction receipt. This is the data that is persisted in the database
§

type BatchReceiptContents = SequencerOutcome<<<Da as DaSpec>::BlobTransaction as BlobReaderTrait>::Address>

The contents of a batch receipt. This is the data that is persisted in the database
§

type Witness = <<C as Spec>::Storage as Storage>::Witness

Witness is a data that is produced during actual batch execution or validated together with proof during verification
§

type Condition = <Da as DaSpec>::ValidityCondition

The validity condition that must be verified outside of the Vm
source§

fn init_chain(&mut self, params: Self::InitialState) -> RootHash

Perform one-time initialization for the genesis block and returns the resulting root hash wrapped in a result. If the init chain fails we panic.
source§

fn apply_slot<'a, I>( &mut self, witness: Self::Witness, slot_header: &Da::BlockHeader, validity_condition: &Da::ValidityCondition, blobs: I ) -> SlotResult<Self::StateRoot, Self::BatchReceiptContents, Self::TxReceiptContents, Self::Witness>where I: IntoIterator<Item = &'a mut Da::BlobTransaction>,

Called at each DA-layer block - whether or not that block contains any data relevant to the rollup. If slot is started in Full Node mode, default witness should be provided. If slot is started in Zero Knowledge mode, witness from execution should be provided. Read more
source§

fn get_current_state_root(&self) -> Result<Self::StateRoot>

Gets the state root from the associated state. If not available (because the chain has not been initialized yet), return None.

Auto Trait Implementations§

§

impl<C, Da, Vm, RT> RefUnwindSafe for AppTemplate<C, Da, Vm, RT>where Da: RefUnwindSafe, RT: RefUnwindSafe, Vm: RefUnwindSafe, <C as Spec>::Storage: RefUnwindSafe, <<C as Spec>::Storage as Storage>::Witness: RefUnwindSafe,

§

impl<C, Da, Vm, RT> Send for AppTemplate<C, Da, Vm, RT>where Da: Send, RT: Send, Vm: Send, <<C as Spec>::Storage as Storage>::Witness: Send,

§

impl<C, Da, Vm, RT> Sync for AppTemplate<C, Da, Vm, RT>where Da: Sync, RT: Sync, Vm: Sync, <<C as Spec>::Storage as Storage>::Witness: Sync,

§

impl<C, Da, Vm, RT> Unpin for AppTemplate<C, Da, Vm, RT>where Da: Unpin, RT: Unpin, Vm: Unpin, <C as Spec>::Storage: Unpin, <<C as Spec>::Storage as Storage>::Witness: Unpin,

§

impl<C, Da, Vm, RT> UnwindSafe for AppTemplate<C, Da, Vm, RT>where Da: UnwindSafe, RT: UnwindSafe, Vm: UnwindSafe, <C as Spec>::Storage: UnwindSafe, <<C as Spec>::Storage as Storage>::Witness: 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> 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, 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