Skip to content

Commit

Permalink
feat: fix nonce and randSeed types
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Nov 8, 2024
1 parent 7c4be3e commit 5a07b57
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Anoma/Builtin/System.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ syntax alias PRNG := PseudoRandomNumberGenerator;
--- Creates and initializes a pure PRNG with a seed.
--- @param The seed.
--- @return The initialized PRNG.
builtin anoma-random-generator-init
axiom pseudoRandomNumberGeneratorInit : Nat -> PRNG;
-- TODO Conversion should be handled on the base layer.
-- builtin anoma-random-generator-init
axiom pseudoRandomNumberGeneratorInit : ByteArray -> PRNG;

--- Returns two distinct PRNGs.
--- @param The generator to split.
Expand Down
5 changes: 3 additions & 2 deletions Anoma/Resource/Types.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Anoma.Resource.Types;
import Stdlib.Prelude open;
import Stdlib.Trait.Ord.Eq open using {fromOrdToEq};
import Anoma.Primitives.FixedSize open;
import Anoma.Builtin.ByteArray open;
import Anoma.Utils open;

--- A fixed-size data type encoding the reference to the resource logic function.
Expand All @@ -26,11 +27,11 @@ type NullifierKeyCommitment :=

--- A fixed-size data type encoding a number to be used once ensuring that the resource commitment is unique.
--- NOTE: This should be a number having an at most negligible chance of repeating is sufficient, e.g., a pseudo-random number.
type Nonce := mkNonce@{unNonce : MISSING_DEFINITION};
type Nonce := mkNonce@{unNonce : ByteArray};

--- A fixed-size data type encoding a randomness seed.
--- NOTE: This seed provides pseudo randomness and cannot be expected to provide true randomness.
type RandSeed := mkRandSeed@{unRandSeed : MISSING_DEFINITION};
type RandSeed := mkRandSeed@{unRandSeed : ByteArray};

--- The resource label type.
type Label := mkLabel@{unLabel : MISSING_DEFINITION};
Expand Down
2 changes: 1 addition & 1 deletion juvix.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Do not edit this file manually.

version: 2
checksum: aee7ca6999521d60319bcb414911575aab7ff59e369c9c4677da9563a6299942
checksum: 2b4ceed787050a25e74294448dc1bcdd9683916bc5bed83bbcbf6e652897308d
dependencies:
- git:
name: anoma_juvix-stdlib
Expand Down

0 comments on commit 5a07b57

Please sign in to comment.