Skip to content

Enable ScriptBuilder to assemble account component libraries #1756

@PhilippGackstatter

Description

@PhilippGackstatter

Based on the discussion in #1734, we should:

  • Add a newtype wrapper: pub struct AccountComponentCode(Library). We'd also want this to be convertible from and to Library.
  • Change AccountComponent to contain AccountComponentCode instead of Library. This is so we can return that type from its getters instead of Library. Otherwise, that type would internally be used as a Library.
  • Add ScriptBuilder::compile_component_code, which may look like this:
pub fn compile_component_code(
    self,
    component_path: impl AsRef<str>, // <- e.g. `my_account::my_module`
    component_code: impl AsRef<str>, // <- the MASM code
) -> Result<AccountComponentCode, ScriptBuilderError> { ... }
  • Replace usages of TransactionKernel::assembler (and its variants) with ScriptBuilder. The goal is to be able to remove all variants of TransactionKernel::assembler after this.
  • Rename ScriptBuilder (and ScriptBuilderError) accordingly. Potential names:
    • TransactionAssembler
    • ProtocolAssembler
    • CodeBuilder
  • Potentially rename compile_* methods into parse_*, to be in line with the Compile trait rename to Parse from Miden VM - though some discussion may be needed.

Original discussion: #1734 (comment)

Metadata

Metadata

Assignees

Labels

rustIssues that affect or pull requests that update Rust code

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions