Struct sov_modules_stf_template::AppTemplate
source · 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>,
impl<C, Vm, Da, RT> AppTemplate<C, Da, Vm, RT>where C: Context, Da: DaSpec, RT: Runtime<C, Da>,
sourcepub fn new(storage: C::Storage, runtime: RT) -> Self
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>,
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 InitialState = <RT as Genesis>::Config
type InitialState = <RT as Genesis>::Config
The initial state of the rollup.
§type TxReceiptContents = TxEffect
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>
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
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
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
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>,
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>
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> 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