Struct miden_tx::TransactionCompiler

source ·
pub struct TransactionCompiler { /* private fields */ }
Expand description

The transaction compiler is responsible for building executable programs for Miden rollup transactions.

The generated programs can then be executed on the Miden VM to update the states of accounts involved in these transactions.

In addition to transaction compilation, transaction compiler provides methods which can be used to compile Miden account code and note scripts.

Implementations§

source§

impl TransactionCompiler

source

pub fn new() -> TransactionCompiler

Returns a new TransactionCompiler.

source

pub fn with_debug_mode(self, in_debug_mode: bool) -> Self

Puts the TransactionCompiler into debug mode.

When transaction compiler is in debug mode, all transaction-related code (note scripts, account code) will be compiled in debug mode which will preserve debug artifacts from the original source code.

source

pub fn load_account( &mut self, account_id: AccountId, account_code: ModuleAst, ) -> Result<AccountCode, TransactionCompilerError>

Compiles the provided module into AccountCode and associates the resulting procedures with the specified account ID.

source

pub fn load_account_interface( &mut self, account_id: AccountId, procedures: Vec<Digest>, ) -> Option<Vec<Digest>>

Loads the provided account interface (vector of procedure digests) into this compiler. Returns the old account interface if it previously existed.

source

pub fn compile_note_script( &self, note_script_ast: ProgramAst, target_account_proc: Vec<ScriptTarget>, ) -> Result<NoteScript, TransactionCompilerError>

Compiles the provided program into the NoteScript and checks (to the extent possible) if a note could be executed against all accounts with the specified interfaces.

source

pub fn compile_tx_script<T>( &self, tx_script_ast: ProgramAst, tx_script_inputs: T, target_account_proc: Vec<ScriptTarget>, ) -> Result<TransactionScript, TransactionCompilerError>
where T: IntoIterator<Item = (Word, Vec<Felt>)>,

Constructs a TransactionScript by compiling the provided source code and checking the compatibility of the resulting program with the target account interfaces.

source

pub fn compile_transaction( &self, account_id: AccountId, notes: &InputNotes<InputNote>, tx_script: Option<&ProgramAst>, ) -> Result<Program, TransactionCompilerError>

Compiles a transaction which executes the provided notes and an optional tx script against the specified account. Returns the compiled transaction program.

The account is assumed to have been previously loaded into this compiler.

Trait Implementations§

source§

impl Default for TransactionCompiler

source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

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