feat: instead of procs, import constants directly#2221
feat: instead of procs, import constants directly#2221mmagician merged 1 commit into0xMiden:nextfrom
Conversation
There was a problem hiding this comment.
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_NAMEinstead ofexec.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 |
There was a problem hiding this comment.
nit: do we still need to re-export this?
There was a problem hiding this comment.
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.
| #! - 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 |
There was a problem hiding this comment.
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.
Fixes #2168