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

Fields§

§current_storage: C::Storage§runtime: RT

Implementations§

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>,

source

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

source

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>,

§

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

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 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)

Perform one-time initialization for the genesis block.
source§

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>

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).
source§

fn end_slot(&mut self) -> (Self::StateRoot, Self::Witness)

Called once at the end of each DA layer block (i.e. after all rollup blobs have been processed) Commits state changes to the database

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> 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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