Nock.Jets (Anoma v0.25.0)

Jets for the Nock interpreter, taking a gate core. Not fully general.

Summary

Functions

@spec bex(Nock.t()) :: :error | {:ok, Noun.t()}
Link to this function

calculate_core_param(core_index, gate_index, parent_layer)

Link to this function

calculate_mug_of_core(index_in_core, parent_layer)

@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 itself

  • parent_layer - the layer of the standard library. This should be the same as the layer numbers found in anoma.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
Link to this function

calculate_mug_of_layer(layer)

@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 in anoma.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

Link to this function

calculate_mug_of_param_core(index_in_core, core_index, parent_layer)

@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

Link to this function

calculate_mug_of_param_layer(core_index, parent_layer)

@spec calculate_mug_of_param_layer(non_neg_integer(), non_neg_integer()) ::
  non_neg_integer()

Like calculate_mug_of_layer/1 except we work over a parameterized core.

Example

> Nock.Jets.calculate_mug_of_param_layer(10, 4)
11284470320276584209

For our standard library, so far only layer 4 is parameterized

@spec lsh(Nock.t()) :: :error | {:ok, Noun.t()}
@spec met(Nock.t()) :: :error | {:ok, Noun.t()}
@spec mix(Nock.t()) :: :error | {:ok, Noun.t()}
@spec nend(Nock.t()) :: :error | {:ok, Noun.t()}
@spec rsh(Nock.t()) :: :error | {:ok, Noun.t()}
@spec sign(Nock.t()) :: :error | {:ok, binary()}
Link to this function

sign_detatched(core)

@spec sign_detatched(Nock.t()) :: :error | {:ok, binary()}
@spec verify(Nock.t()) :: :error | {:ok, binary()}
Link to this function

verify_detatched(core)

@spec verify_detatched(Nock.t()) :: :error | {:ok, 0 | 1}