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.

I find the door cores, i.e. parametrized layers.

Types

error()

@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

abs(core)

@spec abs(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

action_create(core)

@spec action_create(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

action_delta(core)

@spec action_delta(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

add(core)

@spec add(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

bex(core)

@spec bex(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

cairo_compose(core)

@spec cairo_compose(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

cairo_create_from_cus(core)

@spec cairo_create_from_cus(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

cairo_prove_delta(core)

@spec cairo_prove_delta(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

calculate_core(index_in_core, layer)

@spec calculate_core(non_neg_integer(), non_neg_integer()) :: Noun.t()

calculate_core_param(gate_index, core_index, parent_layer)

@spec calculate_core_param(
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer()
) :: Noun.t()

calculate_layer(layer)

@spec calculate_layer(non_neg_integer()) :: Noun.t()

I get the layer based on its number.

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

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

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

calculate_param_layer(core_index, door_index, parent_layer)

@spec calculate_param_layer(
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer()
) :: Noun.t()

I find the door cores, i.e. parametrized layers.

cmp(core)

@spec cmp(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

compliance_delta(core)

@spec compliance_delta(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

cue(core)

@spec cue(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

dec(core)

@spec dec(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

delta_add(core)

@spec delta_add(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

delta_sub(core)

@spec delta_sub(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

dif(core)

@spec dif(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

div(core)

@spec div(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

dor(core)

@spec dor(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

dul(core)

@spec dul(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

duni(core)

@spec duni(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

fra(core)

@spec fra(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

generate_registry(index_map, list)

@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()

gor(core)

@spec gor(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

got(core)

@spec got(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

gte(core)

@spec gte(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

gth(core)

@spec gth(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

has(core)

@spec has(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

int(core)

@spec int(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

jam(core)

@spec jam(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

keccak256(core)

@spec keccak256(Noun.t()) :: :error | {:ok, Noun.t()}

kind(core)

@spec kind(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

lsh(core)

@spec lsh(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

lte(core)

@spec lte(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

lth(core)

@spec lth(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

make_delta(core)

@spec make_delta(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

met(core)

@spec met(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

mix(core)

@spec mix(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

mod(core)

@spec mod(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

mor(core)

@spec mor(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

mput(core)

@spec mput(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

mul(core)

@spec mul(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

nend(core)

@spec nend(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

nmug(core)

@spec nmug(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

pro(core)

@spec pro(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

put(core)

@spec put(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

rem(core)

@spec rem(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

resource_delta(core)

@spec resource_delta(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

rsh(core)

@spec rsh(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

sample(arg1)

@spec sample(Noun.t()) :: :error | {:ok, Noun.t()}

sdif(core)

@spec sdif(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

secp256k1_public_key(core)

@spec secp256k1_public_key(Noun.t()) :: :error | {:ok, Noun.t()}

secp256k1_sign(core)

@spec secp256k1_sign(Noun.t()) :: :error | {:ok, Noun.t()}

secp256k1_verify(core)

@spec secp256k1_verify(Noun.t()) :: :error | {:ok, Noun.t()}

shax(core)

@spec shax(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

sign(core)

@spec sign(Noun.t()) :: {:error, error()} | {:ok, binary()}

sign_detatched(core)

@spec sign_detatched(Noun.t()) :: {:error, error()} | {:ok, binary()}

silt(core)

@spec silt(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

sub(core)

@spec sub(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

sum(core)

@spec sum(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

sun(core)

@spec sun(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

syn(core)

@spec syn(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

t_compose(core)

@spec t_compose(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

trm_compliance_key(core)

@spec trm_compliance_key(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

trm_delta_key(core)

@spec trm_delta_key(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

uni(core)

@spec uni(Noun.t()) :: {:error, error()} | {:ok, Noun.t()}

verify(core)

@spec verify(Noun.t()) :: {:error, error()} | {:ok, binary()}

verify_detatched(core)

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