Skip to content
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

Note types #515

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Note types #515

merged 2 commits into from
Mar 26, 2024

Conversation

hackaugusto
Copy link
Contributor

@hackaugusto hackaugusto commented Mar 7, 2024

Issue #402 , this follows the implementation described at #402 (comment)

This depends on #485

@hackaugusto hackaugusto requested review from bobbinth and polydez March 7, 2024 17:56
@hackaugusto hackaugusto changed the base branch from main to next March 7, 2024 18:00
mock/src/mock/account.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@polydez polydez 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've left one inline comment here.

miden-lib/asm/kernels/transaction/api.masm Outdated Show resolved Hide resolved
@bobbinth
Copy link
Contributor

@hackaugusto - could you rebase it from the latest next?

Also, in one of the other PRs (or issues), I left a comment about potentially reducing the note types to 3: OffChain, Public, and Encrypted. The main reasoning is that maybe we are over-complicating things and note type should specify only how the note data is stored (and maybe the proper name then would be NoteStorageMode). How the note should be consumed would be then be encoded in the note tag. This does require us to think though a bit more about how note tags would be structured. What do you think?

@hackaugusto
Copy link
Contributor Author

How the note should be consumed would be then be encoded in the note tag. This does require us to think though a bit more about how note tags would be structured. What do you think?

I think that works, but I think it would be best to change the tag to be a structure, instead of encoding this in the existing field. Just to make things easier to understand.

@hackaugusto

This comment was marked as outdated.

@bobbinth
Copy link
Contributor

@hackaugusto - could you rebase it from the latest next?

done

Seems like there are still some changes in this PR which were done in other PRs (e.g., introduction of ProvenTransactionBuilder).

@hackaugusto

This comment was marked as outdated.

@hackaugusto hackaugusto force-pushed the hacka-note-types branch 2 times, most recently from 9b8f48d to 10144c7 Compare March 12, 2024 16:46
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.

Thank you! Not a full review - just left a few inline comments which I think may affect quite a few files.

objects/src/notes/note_type.rs Outdated Show resolved Hide resolved
objects/src/notes/metadata.rs Show resolved Hide resolved
miden-lib/asm/miden/kernels/tx/tx.masm Outdated Show resolved Hide resolved
@hackaugusto hackaugusto force-pushed the hacka-note-types branch 3 times, most recently from 716083e to ce2c98a Compare March 22, 2024 14:10
@hackaugusto
Copy link
Contributor Author

Thank you! Not a full review - just left a few inline comments which I think may affect quite a few files.

@bobbinth is there anything else you want to add to this PR? From what I gathered in the issue discussion the storage types are going to stay the same.

@bobbinth
Copy link
Contributor

@bobbinth is there anything else you want to add to this PR? From what I gathered in the issue discussion the storage types are going to stay the same.

How are you thinking about tag-related changes - would these be for a different PR? (specifically, checking that the tag prefix is consistent with note type as discussed in #402)

@hackaugusto
Copy link
Contributor Author

How are you thinking about tag-related changes - would these be for a different PR? (specifically, checking that the tag prefix is consistent with note type as discussed in #402)

Yes different PR.

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! I left some comments inline - most are nits but the main one is about letting callers of send_asset specify the type of the created note. Let me know what you think of this.

objects/src/notes/note_type.rs Outdated Show resolved Hide resolved
objects/src/notes/mod.rs Show resolved Hide resolved
objects/src/notes/metadata.rs Outdated Show resolved Hide resolved
miden-lib/asm/miden/contracts/wallets/basic.masm Outdated Show resolved Hide resolved
miden-lib/asm/miden/contracts/faucets/basic_fungible.masm Outdated Show resolved Hide resolved
miden-lib/asm/kernels/transaction/api.masm Outdated Show resolved Hide resolved
@Dominik1999
Copy link
Collaborator

Can we merge this?

@hackaugusto
Copy link
Contributor Author

hackaugusto commented Mar 25, 2024

Can we merge this?

I wouldn't merge it before @bobbinth has approved it.

@hackaugusto hackaugusto force-pushed the hacka-note-types branch 4 times, most recently from 6ccafa2 to c73b70c Compare March 25, 2024 17:59
@hackaugusto hackaugusto requested a review from bobbinth March 25, 2024 18:00

movdn.8 dropw dropw
# clear the padding from the kernel response
movdn.4 dropw movdn.4 dropw swap drop
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried using locals, but the assembler fails with some error about mismatching number of locals.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to do movdn.8 dropw dropw swap drop and save 1 cycle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

push.{PUBLIC_NOTE} # note_type
push.997 # tag
push.{REMOVED_ASSET_3} # asset
call.wallet::send_asset dropw dropw drop drop
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that removing the dropw dropw drop drop would be a bigger issue, namely defining the calling convention. For now this makes the tests happy.

@hackaugusto
Copy link
Contributor Author

@bobbinth once you have time, please re-review. I have finished the requested changes.

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.

Thank you! Looks good! I left a few more comments inline - most of them are pretty small. The main one is about using syscall's from "user" code.

miden-lib/asm/kernels/transaction/api.masm Outdated Show resolved Hide resolved
miden-lib/asm/miden/contracts/faucets/basic_fungible.masm Outdated Show resolved Hide resolved
miden-lib/asm/miden/contracts/wallets/basic.masm Outdated Show resolved Hide resolved
miden-lib/asm/note_scripts/SWAP.masm Outdated Show resolved Hide resolved
miden-lib/asm/miden/kernels/tx/tx.masm Outdated Show resolved Hide resolved

movdn.8 dropw dropw
# clear the padding from the kernel response
movdn.4 dropw movdn.4 dropw swap drop
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to do movdn.8 dropw dropw swap drop and save 1 cycle.

miden-lib/asm/miden/contracts/wallets/basic.masm Outdated Show resolved Hide resolved
@hackaugusto hackaugusto force-pushed the hacka-note-types branch 3 times, most recently from a36fb78 to 6e20dba Compare March 26, 2024 17:09
@hackaugusto hackaugusto dismissed bobbinth’s stale review March 26, 2024 17:10

applied requested changes

@hackaugusto hackaugusto requested a review from bobbinth March 26, 2024 17:10
@hackaugusto hackaugusto force-pushed the hacka-note-types branch 3 times, most recently from 0a9b8bd to 73313c4 Compare March 26, 2024 17:31
Notes can be stored offchain, on-chain, or encrypted. This is an
orthogonal concept to how the notes are executed. This commit adds a new
metadata field to encode the storage type.
@hackaugusto
Copy link
Contributor Author

fixed the CI

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!

I pushed a small commit which brings the changelog up to date. We can merge once CI completes.

@bobbinth bobbinth merged commit cc2bec3 into next Mar 26, 2024
9 checks passed
@bobbinth bobbinth deleted the hacka-note-types branch March 26, 2024 19:53
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.

4 participants