Struct sov_modules_stf_template::AppTemplate
source · pub struct AppTemplate<C: Context, RT, Vm> {
pub current_storage: C::Storage,
pub runtime: RT,
/* private fields */
}Fields§
§current_storage: C::Storage§runtime: RTImplementations§
source§impl<C: Context, RT, Vm> AppTemplate<C, RT, Vm>where
RT: DispatchCall<Context = C> + Genesis<Context = C> + TxHooks<Context = C> + ApplyBlobHooks<Context = C, BlobResult = SequencerOutcome>,
impl<C: Context, RT, Vm> AppTemplate<C, RT, Vm>where RT: DispatchCall<Context = C> + Genesis<Context = C> + TxHooks<Context = C> + ApplyBlobHooks<Context = C, BlobResult = SequencerOutcome>,
pub fn new(storage: C::Storage, runtime: RT) -> Self
pub fn apply_batch( &mut self, sequencer: &[u8], batch: impl Buf ) -> BatchReceipt<SequencerOutcome, TxEffect>
Trait Implementations§
source§impl<C: Context, RT, Vm: Zkvm> StateTransitionFunction<Vm> for AppTemplate<C, RT, Vm>where
RT: DispatchCall<Context = C> + Genesis<Context = C> + TxHooks<Context = C> + ApplyBlobHooks<Context = C, BlobResult = SequencerOutcome>,
impl<C: Context, RT, Vm: Zkvm> StateTransitionFunction<Vm> for AppTemplate<C, RT, Vm>where RT: DispatchCall<Context = C> + Genesis<Context = C> + TxHooks<Context = C> + ApplyBlobHooks<Context = C, BlobResult = SequencerOutcome>,
§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
type BatchReceiptContents = SequencerOutcome
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 MisbehaviorProof = ()
type MisbehaviorProof = ()
A proof that the sequencer has misbehaved. For example, this could be a merkle proof of a transaction
with an invalid signature
source§fn init_chain(&mut self, params: Self::InitialState)
fn init_chain(&mut self, params: Self::InitialState)
Perform one-time initialization for the genesis block.
source§fn begin_slot(&mut self, witness: Self::Witness)
fn begin_slot(&mut self, witness: Self::Witness)
Called at the beginning of 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.
source§fn apply_blob(
&mut self,
blob: impl BlobTransactionTrait,
_misbehavior_hint: Option<Self::MisbehaviorProof>
) -> BatchReceipt<Self::BatchReceiptContents, Self::TxReceiptContents>
fn apply_blob( &mut self, blob: impl BlobTransactionTrait, _misbehavior_hint: Option<Self::MisbehaviorProof> ) -> BatchReceipt<Self::BatchReceiptContents, Self::TxReceiptContents>
Apply a blob/batch of transactions to the rollup, slashing the sequencer who proposed the blob on failure.
The concrete blob type is defined by the DA layer implementation, which is why we use a generic here instead
of an associated type.
Misbehavior hint allows prover optimizations - the sequencer can be slashed
for including a transaction which fails stateless checks (i.e. has an invalid signature) -
and in that case we ignore his entire batch.
This method lets you give a hint to the prover telling
it where that invalid signature is, so that it can skip signature checks on other transactions.
(If the misbehavior hint is wrong, then the host is malicious so we can
just panic - which means that no proof will be created).
Auto Trait Implementations§
impl<C, RT, Vm> RefUnwindSafe for AppTemplate<C, RT, Vm>where RT: RefUnwindSafe, Vm: RefUnwindSafe, <C as Spec>::Storage: RefUnwindSafe, <<C as Spec>::Storage as Storage>::Witness: RefUnwindSafe,
impl<C, RT, Vm> Send for AppTemplate<C, RT, Vm>where RT: Send, Vm: Send, <C as Spec>::Storage: Send, <<C as Spec>::Storage as Storage>::Witness: Send,
impl<C, RT, Vm> Sync for AppTemplate<C, RT, Vm>where RT: Sync, Vm: Sync, <C as Spec>::Storage: Sync, <<C as Spec>::Storage as Storage>::Witness: Sync,
impl<C, RT, Vm> Unpin for AppTemplate<C, RT, Vm>where RT: Unpin, Vm: Unpin, <C as Spec>::Storage: Unpin, <<C as Spec>::Storage as Storage>::Witness: Unpin,
impl<C, RT, Vm> UnwindSafe for AppTemplate<C, RT, Vm>where 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