-
Notifications
You must be signed in to change notification settings - Fork 107
feat: instead of procs, import constants directly #2221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: instead of procs, import constants directly #2221
Conversation
There was a problem hiding this 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_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.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sparked #2231
bobbinth
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
Fixes #2168