Skip to content

Commit 03744a4

Browse files
committed
guard Nonce.fromByteArray
1 parent fb02a12 commit 03744a4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

BaseLayer/ResourceMachine.juvix

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,14 @@ with
207207

208208
size : Nat := 32;
209209

210-
fromAnomaAtom : AnomaAtom -> Nonce := fromAnomaContents size >> privateMk;
210+
fromAnomaAtom : AnomaAtom -> Nonce := fromAnomaContents size >> fromByteArray;
211211

212-
from32SizedByteArray : ByteArray -> Nonce := privateMk;
212+
fromByteArray (b : ByteArray) : Nonce :=
213+
if
214+
| ByteArray.size b == size := privateMk b
215+
| else := failwith "Nonce.fromByteArray incorrect size";
216+
217+
from32SizedByteArray : ByteArray -> Nonce := fromByteArray;
213218

214219
toAnomaAtom : Nonce -> AnomaAtom
215220
| (privateMk nonce) := toAnomaContents nonce;

0 commit comments

Comments
 (0)