Conversation
alexeykoren
commented
Dec 6, 2022
- Asset id test vectors
- ZSA value commitment building and test
PaulLaux
left a comment
There was a problem hiding this comment.
Added some comments. In addition,
- Reformat the asset_id.py file using the IDE, it has some missing spaces etc.
- please update the Orchard PR with the new result, if any.
| is_native = i < 10 | ||
| note_type = None if is_native else bytes(Point.rand(rand)) | ||
| asset = None if is_native else bytes(Point.rand(rand)) | ||
| asset_descr = None if is_native else randbytes(512) |
There was a problem hiding this comment.
Should probably encode to UTF-8 not that important.
| def value_commit_zsa(rcv: Scalar, v: Scalar, asset_id: Point): | ||
| return asset_id * v + group_hash(b"z.cash:Orchard-cv", b"r") * rcv | ||
|
|
There was a problem hiding this comment.
Remove this function and extend value_commit() to work with (rcv: Scalar, v: Scalar, asset: Point)
| assert value_commit(rcv, v) == VALUE_COMMITMENT_RANDOMNESS_BASE * rcv + VALUE_COMMITMENT_VALUE_BASE * v | ||
|
|
||
| # Test consistency of ValueCommit^{Orchard} with precomputed generators for non-native asset | ||
| def test_value_commit_zsa(): |
There was a problem hiding this comment.
remove test_value_commit_zsa() and simply add another assert into test_value_commit().
|
|
||
| rcv = rcv_trapdoor(rand) | ||
| cv = value_commit(rcv, Scalar(np.v)) | ||
| cv = value_commit(rcv, Scalar(np.v)) if is_native else value_commit_zsa(rcv, Scalar(np.v), asset_id(asset, asset_descr)) |
There was a problem hiding this comment.
This change is redundant after unifying everything into value_commit()
There was a problem hiding this comment.
looks good. For /test-vectors/rust directory - remove all files from this PR except
orchard_asset_id.rs
orchard_key_components.rs
orchard_note_encryption.rs
(same as in /test_vectors/json folder)
All other files include just whitespace changes and we don't want them as part of our diff.
|
conclude by copying the |