Merge branch 'next/arvo' into m/wuthax

This commit is contained in:
Zach Alberico 2022-12-15 19:31:07 -08:00 committed by GitHub
commit 443c3bfbd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
235 changed files with 70267 additions and 104094 deletions

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
cd "$GITHUB_WORKSPACE" || exit
echo "$2" | base64 -d > service-account
echo "$3" | base64 -d > id_ssh
echo "$4" | base64 -d > id_ssh.pub
chmod 600 service-account
chmod 600 id_ssh
chmod 600 id_ssh.pub
janeway release glob-all --dev --no-pill \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash
SHORTHASH=$(git rev-parse --short HEAD)
janeway release prepare-ota arvo-glob-"$SHORTHASH" "$1" \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash
janeway release perform-ota "$1" \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash

View File

@ -1,4 +1,4 @@
FROM tloncorp/janeway:v0.15.4
FROM tloncorp/janeway:v0.17.0
COPY entrypoint.sh /entrypoint.sh
EXPOSE 22/tcp
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,18 +1,21 @@
name: 'glob'
description: 'Create a glob and deploy it to a moon'
name: 'ota'
description: 'perform an OTA update of arvo on a remote ship'
inputs:
ship:
description: "Ship to deploy to"
description: "target ship"
required: true
credentials:
description: "base64-encoded GCP Service Account credentials"
required: true
ssh-sec-key:
description: "A base64-encoded SSH secret key for the container to use"
description: "base64-encoded SSH secret key for the container to use"
required: true
ssh-pub-key:
description: "The corresponding base64-encoded SSH public key"
description: "base64-encoded corresponding SSH public key"
required: true
ref:
description: "git ref of arvo source to check out"
required: false
runs:
using: 'docker'
@ -22,4 +25,4 @@ runs:
- ${{ inputs.credentials }}
- ${{ inputs.ssh-sec-key }}
- ${{ inputs.ssh-pub-key }}
- ${{ inputs.ref }}

20
.github/actions/ota/entrypoint.sh vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
echo "$2" | base64 -d > /service-account
echo "$3" | base64 -d > /id_ssh
echo "$4" | base64 -d > /id_ssh.pub
chmod 600 /service-account
chmod 600 /id_ssh
chmod 600 /id_ssh.pub
janeway \
--ci \
--verbose \
--credentials /service-account \
--ssh-key /id_ssh \
release ota \
arvo \
"$1" \
${5:+"--ref"} ${5:+"$5"} \
| bash

View File

@ -34,7 +34,7 @@ jobs:
call-vere:
uses: ./.github/workflows/vere.yml
with:
pace: 'often'
pace: 'edge' # XX s/b once?
upload: >-
${{
(github.ref_name == 'next/vere' && github.ref_type == 'branch')

View File

@ -1,27 +0,0 @@
name: Chromatic Deployment
on:
pull_request:
paths:
- 'pkg/interface/**'
push:
paths:
- 'pkg/interface/**'
branches:
- 'release/next-userspace'
jobs:
chromatic-deployment:
runs-on: ubuntu-latest
name: "Deploy Chromatic"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm i && npm run bootstrap
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: pkg/interface

View File

@ -1,20 +0,0 @@
name: glob
on:
push:
branches:
- 'release/next-userspace'
jobs:
glob:
runs-on: ubuntu-latest
name: "Create and deploy a glob to ~hanruc-nalfus-nidsut-tomdun"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: ./.github/actions/glob
with:
ship: 'hanruc-nalfus-nidsut-tomdun'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}

View File

@ -1,27 +0,0 @@
name: merge
on:
push:
branches:
- 'master'
jobs:
merge-to-next-js:
runs-on: ubuntu-latest
name: "Merge master to release/next-userspace"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: release/next-userspace
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}
merge-to-group-timer:
runs-on: ubuntu-latest
name: "Merge master to ops/group-timer"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: ops/group-timer
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

View File

@ -1,17 +0,0 @@
name: ops-merge
on:
push:
branches:
- 'release/*'
jobs:
merge-release-to-ops:
runs-on: ubuntu-latest
name: "Merge to ops-tlon"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: ops-tlon
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

19
.github/workflows/ota.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: ota
on:
workflow_dispatch:
push:
branches:
- 'next/arvo'
jobs:
deploy:
runs-on: ubuntu-latest
name: "make an OTA update to arvo on ~binnec-dozzod-marzod"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/ota
with:
ship: 'canary'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}
ref: 'next/arvo'

View File

@ -12,11 +12,13 @@ on:
pace:
description: 'release pace'
type: string
default: 'often'
default: 'edge'
required: false
secrets:
CACHIX_AUTH_TOKEN:
required: false
GCP_CREDENTIALS:
required: false
GCS_SERVICE_ACCOUNT_KEY:
required: false
GCS_PROJECT:
@ -33,7 +35,7 @@ on:
description: 'release pace'
type: choice
options:
- often
- edge
- soon
- live
@ -48,8 +50,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest }
- { os: macos-latest }
- { os: ubuntu-latest, type: linux }
- { os: macos-latest, type: macos }
- { os: buildjet-4vcpu-ubuntu-2204-arm, type: linux }
runs-on: ${{ matrix.os }}
@ -64,7 +67,7 @@ jobs:
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.type == 'linux' }}
- uses: cachix/install-nix-action@v16
if: ${{ matrix.os != 'ubuntu-latest' }}
@ -73,6 +76,11 @@ jobs:
name: ares
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# run unit tests early on linux (x-compilation will skip them)
- name: build dynamic binary (and run tests)
if: ${{ matrix.type == 'linux' }}
run: nix-build -A urbit
- name: build static binary
run: |
nix-build -A urbit \
@ -84,7 +92,7 @@ jobs:
cat ./urbit-derivation
- name: confirm binary is mostly static
if: matrix.os == 'macos-latest'
if: matrix.type == 'macos'
run: |
bin="${{ env.urbit_static }}/bin/urbit"
@ -117,19 +125,20 @@ jobs:
echo -n "$version" > ./version-string
- name: upload version string artifact
if: matrix.os == 'ubuntu-latest'
if: matrix.type == 'linux'
uses: actions/upload-artifact@v3
with:
name: version-string
path: version-string
- uses: google-github-actions/setup-gcloud@v0.2.0
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- uses: google-github-actions/setup-gcloud@v1
if: inputs.upload
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.GCS_PROJECT }}
export_default_credentials: true
- name: upload binary to bootstrap.urbit.org
if: inputs.upload
@ -174,6 +183,7 @@ jobs:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: mingw32-make build/urbit
- run: mingw32-make test
- run: >
build/urbit -l -d -B ../../bin/solid.pill -F bus &&
curl -f --data '{"source":{"dojo":"+hood/exit"},"sink":{"app":"hood"}}'
@ -232,9 +242,7 @@ jobs:
after:
runs-on: ubuntu-latest
needs: [urbit, mingw]
# XX disabled due to missing storage.objects.delete access
if: false
# if: inputs.upload
if: inputs.upload
steps:
- uses: google-github-actions/setup-gcloud@v0.2.0
with:

3
.husky/post-checkout Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; }
git lfs post-checkout "$@"

3
.husky/post-commit Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; }
git lfs post-commit "$@"

3
.husky/post-merge Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
git lfs post-merge "$@"

3
.husky/pre-push Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"

View File

@ -1,10 +1,10 @@
.PHONY: build build-all install cross release test pills ropsten-pills clean
build:
nix-build -A urbit -A herb --no-out-link
nix-build -A urbit --no-out-link
install:
nix-env -f . -iA urbit -iA herb
nix-env -f . -iA urbit
release:
sh/release

View File

@ -27,12 +27,12 @@ identity, use [Bridge][brid].
## Install
To install and run Urbit, please follow the instructions at
[urbit.org/using/install][start]. You'll be on the live network in a
[urbit.org/install][start]. You'll be on the live network in a
few minutes.
If you're interested in Urbit development, keep reading.
[start]: https://urbit.org/using/install/
[start]: https://urbit.org/install/
## Development

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f46209c31bc7be965b6ba32db92fb0746be15d9613b1c3c8d09ce7fa0e5e157
size 8280141
oid sha256:ea8626444e4f0213e39c21ded20607145ee85a947afc592f182f46e7f598ef30
size 7748671

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c45166ff0f8ab8dc1552bcef519c77c0afa6ca52f8ed1ba31ed632012667d619
size 8674763
oid sha256:e46c7fb35826bcc3352eca8dbfeea3a8bdf1686cf46b3f873fad0c09bc25c5a7
size 5715362

View File

@ -56,6 +56,9 @@ let
crossSystem =
if system == "x86_64-linux" && crossSystem == null && enableStatic then
"x86_64-unknown-linux-musl"
else
if system == "aarch64-linux" && crossSystem == null && enableStatic then
"aarch64-unknown-linux-musl"
else
crossSystem;
};

70
doc/spec/nock/10.txt Normal file
View File

@ -0,0 +1,70 @@
Author: Mencius Moldbug [moldbug@gmail.com]
Date: 9/15/2008
Version: 10K
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Brackets enclose cells. [a b c] is [a [b c]].
5. Definition
5.1 Transformations
*[a [b c] d] => [*[a b c] *[a d]]
*[a 0 b] => /[b a]
*[a 1 b] => [b]
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
*[a 3 b] => **[a b]
*[a 4 b] => &*[a b]
*[a 5 b] => ^*[a b]
*[a 6 b] => =*[a b]
*[a] => *[a]
5.2 Operators
5.2.1 Goto [*]
*[a] -> nock[a]
5.2.2 Deep [&]
&[a b] -> 0
&[a] -> 1
5.2.4 Bump [^]
^[a b] -> ^[a b]
^[a] -> (a + 1)
5.2.5 Like [=]
=[a a] -> 0
=[a b] -> 1
=[a] -> =[a]
5.2.6 Snip [/]
/[1 a] -> a
/[2 a b] -> a
/[3 a b] -> b
/[(a + a) b] -> /[2 /[a b]]
/[(a + a + 1) b] -> /[3 /[a b]]
/[a] -> /[a]

74
doc/spec/nock/11.txt Normal file
View File

@ -0,0 +1,74 @@
Author: Mencius Moldbug (moldbug@gmail.com)
Date: 5/25/2008
Version: 11K
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Parentheses enclose cells. (a b c) is (a (b c)).
5. Definition
5.1 Transformations
*(a (b c) d) => (*(a b c) *(a d))
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
*(a 3 b) => **(a b)
*(a 4 b) => &*(a b)
*(a 5 b) => ^*(a b)
*(a 6 b) => =*(a b)
*(a 7 b c) => *(a 3 (((1 0) b) c) 1 0 3)
*(a 8 b c) => *(a c)
*(a) => *(a)
5.2 Operators
5.2.1 Goto (*)
*(a) -> nock(a)
5.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
5.2.4 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
5.2.5 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
5.2.6 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

75
doc/spec/nock/12.txt Normal file
View File

@ -0,0 +1,75 @@
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
Date: 3/28/2008
Version: 0.12
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Parentheses enclose cells. (a b c) is (a (b c)).
5. Definition
5.1 Transformations
*(a (b c) d) => (*(a b c) *(a d))
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b c) => *(*(a b) c)
*(a 3 b) => **(a b)
*(a 4 b) => &*(a b)
*(a 5 b) => ^*(a b)
*(a 6 b) => =*(a b)
*(a 7 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
*(a 8 b c) => *(a 2 (((1 0) b) c) 0 3)
*(a 9 b c) => *(a c)
*(a) => *(a)
5.2 Operators
5.2.1 Goto (*)
*(a) -> nock(a)
5.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
5.2.4 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
5.2.5 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
5.2.6 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

71
doc/spec/nock/13.txt Normal file
View File

@ -0,0 +1,71 @@
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
Date: 3/8/2008
Version: 0.13
1. Manifest
This file defines one Turing-complete function, "nock."
nock is in the public domain. So far as I know, it is
neither patentable nor patented. Use it at your own risk.
2. Data
Both the domain and range of nock are "nouns."
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Pseudocode
nock is defined in a pattern-matching pseudocode.
Match precedence is top-down. Operators are prefix. Parens
denote cells, and group right: (a b c) is (a (b c)).
4. Definition
4.1 Transformations
*(a 0 b c) => *(*(a b) c)
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b) => **(a b)
*(a 3 b) => &*(a b)
*(a 4 b) => ^*(a b)
*(a 5 b) => =*(a b)
*(a 6 b c d) => *(a 2 (0 1) 2 (1 c d) (1 0) 2 (1 2 3) (1 0) 4 4 b)
*(a b c) => (*(a b) *(a c))
*(a) => *(a)
4.2 Operators
4.2.1 Goto (*)
*(a) -> nock(a)
4.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
4.2.3 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
4.2.4 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
4.2.5 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

42
doc/spec/nock/6.txt Normal file
View File

@ -0,0 +1,42 @@
1 Structures
A noun is an atom or a cell. An atom is any natural number.
A cell is an ordered pair of nouns.
2 Reductions
nock(a) *a
[a b c] [a [b c]]
?[a b] 0
?a 1
+a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] +*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[0 1] b] c]
*[a 9 b c] *[a 7 c 0 b]
*[a 10 b c] *[a c]
*[a 10 [b c] d] *[a 8 c 7 [0 2] d]
+[a b] +[a b]
=a =a
/a /a
*a *a

42
doc/spec/nock/7.txt Normal file
View File

@ -0,0 +1,42 @@
1 Structures
A noun is an atom or a cell. An atom is any natural number.
A cell is any ordered pair of nouns.
2 Pseudocode
[a b c] [a [b c]]
nock(a) *a
?[a b] 0
?a 1
^a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] ^*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
*[a 9 b c] *[a 7 c 0 b]
*[a 10 b c] *[a c]
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
^[a b] ^[a b]
=a =a
/a /a
*a *a

45
doc/spec/nock/8.txt Normal file
View File

@ -0,0 +1,45 @@
1 Structures
A noun is an atom or a cell. An atom is any unsigned integer.
A cell is an ordered pair of nouns.
2 Pseudocode
[a b c] is [a [b c]]; *a is nock(a). Reductions match top-down.
3 Reductions
?[a b] 0
?a 1
^a (a + 1)
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] ^*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [7 b [0 1]] c]
*[a 9 b c] *[a 8 b 2 [[7 [0 3] d] [0 5]] 0 5]
*[a 10 b c] *[a 8 b 8 [7 [0 3] c] 0 2]
*[a 11 b c] *[a 8 b 7 [0 3] c]
*[a 12 b c] *[a [1 0] 1 c]
^[a b] ^[a b]
=a =a
/a /a
*a *a

43
doc/spec/nock/9.txt Normal file
View File

@ -0,0 +1,43 @@
1 Context
This spec defines one function, Nock.
2 Structures
A noun is an atom or a cell. An atom is any unsigned integer.
A cell is an ordered pair of any two nouns.
3 Pseudocode
Brackets enclose cells. [a b c] is [a [b c]].
*a is Nock(a). Reductions match top-down.
4 Reductions
?[a b] => 0
?a => 1
^[a b] => ^[a b]
^a => (a + 1)
=[a a] => 0
=[a b] => 1
=a => =a
/[1 a] => a
/[2 a b] => a
/[3 a b] => b
/[(a + a) b] => /[2 /[a b]]
/[(a + a + 1) b] => /[3 /[a b]]
/a => /a
*[a 0 b] => /[b a]
*[a 1 b] => b
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
*[a 3 b] => **[a b]
*[a 4 b] => ?*[a b]
*[a 5 b] => ^*[a b]
*[a 6 b] => =*[a b]
*[a [b c] d] => [*[a b c] *[a d]]
*a => *a

View File

@ -25,6 +25,7 @@ let
(import ./overlays/native.nix)
# Specific overrides guarded by the host platform.
(import ./overlays/musl.nix)
(import ./overlays/arm.nix)
];
};

View File

@ -3,10 +3,11 @@ final: prev:
let
isAarch64 = prev.stdenv.hostPlatform.isAarch64;
isDarwin = prev.stdenv.isDarwin;
in prev.lib.optionalAttrs isAarch64 {
in prev.lib.optionalAttrs (isAarch64 && !isDarwin) {
libsigsegv = prev.libsigsegv.overrideAttrs (attrs: {
preConfigure = (old.preConfigure or "") + ''
preConfigure = (prev.preConfigure or "") + ''
sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-arm.h/' configure
'';
});

18
nix/sources-openssl.json Normal file
View File

@ -0,0 +1,18 @@
{
"openssl": {
"branch": "1_1_1n",
"homepage": "https://www.openssl.org/",
"pmnsh": {
"include": "build/include",
"lib": "build",
"prepare": "./config --prefix=`mkdir -p build && readlink -f ./build` --libdir=. no-shared no-tests",
"make": "install_dev"
},
"owner": "openssl",
"repo": "openssl",
"rev": "OpenSSL_1_1_1n",
"type": "tarball",
"url": "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1n.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/refs/tags/<rev>.tar.gz"
}
}

View File

@ -4,6 +4,11 @@
"description": "A command line tool and library for transferring data with URL syntax",
"homepage": "http://curl.se/",
"pmnsh": {
"compat": {
"openbsd": {
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl=`readlink -f ../openssl/build`"
}
},
"include": "include",
"lib": "lib/.libs",
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl",
@ -76,6 +81,13 @@
},
"urcrypt": {
"pmnsh": {
"compat": {
"openbsd": {
"make": "install prefix=`readlink -f .` exec_prefix=`readlink -f .`",
"include": "include",
"lib": "lib"
}
},
"prepare": "./autogen.sh && ./configure --disable-shared PKG_CONFIG_PATH=../secp256k1 CFLAGS=\"-I../secp256k1/include -I../libaes_siv\" LDFLAGS=-L../libaes_siv",
"make": "install"
}

View File

@ -8,6 +8,9 @@
"compat": {
"mingw": {
"prepare": "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=. ."
},
"openbsd": {
"prepare": "cmake -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
}
},
"include": "include",
@ -35,6 +38,10 @@
"mingw": {
"make": "aes_siv_static",
"prepare": "cmake -G\"MSYS Makefiles\" -DDISABLE_DOCS:BOOL=ON ."
},
"openbsd": {
"make": "aes_siv_static",
"prepare": "cmake -DDISABLE_DOCS:BOOL=ON -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
}
}
},
@ -98,6 +105,10 @@
"mingw": {
"lib": "build/Win64-MinGW-w64",
"make": "-C build/Win64-MinGW-w64 libsoftfloat3.a"
},
"openbsd": {
"lib": "build/template-FAST_INT64",
"make": "-C build/template-FAST_INT64 libsoftfloat3.a"
}
},
"include": "source/include"

View File

@ -7,6 +7,7 @@
:: OR
:: :aqua &pill +solid
::
:: XX: update these examples
:: Then try stuff:
:: :aqua [%init ~[~bud ~dev]]
:: :aqua [%dojo ~[~bud ~dev] "[our eny (add 3 5)]"]
@ -480,14 +481,15 @@
=^ ms state (poke-pill pil)
(emit-cards ms)
::
[%swap-files ~]
[%swap-files @tas]
=/ =desk +.val
=. userspace-ova.pil
=/ slim-dirs=(list path)
~[/app /ted /gen /lib /mar /sur /hoon/sys /arvo/sys /zuse/sys]
:: take all files from a userspace desk
=/ all-dirs=(list path) ~[/]
:_ ~
%- unix-event:pill-lib
%- %*(. file-ovum:pill-lib directories slim-dirs)
/(scot %p our.hid)/work/(scot %da now.hid)
%+ %*(. file-ovum:pill-lib directories all-dirs)
desk /(scot %p our.hid)/[desk]/(scot %da now.hid)
=^ ms state (poke-pill pil)
(emit-cards ms)
::

View File

@ -6,22 +6,16 @@
default-agent,
verb,
dbug
:: Generally don't update the snapshot until we have clay tombstoning.
::
/* snap %azimuth-snapshot /app/azimuth/version-0/azimuth-snapshot
:: To update, run from dojo:
:: -azimuth-snap-state %default 'version-0'
::
:: To recreate from a full list of logs (at /app/azimuth/logs/eth-logs):
:: -azimuth-snap-logs %default 'version-0'
::
=/ snap=snap-state snap
=/ last-snap=@ number.id.snap
::
=, jael
|%
+$ app-state
$: %6
$: %7
url=@ta
=net
refresh=_~m5
@ -30,10 +24,14 @@
own=owners
spo=sponsors
logs=(list =event-log:rpc:ethereum)
sap=snap-state
==
::
+$ poke-data
$% :: %listen
$% :: %load: load snapshot
::
[%load snap=snap-state]
:: %listen
::
[%listen whos=(list ship) =source:jael]
:: %watch: configure node url and network
@ -75,14 +73,18 @@
==
::
++ init-timer
|= =bowl:gall
|= at=@da
^- card
[%pass /init %arvo %b %wait now.bowl]
[%pass /init %arvo %b %wait at]
::
++ start-log-retrieval
|= [=ship args=vase]
^- card
[%pass /wa %agent [ship %eth-watcher] %poke %eth-watcher-poke args]
::
++ start-azimuth-load
^- card
[%pass /al %arvo %k %fard %base %azimuth-load %noun !>(~)]
--
::
=<
@ -92,22 +94,10 @@
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card _this)
=/ points=@ud ~(wyt by points.nas.snap)
%- %- slog
[leaf+"ship: loading azimuth snapshot ({<points>} points)"]~
::
=: net.state %default
nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
url.state 'http://eth-mainnet.urbit.org:8545'
==
:_ this
?: .^(? %j /(scot %p our.bowl)/fake/(scot %da now.bowl))
~
~[(nuke-azimuth-tracker bowl) (init-timer bowl)]
::
~[(init-timer now.bowl)]
++ on-save !>(state)
++ on-load
|= old=vase
@ -122,7 +112,7 @@
`old-state
%- %- slog :_ ~
leaf+"ship: loading snapshot with {<(lent logs.old-state)>} events"
=. +.state +:(state-5-to-6 old-state)
=. +.state +:(state-6-to-7 (state-5-to-6 old-state))
=^ cards state
(%*(run-logs do nas.state *^state:naive) logs.state)
[(jael-update:do (to-udiffs:do cards)) state]
@ -130,12 +120,12 @@
?. ?=(%2 -.old-state)
`old-state
~& > '%azimuth: updating to state 3'
=. +.state +:(state-5-to-6 old-state)
=. +.state +:(state-6-to-7 (state-5-to-6 old-state))
:: replace naive state and indices with snapshot
::
=: nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
=: nas.state nas.sap.state
own.state owners.sap.state
spo.state sponsors.sap.state
logs.state ~
:: TODO: shouldn't be needed but have seen eth-watcher
:: threads use a url='' if this is not used
@ -144,8 +134,8 @@
==
=/ points=@ud ~(wyt by points.nas.state)
%- %- slog :_ ~
leaf+"ship: processing azimuth snapshot ({<points>} points)"
=/ snap-cards=udiffs:point (run-state:do id.snap points.nas.state)
leaf+"ship: processing azimuth snapshot (~{<points>} points)"
=/ snap-cards=udiffs:point (run-state:do id.sap.state points.nas.state)
:_ [%3 url net whos nas own spo logs]:state
%+ weld
(jael-update:do snap-cards)
@ -160,22 +150,30 @@
=^ cards-4 old-state
?. ?=(%4 -.old-state) [cards-3 old-state]
=^ cards this
%- %*(. on-poke +.state.this +:(state-5-to-6 old-state))
%- %*(. on-poke +.state.this +:(state-6-to-7 (state-5-to-6 old-state)))
[%azimuth-poke !>([%watch [url net]:old-state])]
~& > '%azimuth: updating to state 5'
[cards [%5 url net whos nas own spo logs]:state.this]
=? old-state ?=(%5 -.old-state)
(state-5-to-6 old-state)
?> ?=(%6 -.old-state)
=? old-state ?=(%6 -.old-state)
(state-6-to-7 old-state)
?> ?=(%7 -.old-state)
[cards-4 this(state old-state)]
::
++ app-states $%(state-0 state-1-2-3-4-5 app-state)
::
++ state-5-to-6
|= state-1-2-3-4-5
^- app-state
[%6 url net ~m5 whos nas own spo logs]
++ app-states $%(state-0 state-1-2-3-4-5 state-6 app-state)
::
+$ state-6
$: %6
url=@ta
=net
refresh=_~m5
whos=(set ship)
nas=^state:naive
own=owners
spo=sponsors
logs=(list =event-log:rpc:ethereum)
==
+$ state-1-2-3-4-5
$: ?(%1 %2 %3 %4 %5)
url=@ta
@ -196,6 +194,15 @@
own=owners
logs=(list =event-log:rpc:ethereum)
==
++ state-5-to-6
|= state-1-2-3-4-5
^- state-6
[%6 url net ~m5 whos nas own spo logs]
::
++ state-6-to-7
|= state-6
^- app-state
[%7 url net refresh whos nas own spo logs *snap-state]
--
::
++ on-poke
@ -219,9 +226,9 @@
[(subscribe-to-eth-watcher bowl)]~
::
%resnap
=: nas.state nas.snap
own.state owners.snap
spo.state sponsors.snap
=: nas.state nas.sap.state
own.state owners.sap.state
spo.state sponsors.sap.state
==
`this
==
@ -229,7 +236,23 @@
?. ?=(%azimuth-poke mark)
(on-poke:def mark vase)
=+ !<(poke=poke-data vase)
|-
?- -.poke
%load
=/ points=@ud ~(wyt by points.nas.snap.poke)
%- %- slog
[leaf+"ship: loading azimuth snapshot ({<points>} points)"]~
::
=: net.state %default
nas.state nas.snap.poke
own.state owners.snap.poke
spo.state sponsors.snap.poke
url.state 'http://eth-mainnet.urbit.org:8545'
sap.state snap.poke
logs.state ~
==
$(poke [%kick ~])
::
%listen
[[(listen-to-azimuth (silt whos.poke) source.poke)]~ this]
::
@ -237,8 +260,8 @@
=/ last-block=@
?^ logs.state
number:(last-block-id:dice logs.state)
~& >> %no-logs-in-azimuth-state
last-snap
:: ~& >> %no-logs-in-azimuth-state
number.id.sap.state
=+ [our=(scot %p our.bowl) now=(scot %da now.bowl)]
=+ .^(dudes=(set [dude:gall ?]) %ge our %base now /)
=/ running=? (~(has in dudes) [%eth-watcher &])
@ -246,43 +269,44 @@
|((~(has in dudes) [%eth-watcher &]) (~(has in dudes) [%eth-watcher |]))
:_ this
=/ cards=(list card)
:- :: %jael will re-subscribe to get all azimuth diffs
::
(listen-to-azimuth ~ [%| dap.bowl])
:: we poke eth-watcher to retrieve logs from the latest we have
::
%*(start do last-snap last-block)
=? cards !running
:: restart %eth-watcher
::
~& >> %starting-eth-watcher
=/ rein=[desk rein] [%base %.y [%eth-watcher ~ ~] ~]
:_ cards
[%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)]
=? cards !installed
?: installed
~
:: reinstall %base desk
::
=+ spo=(sein:title [our now our]:bowl)
~& >> re-installing-base-from+spo
=/ fresh=[desk ship desk] [%base spo %kids]
[%pass /fresh %agent [our.bowl %hood] %poke kiln-install+!>(fresh)]~
=? cards !running
:: restart %eth-watcher
::
~& >> %starting-eth-watcher
=/ rein=[desk rein] [%base [%eth-watcher %&] ~ ~]
:_ cards
[%pass /fresh %agent [our.bowl %hood] %poke kiln-install+!>(fresh)]
[%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)]
=. cards
:: we poke eth-watcher to retrieve logs from the latest we have
::
(weld %*(start do number.id.sap.state last-block) cards)
=? cards !(~(has by wex.bowl) [/eth-watcher our.bowl %eth-watcher])
:: resubscribe if we somehow get unsubscribed from eth-watcher
::
?: (~(has by wex.bowl) [/eth-watcher our.bowl %eth-watcher])
cards
~& >> %resubscribing-to-eth-watcher
[(subscribe-to-eth-watcher bowl) cards]
=. cards
:: %jael will re-subscribe to get all azimuth diffs
::
[(listen-to-azimuth ~ [%| dap.bowl]) cards]
(flop cards)
::
%watch
=: nas.state ?:(?=(%default net.poke) nas.snap *^state:naive)
own.state ?:(?=(%default net.poke) owners.snap ~)
spo.state ?:(?=(%default net.poke) sponsors.snap ~)
=: nas.state ?:(?=(%default net.poke) nas.sap.state *^state:naive)
own.state ?:(?=(%default net.poke) owners.sap.state ~)
spo.state ?:(?=(%default net.poke) sponsors.sap.state ~)
net.state net.poke
url.state url.poke
logs.state ~
==
[start:do this]
`this
==
::
++ on-watch
@ -309,7 +333,7 @@
:- %leaf
"ship: processing azimuth snapshot ({<points>} points)"
=/ snap-cards=udiffs:point
(%*(run-state do logs.state ~) id.snap points.nas.state)
(%*(run-state do logs.state ~) id.sap.state points.nas.state)
[(weld (jael-update:do snap-cards) start:do) this]
::
++ on-leave on-leave:def
@ -325,6 +349,7 @@
[%x %spo ~] ``noun+!>(spo.state)
[%x %refresh ~] ``atom+!>(refresh.state)
[%x %point @ ~] ``noun+(point i.t.t.path)
[%x %last-snap ~] ``noun+!>(sap.state)
==
::
++ point
@ -369,19 +394,24 @@
::
++ on-arvo
|= [=wire =sign-arvo]
?: &(=(/al wire) ?=(%arow +<.sign-arvo))
?- -.p.sign-arvo
%& `this
%|
%- (slog 'loading azimuth snapshot failed! still trying' p.p.sign-arvo)
[~[(init-timer (add ~s10 now.bowl))] this]
==
?. &(=(/init wire) ?=(%wake +<.sign-arvo))
(on-arvo:def wire sign-arvo)
?^ error.sign-arvo
%- (slog 'azimuth: failed to initialize!' ~)
`this
:_ this
~[(subscribe-to-eth-watcher bowl) (listen-to-azimuth ~ [%| dap.bowl])]
~[start-azimuth-load]
::
++ on-fail on-fail:def
--
|_ =bowl:gall
:: TODO: maybe flop the endianness here so metamask signs it in normal
:: order?
::
++ verifier
^- ^verifier:naive
@ -514,7 +544,7 @@
:+ %watch /[dap.bowl]
^- config:eth-watcher
:* url.state =(%czar (clan:title our.bowl)) refresh.state ~h30
(max launch.net ?:(=(net.state %default) +(last-snap) 0))
(max launch.net ?:(=(net.state %default) +(number.id.sap.state) 0))
~
~[azimuth.net]
~[naive.net]

View File

@ -716,7 +716,7 @@
'rtt'^(numb (div rtt ~s1))
'rttvar'^(numb (div rttvar ~s1))
'ssthresh'^(numb ssthresh)
'num-live'^(numb num-live)
'num-live'^(numb ~(wyt by live))
'cwnd'^(numb cwnd)
'counter'^(numb counter)
==

File diff suppressed because one or more lines are too long

View File

@ -174,8 +174,10 @@
::
;~ pfix fas
;~ pose
(parse-variable (cold %sur hep) ;~(pfix gap parse-cables))
(parse-variable (cold %lib lus) ;~(pfix gap parse-cables))
(parse-variable (cold %sur hep) ;~(pfix gap (parse-cables %sur)))
(parse-variable (cold %lib lus) ;~(pfix gap (parse-cables %lib)))
;~(pfix tis gap (parse-variable sym ;~(pfix gap parse-path)))
;~(pfix cen gap (parse-variable sym ;~(pfix gap parse-mark)))
==
==
::
@ -194,22 +196,17 @@
==
::
++ parse-cables
%+ cook
|= base-path=@ta
%- cook :_ (most ;~(plug com gaw) parse-cable)
|= cables=(list cable:clay)
:+ 0 %ex
^- hoon
:+ 0 %tu
::
:- %clsg
%+ turn cables
|= cable=cable:clay
^- hoon
::
:+ %clhp
?~ face.cable
[%rock %n ~]
[%clhp [%rock %n ~] [%sand %tas u.face.cable]]
[%sand %tas file-path.cable]
(most ;~(plug com gaw) parse-cable)
^- dojo-source
=+ add-face=?~(face.cable "|*(n=* n)" ;:(weld "|*(n=* ^=(" (trip u.face.cable) " n))"))
:^ 0 %do (scan add-face parse-hoon)
:+ 0 %dv [-.dir `path`[base-path file-path.cable ~]]
::
++ parse-cable
%+ cook |=(a=cable:clay a)
@ -218,6 +215,16 @@
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
(cook |=(a=term [`a a]) sym)
==
::
++ parse-mark
%- cook :_ ;~(pfix cen sym)
|= mark=@tas
[0 %dv -.dir `path`[~.mar mark ~]]
::
++ parse-path
%+ cook |=(=path [0 %dv -.dir path])
;~(pfix fas (more fas sym))
::
++ parse-source (stag 0 parse-build)
++ parse-build
%+ knee *dojo-build |. ~+
@ -537,8 +544,6 @@
=. var (~(del by var) p.mad)
=< dy-amok
?+ p.mad .
%lib .(lib ~)
%sur .(sur ~)
%dir .(dir [[our.hid %base ud+0] /])
==
=+ cay=(~(got by rez) p.q.mad)
@ -550,27 +555,17 @@
~| bad-set+[p.p.mad p.q.cay]
=< dy-amok
?+ p.p.mad .
%lib
%_ .
lib
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay)
==
::
%sur
%_ .
sur
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay)
==
::
%dir =+ ^= pax ^- path
%dir
=/ bem=beam
%- need %- de-beam
=+ pax=((dy-cast path !>(*path)) q.cay)
?: ?=(~ pax) ~[(scot %p our.hid) %base '0']
?: ?=([@ ~] pax) ~[i.pax %base '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
?: =(~ .^((list path) %ct pax))
?: =(~ .^((list path) %ct (en-beam he-beam(dir bem))))
+(..dy (he-diff %tan 'dojo: dir does not exist' ~))
=. dir (need (de-beam pax))
=. dir bem
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
==

View File

@ -469,6 +469,10 @@
[~ this(dogs.state (~(put by dogs.state) path u.dog(running ~)))]
::
%thread-done
:: if empty, that means we cancelled this thread
::
?: =(*vase q.cage.sign)
`this
=+ !<([vows=disavows pup=watchpup] q.cage.sign)
=. u.dog
%_ u.dog

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|%
+$ state
$~ [%23 *state:drum *state:helm *state:kiln]
$>(%23 any-state)
$~ [%24 *state:drum *state:helm *state:kiln]
$>(%24 any-state)
::
+$ any-state
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
@ -24,6 +24,7 @@
[%21 drum=state-4:drum helm=state-1:helm kiln=state-8:kiln]
[%22 drum=state-4:drum helm=state-1:helm kiln=state-9:kiln]
[%23 drum=state-4:drum helm=state-2:helm kiln=state-9:kiln]
[%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln]
==
+$ any-state-tuple
$: drum=any-state:drum

View File

@ -168,8 +168,8 @@
?+ mark (on-poke:def mark vase)
%spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider vase))
%spider-inline (handle-inline-thread:sc !<(inline-args:spider vase))
%spider-stop (handle-stop-thread:sc !<([tid ?] vase))
::
%handle-http-request
(handle-http-request:sc !<([@ta =inbound-request:eyre] vase))
==
@ -303,12 +303,31 @@
++ handle-start-thread
~/ %handle-start-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak file=term =vase]
(prep-thread parent-tid use beak %| file vase)
::
++ handle-inline-thread
~/ %handle-inline-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak =shed:khan]
(prep-thread parent-tid use beak %& shed)
::
++ prep-thread
|= $: parent-tid=(unit tid) use=(unit tid) =beak
source=(each shed:khan [file=term =vase])
==
^- (quip card ^state)
=/ parent-yarn=yarn
?~ parent-tid
/
(~(got by tid.state) u.parent-tid)
=/ new-tid (fall use (new-thread-id file))
=/ new-tid
?^ use
u.use
%- new-thread-id
?- -.source
%& (cat 3 'inline-' q.beak)
%| file.p.source
==
::
=/ =yarn (snoc parent-yarn new-tid)
::
?: (~(has of running.state) yarn)
@ -321,16 +340,19 @@
=? serving.state !(~(has by serving.state) new-tid)
(~(put by serving.state) new-tid [~ %noun q.beak])
::
=: starting.state (~(put by starting.state) yarn [%build vase])
tid.state (~(put by tid.state) new-tid yarn)
==
=. tid.state (~(put by tid.state) new-tid yarn)
?- -.source
%& (begin-shed yarn p.source)
%|
=. starting.state (~(put by starting.state) yarn [%build vase.p.source])
=/ pax=path
~| no-file-for-thread+file
(need (get-fit:clay beak %ted file))
~| no-file-for-thread+file.p.source
(need (get-fit:clay beak %ted file.p.source))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
==
::
++ handle-build
~/ %handle-build
@ -349,23 +371,25 @@
=/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot))))
?: ?=(%| -.maybe-thread)
(thread-fail-not-running tid %thread-not-thread ~)
(start-thread yarn p.maybe-thread)
(slam-thread yarn p.maybe-thread)
::
++ start-thread
~/ %start-thread
++ slam-thread
~/ %slam-thread
|= [=yarn =thread]
^- (quip card ^state)
=/ =vase vase:(~(got by starting.state) yarn)
?< (~(has of running.state) yarn)
=/ m (strand ,^vase)
=/ res (mule |.((thread vase)))
?: ?=(%| -.res)
(thread-fail-not-running (yarn-to-tid yarn) %false-start p.res)
=/ =eval-form:eval:m
(from-form:eval:m p.res)
=: starting.state (~(del by starting.state) yarn)
running.state (~(put of running.state) yarn eval-form)
==
=. starting.state (~(del by starting.state) yarn)
(begin-shed yarn p.res)
::
++ begin-shed
|= [=yarn =shed:khan]
?< (~(has of running.state) yarn)
=/ m (strand ,vase)
=/ =eval-form:eval:m (from-form:eval:m shed)
=. running.state (~(put of running.state) yarn eval-form)
(take-input yarn ~)
::
++ handle-stop-thread

View File

@ -0,0 +1,46 @@
:: print [len] %ames flows, sorted by number-per-ship
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] arg=$@(~ [len=@ ~]) ~]
:- %noun
::
=; flows
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
=/ len ?^(arg len.arg 50)
(scag len (sort flows |=([[@ [a=@ud *] *] @ [b=@ud *] *] (gth a b))))
::
=/ peers-map
.^ (map ship ?(%alien %known))
%ax /(scot %p p.bec)//(scot %da now)/peers
==
=/ peers=(list ship)
%+ murn ~(tap by peers-map)
|= [=ship val=?(%alien %known)]
?: =(ship p.bec)
~ :: this is weird, but we saw it
?- val
%alien ~
%known (some ship)
==
::
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
%+ turn peers
|= =ship
=+ .^ =ship-state:ames
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
==
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
=/ corked ~(wyt in corked.peer-state)
=- [ship - corked]
::
=+ %+ roll ~(tap in ~(key by snd.peer-state))
|= [b=bone [out=(list bone) in=(list bone) nax=(list bone)]]
=/ m (mod b 4)
?+ m ~|([%odd-bone b] !!)
%0 [[b out] in nax]
%1 [out [b in] nax]
%3 [out in [b nax]]
==
=/ [out-closing=(list bone) out-open=(list bone)]
(skid out ~(has ^in closing.peer-state))
[(lent out-open) (lent out-closing) (lent in) (lent nax)]

View File

@ -0,0 +1,20 @@
:: print [len] %ames message-pump timers, sorted by number-per-ship
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] arg=$@(~ [len=@ ~]) ~]
:- %noun
::
=; who
^- (list [@ta @ud])
=/ len ?^(arg len.arg 50)
(scag len (sort ~(tap by who) |=([[@ a=@ud] @ b=@ud] (gth a b))))
::
=| who=(map @ta @ud)
=/ tim .^((list (pair @da duct)) bx+/(scot %p p.bec)//(scot %da now)/debug/timers)
|- ^+ who
?~ tim who
?. &(?=(^ q.i.tim) ?=([%ames %pump ^] i.q.i.tim))
$(tim t.tim)
=* her i.t.t.i.q.i.tim
=/ i (~(gut by who) her 0)
$(tim t.tim, who (~(put by who) her +(i)))

View File

@ -1,5 +0,0 @@
:: Kick azimuth
::
:- %say
|= *
[%azimuth-poke %kick ~]

View File

@ -0,0 +1,10 @@
:: +gall-nonces: print %gall agent subscription nonces, highest-last
::
:- %say
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
:- %noun
^- (list [dude:gall @ud])
%+ sort
%~ tap by
.^((map dude:gall @ud) %gf /(scot %p p.bec)//(scot %da now))
|=([[* a=@ud] [* b=@ud]] (lth a b))

View File

@ -1,14 +0,0 @@
:: Helm: Reload vane/s from /=base=
::
:::: /hoon/breload/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=(list term) ~]
==
:+ %helm-reload-desk %base
arg

View File

@ -1,7 +1,3 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~
force=_|
except=(set desk)
==
[%kiln-bump except force]
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
[%kiln-bump ~]

View File

@ -0,0 +1,8 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~
[dude=_`dude:gall`%$ ship=_`@p`(bex 128)]
==
=/ darg=(unit dude:gall) ?:(=(%$ dude) ~ `dude)
=/ sarg=(unit ^ship) ?:(=((bex 128) ship) ~ `ship)
[%helm-doff darg sarg]

View File

@ -0,0 +1,8 @@
:: Helm: Set Gall Verbosity by Agent
::
/? 310
::
:- %say
|= [^ dudes=(list dude:gall) ~]
:- %helm-gall-sift
dudes

View File

@ -0,0 +1,11 @@
:: Helm: Adjust Gall verbosity
::
:: List of diagnostic flags is in verb:gall in zuse.hoon, documented in
:: gall.hoon
::
/? 310
::
:- %say
|= [^ veb=(list verb:gall) ~]
:- %helm-gall-verb
veb

View File

@ -0,0 +1,50 @@
:: |new-desk: creates a minimal desk
::
/+ *generators
::
:- %ask
|= $: [now=@da eny=@uvJ bek=beak]
[=desk ~]
[from=$~(%base desk) hard=_|]
==
::
=; make-new-desk
?. ?& !hard
(~(has in .^((set ^desk) %cd (en-beam bek(q %$) /))) desk)
==
(make-new-desk)
%+ print (rap 3 'the desk %' desk ' already exists. overwrite it?' ~)
%+ prompt [%& %prompt "overwrite? (y/N) "]
|= in=tape
?. |(=("y" in) =("Y" in) =("yes" in))
no-product
(make-new-desk)
::
|. %- produce
:- %helm-pass
%^ new-desk:cloy desk
~
%- ~(gas by *(map path page:clay))
|^ =- (turn - mage)
^- (list path)
:~ /mar/noun/hoon
/mar/hoon/hoon
/mar/txt/hoon
/mar/kelvin/hoon
/sys/kelvin
==
::
++ mage
|= =path
:- path
^- page:clay
:- (rear path)
~| [%missing-source-file from path]
.^ *
%cx
(scot %p p.bek)
from
(scot %da now)
path
==
--

View File

@ -8,9 +8,7 @@
==
:- %kiln-rein
:- desk
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
%+ roll arg
=| =rein:hood
|: [*[on=? =dude:gall] rein=rein(liv liv)]
?: on
rein(add (~(put in add.rein) dude))
rein(sub (~(put in sub.rein) dude))
|: [*[on=? =dude:gall] rein=ren:(~(got by cone) [p.bec desk])]
(~(put by rein) dude on)

View File

@ -15,4 +15,7 @@
?@ +.arg [q.bec -.arg]
?> ((sane %tas) +<.arg)
[-.arg +<.arg]
[%kiln-rein des & [dap ~ ~] ~]
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ =foam:clay (~(gut by cone) [p.bec des] *foam:clay)
=+ ((slog ?:(=(%live liv.foam) ~ ['kiln: desk not live' ~])) ~)
[%kiln-rein des (~(put by ren.foam) dap &)]

View File

@ -13,8 +13,7 @@
=/ =lobe u.fil.arch
=+ .^(=rang %cx /(scot %p p.bec)//(scot %da now)/rang)
=+ .^(=cone %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ domes=(list [[=ship =desk] =dome tom=(map tako norm) nor=norm])
~(tap by cone)
=/ domes=(list [[=ship =desk] foam]) ~(tap by cone)
=/ norms
|^
|- ^- (set [ship desk tako norm path])
@ -24,14 +23,14 @@
=/ =aeon 1
%- ~(uni in $(domes t.domes))
|- ^- (set [ship desk tako norm path])
?: (lth let.dome.i.domes aeon)
?: (lth let.i.domes aeon)
~
=/ =tako (~(got by hit.dome.i.domes) aeon)
=/ =tako (~(got by hit.i.domes) aeon)
=/ paths (draw-tako ship.i.domes desk.i.domes +.i.domes tako)
(~(uni in paths) $(aeon +(aeon)))
::
++ draw-tako
|= [=ship =desk [dome tom=(map tako norm) nor=norm] =tako]
|= [=ship =desk foam =tako]
^- (set [^ship ^desk ^tako norm path])
~+
=/ =yaki (~(got by hut.rang) tako)

View File

@ -1,14 +0,0 @@
:: Kiln: merge each version of remote desk? XX clarify
::
:::: /hoon/track/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=[syd=@tas her=@p sud=@tas ~] ~]
==
:- %kiln-track
[syd her sud]:arg

View File

@ -8,7 +8,7 @@
%- flop ^- tang
%- zing
%+ turn ~(tap by cone)
|= [[=ship =desk] dome tom=(map tako norm) nor=norm]
|= [[=ship =desk] foam]
:- leaf+"{<ship>}/{<desk>}:"
%+ turn ~(tap of nor)
|= [=path keep=?]

View File

@ -77,10 +77,8 @@
~& %solid-double-loaded
=/ whole-formula
=< +
.* 0
:+ %7
compiler-formula
[%9 2 %10 [6 %1 %noun whole-src] [%0 1]]
.* [%noun whole-src]
[%8 compiler-formula [%9 2 %10 [6 %0 3] [%0 2]]]
~& %solid-double-compiled
whole-formula
::
@ -100,24 +98,19 @@
|= [ovo=ovum ken=*]
[~ (slum ken [now ovo])]
::
:: kernel-formula
:: boot-two: startup formula
::
:: We evaluate :arvo-formula (for jet registration),
:: then ignore the result and produce .installed
::
=/ kernel-formula
[%7 arvo-formula %1 installed]
::
:: boot-two: startup formula
::
=/ boot-two
=> [kernel-formula=** main-sequence=**]
!= [.*(0 kernel-formula) main-sequence]
=> *[arvo-formula=^ installed=^ tale=*]
!= =+(.*(0 arvo-formula) [installed tale])
::
:: boot-ova
::
=/ boot-ova=(list)
[aeon:eden:part boot-two kernel-formula ~]
[aeon:eden:part boot-two arvo-formula installed ~]
::
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::

View File

@ -3,6 +3,8 @@
::::
::
/- *story
/$ story-to-txt %story %txt
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[~] =desk ~]
@ -15,9 +17,6 @@
tang+[leaf+"Error: desk {<desk>} does not exist." ~]
?: !.^(? %cu pax)
tang+['Error: No story file found. Please use |story-init to create one.' ~]
=/ story-to-txt
.^($-(story wain) %cf /(scot %p our)/[desk]/(scot cas)/story/txt)
::
=/ tale .^(story %cx pax)
=/ tale-text (story-to-txt tale)
=/ tale-text (flop (story-to-txt tale))
tang+tale-text

View File

@ -48,7 +48,7 @@
?- reverse-ancestors
~
:: stop here and return the current message
=/ msg=(list cord) (msg-from-commit this-commit tale)
=/ msg=wain (msg-from-commit this-commit tale)
[(weld msg result.state) mergebase=~]
::
[tako:clay ~]
@ -103,8 +103,7 @@
=/ mainline-commit
.^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv mainline))
::
=/ msg=(list cord)
(msg-from-commit this-commit tale)
=/ msg=wain (msg-from-commit this-commit tale)
::
:: 1 - process current commit
:: 2 - recur and queue processing on all commits on the sideline
@ -141,14 +140,9 @@
::
++ msg-from-commit
|= [commit=yaki:clay tale=story]
^- (list cord)
=/ proses (~(get by tale) r.commit)
^- wain
=/ proses (~(get ju tale) r.commit)
?~ proses ~
%- flop :: fixes formatting reversal in dojo
%- to-wain:format
%- crip
;: welp
(tako-to-text:lib r.commit)
(proses-to-text:lib u.proses)
==
(chapter-to-text:lib r.commit proses)
--

View File

@ -3,8 +3,4 @@
|= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~]
==
?: =(desk %kids) [%tang ~[(report-kids p.bec now)]]
=+ .^ =vat %gx
/(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun
==
[%tang ~[(report-vat p.bec now vat)]]
[%tang ~[(report-vat (report-prep p.bec now) p.bec now desk)]]

View File

@ -77,7 +77,8 @@
::
++ de-gill :: gill from wire
|= way=wire ^- gill:gall
?>(?=([@ @ ~] way) [(slav %p i.way) i.t.way])
~| way
?>(?=([@ @ *] way) [(slav %p i.way) i.t.way])
--
:: TODO: remove .ost
::

View File

@ -230,6 +230,14 @@
|= veb=(list verb:ames) =< abet
(emit %pass /helm %arvo %a %spew veb)
::
++ poke-gall-sift
|= dudes=(list dude:gall) =< abet
(emit %pass /helm %arvo %g %sift dudes)
::
++ poke-gall-verb
|= veb=(list verb:gall) =< abet
(emit %pass /helm %arvo %g %spew veb)
::
++ poke-ames-wake
|= ~ =< abet
(emit %pass /helm %arvo %a %stir '')
@ -252,6 +260,11 @@
=< abet
(emit %pass /helm/cors/reject %arvo %e %reject-origin origin)
::
++ poke-doff
|= [dude=(unit dude:gall) ship=(unit ship)]
=< abet
(emit %pass /helm/doff %arvo %g %doff dude ship)
::
++ poke
|= [=mark =vase]
?> ?| ?=(%helm-hi mark)
@ -269,6 +282,9 @@
%helm-code =;(f (f !<(_+<.f vase)) poke-code)
%helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve)
%helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject)
%helm-doff =;(f (f !<(_+<.f vase)) poke-doff)
%helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift)
%helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb)
%helm-hi =;(f (f !<(_+<.f vase)) poke-hi)
%helm-knob =;(f (f !<(_+<.f vase)) poke-knob)
%helm-pans =;(f (f !<(_+<.f vase)) poke-pans)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,203 @@
/+ *test, test-pub, test-sub
/= ames-raw /sys/vane/ames
/= gall-raw /sys/vane/gall
::
=/ ames-bunt (ames-raw ~zod)
=/ gall-bunt (gall-raw ~zod)
:: basic helpers
::
|%
++ make-gall
|= =ship
=/ gall-pupa (gall-raw ship)
=/ gall-core (gall-pupa now=~1111.1.1 eny=`@`0xdead.beef scry=*roof)
=+ [out adult]=(call:gall-core duct=~[/init] dud=~ task=[%init ~])
adult
::
++ ames-nec-bud
:: create ~nec
::
=/ nec (ames-raw ~nec)
=. now.nec ~1111.1.1
=. eny.nec 0xdead.beef
=. life.ames-state.nec 2
=. rof.nec |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
=/ nec-pub pub:ex:crypto-core.ames-state.nec
=/ nec-sec sec:ex:crypto-core.ames-state.nec
:: create ~bud
::
=/ bud (ames-raw ~bud)
=. now.bud ~1111.1.1
=. eny.bud 0xbeef.dead
=. life.ames-state.bud 3
=. rof.bud |=(* ``[%noun !>(*(list turf))])
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
=/ bud-pub pub:ex:crypto-core.ames-state.bud
=/ bud-sec sec:ex:crypto-core.ames-state.bud
::
=/ nec-sym (derive-symmetric-key:ames-raw bud-pub nec-sec)
=/ bud-sym (derive-symmetric-key:ames-raw nec-pub bud-sec)
?> =(nec-sym bud-sym)
:: tell ~nec about ~bud
::
=. peers.ames-state.nec
%+ ~(put by peers.ames-state.nec) ~bud
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=bud-sym
life=3
rift=0
public-key=bud-pub
sponsor=~bud
==
=. route.peer-state `[direct=%.y `lane:ames`[%& ~bud]]
[%known peer-state]
:: tell ~bud about ~nec
::
=. peers.ames-state.bud
%+ ~(put by peers.ames-state.bud) ~nec
=| =peer-state:ames
=. -.peer-state
:* symmetric-key=nec-sym
life=2
rift=0
public-key=nec-pub
sponsor=~nec
==
=. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]]
[%known peer-state]
:: metamorphose
::
=> .(nec +:(call:(nec) ~[//unix] ~ %born ~))
=> .(bud +:(call:(bud) ~[//unix] ~ %born ~))
::
[nec=nec bud=bud]
--
:: forward-declare to avoid repeated metamorphoses
=/ gall-adult (make-gall ~zod)
=/ ames-adult nec:ames-nec-bud
:: main core
::
|%
+$ gall-gate _gall-adult
+$ ames-gate _ames-adult
::
++ nec-bud
=/ a ames-nec-bud
=/ gall-nec (make-gall ~nec)
=. gall-nec (load-agent ~nec gall-nec %sub test-sub)
=/ gall-bud (make-gall ~bud)
=. gall-bud (load-agent ~bud gall-bud %pub test-pub)
:* nec=[ames=nec.a gall=gall-nec]
bud=[ames=bud.a gall=gall-bud]
==
:: +gall-check-call: run gall task, assert produces expected-moves
::
++ gall-check-call
|= $: =gall-gate
[now=@da eny=@ =roof]
[=duct task=(hobo task:gall)]
expected-moves=(list move:gall-bunt)
==
^- [tang ^gall-gate]
=/ gall-core (gall-gate now eny roof)
=^ moves gall-gate (call:gall-core duct dud=~ task)
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
::
++ gall-call
|= [=gall-gate =duct task=(hobo task:gall) =roof]
%. [duct dud=~ task]
call:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +gall-check-take: run gall sign, assert produces expected-moves
::
++ gall-check-take
|= $: =gall-gate
[now=@da eny=@ =roof]
[=wire =duct =sign-arvo]
expected-moves=(list move:gall-bunt)
==
^- [tang ^gall-gate]
=/ gall-core (gall-gate now eny roof)
=^ moves gall-gate (take:gall-core wire duct dud=~ sign-arvo)
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
::
++ gall-take
|= [=gall-gate =wire =duct =sign-arvo =roof]
%. [wire duct dud=~ sign-arvo]
take:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +ames-check-call: run gall task, assert produces expected-moves
::
++ ames-check-call
|= $: =ames-gate
[now=@da eny=@ =roof]
[=duct task=(hobo task:ames)]
expected-moves=(list move:ames-bunt)
==
^- [tang ^ames-gate]
=/ ames-core (ames-gate now eny roof)
=^ moves ames-gate (call:ames-core duct dud=~ task)
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
::
++ ames-call
|= [=ames-gate =duct task=(hobo task:ames) =roof]
%. [duct dud=~ task]
call:(ames-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
:: +ames: run ames sign, assert produces expected-moves
::
++ ames-check-take
|= $: =ames-gate
[now=@da eny=@ =roof]
[=wire =duct =sign:ames-bunt]
expected-moves=(list move:ames-bunt)
==
^- [tang ^ames-gate]
=/ ames-core (ames-gate now eny roof)
=^ moves ames-gate (take:ames-core wire duct dud=~ sign)
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
::
++ ames-scry-peer
|= $: =ames-gate
[now=@da eny=@ =roof]
our=ship
her=ship
==
^- peer-state:ames
=- ?>(?=(%known -<) ->)
!< ship-state:ames
=< q
%- need %- need
%- scry:(ames-gate now eny roof)
[~ %x [[our %$ da+now] /peers/(scot %p her)]]
::
++ gall-scry-nonce
|= $: =gall-gate
[now=@da eny=@ =roof]
our=ship
=dude:gall
sub=[=ship =term =wire]
==
^- @ud
!< @ud
=< q
%- need %- need
%- scry:(gall-gate now eny roof)
[~ %n [[our dude da+now] [(scot %p ship.sub) [term wire]:sub]]]
::
++ load-agent
|= [=ship =gall-gate =dude:gall =agent:gall]
=^ * gall-gate
(gall-call gall-gate ~[/jolt] [%jolt %base dude] *roof)
=^ * gall-gate
=/ =sign-arvo
:+ %clay %writ
`[[%a da+~1111.1.1 %base] /app/[dude]/hoon vase+!>(!>(agent))]
%: gall-take
gall-gate
/sys/cor/[dude]/(scot %p ship)/base/(scot %da ~1111.1.1)
~[/jolt]
sign-arvo
*roof
==
gall-gate
--

View File

@ -0,0 +1,36 @@
/+ default-agent, verb, dbug
::
=| state=~
%- agent:dbug
%+ verb &
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-poke
|= [=mark =vase]
(on-poke:def +<)
::
++ on-watch
|= =path
`this
::
++ on-agent
|= [=wire =sign:agent:gall]
(on-agent:def +<)
::
++ on-fail
|= [=term =tang]
(mean ':pub +on-fail' term tang)
::
++ on-leave
|= =path
`this
::
++ on-init `this
++ on-save !>(state)
++ on-load |=(old=vase `this(state !<(_state old)))
++ on-arvo on-arvo:def
++ on-peek on-peek:def
--

View File

@ -0,0 +1,47 @@
/+ default-agent, verb, dbug
::
=| state=~
%- agent:dbug
%+ verb &
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-poke
|= [=mark =vase]
=+ !<(=ship vase)
:_ this
?+ mark !!
%leave [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %leave ~]~
%watch [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~
==
::
++ on-watch
|= =path
(on-watch:def +<)
::
++ on-agent
|= [=wire =sign:agent:gall]
=/ =ship (slav %p &2.wire)
?+ -.sign !!
%fact `this
%watch-ack `this
%kick
[[%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~ this]
==
::
++ on-fail
|= [=term =tang]
(mean ':sub +on-fail' term tang)
::
++ on-leave
|= =path
`this
::
++ on-init `this
++ on-save !>(state)
++ on-load |=(old=vase `this(state !<(_state old)))
++ on-arvo on-arvo:def
++ on-peek on-peek:def
--

View File

@ -0,0 +1,12 @@
/- *aquarium
|_ af=aqua-effect
++ grad %noun
++ grow
|%
++ noun af
--
++ grab
|%
++ noun aqua-effect
--
--

View File

@ -1,23 +1,13 @@
|%
+$ bump [except=(set desk) force=_|]
--
|_ b=bump
|_ ~
++ grad %noun
++ grab
|%
++ noun bump
++ json
^- $-(^json bump)
=, dejs:format
%- ot
:~ except+(as so)
force+bo
==
++ noun ,~
++ json ul:dejs:format
--
++ grow
|%
++ noun b
++ noun ~
++ json ~
--
--

View File

@ -0,0 +1,24 @@
/- h=hood
|_ =pikes:h
++ grad %noun
++ grow
|%
++ noun pikes
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by pikes)
|= [=desk =pike:h]
:- desk
%- pairs
:~ sync/?~(sync.pike ~ =,(u.sync.pike (pairs ship/s/(scot %p ship) desk/s/desk ~)))
hash/s/(scot %uv hash.pike)
zest/s/zest.pike
wefts/a/(turn ~(tap in wic.pike) weft:enjs:h)
==
--
++ grab
|%
++ noun pikes:h
--
--

View File

@ -0,0 +1,29 @@
|%
+$ sync
[local=term =ship =desk]
--
|_ s=sync
++ grad %noun
++ grow
|%
++ noun s
++ json
%- pairs:enjs:format
:~ local+s+local.s
desk+s+desk.s
ship+s+(scot %p ship.s)
==
--
++ grab
|%
++ noun sync
++ json
^- $-(^json sync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -0,0 +1,29 @@
|%
+$ unsync
[local=term =ship =desk]
--
|_ usyc=unsync
++ grad %noun
++ grow
|%
++ noun usyc
++ json
%- pairs:enjs:format
:~ local+s+local.usyc
desk+s+desk.usyc
ship+s+(scot %p ship.usyc)
==
--
++ grab
|%
++ noun unsync
++ json
^- $-(^json unsync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -1,54 +0,0 @@
/- hood
|_ =diff:hood
++ grad %noun
++ grow
|%
++ noun diff
++ json
=, enjs:format
|^
%+ frond -.diff
?- -.diff
%block (block +.diff)
?(%merge-sunk %merge-fail) (desk-arak-err +.diff)
?(%reset %commit %suspend %revive) (desk-arak +.diff)
==
::
++ block
|= [=desk =arak:hood =weft:hood blockers=(set desk)]
%+ merge (desk-arak desk arak)
%- pairs
:~ weft+(weft:enjs:hood weft)
blockers+a+(turn ~(tap in blockers) (lead %s))
==
::
++ desk-arak
|= [=desk =arak:hood]
%- pairs
:~ desk+s+desk
arak+(arak:enjs:hood arak)
==
::
++ desk-arak-err
|= [=desk =arak:hood =tang]
%+ merge (desk-arak desk arak)
%+ frond %tang
a+(turn tang tank)
::
++ merge
|= [a=^json b=^json]
^- ^json
?> &(?=(%o -.a) ?=(%o -.b))
o+(~(uni by p.a) p.b)
--
--
++ grab
|%
++ noun diff:hood
--
--

View File

@ -1,20 +0,0 @@
/- hood
!:
|_ ark=(map desk arak:hood)
++ grad %noun
++ grow
|%
++ noun ark
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by ark)
|= [=desk =arak:hood]
[desk (arak:enjs:hood arak)]
--
::
++ grab
|%
++ noun (map desk arak:hood)
--
--

View File

@ -1,21 +0,0 @@
/- *hood
|_ vats=(list vat)
++ grad %noun
++ grow
|%
++ noun vats
++ json (vats:enjs vats)
--
++ grab
|%
++ noun (list vat)
--
--

View File

@ -7,6 +7,7 @@
+$ owners (jug owner ship)
+$ sponsors (map ship [residents=(set ship) requests=(set ship)])
+$ history (map address:ethereum (tree hist-tx))
+$ events (list event-log:rpc:ethereum)
+$ net ?(%mainnet %ropsten %local %default)
+$ snap-state [%0 =id:block:jael nas=^state:naive =owners =sponsors]
::

View File

@ -1 +1 @@
[%zuse 418]
[%zuse 417]

View File

@ -415,7 +415,7 @@
==
--
::
:: |de: axal engine
:: |of: axal engine
::
++ of
=| fat=(axal)
@ -738,7 +738,7 @@
?@ epic arvo
%= $
epic +.epic
arvo .*(arvo [%9 2 %10 [6 %1 -.epic] %0 1])
arvo .*([arvo -.epic] [%9 2 %10 [6 %0 3] %0 2])
==
::
:: +boot: event 2: bootstrap a kernel from source
@ -773,7 +773,7 @@
::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=/ compiler-tool
.*(compiler-gate [%9 2 %10 [6 %1 noun/hoon.log] %0 1])
.*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2])
::
:: switch to the second-generation compiler. we want to be
:: able to generate matching reflection nouns even if the
@ -781,7 +781,7 @@
:: generate last-generation spans for `!>`, etc.
::
~> %slog.[0 leaf+"1-d"]
=. compiler-gate .*(0 +:compiler-tool)
=. compiler-gate .*(0 +.compiler-tool)
::
:: get the span (type) of the kernel core, which is the context
:: of the compiler gate. we just compiled the compiler,
@ -791,18 +791,18 @@
::
~> %slog.[0 leaf+"1-e"]
=/ kernel-span
-:.*(compiler-gate [%9 2 %10 [6 %1 [-.compiler-tool '+>']] %0 1])
-:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2])
::
:: compile the arvo source against the kernel core.
::
~> %slog.[0 leaf+"1-f"]
=/ kernel-tool
.*(compiler-gate [%9 2 %10 [6 %1 [kernel-span arvo.log]] %0 1])
.*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2])
::
:: create the arvo kernel, whose subject is the kernel core.
::
~> %slog.[0 leaf+"1-g"]
[.*(+>:compiler-gate +:kernel-tool) epic.log]
[.*(+>.compiler-gate +.kernel-tool) epic.log]
--
::
:: |adapt
@ -1570,7 +1570,7 @@
::
%crud =? lag.zen ?& ?=(%exit mote.goof.buz)
?=(^ tang.goof.buz)
?=(%leaf -.i.tang.goof.buz) :: XX ?@
?=([%leaf *] i.tang.goof.buz)
?=(%wyrd (crip p.i.tang.goof.buz))
==
~&(%lagging &)

View File

@ -1247,10 +1247,10 @@
=| [l=(unit) r=(unit)]
|. ^- ?
?~ a &
?& ?~(l & (gor n.a u.l))
?~(r & (gor u.r n.a))
?~(l.a & ?&((mor n.a n.l.a) $(a l.a, l `n.a)))
?~(r.a & ?&((mor n.a n.r.a) $(a r.a, r `n.a)))
?& ?~(l & &((gor n.a u.l) !=(n.a u.l)))
?~(r & &((gor u.r n.a) !=(u.r n.a)))
?~(l.a & ?&((mor n.a n.l.a) !=(n.a n.l.a) $(a l.a, l `n.a)))
?~(r.a & ?&((mor n.a n.r.a) !=(n.a n.r.a) $(a r.a, r `n.a)))
==
::
++ bif :: splits a by b
@ -6245,14 +6245,14 @@
++ mure
|= tap=(trap)
^- (unit)
=/ ton (mink [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
=/ ton (mink [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?.(?=(%0 -.ton) ~ `product.ton)
:: +mute: untyped virtual
::
++ mute
|= tap=(trap)
^- (each * (list tank))
=/ ton (mock [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
=/ ton (mock [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?- -.ton
%0 [%& p.ton]
::
@ -6265,9 +6265,8 @@
::
++ slum
~/ %slum
|= [gat=* sam=*]
^- *
.*(gat [%9 2 %10 [6 %1 sam] %0 1])
|= sub=[gat=* sam=*]
.*(sub [%9 2 %10 [6 %0 3] %0 2])
:: +soft: virtual clam
::
++ soft
@ -11423,13 +11422,12 @@
==
::
++ slew :: get axis in vase
|= [axe=@ vax=vase] ^- (unit vase)
?. |- ^- ?
?: =(1 axe) &
?. ?=(^ q.vax) |
$(axe (mas axe), q.vax .*(q.vax [0 (cap axe)]))
~
`[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
|= [axe=@ vax=vase]
=/ typ |. (~(peek ut p.vax) %free axe)
|- ^- (unit vase)
?: =(1 axe) `[$:typ q.vax]
?@ q.vax ~
$(axe (mas axe), q.vax ?-((cap axe) %2 -.q.vax, %3 +.q.vax))
::
++ slim :: identical to seer?
|= old=vise ^- vase

View File

@ -1,9 +1,9 @@
:: /sys/lull
:: %lull: arvo structures
::
!:
=> ..part
|%
++ lull %329
++ lull %328
:: :: ::
:::: :: :: (1) models
:: :: ::
@ -351,6 +351,7 @@
:: %hear: packet from unix
:: %heed: track peer's responsiveness; gives %clog if slow
:: %jilt: stop tracking peer's responsiveness
:: %cork: request to delete message flow
:: %plea: request to send message
::
:: System and Lifecycle Tasks
@ -367,6 +368,7 @@
$% [%hear =lane =blob]
[%heed =ship]
[%jilt =ship]
[%cork =ship]
$>(%plea vane-task)
::
$>(%born vane-task)
@ -511,6 +513,9 @@
:: entry and emit a nack to the local vane that asked us to send
:: the message.
:: heeds: listeners for %clog notifications
:: closing: bones closed on the sender side
:: corked: bones closed on both sender and receiver
:: krocs: bones that need to be sent again to the publisher
::
+$ peer-state
$: $: =symmetric-key
@ -526,6 +531,9 @@
rcv=(map bone message-sink-state)
nax=(set [=bone =message-num])
heeds=(set duct)
closing=(set bone)
corked=(set bone)
krocs=(set bone)
==
:: $qos: quality of service; how is our connection to a peer doing?
::
@ -747,6 +755,7 @@
[%note p=@tD q=tank] :: debug message
[%ogre p=@tas] :: delete mount point
[%rule red=dict wit=dict] :: node r+w permissions
[%tire p=(each rock:tire wave:tire)] :: app state
[%writ p=riot] :: response
[%wris p=[%da p=@da] q=(set (pair care path))] :: many changes
== ::
@ -776,12 +785,16 @@
[%park des=desk yok=yoki ran=rang] :: synchronous commit
[%perm des=desk pax=path rit=rite] :: change permissions
[%pork ~] :: resume commit
[%rein des=desk ren=rein] :: extra apps
[%stir arg=*] :: debug
[%tire p=(unit ~)] :: app state subscribe
[%tomb =clue] :: tombstone specific
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
[%warp wer=ship rif=riff] :: internal file req
[%werp who=ship wer=ship rif=riff-any] :: external file req
[%wick ~] :: try upgrade
[%zest des=desk liv=zest] :: live
$>(%plea vane-task) :: ames request
== ::
:: ::
@ -814,9 +827,14 @@
[%worn =ship =desk =tako =norm] :: set commit norm
[%seek =ship =desk =cash] :: fetch source blobs
== ::
+$ cone :: domes
%+ map [ship desk] ::
[dome tom=(map tako norm) nor=norm] ::
+$ cone (map [ship desk] foam) :: domes
+$ foam ::
$: dome ::
tom=(map tako norm) ::
nor=norm ::
liv=zest ::
ren=(map dude:gall ?) ::
== ::
+$ crew (set ship) :: permissions group
+$ dict [src=path rul=real] :: effective permission
+$ dome :: project state
@ -886,6 +904,7 @@
who=(pair (set ship) (map @ta crew)) ::
== ::
+$ regs (map path rule) :: rules for paths
+$ rein (map dude:gall ?) :: extra apps
+$ riff [p=desk q=(unit rave)] :: request+desist
+$ riff-any ::
$% [%1 =riff] ::
@ -909,6 +928,9 @@
[%| p=(list a) q=(list a)] :: p -> q[chunk]
== ::
++ urge |*(a=mold (list (unce a))) :: list change
+$ waft :: kelvin range
$^ [[%1 ~] p=(set weft)] ::
weft ::
+$ whom (each ship @ta) :: ship or named crew
+$ yoki (each yuki yaki) :: commit
+$ yuki :: proto-commit
@ -921,11 +943,111 @@
r=tako :: self-reference
t=@da :: date
== ::
+$ zest $~(%dead ?(%dead %live %held)) :: how live
:: ::
++ tire :: app state
|% ::
+$ rock (map desk [=zest wic=(set weft)]) ::
+$ wave ::
$% [%wait =desk =weft] :: blocked
[%warp =desk =weft] :: unblocked
[%zest =desk =zest] :: running
== ::
::
++ wash :: patch
|= [=rock =wave]
^+ rock
?- -.wave
%wait
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(wic (~(put in wic.got) weft.wave)))
::
%warp
%- ~(run by rock)
|= [=zest wic=(set weft)]
[zest (~(del in wic) weft.wave)]
::
%zest
?: ?=(%dead zest.wave)
(~(del by rock) desk.wave)
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(zest zest.wave))
==
::
++ walk :: diff
|= [a=rock b=rock]
^- (list wave)
=/ adds (~(dif by b) a)
=/ dels (~(dif by a) b)
=/ bots (~(int by a) b)
;: welp
^- (list wave)
%- zing
%+ turn ~(tap by adds)
|= [=desk =zest wic=(set weft)]
^- (list wave)
:- [%zest desk zest]
%+ turn ~(tap in wic)
|= =weft
[%wait desk weft]
::
^- (list wave)
%+ turn ~(tap by dels)
|= [=desk =zest wic=(set weft)]
^- wave
[%zest desk %dead]
::
^- (list wave)
%- zing
%+ turn ~(tap by bots)
|= [=desk * *]
^- (list wave)
=/ aa (~(got by a) desk)
=/ bb (~(got by b) desk)
=/ wadds (~(dif in wic.bb) wic.aa)
=/ wdels (~(dif in wic.aa) wic.bb)
;: welp
?: =(zest.aa zest.bb)
~
[%zest desk zest.bb]~
::
%+ turn ~(tap by wadds)
|= =weft
^- wave
[%wait desk weft]
::
%+ turn ~(tap by wdels)
|= =weft
^- wave
[%warp desk weft]
==
==
--
::
:: +page-to-lobe: hash a page to get a lobe.
::
++ page-to-lobe |=(page (shax (jam +<)))
::
++ cord-to-waft
|= =cord
^- waft
=/ wefts=(list weft)
%+ turn (rash cord (star (ifix [gay gay] tall:vast)))
|= =hoon
!<(weft (slap !>(~) hoon))
?: ?=([* ~] wefts)
i.wefts
[[%1 ~] (sy wefts)]
::
++ waft-to-wefts
|= kal=waft
^- (set weft)
?^ -.kal
p.kal
[kal ~ ~]
::
:: +make-yaki: make commit out of a list of parents, content, and date.
::
++ make-yaki
@ -1650,16 +1772,20 @@
[%sear =ship] :: clear pending queues
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
[%load =load] :: load agent
[%nuke =dude] :: delete agent
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
[%rake dude=(unit dude) all=?] :: reclaim old subs
$>(%init vane-task) :: set owner
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
$>(%plea vane-task) :: network request
[%spew veb=(list verb)] :: set verbosity
[%sift dudes=(list dude)] :: per agent
== ::
+$ bitt (map duct (pair ship path)) :: incoming subs
+$ boat :: outgoing subs
%+ map [=wire =ship =term] ::
[acked=? =path] ::
+$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs
+$ boar (map [=wire =ship =term] nonce=@) :: and their nonces
+$ bowl :: standard app state
$: $: our=ship :: host
src=ship :: guest
@ -1675,6 +1801,7 @@
== == ::
+$ dude term :: server identity
+$ gill (pair ship term) :: general contact
+$ load (list [=dude =beak =agent]) :: loadout
+$ scar :: opaque duct
$: p=@ud :: bone sequence
q=(map duct bone) :: by duct
@ -1695,6 +1822,9 @@
$% [%raw-fact =mark =noun]
sign:agent
==
:: TODO: add more flags?
::
+$ verb ?(%odd)
::
:: +agent: app core
::
@ -2112,10 +2242,11 @@
$~ [%vega ~] ::
$% $>(%born vane-task) :: new unix process
[%done ~] :: socket closed
:: XX mark ignored
::
:: TODO mark ignored ::
:: ::
[%fard p=(fyrd cage)] :: in-arvo thread
[%fyrd p=(fyrd cast)] :: external thread
[%lard =bear =shed] :: inline thread
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
== ::
@ -2124,8 +2255,200 @@
+$ bear $@(desk beak) :: partial $beak
+$ cast (pair mark page) :: output mark + input
++ fyrd |$ [a] [=bear name=term args=a] :: thread run request
:: ::
+$ shed _*form:(strand:rand ,vase) :: compute vase
-- ::khan
::
++ rand :: computation
|%
+$ card card:agent:gall
+$ input
$% [%poke =cage]
[%sign =wire =sign-arvo]
[%agent =wire =sign:agent:gall]
[%watch =path]
==
+$ strand-input [=bowl in=(unit input)]
+$ tid @tatid
+$ bowl
$: our=ship
src=ship
tid=tid
mom=(unit tid)
wex=boat:gall
sup=bitt:gall
eny=@uvJ
now=@da
byk=beak
==
::
:: cards: cards to send immediately. These will go out even if a
:: later stage of the computation fails, so they shouldn't have
:: any semantic effect on the rest of the system.
:: Alternately, they may record an entry in contracts with
:: enough information to undo the effect if the computation
:: fails.
:: wait: don't move on, stay here. The next sign should come back
:: to this same callback.
:: skip: didn't expect this input; drop it down to be handled
:: elsewhere
:: cont: continue computation with new callback.
:: fail: abort computation; don't send effects
:: done: finish computation; send effects
::
++ strand-output-raw
|* a=mold
$~ [~ %done *a]
$: cards=(list card)
$= next
$% [%wait ~]
[%skip ~]
[%cont self=(strand-form-raw a)]
[%fail err=(pair term tang)]
[%done value=a]
==
==
::
++ strand-form-raw
|* a=mold
$-(strand-input (strand-output-raw a))
::
:: Abort strand computation with error message
::
++ strand-fail
|= err=(pair term tang)
|= strand-input
[~ %fail err]
::
:: Asynchronous transcaction monad.
::
:: Combo of four monads:
:: - Reader on input
:: - Writer on card
:: - Continuation
:: - Exception
::
++ strand
|* a=mold
|%
++ output (strand-output-raw a)
::
:: Type of an strand computation.
::
++ form (strand-form-raw a)
::
:: Monadic pure. Identity computation for bind.
::
++ pure
|= arg=a
^- form
|= strand-input
[~ %done arg]
::
:: Monadic bind. Combines two computations, associatively.
::
++ bind
|* b=mold
|= [m-b=(strand-form-raw b) fun=$-(b form)]
^- form
|= input=strand-input
=/ b-res=(strand-output-raw b)
(m-b input)
^- output
:- cards.b-res
?- -.next.b-res
%wait [%wait ~]
%skip [%skip ~]
%cont [%cont ..$(m-b self.next.b-res)]
%fail [%fail err.next.b-res]
%done [%cont (fun value.next.b-res)]
==
::
:: The strand monad must be evaluted in a particular way to maintain
:: its monadic character. +take:eval implements this.
::
++ eval
|%
:: Indelible state of a strand
::
+$ eval-form
$: =form
==
::
:: Convert initial form to eval-form
::
++ from-form
|= =form
^- eval-form
form
::
:: The cases of results of +take
::
+$ eval-result
$% [%next ~]
[%fail err=(pair term tang)]
[%done value=a]
==
::
++ validate-mark
|= [in=* =mark =bowl]
^- cage
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[mark]
==
=/ res (mule |.((vale.dais in)))
?: ?=(%| -.res)
~| %spider-mark-fail
(mean leaf+"spider: ames vale fail {<mark>}" p.res)
[mark p.res]
::
:: Take a new sign and run the strand against it
::
++ take
:: cards: accumulate throughout recursion the cards to be
:: produced now
=| cards=(list card)
|= [=eval-form =strand-input]
^- [[(list card) =eval-result] _eval-form]
=* take-loop $
=. in.strand-input
?~ in.strand-input ~
=/ in u.in.strand-input
?. ?=(%agent -.in) `in
?. ?=(%fact -.sign.in) `in
::
:- ~
:^ %agent wire.in %fact
(validate-mark q.q.cage.sign.in p.cage.sign.in bowl.strand-input)
:: run the strand callback
::
=/ =output (form.eval-form strand-input)
:: add cards to cards
::
=. cards
%+ welp
cards
:: XX add tag to wires?
cards.output
:: case-wise handle next steps
::
?- -.next.output
%wait [[cards %next ~] eval-form]
%skip [[cards %next ~] eval-form]
%fail [[cards %fail err.next.output] eval-form]
%done [[cards %done value.next.output] eval-form]
%cont
:: recurse to run continuation with initialization input
::
%_ take-loop
form.eval-form self.next.output
strand-input [bowl.strand-input ~]
==
==
--
--
-- ::strand
::
+$ gift-arvo :: out result <-$
$~ [%doze ~]
$% gift:ames

File diff suppressed because it is too large Load Diff

View File

@ -45,60 +45,64 @@
|= [[now=@da =duct] state=behn-state]
::
|%
:: %entry-points
::
:: +born: urbit restarted; refresh :next-wake and store wakeup timer duct
+| %helpers
::
++ born set-unix-wake(next-wake.state ~, unix-duct.state duct)
:: +crud: handle failure of previous arvo event
::
++ crud
|= [tag=@tas error=tang]
++ this .
++ emit |=(m=move this(moves [m moves]))
++ abet
^+ [moves state]
:: behn must get activated before other vanes in a %wake
:: moves are statefully pre-flopped to ensure that
:: any prepended %doze is emitted first
::
?. =(%wake tag)
~& %behn-crud-not-wake^tag
[[duct %slip %d %flog %crud tag error]~ state]
=. moves (flop moves)
=/ new=(unit @da) (bind (pry:timer-map timers.state) head)
:: emit %doze if needed
::
?: =(~ timers.state)
~|(%behn-crud-no-timer^tag^error !!)
=? ..this
?~ unix-duct.state |
=/ dif=[old=(unit @da) new=(unit @da)] [next-wake.state new]
?+ dif ~|([%unpossible dif] !!)
[~ ~] | :: no-op
[~ ^] & :: set
[^ ~] & :: clear
[^ ^] !=(u.old.dif u.new.dif) :: set if changed
==
(emit(next-wake.state new) [unix-duct.state %give %doze new])
::
(wake `error)
:: +rest: cancel the timer at :date, then adjust unix wakeup
:: +wait: set a new timer at :date, then adjust unix wakeup
[moves state]
::
++ rest |=(date=@da set-unix-wake(timers.state (unset-timer [date duct])))
++ wait |=(date=@da set-unix-wake(timers.state (set-timer [date duct])))
:: +huck: give back immediately
+| %entry-points
::
:: Useful if you want to continue working after other moves finish.
++ call
|= [=task error=(unit tang)]
^+ this
?: ?& ?=(^ error)
!?=(%wake -.task)
==
:: XX more and better error handling
::
++ huck
|= syn=sign-arvo
=< [moves state]
event-core(moves [duct %give %heck syn]~)
:: +drip: XX
~& %behn-crud-not-wake^-.task
(emit [duct %slip %d %flog %crud -.task u.error])
::
++ drip
|= mov=vase
=< [moves state]
^+ event-core
=. moves
[duct %pass /drip/(scot %ud count.drips.state) %b %wait +(now)]~
=. movs.drips.state
(~(put by movs.drips.state) count.drips.state mov)
=. count.drips.state +(count.drips.state)
event-core
:: +take-drip: XX
?- -.task
%born this(next-wake.state ~, unix-duct.state duct)
%drip (drip p.task)
%huck (emit [duct %give %heck syn.task])
%rest this(timers.state (unset-timer [p.task duct]))
%trim this
%vega this
%wait this(timers.state (set-timer [p.task duct]))
%wake (wake(next-wake.state ~) error)
==
::
:: +take-drip: the future is now, %give the deferred move
::
++ take-drip
|= [num=@ud error=(unit tang)]
=< [moves state]
^+ event-core
^+ this
=/ drip (~(got by movs.drips.state) num)
=. movs.drips.state (~(del by movs.drips.state) num)
=/ =move
%- emit(movs.drips.state (~(del by movs.drips.state) num))
=/ card [%give %meta drip]
?~ error
[duct card]
@ -108,98 +112,45 @@
:: [duct %hurl fail/tang card]
::
[duct %pass /drip-slog %d %flog %crud %drip-fail tang]
event-core(moves [move moves])
:: +trim: in response to memory pressue
::
++ trim [moves state]
:: +vega: learn of a kernel upgrade
+| %tasks
::
++ vega [moves state]
:: +wake: unix says wake up; process the elapsed timer and set :next-wake
:: +drip: enqueue a future gift (as a vase), %pass ourselves a %wait
::
++ drip
|= vax=vase
^+ this
%. [duct %pass /drip/(scot %ud count.drips.state) %b %wait +(now)]
%= emit
movs.drips.state (~(put by movs.drips.state) count.drips.state vax)
count.drips.state +(count.drips.state)
==
::
:: +wake: unix says wake up; process the elapsed timer (or forward error)
::
++ wake
|= error=(unit tang)
^+ [moves state]
^+ this
?: =(~ timers.state)
:: no-op on spurious but innocuous unix wakeups
::
?: =(~ timers.state)
~? ?=(^ error) %behn-wake-no-timer^u.error
[moves state]
:: if we errored, pop the timer and notify the client vane of the error
::
?^ error
=< set-unix-wake
=^ =timer timers.state pop-timer
(emit-vane-wake duct.timer error)
:: if unix woke us too early, retry by resetting the unix wakeup timer
::
this
=/ [=timer later-timers=_timers.state] pop-timer
?: (gth date.timer now)
set-unix-wake(next-wake.state ~)
:: pop first timer, tell vane it has elapsed, and adjust next unix wakeup
:: no-op if timer is early, (+abet will reset)
::
=< set-unix-wake
(emit-vane-wake(timers.state later-timers) duct.timer ~)
:: %utilities
this
:: pop the first timer and notify client vane,
:: forwarding error if present
::
::+|
:: XX %wake errors should be signaled out-of-band
:: [duct.timer %hurl goof %give %wake ~]
::
++ event-core .
:: +emit-vane-wake: produce a move to wake a vane; assumes no prior moves
(emit(timers.state later-timers) [duct.timer %give %wake error])
::
++ emit-vane-wake
|= [=^duct error=(unit tang)]
event-core(moves [duct %give %wake error]~)
:: +emit-doze: set new unix wakeup timer in state and emit move to unix
+| %implementation
::
:: We prepend the unix %doze event so that it is handled first. Arvo must
:: handle this first because the moves %behn emits will get handled in
:: depth-first order. If we're handling a %wake which causes a move to a
:: different vane and a %doze event to send to unix, Arvo needs to process
:: the %doze first because otherwise if the move to the other vane calls
:: back into %behn and emits a second %doze, the second %doze would be
:: handled by unix first which is incorrect.
::
++ emit-doze
|= =date=(unit @da)
^+ event-core
:: no-op if .unix-duct has not yet been set
::
?~ unix-duct.state
event-core
:: make sure we don't try to wake up in the past
::
=? date-unit ?=(^ date-unit) `(max now u.date-unit)
::
%_ event-core
next-wake.state date-unit
moves [[unix-duct.state %give %doze date-unit] moves]
==
:: +set-unix-wake: set or unset next unix wakeup timer based on :i.timers
::
++ set-unix-wake
=< [moves state]
~% %set-unix-wake ..part ~ |-
^+ event-core
::
=* next-wake next-wake.state
=* timers timers.state
:: if no timers, cancel existing wakeup timer or no-op
::
=/ first=(unit [date=@da *]) (pry:timer-map timers.state)
?~ first
?~ next-wake
event-core
(emit-doze ~)
:: if :next-wake is in the past or not soon enough, reset it
::
?^ next-wake
?: &((gte date.u.first u.next-wake) (lte now u.next-wake))
event-core
(emit-doze `date.u.first)
:: there was no unix wakeup timer; set one
::
(emit-doze `date.u.first)
:: +pop-timer: dequeue and produce earliest timer
::
++ pop-timer
@ -267,27 +218,10 @@
wrapped-task=(hobo task)
==
^- [(list move) _behn-gate]
::
=/ =task ((harden task) wrapped-task)
=/ event-core (per-event [now hen] state)
::
=^ moves state
::
:: handle error notifications
::
?^ dud
(crud:event-core -.task tang.u.dud)
::
?- -.task
%born born:event-core
%rest (rest:event-core date=p.task)
%drip (drip:event-core move=p.task)
%huck (huck:event-core syn.task)
%trim trim:event-core
%vega vega:event-core
%wait (wait:event-core date=p.task)
%wake (wake:event-core error=~)
==
abet:(call:event-core task ?~(dud ~ `tang.u.dud))
[moves behn-gate]
:: +load: migrate an old state to a new behn version
::
@ -378,6 +312,6 @@
?> ?=([%drip @ ~] tea)
=/ event-core (per-event [now hen] state)
=^ moves state
(take-drip:event-core (slav %ud i.t.tea) error.hin)
abet:(take-drip:event-core (slav %ud i.t.tea) error.hin)
[moves behn-gate]
--

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@
$> $? %merg :: merge desks
%perm :: change permissions
%warp :: wait for clay hack
%zest ::
== ::
task:clay ::
== ::
@ -52,10 +53,7 @@
task:dill ::
== ::
$: %g ::
$> $? %jolt ::
%deal ::
== ::
task:gall ::
$>(%deal task:gall) ::
== ::
$: %j ::
$> $? %dawn ::
@ -221,7 +219,7 @@
^+ .
=/ myt (flop (fall tem ~))
=. tem ~
=. ..mere (pass / %g %jolt %base ram)
=. ..mere (pass /zest %c %zest %base %live)
=. ..mere (show-desk %kids)
=. ..mere drum-watch
|- ^+ ..mere
@ -247,14 +245,6 @@
|= des=desk
(pass /show [%c %perm des / r+`[%black ~]])
::
++ kiln-install
|= [loc=desk =ship rem=desk]
(deal /install %poke %kiln-install !>([loc ship rem]))
::
++ kiln-sync
|= [loc=desk =ship rem=desk]
(deal /sync %poke %kiln-sync !>([loc ship rem]))
::
++ take :: receive
|= [tea=wire sih=sign]
^+ +>

View File

@ -551,6 +551,18 @@
(easy ~)
==
==
:: +host-sans-port: strip the :<port> from a host string
::
++ host-sans-port
;~ sfix
%+ cook crip
%- star
;~ less
;~(plug col (punt dem) ;~(less next (easy ~)))
next
==
(star next)
==
:: +per-server-event: per-event server core
::
++ per-server-event
@ -602,6 +614,31 @@
[action [authenticated secure address request] ~ 0]
=. connections.state
(~(put by connections.state) duct connection)
:: redirect to https if insecure, redirects enabled
:: and secure port live
::
?: ?& !secure
redirect.http-config.state
?=(^ secure.ports.state)
==
=/ location=@t
%+ rap 3
:~ 'https://'
(rash (fall host '') host-sans-port)
?: =(443 u.secure.ports.state)
''
(crip ":{(a-co:co u.secure.ports.state)}")
?: ?=([[~ ~] ~] (parse-request-line url.request))
'/'
url.request
==
%- handle-response
:* %start
:- status-code=301
headers=['location' location]~
data=~
complete=%.y
==
:: figure out whether this is a cors request,
:: whether the origin is approved or not,
:: and maybe add it to the "pending approval" set
@ -1228,7 +1265,7 @@
:: the request may include a 'Last-Event-Id' header
::
=/ maybe-last-event-id=(unit @ud)
?~ maybe-raw-header=(get-header:http 'Last-Event-ID' header-list.request)
?~ maybe-raw-header=(get-header:http 'last-event-id' header-list.request)
~
(rush u.maybe-raw-header dum:ag)
:: flush events older than the passed in 'Last-Event-ID'
@ -2178,7 +2215,7 @@
:: XX cancel active too if =(0 trim-priority) ?
::
?: ?=(%trim -.task)
=/ event-args [[eny duct now rof] server-state.ax]
=* event-args [[eny duct now rof] server-state.ax]
=* by-channel by-channel:(per-server-event event-args)
=* channel-state channel-state.server-state.ax
::
@ -2272,6 +2309,10 @@
::
%live
=. ports.server-state.ax +.task
:: enable http redirects if https port live and cert set
::
=. redirect.http-config.server-state.ax
&(?=(^ secure.task) ?=(^ secure.http-config.server-state.ax))
[~ http-server-gate]
:: %rule: updates our http configuration
::
@ -2284,6 +2325,10 @@
?: =(secure.config cert.http-rule.task)
[~ http-server-gate]
=. secure.config cert.http-rule.task
=. redirect.config
?& ?=(^ secure.ports.server-state.ax)
?=(^ cert.http-rule.task)
==
:_ http-server-gate
=* out-duct outgoing-duct.server-state.ax
?~ out-duct ~
@ -2534,6 +2579,12 @@
++ load
|= old=axle
^+ ..^$
:: enable https redirects if certificate configured
::
=. redirect.http-config.server-state.old
?& ?=(^ secure.ports.server-state.old)
?=(^ secure.http-config.server-state.old)
==
..^$(ax old)
:: +stay: produce current state
::

File diff suppressed because it is too large Load Diff

View File

@ -306,28 +306,6 @@
%^ poke-watch hen %azimuth
%+ fall node.tac
(need (de-purl:html 'http://eth-mainnet.urbit.org:8545'))
=. +>.$
:: get everything from /app/azimuth because jael subscriptions
:: seem to be flaky for now
::
?: &
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
::
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
::
*
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen now pki etn)
(silt (turn spon-points head))
[%| %azimuth]
%- curd =< abet
(sources:~(feel su hen now pki etn) ~ [%& (need spon-ship)])
==
::
=. moz
%+ weld moz
@ -391,7 +369,7 @@
:: [%listen whos=(set ship) =source]
::
%listen
~& [%jael-listen whos source]:tac
:: %- (slog leaf+"jael: listen {<whos.tac>} {<source.tac>}" ~)
%- curd =< abet
(sources:~(feel su hen now pki etn) [whos source]:tac)
::
@ -484,12 +462,12 @@
:: [%vega ~]
::
%vega
+>.$::
+>.$
::
:: in response to memory pressure
:: [%trim p=@ud]
::
%trim
::TODO consider %ruin-ing long-offline comets
+>.$
::
:: watch private keys
@ -758,12 +736,10 @@
++ subscribers-on-ship
|= =ship
^- (set duct)
=/ specific-subs (~(get ju ney.zim) ship)
=/ general-subs=(set duct)
?: ?=(?(%czar %king %duke) (clan:title ship))
nel.zim
~
(~(uni in specific-subs) general-subs)
:: union of general and ship-specific subs
::
%- ~(uni in nel.zim)
(~(get ju ney.zim) ship)
::
++ feed
|_ :: hen: subscription source
@ -1019,7 +995,7 @@
=| lex=state-2
|= $: :: now: current time
:: eny: unique entropy
:: ski: namespace resolver
:: rof: namespace resolver
::
now=@da
eny=@uvJ

View File

@ -102,15 +102,15 @@
=/ =beam (need (de-beam t.wire))
?>(?=([@ ~] s.beam) beam(s i.s.beam))
::
++ start-spider
|= =vase
^- note
[%g %deal [our our] %spider %poke %spider-start vase]
++ poke-spider
|= [hen=duct =cage]
^- move
[hen %pass //g %g %deal [our our] %spider %poke cage]
::
++ watch-spider
|= =path
^- note
[%g %deal [our our] %spider %watch path]
|= [hen=duct =path]
^- move
[hen %pass //g %g %deal [our our] %spider %watch path]
--
=| khan-state
=* state -
@ -134,22 +134,8 @@
%born
[~ khan-gate(hey hen, tic 0)]
::
%fard
=/ tid=@ta
%^ cat 3
'khan-fyrd--'
(scot %uv (sham (mix tic eny)))
=. tic +(tic)
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
=/ args [~ `tid beak name.fyd q.args.fyd]
:_ khan-gate
%+ turn
:~ (watch-spider /thread-result/[tid])
(start-spider !>(args))
==
|=(=note ^-(move [hen %pass //g note]))
::
%fard (bard hen 'khan-fyrd--' bear.p.task %| [name args]:p.task)
%lard (bard hen 'khan-lard--' bear.task %& shed.task)
%fyrd
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
@ -160,6 +146,23 @@
=- [[hen %pass wire -]~ khan-gate]
[%k %fard bear.fyd name.fyd p.q.args.fyd vase]
==
::
++ bard
|= [hen=duct prefix=@ta =bear payload=(each shed [name=term args=cage])]
^- [(list move) _khan-gate]
=/ =tid:rand (cat 3 prefix (scot %uv (sham (mix tic eny))))
=/ =beak (get-beak bear now)
=/ =cage
?- -.payload
%& [%spider-inline !>([~ `tid beak p.payload])]
%| [%spider-start !>([~ `tid beak [name q.args]:p.payload])]
==
=. tic +(tic)
:_ khan-gate
:~ (watch-spider hen /thread-result/[tid])
(poke-spider hen cage)
==
::
:: +load: migrate an old state to a new khan version
::
++ load
@ -195,7 +198,7 @@
?+ p.cag ~&(bad-fact+p.cag !!)
%thread-fail
=/ =tang !<(tang q.cag)
%- (slog 'khan-fact' tang)
:: %- (slog 'khan-fact' tang)
[hen %give %arow %| p.cag tang]~
::
%thread-done

View File

@ -4,7 +4,7 @@
=> ..lull
~% %zuse ..part ~
|%
++ zuse %418
++ zuse %417
:: :: ::
:::: :: :: (2) engines
:: :: ::

View File

@ -0,0 +1,15 @@
/- spider, *dice
/+ strand, strandio, naive, dice
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=/ url=tape
?~ lur=!<((unit tape) arg)
"https://bootstrap.urbit.org/mainnet.azimuth-snapshot"
u.lur
;< =cord bind:m (fetch-cord:strandio url)
=+ ;;(snap=snap-state (cue cord))
;< ~ bind:m (poke-our:strandio %azimuth %azimuth-poke !>([%load snap]))
(pure:m !>(~))

View File

@ -30,12 +30,12 @@
?. good
%+ strand-fail:strandio %bail-early-self-check
[>"couldn't access ship on port 80"< ~]
;< our=@p bind:m get-our:strandio
;< ~ bind:m (watch:strandio /response collector-app /(scot %p our))
;< ~ bind:m (poke:strandio collector-app %dns-address !>([%if if]))
=/ msg=cord
(cat 3 'request for DNS sent to ' (scot %p p:collector-app))
;< ~ bind:m (app-message:strandio %dns msg ~)
;< our=@p bind:m get-our:strandio
;< ~ bind:m (watch:strandio /sub collector-app /(scot %p our))
=/ msg=cord
(cat 3 'awaiting response from ' (scot %p p:collector-app))
;< ~ bind:m (app-message:strandio %dns msg ~)
@ -45,7 +45,7 @@
=/ m (strand ,~)
^- form:m
;< our=ship bind:m get-our:strandio
;< =cage bind:m (take-fact:strandio /(scot %p our))
;< =cage bind:m (take-fact:strandio /response)
?> ?=(%dns-binding p.cage)
=/ =binding:dns !<(binding:dns q.cage)
;< good=? bind:m (turf-confirm-install:libdns turf.binding)

View File

@ -33,10 +33,6 @@
naive,
naive-tx=naive-transactions,
*strandio
:: starting snapshot. this may not be the right starting point once we have
:: clay tombstoning and the snapshot may be updated
::
/* snap %azimuth-snapshot /app/azimuth/version-0/azimuth-snapshot
::
=, strand=strand:spider
=, jael
@ -103,7 +99,11 @@
;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ [naive-contract=address chain-id=@]
[naive chain-id]:(get-network:dice net)
=/ snap=snap-state:dice snap
;< =bowl:spider bind:m get-bowl
=/ snap=snap-state:dice
.^ snap-state:dice %gx
/(scot %p our.bowl)/azimuth/(scot %da now.bowl)/last-snap/noun
==
::
;< ~ bind:m
%- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs "

View File

@ -44,10 +44,6 @@
%+ turn ~(tap by paths-to-tests)
|= [=path test-arms=(list test-arm)]
^- (list test)
:: strip off leading 'tests' from :path
::
?. ?=([%tests *] path) ~
=/ path t.path ::NOTE TMI
:: for each test, add the test's name to :path
::
%+ turn test-arms
@ -108,7 +104,16 @@
|= arg=vase
=/ m (strand ,vase)
^- form:m
;< =bowl:strand bind:m get-bowl:strandio
=/ paz=(list path)
:: if no args, test everything under /=base=/tests
::
?~ q.arg
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
:: else cast path to ~[path] if needed
::
?@ +<.q.arg
[(tail !<([~ path] arg)) ~]
(tail !<([~ (list path)] arg))
=/ bez=(list beam)
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))

View File

@ -739,19 +739,19 @@
++ gen-rut-jar
^~ ^- (jar @p event)
=/ filter ;: cork
(cury filter-owner %.y)
::(cury filter-owner %.y)
::(cury filter-proxy %spawn)
(cury filter-nonce %.y)
::(cury filter-nonce %.y)
::(cury filter-rank %galaxy)
::(cury filter-dominion %l1)
%- cury
:- filter-tx-type
:* ::%spawn
::%transfer-point
:* %spawn
%transfer-point
%configure-keys
::%set-management-proxy
::%set-spawn-proxy
::%set-transfer-proxy
%set-management-proxy
%set-spawn-proxy
%set-transfer-proxy
~
==
==

View File

@ -1,21 +1,33 @@
:: Test that these hints do not crash the runtime
:: there is no need to include the hints for dynamic %bout
:: there is no need to include a test for dynamic %bout
:: since all hoon tests exersize dynamic %bout
|%
:: these test that the hilt-trace hints
:: test that these trace hints
:: are safe to run or ignore
++ test-hela-hilt
++ test-hilt-hela
~> %hela
~
++ test-nara-hilt
++ test-hint-hela
~> %hela.[1 leaf+"test-hint-hela ~"]
~
++ test-hilt-nara
~> %nara
~
:: these test that the hint-trace hints
:: are safe to run or ignore
++ test-hela-hint
~> %hela.[1 leaf+"test-hela-trace-hint"]
++ test-hint-nara
~> %nara.[1 leaf+"test-hint-nara ~"]
~
++ test-nara-hint
~> %nara.[1 leaf+"test-nara-trace-hint"]
:: test that theses bytecode-report hints
:: are safe to run or ignore
++ test-hilt-xray
~> %xray
~
++ test-hint-xray
~> %xray.[1 leaf+"test-hint-xray ~"]
~
:: test that the hilt bout hint
:: is safe to run or ignore
++ test-hilt-bout
~> %bout
~
--

505
pkg/arvo/tests/sys/grq.hoon Normal file
View File

@ -0,0 +1,505 @@
:: test gall subscription nonce incrementation and ames flow killing
::
:: /+ *test, v=test-ames-gall
:: |%
:: ++ test-watch
:: %- run-chain
:: |. :- %|
:: =+ nec-bud:v
:: :: uncomment to turn on verbose debug output
:: ::=^ * ames.nec
:: :: (ames-call:v ames.nec ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
:: ::=^ * ames.bud
:: :: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
:: :: poke %sub to tell it to subscribe
:: =/ =task:gall [%deal [~nec ~nec] %sub %poke watch+!>(~bud)]
:: =^ t1 gall.nec
:: %: gall-check-call:v gall.nec
:: [~1111.1.1 0xdead.beef *roof]
:: [~[/foo] task]
:: :~ :- ~[/foo] [%give %unto %poke-ack ~]
:: :- ~[/init]
:: :* %pass /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: [%g %deal [~nec ~bud] %pub %watch /foo]
:: == ==
:: ==
:: :- t1 |. :- %|
:: :: handle gall passing the %watch to itself, which passes to ames
:: =^ t2 gall.nec
:: %: gall-check-call:v gall.nec
:: [~1111.1.1 0xdead.beef *roof]
:: :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%deal [~nec ~bud] %pub %watch /foo]
:: :~ :- ~[/init] [%pass /sys/lag %a %heed ~bud]
:: :- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
:: :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
:: ==
:: ==
:: :- t2 |. :- %|
:: :: subscriber ames handles %plea from gall, gives a packet to vere
:: =^ t3 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.1 0xdead.beef *roof]
:: :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%plea ~bud %g /ge/pub [%0 %s /foo]]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~bud]
:: 0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
:: 2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
:: 8a00.0200.0132.8fd4.f000
:: ==
:: :- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.1..00.00.01]
:: ==
:: ==
:: :- t3 |. :- %|
:: :: publisher ames hears %watch, passes to gall
:: =^ t4 ames.bud
:: %: ames-check-call:v ames.bud
:: [~1111.1.2 0xbeef.dead *roof]
:: :- ~[//unix]
:: :* %hear [%& ~nec]
:: 0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
:: 2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
:: 8a00.0200.0132.8fd4.f000
:: ==
:: :~ :- ~[//unix] [%pass /qos %d %flog %text "; ~nec is your neighbor"]
:: :- ~[//unix]
:: [%pass /bone/~nec/0/1 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
:: ==
:: ==
:: :- t4 |. :- %|
:: :: publisher gall hears %watch from ames, passes to itself
:: =^ t5 gall.bud
:: %: gall-check-call:v gall.bud
:: [~1111.1.2 0xbeef.dead *roof]
:: :- ~[/bone/~nec/0/1 //unix]
:: [%plea ~nec %g /ge/pub [%0 %s /foo]]
:: :~ :- ~[/init] [%pass /sys/lag %a %heed ~nec]
:: :- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
:: :- ~[/bone/~nec/0/1 //unix]
:: [%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
:: ==
:: ==
:: :- t5 |. :- %|
:: :: publisher gall runs %pub with %watch, gives ack to itself
:: =^ t6 gall.bud
:: %: gall-check-call:v gall.bud
:: [~1111.1.2 0xbeef.dead *roof]
:: :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
:: [%deal [~nec ~bud] %pub %watch /foo]
:: :~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
:: [%give %unto %watch-ack ~]
:: ==
:: ==
:: :- t6 |. :- %|
:: :: gall gives ack to ames
:: =^ t7 gall.bud
:: %: gall-check-take:v gall.bud
:: [~1111.1.2 0xbeef.dead *roof]
:: :+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
:: [%gall %unto %watch-ack ~]
:: :~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
:: ==
:: ==
:: :- t7 |. :- %|
:: :: publisher ames hears ack from gall, sends over the network
:: =^ t8 ames.bud
:: %: ames-check-take:v ames.bud
:: [~1111.1.2 0xbeef.dead *roof]
:: :+ /bone/~nec/0/1 ~[//unix]
:: [%gall %done ~]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~nec]
:: 0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
:: 2d9d.076e.6d00.0100.0223.9ae9.5000
:: == ==
:: ==
:: :- t8 |. :- %|
:: :: subscriber ames hears watch-ack packet, gives to gall
:: =^ t9 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.3 0xdead.beef *roof]
:: :- ~[//unix]
:: :* %hear [%& ~bud]
:: 0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
:: 2d9d.076e.6d00.0100.0223.9ae9.5000
:: ==
:: :~ :- ~[//unix] [%pass /qos %d %flog %text "; ~bud is your neighbor"]
:: :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%give %done ~]
:: :- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.01]
:: ==
:: ==
:: :- t9 |. :- %|
:: :: gall gives %done to itself
:: =^ t10 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.3 0xdead.beef *roof]
:: :+ /sys/way/~bud/pub
:: ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%ames %done ~]
:: :~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%give %unto %watch-ack ~]
:: ==
:: ==
:: :- t10 |. :- %|
:: :: gall gives watch-ack to itself
:: =^ t11 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.3 0xdead.beef *roof]
:: :+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: ~[/init]
:: [%gall %unto %watch-ack ~]
:: ~
:: ==
:: :- t11 |. :- %|
:: :: start the clog and kick process; give clog to publisher gall
:: =^ t12 gall.bud
:: %: gall-check-take:v gall.bud
:: [~1111.1.4 0xbeef.dead *roof]
:: :+ /sys/lag ~[/init]
:: [%ames %clog ~nec]
:: :~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
:: [%give %unto %kick ~]
:: ==
:: ==
:: :- t12 |. :- %|
:: :: gall gives %kick %boon to ames
:: =^ t13 gall.bud
:: %: gall-check-take:v gall.bud
:: [~1111.1.4 0xbeef.dead *roof]
:: :+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
:: [%gall %unto %kick ~]
:: :~ :- ~[/bone/~nec/0/1 //unix] [%give %boon %x ~]
:: ==
:: ==
:: :- t13 |. :- %|
:: :: ames gives kick over the network
:: =^ t14 ames.bud
:: %: ames-check-take:v ames.bud
:: [~1111.1.4 0xbeef.dead *roof]
:: :+ /bone/~nec/0/1 ~[//unix]
:: [%gall %boon %x ~]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~nec]
:: 0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
:: 4ca0.801d.3ddc.d400.0100.0223.bc18.1000
:: ==
:: :- ~[/ames] [%pass /pump/~nec/1 %b %wait ~1111.1.4..00.00.01]
:: ==
:: ==
:: :- t14 |. :- %|
:: :: subscriber ames receives kick, gives to gall and gives ack to unix
:: =^ t15 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :- ~[//unix]
:: :* %hear [%& ~bud]
:: 0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
:: 4ca0.801d.3ddc.d400.0100.0223.bc18.1000
:: ==
:: :~ :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%give %boon %x ~]
:: :- ~[//unix]
:: :* %give %send [%& ~bud]
:: 0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
:: 9de0.3906.b678.6e00.0200.0132.e55d.5000
:: == ==
:: ==
:: :- t15 |. :- %|
:: :: subscriber gall receives kick %boon from ames, gives to self
:: =^ t16 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :+ /sys/way/~bud/pub
:: ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%ames %boon %x ~]
:: :~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%give %unto %kick ~]
:: :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
:: [%pass /sys/way/~bud/pub %a %cork ~bud]
:: ==
:: ==
:: :: subscriber gall receives %kick from itself
:: =^ t17 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: ~[/init]
:: [%gall %unto %kick ~]
:: :~ :- ~[/init]
:: :* %pass /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: [%g %deal [~nec ~bud] %pub %watch /foo]
:: == ==
:: ==
:: :- t17 |. :- %|
:: :: gall receives %deal %watch from itself, passes to ames
:: =^ t18 gall.nec
:: %: gall-check-call:v gall.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
:: [%deal [~nec ~bud] %pub %watch /foo]
:: :~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
:: [%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
:: ==
:: ==
:: :- t18 |. :- %|
:: :: subscriber ames sends new %watch
:: =^ t19 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: /init
:: ==
:: [%plea ~bud %g /ge/pub [%0 %s /foo]]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~bud]
:: 0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
:: 1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
:: ==
:: :- ~[/ames] [%pass /pump/~bud/4 %b %wait ~1111.1.5..00.00.01]
:: ==
:: ==
:: :- t19 |. :- %|
:: :: subscriber ames sends %cork
:: =^ t20 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.5 0xdead.beef *roof]
:: :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%cork ~bud]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~bud]
:: 0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
:: 3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
:: ==
:: :- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.5..00.02.00]
:: ==
:: ==
:: :: publisher ames hears %kick ack
:: :- t20 |. :- %|
:: =^ t21 ames.bud
:: %: ames-check-call:v ames.bud
:: [~1111.1.6 0xbeef.dead *roof]
:: :- ~[//unix]
:: :* %hear [%& ~nec]
:: 0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
:: 9de0.3906.b678.6e00.0200.0132.e55d.5000
:: ==
:: :~ :- ~[/ames] [%pass /pump/~nec/1 %b %rest ~1111.1.4..00.00.01]
:: ==
:: ==
:: :: publisher ames hears new %watch
:: :- t21 |. :- %|
:: =^ t22 ames.bud
:: %: ames-check-call:v ames.bud
:: [~1111.1.7 0xbeef.dead *roof]
:: :- ~[//unix]
:: :* %hear [%& ~nec]
:: 0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
:: 1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
:: ==
:: :~ :- ~[//unix]
:: [%pass /bone/~nec/0/5 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
:: ==
:: ==
:: :: publisher gall hears new %watch, passes to self
:: :- t22 |. :- %|
:: =^ t23 gall.bud
:: %: gall-check-call:v gall.bud
:: [~1111.1.7 0xbeef.dead *roof]
:: :- ~[/bone/~nec/0/5 //unix]
:: [%plea ~nec %g /ge/pub [%0 %s /foo]]
:: :~ :- ~[/bone/~nec/0/5 //unix]
:: [%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
:: ==
:: ==
:: :: publisher gall runs :pub's +on-watch, gives ack to self
:: :- t23 |. :- %|
:: =^ t24 gall.bud
:: %: gall-check-call:v gall.bud
:: [~1111.1.7 0xbeef.dead *roof]
:: :- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
:: [%deal [~nec ~bud] %pub %watch /foo]
:: :~ :- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
:: [%give %unto %watch-ack ~]
:: ==
:: ==
:: :: publisher gall hears %watch-ack, gives to ames
:: :- t24 |. :- %|
:: =^ t25 gall.bud
:: %: gall-check-take:v gall.bud
:: [~1111.1.7 0xbeef.dead *roof]
:: :+ /sys/req/~nec/pub ~[/bone/~nec/0/5 //unix]
:: [%gall %unto %watch-ack ~]
:: :~ :- ~[/bone/~nec/0/5 //unix] [%give %done ~]
:: ==
:: ==
:: :: publisher ames hears done from gall, sends over the network
:: :- t25 |. :- %|
:: =^ t26 ames.bud
:: %: ames-check-take:v ames.bud
:: [~1111.1.7 0xbeef.dead *roof]
:: :+ /bone/~nec/0/5 ~[//unix]
:: [%gall %done ~]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~nec]
:: 0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
:: 49f4.4848.bfa6.f600.0100.0223.c98c.8800
:: == ==
:: ==
:: :: publisher ames hears %cork, passes to itself
:: :- t26 |. :- %|
:: =^ t27 ames.bud
:: %: ames-check-call:v ames.bud
:: [~1111.1.8 0xbeef.dead *roof]
:: :- ~[//unix]
:: :* %hear [%& ~nec]
:: 0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
:: 3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
:: ==
:: :~ :- ~[//unix] [%pass /bone/~nec/0/1 %a %plea ~nec [%a /close ~]]
:: ==
:: ==
:: :- t27 |. :- %|
:: :: publisher ames hear cork plea from self, give %done to self
:: =^ t28 ames.bud
:: %: ames-check-call:v ames.bud
:: [~1111.1.8 0xbeef.dead *roof]
:: :- ~[/bone/~nec/0/1 //unix]
:: [%plea ~nec [%a /close ~]]
:: :~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
:: ==
:: ==
:: :: publisher ames hears cork done from self, sends ack packet
:: :- t28 |. :- %|
:: =^ t29 ames.bud
:: %: ames-check-take:v ames.bud
:: [~1111.1.8 0xbeef.dead *roof]
:: :+ /bone/~nec/0/1
:: ~[//unix]
:: [%ames %done ~]
:: :~ :- ~[//unix]
:: :* %give %send [%& ~nec]
:: 0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
:: 1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
:: == ==
:: ==
:: :: subscriber ames hears %watch-ack, gives to gall
:: :- t29 |. :- %|
:: =^ t30 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.9 0xdead.beef *roof]
:: :- ~[//unix]
:: :* %hear [%& ~bud]
:: 0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
:: 49f4.4848.bfa6.f600.0100.0223.c98c.8800
:: ==
:: :~ :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: /init
:: ==
:: [%give %done ~]
:: :- ~[/ames] [%pass /pump/~bud/4 %b %rest ~1111.1.5..00.00.01]
:: ==
:: ==
:: :: subscriber gall hears new %watch-ack from ames, gives to self
:: :- t30 |. :- %|
:: =^ t31 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.9 0xdead.beef *roof]
:: :+ /sys/way/~bud/pub
:: :~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: /init
:: ==
:: [%ames %done ~]
:: :~ :- :~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: /init
:: ==
:: [%give %unto %watch-ack ~]
:: ==
:: ==
:: :: subscriber gall hears new %watch-ack from self, tells :sub
:: :- t31 |. :- %|
:: =^ t32 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.9 0xdead.beef *roof]
:: :+ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
:: ~[/init]
:: [%gall %unto %watch-ack ~]
:: ~
:: ==
:: :: subscriber ames hears %cork ack
:: :- t32 |. :- %|
:: =^ t33 ames.nec
:: %: ames-check-call:v ames.nec
:: [~1111.1.10 0xdead.beef *roof]
:: :- ~[//unix]
:: :* %hear [%& ~bud]
:: 0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
:: 1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
:: ==
:: :~ :- :~ /sys/way/~bud/pub
:: /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%give %done ~]
:: :- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.5..00.02.00]
:: ==
:: ==
:: :: subscriber gall hears %cork ack from ames
:: :- t33 |. :- %|
:: =^ t34 gall.nec
:: %: gall-check-take:v gall.nec
:: [~1111.1.10 0xdead.beef *roof]
:: :+ /sys/way/~bud/pub
:: :~ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
:: /init
:: ==
:: [%ames %done ~]
:: ~
:: ==
:: :- t34 |. :- %&
:: ;: weld
:: %+ expect-eq
:: !> (sy 0 ~)
:: !> =< corked
:: %: ames-scry-peer:v
:: ames.nec
:: [~1111.1.10 0xdead.beef *roof]
:: [~nec ~bud]
:: ==
:: ::
:: %+ expect-eq
:: !> (sy 1 ~)
:: !> =< corked
:: %: ames-scry-peer:v
:: ames.bud
:: [~1111.1.8 0xbeef.dead *roof]
:: [~bud ~nec]
:: ==
:: ::
:: %+ expect-eq
:: !> 2
:: !> %: gall-scry-nonce:v
:: gall.nec
:: [~1111.1.10 0xdead.beef *roof]
:: ~nec %sub
:: [~bud %pub /sub-foo/~bud]
:: ==
:: ==
:: --
~

View File

@ -106,6 +106,10 @@
:: Doesn't follow horizontal & vertical ordering
::
=/ unbalanced-e=(set @) [1 [3 ~ ~] [2 ~ ~]]
:: Duplicate elements
::
=/ has-dupes=(set @) [1 [1 ~ ~] ~]
::
;: weld
%+ expect-eq
!> [%b-a %.y]
@ -125,6 +129,9 @@
%+ expect-eq
!> [%u-e %.n]
!> [%u-e ~(apt in unbalanced-e)]
%+ expect-eq
!> [%h-d %.n]
!> [%h-d ~(apt in has-dupes)]
==
::
:: Test splits a in b

View File

@ -251,17 +251,19 @@
!> shut-packet
!> decoded
::
++ test-shut-packet-associated-data ^- tang
::
=/ =shut-packet:ames
:+ bone=17 message-num=18
[%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
::
=/ =packet:ames
(encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
::
%- expect-fail
|.((decode-shut-packet:ames packet nec-sym 3 17))
:: Crypto failures are now non-deterministic
::
:: ++ test-shut-packet-associated-data ^- tang
:: ::
:: =/ =shut-packet:ames
:: :+ bone=17 message-num=18
:: [%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
:: ::
:: =/ =packet:ames
:: (encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
:: ::
:: %- expect-fail
:: |.((decode-shut-packet:ames packet nec-sym 3 17))
::
++ test-alien-encounter ^- tang
::
@ -353,10 +355,14 @@
!> [~[/g/talk] %give %boon [%post 'first1']]
!> (snag 0 `(list move:ames)`moves6)
==
:: +test-comet-message-flow: galaxy<->comet comms
::
:: same as test-message-flow, but ~nec will send a sendkeys packet to
:: request comet's self-attestation directly
::
++ test-comet-message-flow ^- tang
:: same as test-message-flow, but ~nec will send a sendkeys packet to request
:: comet's self-attestation directly
::=^ * nec (call nec ~[//nemo] %spew ~[%snd %rcv %odd %msg])
::=^ * comet (call comet ~[//nemo] %spew ~[%snd %rcv %odd %msg])
::
=^ moves0 nec (call nec ~[/g/talk] %plea our-comet %g /talk [%get %post])
=^ moves1 comet (call comet ~[//unix] %hear (snag-packet 0 moves0))
@ -371,27 +377,34 @@
:^ comet /public-keys ~[//unix]
^- sign:ames
[%jael %public-keys %full [n=[~nec point] ~ ~]]
:: give comet's self-attestation to ~nec; at this point, we have established
:: a channel, and can proceed as usual
:: give comet's self-attestation to ~nec; at this point, we have
:: established a channel, and can proceed as usual
::
=/ post [%post 'first1!!']
=^ moves3 nec (call nec ~[//unix] %hear (snag-packet 0 moves2))
%+ weld
%- expect-fail |.
(call nec ~[//unix] %hear (snag-packet 1 moves2))
::
=^ moves4 comet (call comet ~[//unix] %hear (snag-packet 0 moves3))
=^ moves5 comet (take comet /bone/~nec/0/1 ~[//unix] %g %done ~)
=^ moves5 comet (take comet /bone/~nec/1/1 ~[//unix] %g %done ~)
=^ moves6 nec (call nec ~[//unix] %hear (snag-packet 0 moves5))
=^ moves7 comet (take comet /bone/~nec/0/1 ~[//unix] %g %boon [%post 'first1!!'])
=^ moves7 comet (take comet /bone/~nec/1/1 ~[//unix] %g %boon post)
=^ moves8 nec (call nec ~[//unix] %hear (snag-packet 0 moves7))
::
;: weld
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; ~nec is your neighbor"]
!> =- [~[//unix] %pass /qos %d %flog %text -]
"; ~nec is your neighbor"
!> (snag 0 `(list move:ames)`moves4)
::
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
!> =- [~[//unix] %pass /qos %d %flog %text -]
"; {<our-comet>} is your neighbor"
!> (snag 0 `(list move:ames)`moves6)
::
%+ expect-eq
!> [~[/g/talk] %give %boon [%post 'first1!!']]
!> [~[/g/talk] %give %boon post]
!> (snag 0 `(list move:ames)`moves8)
==
::

View File

@ -0,0 +1,234 @@
/+ *test
/= behn-raw /sys/vane/behn
=/ behn-gate (behn-raw ~bus)
=/ scry *roof
=* move move:behn-gate
::
|%
++ test-wake-no
^- tang
=/ wen ~1111.1.1
=/ arg [~[/vere] [%wake ~]]
-:(call ~ wen arg ~)
::
++ test-wake-no-wait
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%wake ~]]
=/ b-out ~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-wake-no-born
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/foo] [%wait +(wen)]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%wake ~]]
=/ b-out ~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-wake
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate
(call ~ wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/vere] [%wake ~]]
=/ c-out=(list move) [~[/foo] [%give [%wake ~]]]~
=^ c behn-gate (call `%c +(wen) c-arg c-out)
::
:(weld a b c)
::
++ test-born
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/foo] [%wait +(wen)]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/vere] [%born ~]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
(weld a b)
::
++ test-many-ordered
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 3 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-many-ordered-lag
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait +(wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 3 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e +(wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-many-unordered
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 3 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait +(wen)]]
=/ d-out=(list move) [~[/vere] [%give [%doze `+(wen)]]]~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-same-ordered-lag
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 2 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%wait (add 2 wen)]]
=/ d-out ~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move)
:~ [~[/vere] [%give [%doze `(add 2 wen)]]]
[~[/foo] [%give [%wake ~]]]
==
=^ e behn-gate (call `%e (add 3 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ test-rest
^- tang
=/ wen ~1111.1.1
::
=/ a-arg [~[/vere] [%born ~]]
=/ a-out ~
=^ a behn-gate (call `%a wen a-arg a-out)
::
=/ b-arg [~[/foo] [%wait (add 2 wen)]]
=/ b-out=(list move) [~[/vere] [%give [%doze `(add 2 wen)]]]~
=^ b behn-gate (call `%b wen b-arg b-out)
::
=/ c-arg [~[/foo] [%wait (add 3 wen)]]
=/ c-out ~
=^ c behn-gate (call `%c wen c-arg c-out)
::
=/ d-arg [~[/foo] [%rest (add 2 wen)]]
=/ d-out=(list move) [~[/vere] [%give [%doze `(add 3 wen)]]]~
=^ d behn-gate (call `%d wen d-arg d-out)
::
=/ e-arg [~[/vere] [%wake ~]]
=/ e-out=(list move) [~[/foo] [%give [%wake ~]]]~
=^ e behn-gate (call `%e (add 4 wen) e-arg e-out)
::
:(weld a b c d e)
::
++ call
=| lac=?
|= $: label=(unit @tas)
now=@da
args=[=duct task=(hobo task:behn)]
expected-moves=(list move)
==
=/ behn-core (behn-gate now=now eny=`@`0xdead.beef scry=scry)
=^ moves behn-gate
(call:behn-core duct.args dud=~ task.args)
::
~? !lac moves
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
[?~(label output ?~(output ~ [u.label output])) behn-gate]
--

View File

@ -22,32 +22,6 @@
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
:: +test-jolt: test %jolt; TODO: test clay response
::
++ test-jolt
^- tang
::
=/ =duct ~[/init]
=/ time (add ~1111.1.1 ~s1)
=/ dap=term %my-agent
=/ ship ~nec
::
=/ call-args
=/ =task:gall [%jolt %base dap]
[duct task]
::
=/ =move:gall-gate
=/ =wire /sys/cor/[dap]/(scot %p ship)/base/(scot %da time)
=/ =note-arvo
[%c %warp ship %base ~ %sing %a da+time /app/[dap]/hoon]
[duct %pass wire note-arvo]
::
=/ expected-moves=(list move:gall-gate) ~[move]
::
=/ res
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
:: +gall-call: have %gall run a +task and assert it produces expected-moves
::
++ gall-call

Some files were not shown because too many files have changed in this diff Show More