Skip to content

feat: migrate transaction scripts to Library#3173

Open
TomasArrachea wants to merge 2 commits into
nextfrom
tomasarrachea-tx-script-attribute
Open

feat: migrate transaction scripts to Library#3173
TomasArrachea wants to merge 2 commits into
nextfrom
tomasarrachea-tx-script-attribute

Conversation

@TomasArrachea

@TomasArrachea TomasArrachea commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #3093

This PR migrates transaction scripts to the library form and adds a @transaction_script attribute to mark the entrypoint procedure.

@TomasArrachea TomasArrachea force-pushed the tomasarrachea-tx-script-attribute branch from a63c913 to af44cea Compare June 30, 2026 21:39
@TomasArrachea TomasArrachea marked this pull request as ready for review June 30, 2026 21:43

@bobbinth bobbinth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left a few small comments inline.

I would probably merge this PR after #3107 and #3146 are merged.

Comment on lines +343 to 347
// TODO: we can remove this `Program` based constructor once the compiler integrates the
// `@transaction_script` attribute (https://github.com/0xMiden/compiler/issues/1190).
pub fn new(code: Program) -> Self {
Self::from_parts(code.mast_forest().clone(), code.entrypoint())
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this in a follow up right after this PR. And we should do the same for note scripts.

cc @greenhat for visibility.

Comment on lines +25 to +26
@transaction_script
pub proc main

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but we should move this out into a package (similar to how we do with notes).

Comment on lines +105 to +106
let script =
format!("@transaction_script\npub proc main\n{expiration_prelude}\n{body}\nend");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of using @transaction_script here as a string literal, should we use the constant defined in the protocol library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert transaction scripts to libraries with a @transaction_script entrypoint attribute

2 participants