Skip to content

Commit 51dfdec

Browse files
committed
Merge remote-tracking branch 'origin/main' into bytes
2 parents 7e6d7c2 + 0751868 commit 51dfdec

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

Applib/Helpers.juvix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,14 @@ fromResult
106106
case result of
107107
| ok data := data
108108
| error err := failwith (Show.show err);
109+
110+
modulesAppData (modules : List Nat) : AppData :=
111+
Map.fromList [RawTag.fromNat 0, map (AnomaAtom.fromNat) modules]
112+
|> AppData.fromMap;
113+
114+
moduleSubmissionTransaction
115+
{M : Type -> Type}
116+
{{Tx M}}
117+
{{Monad M}}
118+
(modules : List Nat)
119+
: M Transaction := prepareStandardTransaction [] [] (modulesAppData modules);

BaseLayer/ResourceMachine.juvix

Lines changed: 6 additions & 23 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;
@@ -166,7 +158,7 @@ with
166158
isConsumed : Bool;
167159
consumed : List Resource;
168160
created : List Resource;
169-
appData : AppData;
161+
appData : List AppData.Value;
170162
}
171163
with
172164
nullifiers (a : Args) : List Nullifier :=
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package : Package :=
88
version :=
99
mkVersion@{
1010
major := 0;
11-
minor := 10;
11+
minor := 11;
1212
patch := 1;
1313
};
1414
dependencies :=

juvix.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Do not edit this file manually.
33

44
version: 2
5-
checksum: a28fa0a4023ddc664913499e443d287826bd4b5e116c8b5f693f126ac4e2abf4
5+
checksum: 5c11471c6f7b80ce9559cafebe1537073dc5cb6bba44bbf364862c2a821bef49
66
dependencies:
77
- git:
88
name: anoma_juvix-stdlib

0 commit comments

Comments
 (0)