Comments (7)
The initial version of build_note_recipient
procedure was implemented in #710. This version assumes that input
parameter is a single element.
We should figure out how to modify the procedure so that it supports variable number of note inputs.
from miden-base.
Originally, I was thinking of keeping this issue open - but I agree, probably makes sense to close it. We should, however, create a new issue for making build_note_recipient
more generic. @partylikeits1983 or @Dominik1999 - could one of you do that?
from miden-base.
#! Returns the RECIPIENT for a specified SERIAL_NUM, SCRIPT_HASH, and inputs hash #! #! Inputs: [SERIAL_NUM, SCRIPT_HASH, INPUT_HASH] #! Outputs: [RECIPIENT] #! proc.build_recipient_hash padw hmerge # => [SERIAL_NUM_HASH, SCRIPT_HASH, INPUT_HASH] swapw hmerge # => [MERGE_SCRIPT, INPUT_HASH] swapw hmerge # [RECIPIENT] end
Yes - that's exactly how it would look like!
from miden-base.
This is super nice!
The only open question is how we want to use this procedure.
Do we always want to provide [script_hash_word, serial_number_word, input]
? It might make more sense to have [SERIAL_NUMBER, SCRIPT_HASH, input]
. In that case, you don't need to swapw
first.
We can add this here.
We don't need to touch a kernel procedure even.
from miden-base.
This is a very nice addition! And also agree with @Dominik1999 that it should go miden::tx
module.
A couple of thoughts about the interface:
- I would probably call this procedure
build_note_recipient
to indicate that we are building the recipient rather than retrieving it from somewhere. - I'm wondering if we should make it a bit more generic in how it handles inputs. Specifically, a note can take up to 16 input elements (and in the future potentially more). So, maybe instead of assuming the number of input elements, we should specify it as a parameter as well?
from miden-base.
Originally, I was thinking of keeping this issue open - but I agree, probably makes sense to close it. We should, however, create a new issue for making
build_note_recipient
more generic. @partylikeits1983 or @Dominik1999 - could one of you do that?
Yes, I agree. I've been working on a procedure that makes the build_note_recipient more generic.
Would something like this work?
#! Returns the RECIPIENT for a specified SERIAL_NUM, SCRIPT_HASH, and input
#!
#! Inputs: [SERIAL_NUM, SCRIPT_HASH, INPUT_HASH]
#! Outputs: [RECIPIENT]
#!
proc.build_recipient_hash
padw hmerge
# => [SERIAL_NUM_HASH, SCRIPT_HASH, INPUT_HASH]
swapw hmerge
# => [MERGE_SCRIPT, INPUT_HASH]
swapw hmerge
# [RECIPIENT]
end
I have a rudimentary test for it here: https://github.com/compolabs/spark-miden-v1/blob/bede38ad425e66f9c91d6152dd378e2a4c020636/tests/mock_integration/swap_recipient_test.rs#L83
This test is a bit messy, would improve it for a PR.
from miden-base.
Opened a PR to add this to the next branch
from miden-base.
Related Issues (20)
- Allow increasing an account's nonce without changing its state HOT 1
- Add `create_wallet_with_custom_code` wallet helper function in miden-lib HOT 5
- Refactor transaction kernel events and errors HOT 1
- Make memory setters consistent HOT 1
- Checking that a transaction does not consume two identical notes
- Update names used for input/output notes HOT 4
- Refactor batch/block note tree structure
- Refactor `NoteOrigin` / `NoteInclusionProof` structs HOT 3
- Fix the stack management for account procedures HOT 7
- Allow setting block timestamp and block number when using TransactionContextBuilder HOT 3
- Refactor delta's vault and storage to use maps HOT 2
- feat: add a procedure for basic wallets that creates notes with 0 or more assets HOT 1
- Refactor account storage to use sequential hash rather than a Merkle tree
- Make `miden_lib::notes::build_swap_tag()` public HOT 1
- Creation of privacy optimized P2ID note HOT 6
- Remove `send_asset` procedure from the basic wallet. HOT 6
- Improve the doc to add a detailed explanation of how to create public notes
- Implement `estimate_size` for individual deltas
- Implement ability to determine if a note/tx script cannot be executed against a given account
- Remove duplicate procedures from `miden-lib`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miden-base.