Skip to content

feat: rename note inputs to note storage#2008

Closed
varun-doshi wants to merge 12 commits into0xMiden:nextfrom
varun-doshi:varun/rename-inputs
Closed

feat: rename note inputs to note storage#2008
varun-doshi wants to merge 12 commits into0xMiden:nextfrom
varun-doshi:varun/rename-inputs

Conversation

@varun-doshi
Copy link
Contributor

Fixes #1662

@mmagician mmagician requested a review from Copilot October 22, 2025 07:40
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 renames the NoteInputs type to NoteStorage throughout the codebase to better reflect that these values represent storage associated with a note rather than inputs. The renaming includes updating all references in code, comments, documentation, error messages, and assembly files.

Key Changes

  • Renamed NoteInputs struct to NoteStorage across all Rust code
  • Updated related constants from MAX_INPUTS_PER_NOTE to MAX_STORAGE_VALUE_PER_NOTE
  • Renamed error variants to reflect the new terminology
  • Updated all assembly code comments and error messages to use "note storage" terminology

Reviewed Changes

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

Show a summary per file
File Description
crates/miden-tx/src/host/note_builder.rs Updated type imports and error variants from NoteInputs to NoteStorage
crates/miden-tx/src/errors/mod.rs Renamed error variants and messages to use "note storage" terminology
crates/miden-objects/src/note/storage.rs New file containing the renamed NoteStorage struct (previously inputs.rs)
crates/miden-objects/src/note/inputs.rs Deleted file, replaced by storage.rs
crates/miden-objects/src/note/mod.rs Updated module imports and documentation
crates/miden-objects/src/note/recipient.rs Updated type references and comments
crates/miden-objects/src/note/details.rs Updated type references and documentation
crates/miden-objects/src/note/partial.rs Updated documentation comments
crates/miden-objects/src/errors.rs Renamed error variant from TooManyInputs to TooManyStorageValues
crates/miden-objects/src/constants.rs Renamed constant from MAX_INPUTS_PER_NOTE to MAX_STORAGE_VALUE_PER_NOTE
crates/miden-objects/src/transaction/tx_args.rs Updated comment to use "note storage" terminology
crates/miden-testing/* Updated test files to use NoteStorage type
crates/miden-lib/src/testing/note.rs Renamed method from note_inputs to note_storage_values
crates/miden-lib/src/note/utils.rs Updated variable names from note_inputs to note_storage
crates/miden-lib/src/errors/*.rs Updated error messages and constants
crates/miden-lib/asm/* Updated assembly code comments and constants
CHANGELOG.md Added entry documenting the breaking change

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +212 to +213
/// Error Message: "note storage length exceeded the maximum limit of 128"
pub const ERR_PROLOGUE_NOTE_STORAGE_LEN_EXCEEDED_LIMIT: MasmError = MasmError::from_static_str("note storage length exceeded the maximum limit of 128");
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

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

Two constants ERR_PROLOGUE_NOTE_STORAGE_LENGTH_EXCEEDED_LIMIT and ERR_PROLOGUE_NOTE_STORAGE_LEN_EXCEEDED_LIMIT have identical error messages and appear to be duplicates. Consider removing one to avoid confusion and maintain cleaner code.

Suggested change
/// Error Message: "note storage length exceeded the maximum limit of 128"
pub const ERR_PROLOGUE_NOTE_STORAGE_LEN_EXCEEDED_LIMIT: MasmError = MasmError::from_static_str("note storage length exceeded the maximum limit of 128");

Copilot uses AI. Check for mistakes.
@mmagician mmagician requested a review from Copilot October 24, 2025 19:00
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

Copilot reviewed 37 out of 37 changed files in this pull request and generated 5 comments.


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

@mmagician mmagician requested a review from Copilot October 26, 2025 08:06

This comment was marked as resolved.

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Thank you for working on this!

This is a good start, but in general, we should update all variable and field names of structs and functions to be "storage" instead of "inputs".
Try searching for these strings in the codebase and update if necessary:

  • note's inputs
  • note inputs
  • INPUTS_COMMITMENT
  • inputs: (to find places where we previously had inputs: NoteInputs)

# =================================================================================================

const.ERR_P2ID_WRONG_NUMBER_OF_INPUTS="P2ID note expects exactly 2 note inputs"
const.ERR_P2ID_WRONG_NUMBER_OF_STORAGE_VALUES="P2ID note expects exactly 2 note storage values"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const.ERR_P2ID_WRONG_NUMBER_OF_STORAGE_VALUES="P2ID note expects exactly 2 note storage values"
const.ERR_P2ID_UNEXPECTED_STORAGE_LENGTH="P2ID note expects storage of length 2"

Nit: For the standards notes, P2ID, P2IDE, SWAP, I would rephrase this error to ERR_{NOTE_NAME}_UNEXPECTED_STORAGE_LENGTH="{NOTE_NAME} note expects storage of length X", e.g. for P2ID, the above suggestion.

#! Outputs: []
#!
#! Note inputs are assumed to be as follows:
#! Note storage values are assumed to be as follows:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#! Note storage values are assumed to be as follows:
#! Note storage must be laid out as follows:

This also applies to the other notes.

push.0 exec.active_note::get_inputs
# => [num_inputs, inputs_ptr]

# make sure the number of inputs is 4
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# make sure the number of inputs is 4
# check the length of note storage

# =================================================================================================

const.SWAP_NOTE_INPUTS_NUMBER=12
const.SWAP_NOTE_STORAGE_NUMBER=12
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const.SWAP_NOTE_STORAGE_NUMBER=12
const.SWAP_NOTE_STORAGE_LENGTH=12

Comment on lines 69 to 72
/// Set the note's input to `inputs`.
///
/// Note: This overwrite the inputs, the previous input values are discarded.
pub fn note_inputs(
pub fn note_storage_values(
Copy link
Contributor

Choose a reason for hiding this comment

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

The docs need a "note inputs" -> "note storage" update.

Also, I would just call this note_storage because "values" is quite generic, so it doesn't make things much clearer.

/// account of a P2ID or conditions of a SWAP, and the effects of the note. The serial number has
/// a double duty of preventing double spend, and providing unlikability to the consumer of a note.
/// The note's inputs allow for customization of its script.
/// The note's storage values allow for customization of its script.
Copy link
Contributor

Choose a reason for hiding this comment

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

In this file, there are ~5 occurences of "inputs" left which still need to be replaced with "note storage" or "storage".

In general, try searching for "inputs" in the directory ./crates/miden-objects/src/note and you'll find more occurences that need to be updated.

Comment on lines 133 to 134
/// Returns the note's recipient inputs which customizes the script's behavior.
pub fn inputs(&self) -> &NoteInputs {
pub fn inputs(&self) -> &NoteStorage {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Returns the note's recipient inputs which customizes the script's behavior.
pub fn inputs(&self) -> &NoteInputs {
pub fn inputs(&self) -> &NoteStorage {
/// Returns the note recipient's [`NoteStorage`].
pub fn storage(&self) -> &NoteStorage {

serial_num: Word,
script: NoteScript,
inputs: NoteInputs,
inputs: NoteStorage,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
inputs: NoteStorage,
storage: NoteStorage,


impl NoteRecipient {
pub fn new(serial_num: Word, script: NoteScript, inputs: NoteInputs) -> Self {
pub fn new(serial_num: Word, script: NoteScript, inputs: NoteStorage) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn new(serial_num: Word, script: NoteScript, inputs: NoteStorage) -> Self {
pub fn new(serial_num: Word, script: NoteScript, storage: NoteStorage) -> Self {

All of the variable names should also be updated (applies to the entire PR),

}

/// Returns a reference to the storage values.
pub fn values(&self) -> &[Felt] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn values(&self) -> &[Felt] {
pub fn items(&self) -> &[Felt] {

As mentioned in another comment, I'd call the individual elements "items".

@PhilippGackstatter
Copy link
Contributor

@varun-doshi Could you merge latest next and address the open review comments?

@varun-doshi
Copy link
Contributor Author

@varun-doshi Could you merge latest next and address the open review comments?

On it

@varun-doshi varun-doshi force-pushed the varun/rename-inputs branch 2 times, most recently from 52bf1de to 2be75cb Compare November 4, 2025 20:19
@varun-doshi
Copy link
Contributor Author

Some note input note's input are left out because I'm not sure if we want those to be changed

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

There are still many occurrences of inputs left that need to be renamed. Searching for num_inputs should show you a lot of places that need an update, not only replacing num_inputs itself, but also any other inputs that refer to note inputs surrounding it.

Comment on lines 93 to 100
#! Advice Map: { NOTE_STORAGE_COMMITMENT: [INPUTS] }
#! Outputs:
#! Stack: [num_inputs, dest_ptr]
#!
#! Where:
#! - dest_ptr is the memory address to write the note inputs.
#! - NOTE_INPUTS_COMMITMENT is the sequential hash of the padded note's inputs.
#! - INPUTS is the data corresponding to the note's inputs.
#! - dest_ptr is the memory address to write the note storage.
#! - NOTE_STORAGE_COMMITMENT is the sequential hash of the padded note's storage items.
#! - INPUTS is the data corresponding to the note's storage items.
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we need to rename INPUTS to STORAGE_ITEMS, e.g.:

#!   Advice Map: { NOTE_STORAGE_COMMITMENT: [STORAGE_ITEMS] }

And also in the Where section.

swapdw dropw dropw
movup.5 drop movup.5 drop movup.5 drop
# => [NOTE_INPUTS_COMMITMENT, num_inputs, dest_ptr]
# => [NOTE_STORAGE_COMMITMENT, num_inputs, dest_ptr]
Copy link
Contributor

Choose a reason for hiding this comment

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

Below this line we should also rename inputs to storage, e.g. the comments and exec.write_storage_to_memory. That write_inputs_to_memory procedure also needs a rename of many "inputs" occurrences.

#! Advice Map: { NOTE_INPUTS_COMMITMENT: [INPUTS] }
#! Advice Map: { NOTE_STORAGE_COMMITMENT: [INPUTS] }
#! Outputs:
#! Stack: [num_inputs, dest_ptr]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#! Stack: [num_inputs, dest_ptr]
#! Stack: [storage_len, dest_ptr]

Search for num_inputs and replace with storage_len or something appropriate. There will be a lot of occurences, and it requires renaming some procedures as well, e.g. input_note_get_inputs_info -> input_note_get_storage_info or exec.input_note::get_inputs_info -> exec.input_note::get_storage_info.

# =================================================================================================

const.MINT_NOTE_INPUTS_NUMBER=9
const.MINT_NOTE_STORAGE_NUMBER=9
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const.MINT_NOTE_STORAGE_NUMBER=9
const.MINT_NOTE_STORAGE_LENGTH=9

Generally, I'd replace "num inputs" with "storage length" instead of "storage number".

@@ -33,11 +33,11 @@ const.ERR_PROLOGUE_NOTE_INPUTS_LEN_EXCEEDED_LIMIT="number of note inputs exceede
#! Invocation: exec
export.compute_inputs_commitment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export.compute_inputs_commitment
export.compute_storage_commitment

@varun-doshi
Copy link
Contributor Author

Few remaining num_inputs are in the context of advice map. If i'm not mistaken, that should not be changed right?

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Thanks! I think we're getting closer 🙂

The advice_num_inputs and rounded_up_num_inputs also represent number of inputs and so we should also rename these to storage length.

Also, search for INPUTS_COMMITMENT, there are still a few that need to be renamed.

#! - note_index is the index of the input note whose data should be returned.
#! - NOTE_INPUTS_COMMITMENT is the inputs commitment of the specified input note.
#! - num_inputs is the number of input values of the specified input note.
#! - NOTE_STORAGE_COMMITMENT is the inputs commitment of the specified input note.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#! - NOTE_STORAGE_COMMITMENT is the inputs commitment of the specified input note.
#! - NOTE_STORAGE_COMMITMENT is the storage commitment of the specified input note.

#! Operand stack: [RECIPIENT]
#! Advice map: {
#! INPUTS_COMMITMENT: [INPUTS],
#! INPUTS_COMMITMENT: [STORAGE],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#! INPUTS_COMMITMENT: [STORAGE],
#! STORAGE_COMMITMENT: [STORAGE],

#!
#! Invocation: exec
export.get_inputs_info
export.get_storage_info
Copy link
Contributor

Choose a reason for hiding this comment

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

Following this rename, we should also rename input_note_get_inputs_info_offset -> input_note_get_storage_info_offset and the constants as well in crates/miden-lib/asm/miden/kernel_proc_offsets.masm.

@@ -652,18 +652,18 @@ end
#! Where:
#! - note_ptr is the memory location for the input note.
#! - inputs_len is the note's input count.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#! - inputs_len is the note's input count.
#! - storage_len is the length of the note's storage.

And update this also a couple of lines above.

///
/// # Errors
/// Returns an error if the number of provided storage is greater than 128.
pub fn new(values: Vec<Felt>) -> Result<Self, NoteError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this file, I'd also rename value to item so it matches the items field.

/// Returns the number of storage items.
///
/// The returned value is guaranteed to be smaller than or equal to 128.
pub fn num_values(&self) -> u8 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn num_values(&self) -> u8 {
pub fn num_items(&self) -> u8 {

// ================================================================================================

impl From<NoteStorage> for Vec<Felt> {
fn from(value: NoteStorage) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn from(value: NoteStorage) -> Self {
fn from(storage: NoteStorage) -> Self {

Nit

Comment on lines 578 to 579
#[error("note contains {0} storage items which exceeds the maximum of {max}", max = MAX_STORAGE_VALUE_PER_NOTE)]
TooManyStorageValues(usize),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[error("note contains {0} storage items which exceeds the maximum of {max}", max = MAX_STORAGE_VALUE_PER_NOTE)]
TooManyStorageValues(usize),
#[error("note contains {0} storage items which exceeds the maximum of {max}", max = MAX_NOTE_STORAGE_LENGTH)]
TooManyStorageItems(usize),

/// the `get_storage` procedure, see the [issue #1363](https://github.com/0xMiden/miden-base/issues/1363)
/// for more details.
#[tokio::test]
async fn test_active_note_get_exactly_8_inputs() -> anyhow::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async fn test_active_note_get_exactly_8_inputs() -> anyhow::Result<()> {
async fn test_active_note_get_exactly_8_storage_items() -> anyhow::Result<()> {

/// obtained from the `input_note::get_inputs_info` procedure is correct.
/// obtained from the `input_note::get_storage_info` procedure is correct.
#[tokio::test]
async fn test_get_inputs_info() -> anyhow::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async fn test_get_inputs_info() -> anyhow::Result<()> {
async fn test_get_storage_info() -> anyhow::Result<()> {

@varun-doshi
Copy link
Contributor Author

varun-doshi commented Nov 12, 2025

The following are cleared (among others):

  • num_inputs
  • inputs_commitment
  • inputs_ptr
  • input_ptr
  • note input
  • note_inputs
  • note's inputs
  • num_values
  • advice_num_inputs

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Thank you! Looks great now. I merged in next, in particular to resolve the conflicts introduced by merging #2071.

I left a few more comments, but after these I'd personally just merge this PR and do smaller cleanups in follow-ups, since this PR has gotten pretty large.

Since starting this PR, we've merged some PRs that moved around a few things and so now we have quite a few occurrences of num_inputs again in the codebase, but I would address those in a follow-up.

Small follow-ups I would consider for separate PRs:

  • active_note::get_storage is a bit clearer when renamed to active_note::get_storage_items
  • Updated the changed kernel procedure in docs/src/protocol_library.md.
  • Maybe rename "storage length" into "storage size" or "number of storage items" alternatively. Depends on what others think as well.
    • Example: MINT_NOTE_STORAGE_SIZE reads pretty good while MINT_NOTE_NUM_STORAGE_ITEMS is a bit verbose, but still fine. It would be a bit more consistent with "num storage slots" as an analog to account storage. I'd slightly prefer "size" still.

It would be nice if you could avoid force-pushing once reviews have started, since it sometimes means there are more files to re-review on every iteration than necessary. Thank you 🙏!

#! Where:
#! - note_index is the index of the output note whose recipient should be returned.
#! - RECIPIENT is the commitment to the output note's script, inputs, the serial number.
#! - RECIPIENT is the commitment to the input note's script, storage, the serial number.
Copy link
Contributor

Choose a reason for hiding this comment

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

The change from output to input needs to be reversed I think.

@@ -1594,14 +1594,14 @@ end
#! Returns the inputs commitment of an input note located at the specified memory address.
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be something like "Returns the note storage commitment..."

#! STORAGE_COMMITMENT,
#! ASSETS_COMMITMENT,
#! ARGS,
#! NOTE_METADATA,
Copy link
Contributor

Choose a reason for hiding this comment

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

The advice stack comment here looks outdated. We should have

...
NOTE_METADATA,
storage_len,
assets_count,
...

according to:

https://github.com/0xMiden/miden-base/blob/8592b0367c6ddb57a65b0773e348c3ea35c7bf0a/crates/miden-lib/src/transaction/inputs.rs#L356-358

# OS => [NOTE_INPUTS_COMMITMENT, num_inputs, dest_ptr]
# AS => [advice_num_inputs, [INPUT_VALUES]]
# OS => [NOTE_STORAGE_COMMITMENT, storage_len, dest_ptr]
# AS => [advice_storage_len, [INPUT_VALUES]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# AS => [advice_storage_len, [INPUT_VALUES]]
# AS => [advice_storage_len, [STORAGE_ITEMS]]

proc.write_inputs_to_memory
#! Operand stack: [storage_len, dest_ptr]
proc.write_storage_to_memory
# load the inputs from the advice map to the advice stack
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# load the inputs from the advice map to the advice stack
# load the storage items from the advice map to the advice stack

Comment on lines 339 to 340
/// Returns the receiver account ID parsed from the provided P2ID check that note storage has
/// correct length..
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Returns the receiver account ID parsed from the provided P2ID check that note storage has
/// correct length..
/// Returns the receiver account ID parsed from the provided P2ID note storage.

I think this is sufficient.

fn parse_p2ide_inputs(note_inputs: &[Felt]) -> Result<(AccountId, u32, u32), StaticAnalysisError> {
if note_inputs.len() != WellKnownNote::P2IDE.num_expected_inputs() {
/// - the note storage length is not equal to the expected inputs number of the P2IDE note.
/// - first two elements of the note storage array does not form the valid account ID.
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter Nov 23, 2025

Choose a reason for hiding this comment

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

Suggested change
/// - first two elements of the note storage array does not form the valid account ID.
/// - first two elements of the note storage are not a valid account ID.

Nit: I'd avoid "array" here. (Also applies to the other function above)

Also the function names still refer to "inputs" instead of "storage".

/// Returns None if the note input values used to construct the account ID are invalid.
fn try_read_account_id_from_inputs(note_inputs: &[Felt]) -> Result<AccountId, StaticAnalysisError> {
if note_inputs.len() < 2 {
/// Returns None if the note storage items used to construct the account ID are invalid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Returns None if the note storage items used to construct the account ID are invalid.
/// Returns an error if the note storage items used to construct the account ID are invalid.

Nit: This was outdated.

// `INPUTS_COMMITMENT -> INPUTS || PADDING`.
// Notice that note storage items are not loaded to the memory, only their length. In order to obtain
// the storage items the advice map should be used: they are stored there as
// `STORAGE_COMMITMENT -> STORAGE || PADDING`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// `STORAGE_COMMITMENT -> STORAGE || PADDING`.
// `STORAGE_COMMITMENT -> STORAGE_ITEMS || PADDING`.

Nit

Comment on lines 160 to 161
/// - SERIAL_HASH: [SERIAL_NUM, EMPTY_WORD]
/// - inputs_commitment |-> inputs.
/// - storage_commitment |-> inputs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  • Not from this PR, but we should fix the inconsistency of using lower case for keys, they should be uppercase.
  • inputs should be replaced

So overall:

/// - SCRIPT_ROOT |-> script_data.
/// - STORAGE_COMMITMENT |-> storage_items.

@varun-doshi
Copy link
Contributor Author

Small follow-ups I would consider for separate PRs:

Understood; I will make a follow PR after this to get these fixed.

It would be nice if you could avoid force-pushing once reviews have started, since it sometimes means there are more files to re-review on every iteration than necessary.

Ahh got it. I will keep this in mind

Copy link
Contributor

@PhilippGackstatter PhilippGackstatter 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 to me!

I think we got most inputs renamed to storage, and any leftovers can be done in follow-ups (see previous comment).

Will also tag @mmagician for a review.

@PhilippGackstatter
Copy link
Contributor

@varun-doshi Could you merge latest next into this PR and update any "note inputs" to "note storage" while we're finishing the review of the PR? Thank you very much 🙏

@varun-doshi
Copy link
Contributor Author

@varun-doshi Could you merge latest next into this PR and update any "note inputs" to "note storage" while we're finishing the review of the PR? Thank you very much 🙏

Done!

Copy link
Contributor

@Fumuran Fumuran 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!

I agree with @PhilippGackstatter, it will be better to merge this PR and open the second part, which will address the comments I left here and changes which Philipp requested in his comment.

#! - num_inputs is the number of inputs in in the input note.
export.get_input_note_num_inputs
add.INPUT_NOTE_NUM_INPUTS_OFFSET
#! - storage_len is the storage length in in the input note.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo:

Suggested change
#! - storage_len is the storage length in in the input note.
#! - storage_len is the length of the input note's storage.

#! - num_inputs is the number of inputs in the input note.
export.set_input_note_num_inputs
add.INPUT_NOTE_NUM_INPUTS_OFFSET
#! - storage_len is the storage length in the input note.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for the consistency, let's update this line as well:

Suggested change
#! - storage_len is the storage length in the input note.
#! - storage_len is the length of the input note's storage.

# => [inputs_len, note_ptr]
# => [storage_len, note_ptr]

# validate the input length
Copy link
Contributor

Choose a reason for hiding this comment

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

overlooked:

Suggested change
# validate the input length
# validate the storage length

# => [storage_len, note_ptr]

# validate the input length
dup exec.::$kernel::util::note::get_max_inputs_per_note lte
Copy link
Contributor

Choose a reason for hiding this comment

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

shared_utils/util/note.masm file should be updated as well: we store there the MAX_INPUTS_PER_NOTE constant and its getter, which is used here.

Comment on lines +920 to 921
#! - is_active_note is 1 and no input note is not being processed (attempted to access note storage
#! from incorrect context).
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we overseen this previously: this line (and all similar ones) should explain the error reason according to the specific error used in the proc body. For example, in that case we use ERR_NOTE_ATTEMPT_TO_ACCESS_NOTE_ASSETS_WHILE_NO_NOTE_BEING_PROCESSED, so this line should use assets instead of storage.

Suggested change
#! - is_active_note is 1 and no input note is not being processed (attempted to access note storage
#! from incorrect context).
#! - is_active_note is 1 and no input note is not being processed (attempted to access note assets
#! from incorrect context).

exec.input_note::get_storage_info
# => [NOTE_STORAGE_COMMITMENT, storage_len]

# assert the correctness of the inputs commitment
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# assert the correctness of the inputs commitment
# assert the correctness of the storage commitment

assert_eqw.err="note 0 has incorrect storage commitment"
# => [storage_len]

# assert the inputs have correct length
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# assert the inputs have correct length
# assert the storage have correct length

Comment on lines 506 to 507
/// This test checks the scenario when some public key, which is provided to the RPO component of
/// the target account, is also provided as an input to the input note.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// This test checks the scenario when some public key, which is provided to the RPO component of
/// the target account, is also provided as a storage item to the input note.

let mut rng = ChaCha20Rng::from_seed(Default::default());
let sec_key = SecretKey::with_rng(&mut rng);
// this value will be used both as public key in the RPO component of the target account and as
// well as the input of the input note
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// well as the storage value of the input note

@@ -650,12 +651,12 @@ async fn test_build_recipient_hash() -> anyhow::Result<()> {
padw

# input
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# input
# storage

@PhilippGackstatter
Copy link
Contributor

@varun-doshi Let's also merge next one more time and then we'll merge after addressing @Fumuran's comments 👍

@PhilippGackstatter
Copy link
Contributor

Hi @varun-doshi, would you be able to update this PR to latest next? After that, we should be able to merge. Thank you very much!

@bobbinth
Copy link
Contributor

Closing this as stale and potentially superseded by #2282.

@bobbinth bobbinth closed this Jan 16, 2026
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.

Rename note inputs

5 participants