Skip to content

Conversation

@PoulavBhowmick03
Copy link
Contributor

Fixes #2168

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the codebase to import constants directly instead of accessing them through procedure calls, improving code clarity and reducing indirection. The changes primarily affect assembly files in the miden-protocol crate.

  • Converts private constants to public constants with direct access
  • Removes wrapper procedures that returned constant values
  • Updates all call sites to use push.CONSTANT_NAME instead of exec.constants::get_constant_name()

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/miden-protocol/asm/kernels/transaction/lib/constants.masm Converted constants from private to public, removed all wrapper procedures, added EMPTY_SMT_ROOT as a constant array
crates/miden-protocol/asm/kernels/transaction/lib/prologue.masm Updated imports to directly import specific constants, replaced procedure calls with direct constant access
crates/miden-protocol/asm/kernels/transaction/lib/output_note.masm Updated imports and replaced procedure call with direct constant access
crates/miden-protocol/asm/kernels/transaction/lib/note.masm Updated imports and replaced procedure call with direct constant access
crates/miden-protocol/asm/kernels/transaction/lib/memory.masm Updated imports, replaced procedure calls with direct constant access, removed duplicate ACCOUNT_PROCEDURE_DATA_LENGTH definition
crates/miden-protocol/asm/kernels/transaction/lib/epilogue.masm Updated imports and replaced procedure calls with direct constant access
crates/miden-protocol/asm/kernels/transaction/lib/account_delta.masm Updated imports and replaced procedure call with direct constant access
crates/miden-protocol/asm/kernels/transaction/lib/account.masm Updated imports, replaced procedure calls with direct constant access, removed duplicate ACCOUNT_PROCEDURE_DATA_LENGTH definition
crates/miden-protocol/asm/protocol/note.masm Replaced hardcoded value with constant reference, changed re-export from procedure to constant
crates/miden-protocol/asm/shared_utils/util/note.masm Converted constant to public and removed wrapper procedure
crates/miden-testing/src/kernel_tests/tx/test_output_note.rs Updated test to import and use constant directly instead of calling procedure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#! - max_inputs_per_note is the max inputs per note.
pub use ::miden::protocol::util::note::get_max_inputs_per_note
# Re-export the max inputs per note constant.
pub use ::miden::protocol::util::note::MAX_INPUTS_PER_NOTE
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: do we still need to re-export this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion here - maybe @PhilippGackstatter can suggest?

If we do end up keeping it, I'd move this re-export to the top of the file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This sparked #2231

@mmagician mmagician added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jan 5, 2026
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

#! - max_inputs_per_note is the max inputs per note.
pub use ::miden::protocol::util::note::get_max_inputs_per_note
# Re-export the max inputs per note constant.
pub use ::miden::protocol::util::note::MAX_INPUTS_PER_NOTE
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion here - maybe @PhilippGackstatter can suggest?

If we do end up keeping it, I'd move this re-export to the top of the file.

@mmagician mmagician merged commit e062f75 into 0xMiden:next Jan 6, 2026
21 of 23 checks passed
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Jan 15, 2026
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import constants directly instead of through procedures

3 participants