Nock.Jets (Anoma v0.34.0)
Jets for the Nock interpreter, taking a gate core. Not fully general.
Summary
Functions
I get the layer based on its number.
We calculate the mug of a given core at a given gate.
We calculate the mug of a given layer at any given gate.
Like calculate_mug_of_core/2
except we work over a parameterized core.
I find the door cores, i.e. parametrized layers.
Types
@type error() :: {:dec, Noun.t()} | {:add, Noun.t()} | {:sub, Noun.t()} | {:lth, Noun.t()} | {:lte, Noun.t()} | {:gth, Noun.t()} | {:gte, Noun.t()} | {:mul, Noun.t()} | {:div, Noun.t()} | {:mod, Noun.t()} | {:sign, Noun.t()} | {:verify, Noun.t()} | {:sign_detatched, Noun.t()} | {:verify_detatched, Noun.t()} | {:bex, Noun.t()} | {:mix, Noun.t()} | {:lsh, Noun.t()} | {:rsh, Noun.t()} | {:bex, Noun.t()} | {:nend, Noun.t()} | {:met, Noun.t()} | {:jam, Noun.t()} | {:cue, Noun.t()} | {:shax, Noun.t()} | {:abs, Noun.t()} | {:dif, Noun.t()} | {:dul, Noun.t()} | {:fra, Noun.t()} | {:pro, Noun.t()} | {:rem, Noun.t()} | {:sum, Noun.t()} | {:sun, Noun.t()} | {:syn, Noun.t()} | {:cmp, Noun.t()} | {:nmug, Noun.t()} | {:dor, Noun.t()} | {:gor, Noun.t()} | {:mor, Noun.t()} | {:silt, Noun.t()} | {:put, Noun.t()} | {:uni, Noun.t()} | {:int, Noun.t()} | {:sdif, Noun.t()} | {:has, Noun.t()} | {:mput, Noun.t()} | {:got, Noun.t()} | {:kind, Noun.t()} | {:delta_add, Noun.t()} | {:delta_sub, Noun.t()} | {:resource_delta, Noun.t()} | {:compliance_delta, Noun.t()} | {:action_delta, Noun.t()} | {:make_delta, Noun.t()} | {:action_create, Noun.t()} | {:trm_compliance_key, Noun.t()} | {:trm_delta_key, Noun.t()} | {:t_compose, Noun.t()} | {:cairo_compose, Noun.t()} | {:cairo_create_from_cus, Noun.t()} | {:cairo_prove_delta, Noun.t()} | {:secp256k1_sign, Noun.t()} | {:secp256k1_verify, Noun.t()} | {:secp256k1_public_key, Noun.t()} | {:keccak256, Noun.t()}
Functions
@spec calculate_core(non_neg_integer(), non_neg_integer()) :: Noun.t()
@spec calculate_core_param( non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: Noun.t()
@spec calculate_layer(non_neg_integer()) :: Noun.t()
I get the layer based on its number.
@spec calculate_mug_of_core(non_neg_integer(), non_neg_integer()) :: non_neg_integer()
We calculate the mug of a given core at a given gate.
Parameters
index_in_core
- the index of the gate itselfparent_layer
- the layer of the standard library. This should be the same as the layer numbers found inanoma.hoon
Example
In the Hoon repl one should write
dojo> |commit %anoma
>=
dojo> =anoma -build-file /=anoma=/lib/anoma/hoon
dojo> => anoma !=(sub)
[9 47 0 31]
Now in IEX
> Nock.Jets.calculate_mug_of_core(47, 1)
14801825384048474882
@spec calculate_mug_of_layer(non_neg_integer()) :: non_neg_integer()
We calculate the mug of a given layer at any given gate.
Parameters
parent_layer
- the layer of the standard library. This should be the same as the layer numbers found inanoma.hoon
Example
In the Hoon repl one should write
dojo> |commit %anoma
>=
dojo> =anoma -build-file /=anoma=/lib/anoma/hoon
dojo> => anoma !=(sub)
[9 47 0 31]
Now in IEX
> Nock.Jets.calculate_mug_of_layer(1)
17654928022549292273
This value should match Nock.@layer_1_contex_mug
@spec calculate_mug_of_param_core( non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: non_neg_integer()
Like calculate_mug_of_core/2
except we work over a parameterized core.
Example
> Nock.Jets.calculate_mug_of_param_core(767, 10, 4)
12605872635346981159
For our standard library, so far only layer 4 is parameterized
@spec calculate_param_layer( non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: Noun.t()
I find the door cores, i.e. parametrized layers.
@spec generate_registry( %{ required(atom()) => %{ :index => non_neg_integer(), :label => non_neg_integer(), optional(:door) => non_neg_integer() } }, [ {atom(), (Noun.t() -> {:ok, Noun.t()} | :error), :enabled | :disabled | :check, non_neg_integer()} ] ) :: map()