|
|
@@ -0,0 +1,69 @@
|
|
|
+# :set syntax=pism
|
|
|
+# :source ../scripts/pism.vim
|
|
|
+constant G_SPEND FixedGenerator
|
|
|
+constant CRH_IVK BlakePersonalization
|
|
|
+constant JUBJUB_FR_CAPACITY BinarySize
|
|
|
+constant NOTE_COMMIT PedersenPersonalization
|
|
|
+
|
|
|
+contract input_spend
|
|
|
+ param secret Fr
|
|
|
+ param ak Point
|
|
|
+ param value U64
|
|
|
+ param is_cool Bool
|
|
|
+ param path Scalar
|
|
|
+{% for n in range(10) %}
|
|
|
+ param path_{{ n }} Scalar
|
|
|
+ param is_right_{{ n }} Bool
|
|
|
+{% endfor %}
|
|
|
+start
|
|
|
+ # Compute P = xG + A
|
|
|
+ witness ak param:ak
|
|
|
+ assert_not_small_order ak
|
|
|
+ fr_as_binary_le secret param:secret
|
|
|
+
|
|
|
+ ec_mul_const public secret G_SPEND
|
|
|
+
|
|
|
+ ec_add public public ak
|
|
|
+ emit_ec public
|
|
|
+
|
|
|
+ # Make some a blake2s hash
|
|
|
+ alloc_binary preimage
|
|
|
+ ec_repr repr_ak ak
|
|
|
+ binary_extend preimage repr_ak
|
|
|
+ static_assert_binary_size preimage 256
|
|
|
+ blake2s ivk preimage CRH_IVK
|
|
|
+ emit_binary ivk
|
|
|
+
|
|
|
+ ############
|
|
|
+ # For loop 10 times
|
|
|
+{% for n in range(10) %}
|
|
|
+ alloc_bit is_right param:is_right_{{ n }}
|
|
|
+ alloc_scalar path param:path_{{ n }}
|
|
|
+{% endfor %}
|
|
|
+ ############
|
|
|
+
|
|
|
+ # Below lines are random garbage
|
|
|
+ # Uncomment them to test
|
|
|
+
|
|
|
+ #binary_clone ivk2 ivk
|
|
|
+ #binary_truncate ivk2 JUBJUB_FR_CAPACITY
|
|
|
+ #u64_as_binary_le value_bits param:value
|
|
|
+ #ec_mul pk_d value_bits public
|
|
|
+
|
|
|
+ #pedersen_hash cm ivk NOTE_COMMIT
|
|
|
+ #ec_get_u cur cm
|
|
|
+ #
|
|
|
+ #alloc_bit is_cool param:is_cool
|
|
|
+ #clone_bit is_cool2 is_cool
|
|
|
+ #binary_push ivk is_cool2
|
|
|
+
|
|
|
+ #alloc_scalar path param:path
|
|
|
+ #conditionally_reverse ul ur cur path is_cool
|
|
|
+
|
|
|
+ #scalar_as_binary ul_bin ul
|
|
|
+ #binary_extend preimage ul_bin
|
|
|
+
|
|
|
+ #scalar_enforce_equal ur ul
|
|
|
+ #emit_scalar ur
|
|
|
+end
|
|
|
+
|