Skip to content

Commit 4f740b0

Browse files
authored
Update Nonce and NullifierKey types (#98)
- Closes #96
1 parent a3ad573 commit 4f740b0

File tree

3 files changed

+13
-30
lines changed

3 files changed

+13
-30
lines changed

BaseLayer/ResourceMachine.juvix

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ end;
4747
builtin anoma-nullifier-key
4848
type NullifierKey := privateMk ByteArray
4949
with
50-
type Raw := mk AnomaAtom;
51-
52-
fromRaw : NullifierKey.Raw -> NullifierKey
53-
| (Raw.mk n) := privateMk (fromAnomaContents size n);
54-
55-
toRaw : NullifierKey -> NullifierKey.Raw
56-
| (NullifierKey.privateMk bs) := Raw.mk (toAnomaContents bs);
57-
5850
size : Nat := 64;
5951

6052
fromByteArray : ByteArray -> NullifierKey := privateMk;
@@ -210,15 +202,6 @@ end;
210202
--- NOTE: This should be a number having an at most negligible chance of repeating is sufficient, e.g., a pseudo-random number.
211203
type Nonce := privateMk ByteArray
212204
with
213-
-- should be mk AnomaAtom
214-
type Raw := mk AnomaAtom;
215-
216-
fromRaw : Nonce.Raw -> Nonce
217-
| (Raw.mk n) := privateMk (fromAnomaContents size n);
218-
219-
toRaw : Nonce -> Nonce.Raw
220-
| (Nonce.privateMk bs) := Raw.mk (toAnomaContents bs);
221-
222205
instance
223206
Nonce-FixedSize : FixedSize Nonce := FixedSize.mk size;
224207

@@ -289,7 +272,7 @@ type Resource :=
289272
value : AnomaAtom;
290273
quantity : Nat;
291274
ephemeral : Bool;
292-
nonce : Nonce.Raw;
275+
nonce : Nonce;
293276
nullifierKeyCommitment : AnomaAtom;
294277
--- Currently unused. It is safe to set it to 0
295278
unusedRandSeed : Nat;
@@ -460,7 +443,7 @@ end;
460443

461444
type RootedNullifiableResource :=
462445
mk@{
463-
key : NullifierKey.Raw;
446+
key : NullifierKey;
464447
resource : Resource;
465448
root : CommitmentRoot;
466449
}
@@ -483,14 +466,14 @@ with
483466
RootedNullifiableResource.mk@{
484467
resource;
485468
root;
486-
key := NullifierKey.toRaw NullifierKey.Transparent.mk;
469+
key := NullifierKey.Transparent.mk;
487470
};
488471
end;
489472
end;
490473

491474
type NullifiableResource :=
492475
mk@{
493-
key : NullifierKey.Raw;
476+
key : NullifierKey;
494477
resource : Resource;
495478
}
496479
with
@@ -504,7 +487,7 @@ with
504487
mk (resource : Resource) : NullifiableResource :=
505488
NullifiableResource.mk@{
506489
resource;
507-
key := NullifierKey.toRaw NullifierKey.Transparent.mk;
490+
key := NullifierKey.Transparent.mk;
508491
};
509492
end;
510493
end;

Package.juvix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ package : Package :=
88
version :=
99
mkVersion@{
1010
major := 0;
11-
minor := 10;
12-
patch := 1;
11+
minor := 11;
12+
patch := 0;
1313
};
1414
dependencies :=
1515
[
16-
github "anoma" "juvix-stdlib" "v0.11.0";
17-
github "anoma" "juvix-mtl" "v0.3.0";
16+
github "anoma" "juvix-stdlib" "v0.12.0";
17+
github "anoma" "juvix-mtl" "v0.3.3";
1818
];
1919
};

juvix.lock.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
# Do not edit this file manually.
33

44
version: 2
5-
checksum: 2404b847a6ab80e90e31ffa933a0abdd98d3b35458f523ec157a7c6d15ffa6f9
5+
checksum: 87f3f9705354faf72160b218cd9b4425174f4482ff9c413f1f34897b90ea52b5
66
dependencies:
77
- git:
88
name: anoma_juvix-stdlib
9-
ref: 24e656d9af73891d012c05e1c21d1f1beb80913b
9+
ref: 24988693716daa8476806a812e71ce229983f5fa
1010
url: https://github.com/anoma/juvix-stdlib
1111
dependencies: []
1212
- git:
1313
name: anoma_juvix-mtl
14-
ref: 3423b28a18df9393ecc19ac8dd359cf7c0dac41a
14+
ref: d257e194a99b2dcf67b1a8610245c83117f3589a
1515
url: https://github.com/anoma/juvix-mtl
1616
dependencies:
1717
- git:
1818
name: anoma_juvix-stdlib
19-
ref: 4e98315bc937536cbcd1c60178fd3d48e3a9d3c4
19+
ref: 24988693716daa8476806a812e71ce229983f5fa
2020
url: https://github.com/anoma/juvix-stdlib
2121
dependencies: []

0 commit comments

Comments
 (0)