Merge branch 'master' of github.com:urbit/urbit into bs/uterm

This commit is contained in:
Benjamin Summers 2019-08-14 15:37:20 -07:00
commit 7c6709de9b
282 changed files with 13374 additions and 10506 deletions

8
.gitignore vendored
View File

@ -12,3 +12,11 @@ release/
.stack-work
\#*\#
s/*
=======
**/.DS_Store
**/dist
**/node_modules
**/urbitrc
**/*.swp
**/*.swo
**/*-min.js

View File

@ -8,10 +8,8 @@ before_install:
- git lfs pull
script:
- cachix authtoken "$CACHIX_AUTH_TOKEN" >/dev/null
- cachix use urbit2
- ./sh/cachix
- ./sh/cachix || true
- make
- make release

View File

@ -21,6 +21,10 @@ test:
pills:
sh/update-solid-pill
sh/update-brass-pill
sh/update-ivory-pill
interface:
sh/build-interface
clean:
rm -rf ./out ./work

View File

@ -70,11 +70,9 @@ right, and there is no issue about it yet, feel free to open one.
If you're looking to get involved, there are a few things you can do:
- Join the [urbit-dev][list] mailing list.
- [Ask us about Hoon School][mail], a course we run to teach the Hoon
- [Apply to Hoon School][mail], a course we run to teach the Hoon
programming language and Urbit application development.
- Check out [good contributor issues][good].
- Reach out to [support@urbit.org][mail] to say hi and ask any questions you
might have.
Once you've got your bearings, have a look at [CONTRIBUTING.md][cont] for some
pointers on setting up your development environment.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f6e93cb3ee5fcb0970851bd10d2d2a640ff968292d147c35385623b86570296
size 6662042
oid sha256:6c7ad5eec00d0d6a6857ea023c6102999a30d5c99de7411e474b9d1c14a3e7b4
size 9765203

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e520b9ab0232d1765e1dacde96a1210845768e7334a334b5705d1c40348c82b
size 4464201
oid sha256:6e828e89f4e6f2b39d4d8d62101f9c052253cdfa4e91abb8682678acd796f999
size 4707549

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4a8e1daf0bfe86d5fc4ef7060b0c6a6c2678a344787926f14bb4b8cfabe8752
size 9549390
oid sha256:2a7be485bbece9d4a4624a8267d2e969bed2a2923b4b67f0ed6423cd71d49373
size 13474032

View File

@ -1,13 +1,15 @@
crossenv:
rec {
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
uv = import ./deps/uv/cross.nix { inherit crossenv; };
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
sni = import ./deps/sni/cross.nix { inherit crossenv; };
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
ivory-header = import ./deps/ivory-header/cross.nix { inherit crossenv; };
ca-header = import ./deps/ca-header/cross.nix { inherit crossenv; };
}

View File

@ -20,7 +20,7 @@ let
vendor =
with deps;
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ge-additions ];
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ent ge-additions ivory-header ca-header ];
in

27
nix/deps/ca-header/builder.sh Executable file
View File

@ -0,0 +1,27 @@
source $stdenv/setup
set -ex
cleanup () {
echo "done"
}
trap cleanup EXIT
if ! [ -f "$SSL_CERT_FILE" ]; then
echo "$SSL_CERT_FILE doesn't exist"
exit 1
fi
mkdir -p ./include
cat $SSL_CERT_FILE > include/ca-bundle.crt
xxd -i include/ca-bundle.crt > ca-bundle.h
mkdir -p $out/include
mv ca-bundle.h $out/include
rm -rf ./include
set +x

View File

@ -0,0 +1,8 @@
{ crossenv }:
crossenv.make_derivation rec {
name = "ca-bundle.h";
builder = ./builder.sh;
native_inputs = with crossenv.nixpkgs; [ cacert xxd ];
SSL_CERT_FILE = "${crossenv.nixpkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
}

View File

@ -0,0 +1,7 @@
{ pkgs }:
pkgs.stdenv.mkDerivation {
name = "ca-bundle.h";
builder = ./builder.sh;
nativeBuildInputs = with pkgs; [ cacert xxd ];
}

View File

@ -1,13 +1,15 @@
{ pkgs ? import ../nixpkgs.nix }:
rec {
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; };
argon2 = import ./argon2 { inherit pkgs; };
murmur3 = import ./murmur3 { inherit pkgs; };
uv = import ./uv { inherit pkgs; };
ed25519 = import ./ed25519 { inherit pkgs; };
sni = import ./sni { inherit pkgs; };
scrypt = import ./scrypt { inherit pkgs; };
softfloat3 = import ./softfloat3 { inherit pkgs; };
secp256k1 = import ./secp256k1 { inherit pkgs; };
h2o = import ./h2o { inherit pkgs uv; };
ivory-header = import ./ivory-header { inherit pkgs; };
ca-header = import ./ca-header { inherit pkgs; };
}

View File

@ -0,0 +1,41 @@
source $stdenv/setup
set -ex
cleanup () {
echo "done"
}
trap cleanup EXIT
if ! [ -f "$IVORY" ]; then
echo "$IVORY doesn't exist"
exit 1
fi
#
# heuristics to confirm the ivory pill is valid
#
# greater than 10KB
#
if [ $(du -k $IVORY | cut -f1) -gt 10 ]; then
echo "$IVORY is less than 10KB"
fi
# first 7 bytes != "version" (start of an lfs pointer)
#
if [ "$(cat $(IVORY) | head -c 7)" = "version" ]; then
echo "$IVORY starts with 'version'; it's an LFS pointer"
fi
cat $IVORY > u3_Ivory.pill
xxd -i u3_Ivory.pill > ivory.h
mkdir -p $out/include
mv ivory.h $out/include
rm u3_Ivory.pill
set +x

View File

@ -0,0 +1,11 @@
{
crossenv,
ivory ? ../../../bin/ivory.pill
}:
crossenv.make_derivation rec {
name = "ivory.h";
builder = ./builder.sh;
native_inputs = with crossenv.nixpkgs; [ xxd ];
IVORY = ivory;
}

View File

@ -0,0 +1,11 @@
{
pkgs,
ivory ? ../../../bin/ivory.pill
}:
pkgs.stdenv.mkDerivation {
name = "ivory.h";
builder = ./builder.sh;
nativeBuildInputs = with pkgs; [ xxd ];
IVORY = ivory;
}

View File

@ -15,21 +15,55 @@ cleanup () {
trap cleanup EXIT
# update pill strategy to ensure correct staging
# update pill strategy to ensure correct staging
#
herb ./pier -p hood -d "+hood/mount /=home="
cp $ARVO/lib/pill.hoon ./pier/home/lib/
chmod -R u+rw ./pier/home/lib/
until [ -d ./pier/home ]
do
sleep 1
done
# update :lens, :dojo and dependencies
#
# XX reduce this list
#
cp $ARVO/app/lens.hoon ./pier/home/app/ 2>/dev/null || true
cp $ARVO/app/dojo.hoon ./pier/home/app/ 2>/dev/null || true
cp $ARVO/lib/base64.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/lib/server.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/lib/sole.hoon ./pier/home/lib/ 2>/dev/null || true
mkdir -p ./pier/home/mar/lens/
cp $ARVO/mar/lens/* ./pier/home/mar/lens/ 2>/dev/null || true
cp $ARVO/sur/lens.hoon ./pier/home/sur/ 2>/dev/null || true
cp $ARVO/sur/sole.hoon ./pier/home/sur/ 2>/dev/null || true
# update +solid and its dependencies
#
cp $ARVO/lib/pill.hoon ./pier/home/lib/ 2>/dev/null || true
cp $ARVO/gen/solid.hoon ./pier/home/gen/ 2>/dev/null || true
chmod -R u+rw ./pier/home/
herb ./pier -p hood -d "+hood/commit %home"
herb ./pier -p hood -d "+hood/unmount %home"
# stage new desk for pill contents
# XX horrible hack to ensure the update is applied first
#
sleep 10
# stage new desk for pill contents
#
herb ./pier -p hood -d '+hood/merge %stage our %home'
herb ./pier -p hood -d "+hood/mount /=stage="
until [ -d ./pier/stage ]
do
sleep 1
done
rm -rf ./pier/stage
cp -r $ARVO ./pier/stage
chmod -R u+rw ./pier/stage

View File

@ -17,7 +17,7 @@ let
import ./urbit {
inherit pkgs ent debug ge-additions;
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
inherit (deps) secp256k1 h2o;
inherit (deps) secp256k1 h2o ivory-header ca-header;
};
urbit = mkUrbit { debug=false; };

View File

@ -1,8 +1,7 @@
{
pkgs,
debug,
ivory ? ../../../bin/ivory.pill,
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv, ivory-header, ca-header
}:
let
@ -12,10 +11,10 @@ let
deps =
with pkgs;
[ curl gmp libsigsegv ncurses openssl zlib lmdb cacert xxd ];
[ curl gmp libsigsegv ncurses openssl zlib lmdb ];
vendor =
[ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ];
[ argon2 softfloat3 ed25519 ent ge-additions h2o scrypt uv murmur3 secp256k1 sni ivory-header ca-header ];
in
@ -31,7 +30,6 @@ pkgs.stdenv.mkDerivation {
hardeningDisable = if debug then [ "all" ] else [];
CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror";
IVORY = ivory;
MEMORY_DEBUG = debug;
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;

View File

@ -4,8 +4,7 @@
ent,
name ? "urbit",
debug ? false,
ivory ? ../../../bin/ivory.pill,
ge-additions, cacert, xxd
ge-additions
}:
let
@ -16,7 +15,7 @@ let
vendor =
with deps;
[ argon2 softfloat3 ed25519 ge-additions h2o scrypt uv murmur3 secp256k1 sni ];
[ argon2 softfloat3 ed25519 ge-additions h2o scrypt uv murmur3 secp256k1 sni ivory-header ca-header ];
in
@ -27,13 +26,10 @@ env.make_derivation {
CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false;
NCURSES = env.ncurses;
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
IVORY = ivory;
name = "${name}-${env_name}";
exename = name;
src = ../../../pkg/urbit;
native_inputs = [ xxd ];
cross_inputs = crossdeps ++ vendor ++ [ ent ];
builder = ./release.sh;
}

View File

@ -12,5 +12,5 @@ import ./default.nix {
inherit (tlon)
ent ge-additions;
inherit (deps)
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv;
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv ivory-header ca-header;
}

View File

@ -21,8 +21,7 @@ let
urbit = env:
import ./pkgs/urbit/release.nix env
{ ent = ent env; ge-additions = ge-additions env; cacert = nixpkgs.cacert;
xxd = nixpkgs.xxd; debug = false; name = "urbit"; };
{ ent = ent env; ge-additions = ge-additions env; debug = false; name = "urbit"; };
builds-for-platform = plat:
plat.deps // {

View File

@ -169,7 +169,7 @@
=. ..abet-pe
=/ sof ((soft unix-effect) i.effects)
?~ sof
~? aqua-debug=| [who=who %unknown-effect i.effects]
~? aqua-debug=& [who=who %unknown-effect i.effects]
..abet-pe
(publish-effect u.sof)
$(effects t.effects)
@ -366,7 +366,7 @@
%e %eyre
%f %ford
%g %gall
%j %ford
%j %jael
==
=/ pax
/(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane]
@ -435,8 +435,9 @@
[%fake who.ae]
[%dawn u.keys.ae]
-.userspace-ova.pil
[//http/0v1n.2m9vh %born ~]
[//http/0v1n.2m9vh %live 8.080 `8.445]
[//http-client/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %live 8.080 `8.445]
==
=. this abet-pe:initted
(pe who.ae)
@ -545,6 +546,17 @@
:^ ~ ~ %noun
`(list ship)`(turn ~(tap by piers) head)
::
::
::
++ peek-x-pill
|= pax=path
^- (unit (unit [%pill pill]))
=/ pill-size (met 3 (jam pil))
?: (lth pill-size 100)
~& [%no-pill size=pill-size]
[~ ~]
``pill+pil
::
:: Trivial scry for mock
::
++ scry |=([* *] ~)

View File

@ -1,28 +1,26 @@
/+ tapp, stdio
=, able:kale
=, able:jael
=> |%
+$ pending-udiffs (map number:block udiffs:point)
+$ config
$: url=@ta
from-number=number:block
==
+$ app-state
$: url=@ta
$: %2
url=@ta
=number:block
=pending-udiffs
blocks=(list block)
whos=(set ship)
==
+$ peek-data ~
+$ in-poke-data
$: %azimuth-tracker-poke
$% [%init ~]
[%listen whos=(set ship) =source:kale]
[%watch =config]
$% [%listen whos=(list ship) =source:jael]
[%watch url=@ta]
==
==
+$ out-poke-data ~
+$ in-peer-data ~
+$ out-peer-data ~
+$ out-peer-data
[%azimuth-udiff =ship =udiff:point]
++ tapp
%: ^tapp
app-state
@ -40,13 +38,23 @@
::
=> |%
++ topics
=> azimuth-events:azimuth
:_ ~
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
|= ships=(set ship)
^- (list ?(@ux (list @ux)))
:: The first topic should be one of these event types
::
:- => azimuth-events:azimuth
:~ broke-continuity
changed-keys
lost-sponsor
escape-accepted
==
:: If we're looking for a specific set of ships, specify them as
:: the second topic. Otherwise don't specify the second topic so
:: we will match all ships.
::
?: =(~ ships)
~
[(turn ~(tap in ships) ,@) ~]
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
@ -77,7 +85,9 @@
=/ m (async:stdio ,(unit json))
^- form:m
?> ?=(%finished -.client-response)
=/ body=@t q.data:(need full-file.client-response)
?~ full-file.client-response
(pure:m ~)
=/ body=@t q.data.u.full-file.client-response
=/ jon=(unit json) (de-json:html body)
?~ jon
(pure:m ~)
@ -177,7 +187,7 @@
--
::
++ get-logs-by-hash
|= [url=@ta =hash:block]
|= [url=@ta whos=(set ship) =hash:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -186,7 +196,7 @@
%eth-get-logs-by-hash
hash
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -194,7 +204,7 @@
(pure:m udiffs)
::
++ get-logs-by-range
|= [url=@ta =from=number:block =to=number:block]
|= [url=@ta whos=(set ship) =from=number:block =to=number:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
@ -204,7 +214,7 @@
`number+from-number
`number+to-number
~[azimuth:contracts:azimuth]
topics
(topics whos)
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
@ -253,8 +263,9 @@
=* loop $
?~ udiffs
(pure:m ~)
~& [%sending-event i.udiffs]
;< ~ bind:m (send-effect:stdio %new-event /ne i.udiffs)
=/ =path /(scot %p ship.i.udiffs)
;< ~ bind:m (give-result:stdio / %azimuth-udiff i.udiffs)
;< ~ bind:m (give-result:stdio path %azimuth-udiff i.udiffs)
loop(udiffs t.udiffs)
--
::
@ -262,44 +273,22 @@
::
=> |%
::
:: Subscribe to %sources from kale
::
++ init
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %sources /se ~)
(pure:m state)
::
:: Send %listen to kale
:: Send %listen to jael
::
++ listen
|= [state=app-state whos=(set ship) =source:kale]
|= [state=app-state whos=(list ship) =source:jael]
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %listen /lo whos source)
;< ~ bind:m (send-effect:stdio %listen /lo (silt whos) source)
(pure:m state)
::
:: Take %source from kale
::
++ take-source
|= [state=app-state whos=(set ship) =source:kale]
=/ m (async:stdio ,app-state)
^- form:m
?: ?=(%& -.source)
(pure:m state)
=/ a-purl=purl:eyre node.p.source
=. url.state (crip (en-purl:html a-purl))
(watch state url.state launch:contracts:azimuth)
::
:: Start watching a node
::
++ watch
|= [state=app-state =config]
++ start
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
=: url.state url.config
number.state from-number.config
=: number.state 0
pending-udiffs.state *pending-udiffs
blocks.state *(list block)
==
@ -311,20 +300,18 @@
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
~& [%get-updates number.state]
;< =latest=block bind:m (get-latest-block url.state)
;< =new=number:block bind:m (zoom state number.id.latest-block)
=. number.state new-number
;< =latest=block bind:m (get-latest-block url.state)
;< state=app-state bind:m (zoom state number.id.latest-block)
|- ^- form:m
=* walk-loop $
~& [%walk-loop number.state]
?: (gth number.state number.id.latest-block)
;< now=@da bind:m get-time:stdio
;< ~ bind:m (wait-effect:stdio (add now ~s10))
;< ~ bind:m (wait-effect:stdio (add now ~m5))
(pure:m state)
;< =block bind:m (get-block-by-number url.state number.state)
;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m
(take-block url.state pending-udiffs.state block blocks.state)
%- take-block
[url.state whos.state pending-udiffs.state block blocks.state]
=: pending-udiffs.state new-pending-udiffs
blocks.state new-blocks
number.state +(number.id.i.new-blocks)
@ -334,17 +321,14 @@
:: Process a block, detecting and handling reorgs
::
++ take-block
|= [url=@ta =a=pending-udiffs =block blocks=(list block)]
|= [url=@ta whos=(set ship) =a=pending-udiffs =block blocks=(list block)]
=/ m (async:stdio ,[pending-udiffs (lest ^block)])
^- form:m
~& [%taking id.block]
?: &(?=(^ blocks) !=(parent-hash.block hash.id.i.blocks))
~& %rewinding
(rewind url a-pending-udiffs block blocks)
;< =b=pending-udiffs bind:m
(release-old-events a-pending-udiffs number.id.block)
;< =new=udiffs:point bind:m (get-logs-by-hash url hash.id.block)
~? !=(~ new-udiffs) [%adding-diffs new-udiffs]
;< =new=udiffs:point bind:m (get-logs-by-hash url whos hash.id.block)
=. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs)
(pure:m b-pending-udiffs block blocks)
::
@ -366,7 +350,6 @@
=/ m (async:stdio ,[^pending-udiffs (lest ^block)])
|- ^- form:m
=* loop $
~& [%wind block ?~(blocks ~ i.blocks)]
?~ blocks
(pure:m pending-udiffs block blocks)
?: =(parent-hash.block hash.id.i.blocks)
@ -394,15 +377,18 @@
::
++ zoom
|= [state=app-state =latest=number:block]
=/ m (async:stdio ,number:block)
=/ m (async:stdio ,app-state)
^- form:m
?: (lth latest-number (add number.state 500))
(pure:m latest-number)
=/ to-number=number:block (sub latest-number 500)
=/ zoom-margin=number:block 100
?: (lth latest-number (add number.state zoom-margin))
(pure:m state)
=/ to-number=number:block (sub latest-number zoom-margin)
;< =udiffs:point bind:m
(get-logs-by-range url.state number.state to-number)
(get-logs-by-range url.state whos.state number.state to-number)
;< ~ bind:m (jael-update udiffs)
(pure:m to-number)
=. number.state +(to-number)
=. blocks.state ~
(pure:m state)
--
::
:: Main
@ -415,9 +401,8 @@
=/ m tapp-async
^- form:m
?- +<.in-poke-data
%init (init state)
%listen (listen state +>.in-poke-data)
%watch (watch state +>.in-poke-data)
%listen (listen state +>.in-poke-data)
%watch (pure:m state(url url.in-poke-data))
==
::
++ handle-take
@ -425,9 +410,17 @@
=/ m tapp-async
^- form:m
?+ -.sign ~|([%strange-sign -.sign] !!)
%source (take-source state +.sign)
%wake (get-updates state)
==
::
++ handle-peer ~(handle-peer default-tapp bowl state)
++ handle-peer
|= =path
=/ m tapp-async
^- form:m
=/ who=(unit ship) ?~(path ~ `(slav %p i.path))
=. whos.state
?~ who
~
(~(put in whos.state) u.who)
(start state)
--

View File

@ -41,6 +41,25 @@
::
=, chat
::
|%
+$ state
$% [%0 str=streams]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -56,7 +75,7 @@
=/ inboxpat /circle/inbox/config/group
=/ circlespat /circles/[(scot %p our.bol)]
=/ inboxwir /circle/[(scot %p our.bol)]/inbox/config/group
=/ inboxi/poke
=/ inboxi/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %i] ~]~)]
=/ fakeannounce=poke
@ -71,10 +90,10 @@
=/ dev=poke
:- %hall-action
[%create %urbit-dev 'Chat about developing on Urbit' %channel]
=/ sourcefakeannounce/poke
=/ sourcefakeannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[our.bol %hall-internal-announcements] ~]~)]
=/ sourceannounce/poke
=/ sourceannounce/poke
:- %hall-action
[%source %inbox %.y (silt [[~marzod %announcements] ~]~)]
=/ hallactions=(list move)
@ -99,7 +118,7 @@
[ost.bol %poke /chat [our.bol %launch] launcha]
==
:_ this
%+ weld moves hallactions
%+ weld moves hallactions
:- [ost.bol %poke /chat [our.bol %launch] launcha]~
this(sta u.old)
::
@ -115,8 +134,8 @@
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
[cir (add num.last 1)]
=/ maptjson=(map @t json)
%- my
:~ ['config' (config-to-json str)]
%- my
:~ ['config' (config-to-json str)]
['numbers' (numbers-to-json numbers)]
==
[%o maptjson]
@ -142,7 +161,7 @@
?~ envs
~
=/ length/@ (lent u.envs)
=/ start/@
=/ start/@
?: (gte length 100)
(sub length 100)
0
@ -247,7 +266,7 @@
^- [circle:hall (list envelope:hall)]
[cir ~]
::
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -281,7 +300,7 @@
::
=* messages messages.str.sta
=/ circle/circle:hall [`@p`(slav %p &2:wir) &3:wir]
=/ localpeers/(set @p)
=/ localpeers/(set @p)
%- silt %+ turn ~(tap by loc.pes.piz)
|= [shp=@p stat=status:hall]
shp
@ -391,7 +410,7 @@
?+ -.dif.sto
[~ this]
::
:: %full: set all of config without side effects
:: %full: set all of config without side effects
::
%full
=* conf cof.dif.sto

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@
$% [%dns-authority =authority]
[%dns-bind =ship =target]
[%handle-http-request =inbound-request:eyre]
[%handle-http-cancel =inbound-request:eyre]
[%noun noun=*]
==
+$ out-poke-data
@ -779,7 +780,9 @@
;< ~ bind:m (poke-app:stdio [our dap]:bowl [%dns-bind ship target]:i.dep)
loop(dep t.dep)
::
:: XX need to %handle-http-cancel as well
%handle-http-cancel
~& %tapp-http-cant-cancel
(pure:m state)
::
%handle-http-request
:: always stash request bone for giving response

View File

@ -1019,6 +1019,8 @@
==
::
$listen-api !!
$export !!
$import !!
$as
:* %as mar.source.com
$(num +(num), source.com next.source.com)

View File

@ -10,7 +10,6 @@
[%vein wire]
[%look wire src=(each ship purl:eyre)]
[%wind wire p=@ud]
[%snap wire snapshot=snapshot:jael kick=?]
==
++ state
$: a/@
@ -28,8 +27,6 @@
%turf [ost.hid %turf /hi ~]~
%vein [ost.hid %vein /hi]~
[%wind @ud] [ost.hid %wind /hi +.val]~
[%snap * ?]
[ost.hid %snap /hi (snapshot:jael +<.val) +>.val]~
::
%look-ethnode
:_ ~

View File

@ -92,6 +92,7 @@
++ lime :: diff fruit
$% {$hall-prize prize} ::
{$hall-rumor rumor} ::
{$export [%hall-v0 (list telegram)]} :: sent to lens
== ::
++ pear :: poke fruit
$% {$hall-command command} ::
@ -2789,6 +2790,8 @@
^- (list move)
=+ mur=(~(get by res) p)
?^ mur u.mur
?: =([%export ~] p)
~
=- =. res (~(put by res) p -)
-
=+ qer=(path-to-query p)
@ -3017,6 +3020,10 @@
|= pax/path
^- (quip move _+>)
?: ?=([%sole *] pax) ~&(%hall-no-sole !!)
?: ?=([%export *] pax)
:_ +>.$
[ost.bol %diff %export [%hall-v0 grams:(~(got by stories) ~.inbox)]]~
::
=+ qer=(path-to-query pax)
?. (leak src.bol qer) ~&(%peer-invisible !!)
=^ mos +>.$
@ -3196,6 +3203,20 @@
:- ~
+>.$(log (~(del by log) nom))
::
++ poke-import
|= i=*
^- (quip move _+>)
::
?> ?=([%hall-v0 *] i)
=/ grams=(list telegram) ;;((list telegram) +.i)
::
~& [%importing-telegrams count=(lent grams)]
::
%- pre-bake
%+ turn grams
|= t/telegram
[%story ~.inbox %gram [our.bol ~.inbox] t]
::
++ log-all-to-file
:: update stories logs
::

View File

@ -161,6 +161,7 @@
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-rekey (wrap poke-rekey):from-helm
++ poke-helm-moon (wrap poke-moon):from-helm
++ poke-helm-nuke (wrap poke-nuke):from-helm
++ poke-helm-automass (wrap poke-automass):from-helm
++ poke-helm-cancel-automass (wrap poke-cancel-automass):from-helm
@ -182,6 +183,7 @@
++ poke-kiln-keep-ford (wrap poke-keep-ford):from-kiln
++ poke-kiln-autoload (wrap poke-autoload):from-kiln
++ poke-kiln-overload (wrap poke-overload):from-kiln
++ poke-kiln-wash-gall (wrap poke-wash-gall):from-kiln
++ poke-kiln-unmount (wrap poke-unmount):from-kiln
++ poke-kiln-unsync (wrap poke-unsync):from-kiln
++ poke-kiln-permission (wrap poke-permission):from-kiln

View File

@ -1,4 +1,6 @@
/+ *server, launch
/- launch
/+ *server
::
/= index
/^ $-(marl manx)
/: /===/app/launch/index /!noun/
@ -22,6 +24,21 @@
::
=, launch
::
|%
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
--
::
|_ [bol=bowl:gall sta=state]
::
++ this .
@ -35,7 +52,7 @@
[~ this(sta u.old)]
::
++ poke-launch-action
|= act=action:launch
|= act=action
^- (quip move _this)
=/ beforedata (~(get by data.sta) name.act)
=/ newdata

View File

@ -1,24 +1,32 @@
/- lens
/+ *server
/- lens, *sole
/+ base64, *server
/= lens-mark /: /===/mar/lens/command
/!noun/
=, format
|%
:: +move: output effect
:: +lens-out: json or named octet-stream
::
+$ lens-out
$% [%json =json]
[%mime =mime]
==
:: +move: output effect
::
+$ move [bone card]
:: +card: output effect payload
:: +card: output effect payload
::
+$ card
$% [%connect wire binding:eyre term]
[%http-response =http-event:http]
[%peel wire dock mark path]
[%peer wire dock path]
[%peer wire dock path]
[%poke wire dock poke]
[%pull wire dock ~]
==
::
+$ poke
$% [%lens-command command:lens]
[%import *]
==
::
+$ state
@ -49,6 +57,7 @@
%- (require-authorization:app ost.bow move this)
|= =inbound-request:eyre
^- (quip move _this)
::
?^ job.state
:_ this
[ost.bow %http-response %start [%500 ~] ~ %.y]~
@ -60,17 +69,114 @@
(need (de-json:html q:(need body.request.inbound-request)))
=/ com=command:lens
(json:grab:lens-mark jon)
::
?: ?=(%export -.source.com)
~& [%export app.source.com]
:_ this(job.state (some [ost.bow com]))
[ost.bow %peer /export [our.bow app.source.com] /export]~
::
?: ?=(%import -.source.com)
?~ enc=(de:base64 base64-jam.source.com)
:_ this
[ost.bow %http-response %start [%500 ~] ~ %.y]~
::
=/ c=* (cue q.u.enc)
::
:_ this(job.state (some [ost.bow com]))
[ost.bow %poke /import [our.bow app.source.com] %import c]~
::
:_ this(job.state (some [ost.bow com]))
[ost.bow %peel /sole [our.bow %dojo] %lens-json /sole]~
[ost.bow %peer /sole [our.bow %dojo] /sole]~
::
++ diff-lens-json
|= [=wire jon=json]
++ diff-sole-effect
|= [=wire fec=sole-effect]
^- (quip move _this)
?~ jon
=/ out
|- ^- (unit lens-out)
=* loop $
?+ -.fec
~
::
%tan
%- some
:- %json
%- wall:enjs:format
(turn (flop p.fec) |=(=tank ~(ram re tank)))
::
%txt
(some %json s+(crip p.fec))
::
%sag
%- some
[%mime p.fec (as-octs:mimes:html (jam q.fec))]
::
%sav
:: XX use +en:base64 or produce %mime a la %sag
::
%- some
:- %json
%- pairs:enjs:format
:~ file+s+(crip <`path`p.fec>)
data+s+(crip (en-base64:mimes:html q.fec))
==
::
%mor
=/ all `(list lens-out)`(murn p.fec |=(a=sole-effect loop(fec a)))
?~ all ~
~| [%multiple-effects all]
?> ?=(~ t.all)
(some i.all)
==
::
?~ out
[~ this]
?> ?=(^ job.state)
:_ this(job.state ~)
[bone.u.job.state %http-response (json-response:app (json-to-octs jon))]~
:_ ~
:+ bone.u.job.state
%http-response
?- -.u.out
%json
(json-response:app (json-to-octs json.u.out))
::
%mime
:* %start
:~ 200
['content-type' 'application/octet-stream']
?> ?=([@ @ ~] p.mime.u.out)
:- 'content-disposition'
^- @t
%^ cat 3
'attachment; filename='
(rap 3 '"' i.p.mime.u.out '.' i.t.p.mime.u.out '"' ~)
==
(some q.mime.u.out)
%.y
==
==
::
++ diff-export
|= [=wire data=*]
^- (quip move _this)
::
?> ?=(^ job.state)
:: herb will do whatever we tell it to, so by convention have it write to an
:: app name based on the file name.
::
?> ?=(%export -.source.com.u.job.state)
=/ app-name=tape (trip app.source.com.u.job.state)
=/ output=@t (crip "/{app-name}/jam")
::
=/ jon=json
=/ =atom (jam data)
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
(pairs:enjs:format file+s+output data+s+enc ~)
::
:_ this(job.state ~)
:~ [bone.u.job.state %http-response (json-response:app (json-to-octs jon))]
[ost.bow %pull /export [our.bow app.source.com.u.job.state] ~]
==
::
++ quit
|= =wire
@ -81,17 +187,36 @@
++ reap
|= [=wire saw=(unit tang)]
^- (quip move _this)
::
?: =([%export ~] wire)
[~ this]
::
?^ saw
[((slog u.saw) ~) this]
?> ?=(^ job.state)
:_ this
:~ [ost.bow %poke /sole [our.bow %dojo] %lens-command com.u.job.state]
:: XX move to +diff-sole-effect?
::
[ost.bow %pull /sole [our.bow %dojo] ~]
==
::
++ coup
|= [=wire saw=(unit tang)]
^- (quip move _this)
::
?: =([%import ~] wire)
?> ?=(^ job.state)
:_ this(job.state ~)
:_ ~
:* bone.u.job.state
%http-response
%start
[%200 ~]
[~ (as-octt:mimes:html "\"Imported data\"")]
%.y
==
::
?^ saw
[((slog u.saw) ~) this]
[~ this]

View File

@ -61,6 +61,7 @@
++ manual-tests
^- (list (pair term [(list ship) _*form:(ph ,~)]))
=+ (ph-tests our.hid)
=+ ph-azimuth=(ph-azimuth our.hid)
=/ eth-node (spawn:ph-azimuth ~bud)
=/ m (ph ,~)
:~ :+ %boot-bud
@ -110,7 +111,49 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
(pure:m ~)
::
:+ %hi-az
~[~bud ~dev]
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > %dev-done
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > %bud-done
(send-hi ~bud ~dev)
(pure:m ~)
::
:+ %moon-az
~[~bud ~marbud ~linnup-torsyx ~linnup-torsyx-linnup-torsyx ~dev]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~linnup-torsyx)
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx)
~& > 'LINNUP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~linnup-torsyx-linnup-torsyx)
~& > 'MOON LINNUP DONE'
;< ~ bind:m (send-hi ~bud ~linnup-torsyx-linnup-torsyx)
~& > 'HI DOWN DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~marbud)
~& > 'HI UP DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
;< ~ bind:m (send-hi ~linnup-torsyx-linnup-torsyx ~dev)
~& > 'HI OVER UP DONE'
;< ~ bind:m (send-hi ~dev ~linnup-torsyx-linnup-torsyx)
~& > 'HI OVER DOWN DONE'
(pure:m ~)
(pure:m ~)
::
:+ %breach-hi
@ -119,17 +162,24 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'DEV DONE'
(send-hi ~bud ~dev)
~& > 'HI DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~dev ~bud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~bud ~dev)
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
~& > 'HI NOT RESPONDING DONE'
;< ~ bind:m (raw-real-ship:eth-node ~dev)
~& > 'REBOOT DEV DONE'
(wait-for-dojo ~bud "hi ~dev successful")
~& > 'DONE'
(pure:m ~)
::
:+ %breach-hi-cousin
@ -140,10 +190,10 @@
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
;< ~ bind:m (raw-real-ship:eth-node ~dev)
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(send-hi ~marbud ~mardev)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~mardev ~marbud)
@ -151,59 +201,111 @@
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (send-hi-not-responding ~marbud ~mardev)
;< ~ bind:m (raw-ship ~mardev `(dawn:eth-node ~mardev))
;< ~ bind:m (raw-real-ship:eth-node ~mardev)
(wait-for-dojo ~marbud "hi ~mardev successful")
(pure:m ~)
::
:+ %breach-sync
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& %checking-file-touched
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& %checked-file-touched
~& > 'TOUCH FILE CHECK DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-multiple
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH DONE'
(check-file-touched ~marbud %home file)
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~bud ~marbud)
~& > 'BREACH-1 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< eth-node=_eth-node bind:m
(breach-and-hear:eth-node our.hid ~marbud ~bud)
~& > 'BREACH-2 DONE'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~marbud `(dawn:eth-node ~marbud))
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD RE DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
::
:+ %breach-sudden
~[~bud ~marbud]
=. eth-node (spawn:eth-node ~marbud)
=. eth-node (spawn:eth-node ~fipfes)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD DONE'
;< ~ bind:m (raw-real-ship:eth-node ~marbud)
~& > 'MARBUD DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH FILE DONE'
(check-file-touched ~marbud %home file)
~& > 'TOUCH FILE CHECK DONE'
=. eth-node (breach:eth-node ~bud)
~& > 'BREACH EXECUTED'
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-real-ship:eth-node ~bud)
~& > 'BUD RE DONE'
;< ~ bind:m (just-events (dojo ~bud "|merge %base ~marbud %kids, =gem %this"))
~& > 'THIS MERGE STARTED DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-1 DONE'
;< file=@t bind:m (touch-file ~bud %base)
~& > 'TOUCH-2 DONE'
(check-file-touched ~marbud %home file)
~& > 'DONE DONE'
(pure:m ~)
==
::

View File

@ -34,6 +34,15 @@
/: /===/app/publish/img /_ /png/
::
|%
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ move [bone card]
::
@ -268,7 +277,7 @@
(~(get by subs.sat) who.del col.del)
=/ new=collection
?~ old
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
:* [0 %.n ~] (my [pos.del ost.bol dat.del] ~) ~
[~ ~] [%white ~] ~ now.bol
==
%= u.old
@ -348,7 +357,7 @@
[~ da-this]
=. subs.sat (~(del by subs.sat) who.del col.del)
:- ~(tap in ~(key by pos.u.old))
%- da-emil
%- da-emil
:- [ost.bol %pull /collection/[col.del] [who.del %publish] ~]
(affection-primary del)
:: iterate through post ids collected before, removing each from
@ -373,7 +382,7 @@
da-this
?. (~(has in ~(key by pos.u.old)) u.pos.del)
da-this
=/ new=collection
=/ new=collection
%= u.old
pos (~(del by pos.u.old) u.pos.del)
com (~(del by com.u.old) u.pos.del)
@ -392,7 +401,7 @@
++ da-remove-unread
|= [who=@p coll=@tas post=@tas]
^+ da-this
=. unread.sat (~(del in unread.sat) who coll post)
=. unread.sat (~(del in unread.sat) who coll post)
(da-emil make-tile-moves)
::
++ da-remove-latest
@ -482,7 +491,7 @@
^+ da-this
=/ new-post=post-info (need (get-post-info-by-index who coll post))
=/ col=collection (need (get-coll-by-index who coll))
::
::
=/ pre=(list @tas) ~
=/ suf=(list @tas)
?: pinned.new-post
@ -635,7 +644,7 @@
:: 1st part of multi-part, store partial delta and don't process it
::
=/ del=delta
:* %total our.bol col [ost.bol dat]
:* %total our.bol col [ost.bol dat]
~ ~ [~ ~] [%white ~] ~ now.bol
==
=. awaiting.sat (~(put by awaiting.sat) col builds.u.awa `del)
@ -648,7 +657,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -665,7 +674,7 @@
=/ del=delta
:* %total
our.bol
col
col
[ost.bol dat]
pos.dat.u.partial.u.awa
com.dat.u.partial.u.awa
@ -733,8 +742,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
(~(put by pos.dat.u.partial.u.awa) pos [ost.bol dat])
com.dat.u.partial.u.awa
[~ ~]
@ -784,8 +793,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -801,8 +810,8 @@
=/ del=delta
:* %total
our.bol
col
col.dat.u.partial.u.awa
col
col.dat.u.partial.u.awa
pos.dat.u.partial.u.awa
(~(put by com.dat.u.partial.u.awa) pos [ost.bol dat])
[~ ~]
@ -881,7 +890,7 @@
=/ pax=path /web/publish/[name.act]/publish-info
=/ blog-perms=card
:* %perm /perms q.byk.bol
/web/publish/[name.act]
/web/publish/[name.act]
%rw `read.perm.act `write.perm.act
==
=/ info-perms=card
@ -999,7 +1008,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
kills
moves
@ -1194,7 +1203,7 @@
=/ del=delta [%remove our.bol coll.act ~]
=^ moves this (bake del)
::
:-
:-
;: welp
moves
make-tile-moves
@ -1259,7 +1268,13 @@
::
%read
=. unread.sat (~(del in unread.sat) who.act coll.act post.act)
[make-tile-moves this]
:_ this
%+ welp make-tile-moves
::
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %publish-update %unread %.n (sy [who.act coll.act post.act] ~)]
::
==
::
@ -1361,6 +1376,68 @@
::
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
++ make-tile-moves
^- (list move)
%+ turn (prey:pubsub:userlib /publishtile bol)

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -66,9 +66,9 @@
== ::
++ work :: interface action
$% :: circle management ::
{$join (map circle range)} :: subscribe to
{$join (map circle range) (unit char)} :: subscribe to
{$leave audience} :: unsubscribe from
{$create security name cord} :: create circle
{$create security name cord (unit char)} :: create circle
{$delete name (unit cord)} :: delete circle
{$depict name cord} :: change description
{$filter name ? ?} :: change message rules
@ -716,8 +716,12 @@
++ circ :: circle
;~ pose
(cold incir col)
;~(pfix cen (stag self urs:ab))
;~(pfix net (stag (^sein:title self) urs:ab))
;~ pfix cen
%+ stag self
%+ sear |=(circ=name ?:(=('' circ) ~ (some circ)))
urs:ab
==
::
%+ cook
|= {a/@p b/(unit term)}
@ -838,14 +842,14 @@
::
;~((glue ace) (perk %read ~) cire dem:ag)
::
;~((glue ace) (perk %join ~) sorz)
;~((glue ace) (perk %join ~) ;~(plug sorz (punt ;~(pfix ace glyph))))
::
;~((glue ace) (perk %leave ~) cirs)
::
;~ (glue ace) (perk %create ~)
pore
cire
qut
;~(plug qut (punt ;~(pfix ace glyph)))
==
::
;~ plug (perk %delete ~)
@ -1186,9 +1190,11 @@
:: change local mailbox config to include
:: subscriptions to {pas}.
::
|= pos/(map circle range)
|= {pos/(map circle range) gyf/(unit char)}
^+ ..sh-work
=+ pas=~(key by pos)
=? ..sh-work ?=(^ gyf)
(bind u.gyf `pas)
=. ..sh-work
sh-prod(active.she pas)
:: default to a day of backlog
@ -1226,11 +1232,11 @@
::
:: creates circle {nom} with specified config.
::
|= {sec/security nom/name txt/cord}
|= {sec/security nom/name txt/cord gyf/(unit char)}
^+ ..sh-work
=. ..sh-work
(sh-act %create nom txt sec)
(join [[[self nom] ~] ~ ~])
(join [[[self nom] ~] ~ ~] gyf)
::
++ delete
:: %delete
@ -1922,7 +1928,7 @@
$(dif [%filter fit.cof.dif])
?: ?=($remove -.dif)
(sh-note (weld "rip " (~(cr-show cr cir) ~)))
?: ?=($usage -.dif) +>
?: ?=(?($usage $read) -.dif) +>
%- sh-note
%+ weld
(weld ~(cr-phat cr cir) ": ")
@ -1933,9 +1939,6 @@
::
$caption
"cap: {(trip cap.dif)}"
::
$read
""
::
$filter
;: weld
@ -2314,7 +2317,15 @@
url+(crip (apix:en-purl:html url.sep))
::
$exp
mor+~[txt+"# {(trip exp.sep)}" tan+res.sep]
=/ texp=tape ['>' ' ' (trip exp.sep)]
:- %mor
|- ^- (list sole-effect:sole-sur)
?: =("" texp) [tan+res.sep ~]
=/ newl (find "\0a" texp)
?~ newl [txt+texp $(texp "")]
=+ (trim u.newl texp)
:- txt+(scag u.newl texp)
$(texp [' ' ' ' (slag +(u.newl) texp)])
::
$ire
=+ num=(~(get by known) top.sep)
@ -2399,7 +2410,11 @@
==
::
$exp
:- (tr-chow wyd '#' ' ' (trip exp.sep))
=+ texp=(trip exp.sep)
=+ newline=(find "\0a" texp)
=? texp ?=(^ newline)
(weld (scag u.newline texp) " ...")
:- (tr-chow wyd '#' ' ' texp)
?~ res.sep ~
=- [' ' (tr-chow (dec wyd) ' ' -)]~
~(ram re (snag 0 `(list tank)`res.sep))

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
/+ pill
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=~
~
==
:- %pill
.^(pill:pill %gx /(scot %p p.bec)/aqua/(scot %da now)/pill/noun)

View File

@ -1,14 +1,14 @@
=> |%
+$ src
$% [%ship =ship ~]
[%node url=@t ~]
[%app =term ~]
==
--
:- %say
|= [* [whos=(set ship) =src] ~]
=/ =source:kale
|= [* [whos=(list ship) =src] ~]
=/ =source:jael
?- -.src
%ship [%& ship.src]
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da]
%app [%| term.src]
==
[%azimuth-tracker-poke %listen whos source]

View File

@ -1,6 +1,6 @@
=> |%
+$ config
[url=@ta =from=number:block:able:kale]
[url=@ta =from=number:block:able:jael]
--
:- %say
|= [* config ~]

View File

@ -0,0 +1,33 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=rift
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^rift
?. =(*^rift rift)
rift
+(.^(^rift j+/(scot %p our)/rift/(scot %da now)/(scot %p mon)))
`[mon *id:block:able:jael %rift rift]

View File

@ -0,0 +1,45 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[mon=@p ~]
=life
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't manage a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =^life
?. =(*^life life)
life
+(.^(^life j+/(scot %p our)/life/(scot %da now)/(scot %p mon)))
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys life 1 pass]

View File

@ -0,0 +1,44 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/hood/gen
::
/- *sole
/+ *generators
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- %- slog :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
~
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- %- slog :_ ~
:- %leaf
"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
~
=/ =pass
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life=1 eny)))
=/ =seed:able:jael
[mon 1 sec:ex:cub ~]
%- %- slog
:~ leaf+"moon: {(scow %p mon)}"
leaf+(scow %uw (jam seed))
==
pub:ex:cub
`[mon *id:block:able:jael %keys 1 1 pass]

View File

@ -0,0 +1,13 @@
:: Kiln: clear Gall compiler caches
::
:::: /hoon/wash-gall/hood/gen
::
/? 310
::
::::
!:
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~ ~
==
[%kiln-wash-gall ~]

View File

@ -1,38 +0,0 @@
:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/gen
::
/? 310
/- *sole
/+ *generators
::
::::
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
~
==
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- produce
:- %tang :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- produce
:- %tang :_ ~
leaf+"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
=/ sig=oath:pki:jael
.^(@ j+/(scot %p our)/earl/(scot %da now)/(scot %p mon)/(scot %ud lyf)/(scot %ux pub:ex:cub))
=/ sed=seed:able:jael
[mon lyf sec:ex:cub `sig]
%+ print leaf+"moon: {(scow %p mon)}"
%- produce [%atom (scot %uw (jam sed))]

View File

@ -15,7 +15,8 @@
arg=$@(~ [top=path ~])
dub=_|
==
:- %noun
:- %pill
^- pill:pill
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
=/ sys=path

View File

@ -1,69 +1,6 @@
/- hall
/- *chat, hall
/+ hall-json
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%quit ~]
[%poke wire dock poke]
[%peer wire dock path]
[%pull wire dock ~]
[%diff diff]
==
::
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ state
$% [%0 str=streams]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
::
::
:: +utilities
::
++ msg-to-json
=, enjs:format
|= upd=update
@ -88,7 +25,7 @@
^- json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::
@ -135,6 +72,4 @@
[%length (numb len)]
==
==
::
--
::

View File

@ -65,7 +65,7 @@
++ lank ::: tank as string arr
|= a/tank
^- json
a+(turn (wash [0 1.024] a) tape)
a+(turn (wash [0 80] a) tape)
::
++ dank ::: tank
|= a/tank
@ -577,7 +577,7 @@
:+ ~ u.exp
=+ res=((ot res+(ar dank) ~) a)
?^ res u.res
p:(mule |.([(sell (slap !>(..zuse) (ream u.exp)))]~)) ::TODO oldz
p:(mule |.([(sell (slap !>(..^zuse) (ream u.exp)))]~)) ::TODO oldz
::
++ atta ::: attache
^- $-(json (unit attache))

View File

@ -84,6 +84,11 @@
[%base %talk]
[%base %dojo]
[%base %modulo]
[%home %launch]
[%home %chat]
[%home %publish]
[%home %clock]
[%home %weather]
==
:~ [%home %lens]
[%home %acme]
@ -97,6 +102,7 @@
[%home %publish]
[%home %clock]
[%home %weather]
[%home %azimuth-tracker]
==
::
++ deft-fish :: default connects
@ -105,7 +111,7 @@
^- (list gill:gall)
[[our %talk] [our %dojo] ~]
::
++ make :: initial part
++ make :: initial part
|= our/ship
^- part
:* %drum

View File

@ -40,12 +40,13 @@
$% [%bonk wire ~] ::
{$conf wire dock $load ship term} ::
{$flog wire flog:dill} ::
[%mint wire p=ship q=safe:rights:jael]
{$nuke wire ship} ::
[%serve wire binding:eyre generator:eyre]
[%serve wire binding:eyre generator:eyre] ::
{$poke wire dock pear} ::
{$rest wire @da} ::
{$wait wire @da} ::
{$rekey wire life ring} ::
{$moon wire ship udiff:point:able:jael} ::
== ::
++ move (pair bone card) :: user-level move
++ pear :: poke fruit
@ -79,14 +80,14 @@
?. =(our who.u.sed)
~& [%wrong-private-key-ship who.u.sed]
+>.$
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
?. =(+(lyf) lyf.u.sed)
~& [%wrong-private-key-life expected=+(lyf) actual=lyf.u.sed]
(emit %rekey / lyf.u.sed key.u.sed)
::
++ poke-moon :: rotate moon keys
|= sed=(unit [=ship =udiff:point:able:jael])
=< abet
?~ sed
+>.$
:: our new private key, as a +tree of +rite
::
=/ rit (sy [%jewel (my [lyf.u.sed key.u.sed] ~)] ~)
(emit %mint / our rit)
(emit %moon / u.sed)
::
++ poke-nuke :: initialize
|= him/ship =< abet

View File

@ -70,6 +70,7 @@
{$merg wire @tas @p @tas case germ} ::
{$perm wire desk path rite} ::
{$poke wire dock pear} ::
[%wash wire ~]
{$wipe wire @ud} ::
[%keep wire compiler-cache-size=@ud build-cache-size=@ud]
{$wait wire @da} ::
@ -276,6 +277,8 @@
|= [compiler-cache-size=@ud build-cache-size=@ud]
abet:(emit %keep /kiln compiler-cache-size build-cache-size)
::
++ poke-wash-gall |=(* abet:(emit %wash /kiln ~))
::
++ mack
|= {way/wire saw/(unit tang)}
~? ?=(^ saw) [%kiln-nack u.saw]

View File

@ -1,24 +0,0 @@
::
|%
::
+$ move [bone card]
::
+$ card
$% [%http-response =http-event:http]
[%connect wire binding:eyre term]
[%peer wire dock path]
[%diff %json json]
==
::
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
::
+$ state
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
==
::
--
::

View File

@ -1,9 +1,10 @@
:: Mock Azimuth
::
/+ ph, ph-util, ph-philter
/+ ph, ph-util, ph-philter, ph-tests
=, ph
=, ph-util
=, ph-philter
|= our=ship
=> |%
+$ az-log [topics=(lest @) data=@t]
--
@ -30,22 +31,39 @@
|= pin=ph-input
^- output:n
=, enjs:format
=/ thus (extract-thus-to uf.pin 'http://localhost:8545')
?~ thus
=/ ask (extract-request uf.pin 'http://localhost:8545/')
?~ ask
[& ~ %wait ~]
?~ r.mot.u.thus
?~ body.request.u.ask
[& ~ %wait ~]
=/ req q.u.r.mot.u.thus
=/ req q.u.body.request.u.ask
|^ ^- output:n
=/ method (get-method req)
:: =; a ~& [%give-azimuth-response a] -
?: =(method 'eth_blockNumber')
:- | :_ [%wait ~]
%+ answer-request req
s+(crip (num-to-hex:ethereum latest-block))
?: =(method 'eth_getBlockByNumber')
:- | :_ [%wait ~]
%+ answer-request req
:- %o
=/ number (hex-to-num:ethereum (get-first-param req))
=/ hash (number-to-hash number)
=/ parent-hash (number-to-hash ?~(number number (dec number)))
%- malt
^- (list (pair term json))
:~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
number+s+(crip (num-to-hex:ethereum number))
'parentHash'^s+(crip (num-to-hex:ethereum parent-hash))
==
?: =(method 'eth_getLogs')
:- | :_ [%wait ~]
%+ answer-request req
%+ logs-to-json
?^ (get-param-obj-maybe req 'blockHash')
%- logs-by-hash
(get-param-obj req 'blockHash')
%+ logs-by-range
(get-param-obj req 'fromBlock')
(get-param-obj req 'toBlock')
?: =(method 'eth_newFilter')
@ -67,7 +85,7 @@
:+ |
%+ answer-request req
~| [eth-filters latest-block]
(logs-to-json from-block.u.fil latest-block)
(logs-by-range from-block.u.fil latest-block)
=. last-block.u.fil latest-block
[%cont ..stay]
?: =(method 'eth_getFilterChanges')
@ -77,16 +95,17 @@
~|(%no-filter-not-implemented !!)
:+ |
%+ answer-request req
(logs-to-json last-block.u.fil latest-block)
(logs-by-range last-block.u.fil latest-block)
=. all.eth-filters
%+ ~(put by all.eth-filters)
fil-id
u.fil(last-block latest-block)
[%cont ..stay]
~& [%ph-azimuth-miss req]
[& ~ %wait ~]
::
++ latest-block
(add launch:contracts:azimuth (lent logs))
(add launch:contracts:azimuth (dec (lent logs)))
::
++ get-id
|= req=@t
@ -110,6 +129,20 @@
?> ?=([* ~] array)
i.array
::
++ get-param-obj-maybe
|= [req=@t param=@t]
^- (unit @ud)
=, dejs-soft:format
=/ array
%. (need (de-json:html req))
(ot params+(ar (ot param^so ~)) ~)
?~ array
~
:- ~
?> ?=([* ~] u.array)
%- hex-to-num:ethereum
i.u.array
::
++ get-filter-id
|= req=@t
=, dejs:format
@ -120,6 +153,14 @@
?> ?=([* ~] id)
i.id
::
++ get-first-param
|= req=@t
=, dejs:format
=/ id
%. (need (de-json:html req))
(ot params+(at so bo ~) ~)
-.id
::
++ answer-request
|= [req=@t result=json]
^- (list ph-event)
@ -136,19 +177,42 @@
who.pin
//http-client/0v1n.2m9vh
%receive
num.u.thus
num.u.ask
[%start [200 ~] `(as-octs:mimes:html resp) &]
==
::
++ logs-to-json
++ number-to-hash
|= =number:block:able:jael
^- @
?: (lth number launch:contracts:azimuth)
(cat 3 0x5364 (sub launch:contracts:azimuth number))
(cat 3 0x5363 (sub number launch:contracts:azimuth))
::
++ hash-to-number
|= =hash:block:able:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
|= [from-block=@ud to-block=@ud]
%+ logs-to-json (max launch:contracts:azimuth from-block)
?: (lth to-block launch:contracts:azimuth)
~
%+ swag
?: (lth from-block launch:contracts:azimuth)
[0 +((sub to-block launch:contracts:azimuth))]
:- (sub from-block launch:contracts:azimuth)
+((sub to-block from-block))
logs
::
++ logs-by-hash
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json
|= [count=@ud selected-logs=(list az-log)]
^- json
:- %a
=/ selected-logs
%+ swag
[(sub from-block launch:contracts:azimuth) (sub to-block from-block)]
logs
=/ count from-block
|- ^- (list json)
?~ selected-logs
~
@ -160,7 +224,8 @@
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5362)))
::
:+ 'blockHash' %s
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5363)))
=/ hash (number-to-hash count)
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
::
:+ 'blockNumber' %s
(crip (num-to-hex:ethereum count))
@ -183,23 +248,60 @@
--
--
::
++ dawn
++ raw-real-ship
|= who=ship
=/ m (ph ,~)
^- form:m
?. =(%earl (clan:title who))
(raw-ship:(ph-tests our) who `(dawn who ~))
=/ spon=ship (^sein:title who)
=/ cub (pit:nu:crub:crypto 512 (shaz (jam who life=1 %entropy)))
=/ =seed:able:jael
[who 1 sec:ex:cub ~]
=/ =pass pub:ex:cub
=/ com=tape "|moon {(scow %p who)}, =public-key {(scow %uw pass)}"
;< ~ bind:m (just-events:(ph-tests our) (dojo spon com))
(raw-ship:(ph-tests our) who `(dawn who `seed))
::
++ dawn
|= [who=ship seed=(unit seed:able:jael)]
^- dawn-event
=/ lyfe lyfe:(~(got by lives) who)
:* [who lyfe sec:ex:(get-keys who lyfe) ~]
(^sein:title who)
=/ spon
=/ =ship (^sein:title who)
=/ spon-spon
?: ?=(%czar (clan:title ship))
[| ~zod]
[& (^sein:title ship)]
=/ life-rift ~|([ship lives] (~(got by lives) ship))
=/ =life lyfe.life-rift
=/ =rift rut.life-rift
=/ =pass
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public ship life %crypt))
(as-octs:mimes:html (get-public ship life %auth))
1
:^ ship=ship
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
=/ =seed:able:jael
?^ seed
u.seed
=/ life-rift (~(got by lives) who)
=/ =life lyfe.life-rift
[who life sec:ex:(get-keys who life) ~]
:* seed
spon
get-czars
~[~['arvo' 'netw' 'ork']]
0
`(need (de-purl:html 'http://localhost:8545'))
~
==
::
:: Should only do galaxies
::
++ get-czars
^- (map ship [life pass])
^- (map ship [rift life pass])
%- malt
%+ murn
~(tap by lives)
@ -207,7 +309,7 @@
?. =(%czar (clan:title who))
~
%- some
:+ who lyfe
:^ who rut lyfe
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public who lyfe %crypt))
(as-octs:mimes:html (get-public who lyfe %auth))
@ -217,21 +319,17 @@
|= who=@p
?< (~(has by lives) who)
=. lives (~(put by lives) who [1 0])
%- add-logs
%+ welp
?: =(%czar (clan:title who))
~
~[(spawned:lo (^sein:title who) who)]
:~ (activated:lo who)
(owner-changed:lo who 0xdead.beef)
%- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
=. this-az
%- add-logs
:~ %- changed-keys:lo
:* who
(get-public who 1 %crypt)
(get-public who 1 %auth)
1
1
==
==
(spam-logs 30)
::
:: our: host ship
:: who: cycle keys
@ -303,9 +401,16 @@
=/ prev (~(got by lives) who)
=/ rut +(rut.prev)
=. lives (~(put by lives) who [lyfe.prev rut])
%- add-logs
:_ ~
(broke-continuity:lo who rut)
=. this-az
(add-logs (broke-continuity:lo who rut) ~)
(spam-logs 30)
::
++ spam-logs
|= n=@
?: =(n 0)
this-az
=. this-az ?:((~(has by lives) ~fes) (cycle-keys ~fes) (spawn ~fes))
$(n (dec n))
::
++ get-keys
|= [who=@p lyfe=life]
@ -326,11 +431,6 @@
++ lo
=, azimuth-events:azimuth
|%
++ activated
|= who=ship
^- az-log
[~[^activated who] '']
::
++ broke-continuity
|= [who=ship rut=rift]
^- az-log
@ -351,15 +451,5 @@
(render-hex-bytes:ethereum 32 `@`crypto)
(render-hex-bytes:ethereum 32 `@`lyfe)
==
::
++ owner-changed
|= [who=ship owner=@ux]
^- az-log
[~[^owner-changed who owner] '']
::
++ spawned
|= [par=ship who=ship]
^- az-log
[~[^spawned par who] '']
--
--

View File

@ -80,13 +80,12 @@
::
:: Check if given effect is an http request; extract
::
++ extract-thus-to
++ extract-request
|= [uf=unix-effect dest=@t]
^- (unit [num=@ud mot=moth:eyre])
?. ?=(%thus -.q.uf) ~
?~ q.q.uf ~
?. =(p.u.q.q.uf (rash dest auri:de-purl:html)) ~
`[p.q.uf q.u.q.q.uf]
^- (unit [num=@ud =request:http])
?. ?=(%request -.q.uf) ~
?. =(dest url.request.q.uf) ~
`[id.q.uf request.q.uf]
::
:: Scry into a running aqua ship
::

View File

@ -6,6 +6,26 @@
::
:: sys: full path to /sys directory
::
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ dawn-event
$: =seed:able:jael
spon=[=ship point:azimuth]
czar=(map ship [=rift =life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
==
::
++ module-ova
|= sys=path
^- (list [wire [%veer term path cord]])
@ -54,7 +74,7 @@
=/ directories
`(list path)`~[/app /gen /lib /mar /ren /sec /sur /sys /tests /web]
|= bas=path
^- ovum
^- unix-event
::
:: /app %gall applications
:: /gen :dojo generators
@ -71,7 +91,7 @@
|= :: sal: all spurs to load from
::
sal/(list spur)
^- ovum
^- unix-event
::
:: hav: all user files
::
@ -97,7 +117,7 @@
=? hav ?=(^ fil.lon)
:: XX this whitelist needs to be reviewed
::
?. ?= ?($css $hoon $json $md $txt $udon $umd)
?. ?= ?($css $hoon $html $js $json $md $png $txt $udon $umd)
-.tyl
::
:: install only files with whitelisted marks

View File

@ -166,67 +166,4 @@
::
[%last-update (time:enjs:format last-update.col)]
==
::
++ state-to-json
|= sat=state
^- json
%- pairs:enjs:format
:~ :+ %pubs
%o
%+ roll ~(tap by pubs.sat)
|= [[nom=@tas col=collection] out=(map @t json)]
%+ ~(put by out)
nom
(total-build-to-json col)
::
:+ %subs
%o
%- ~(rep by subs.sat)
|= $: [[who=@p nom=@tas] col=collection]
out=(map @t [%o (map @t json)])
==
=/ shp=@t (rsh 3 1 (scot %p who))
?: (~(has by out) shp)
%+ ~(put by out)
shp
:- %o
%+ ~(put by +:(~(got by out) shp))
nom
(total-build-to-json col)
%+ ~(put by out)
shp
:- %o
(my [nom (total-build-to-json col)] ~)
::
:+ %latest
%a
%+ turn latest.sat
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %unread
%a
%+ turn ~(tap in unread.sat)
|= [who=@p coll=@tas post=@tas]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
post+s+post
==
::
:+ %invites
%a
%+ turn ~(tap in invites.sat)
|= [[who=@p coll=@tas] title=@t]
%- pairs:enjs:format
:~ who+(ship:enjs:format who)
coll+s+coll
title+s+title
==
==
::
--

View File

@ -62,6 +62,25 @@
::
:: ----
::
:: Scry from the namespace.
::
:: Direct scrys are impossible in a tapp, so this routes around that.
::
++ scry
|* result-type=mold
|= =path
=/ m (async ,result-type)
;< ~ bind:m (send-raw-card %scry path)
|= =async-input
:^ ~ ~ ~
?~ in.async-input
[%wait ~]
?. ?=(%scry-result -.sign.u.in.async-input)
[%fail %expected-scry-result >got=-.sign< ~]
[%done (result-type result.sign.u.in.async-input)]
::
:: ----
::
:: Outgoing HTTP requests
::
++ send-request

View File

@ -255,7 +255,7 @@
:: XX if active clam contracts only to abort transaction?
::
:: ~& [%tapp-reset dap.bowl]
:: `this-tapp
:: `this-tapp
~| [%tapp-load-incompatible dap.bowl]
!!
::
@ -412,10 +412,10 @@
^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding])
::
:: Receive source update from kale
:: Receive source update from jael
::
++ source
|= [=wire whos=(set ship) =source:kale]
|= [=wire whos=(set ship) =source:jael]
^- (quip move _this-tapp)
=. waiting (~(put to waiting) ost.bowl [%take %source whos source])
?^ active
@ -428,6 +428,9 @@
|= =async-input:async-lib
^- (quip move _this-tapp)
=/ m tapp-async
=| moves=(list move)
=| scrys=(list path)
|- ^- (quip move _this-tapp)
?~ active
~| %no-active-async
~| ?~ in.async-input
@ -442,14 +445,27 @@
%& p.out
%| [[~ [%fail contracts.u.active %crash p.out]] u.active]
==
=. moves (weld moves (skip moves.r |=(=move =(%scry -.q.move))))
=. scrys
%+ weld scrys
^- (list path)
%+ murn moves.r
|= =move
^- (unit path)
?. ?=(%scry -.q.move)
~
`path.q.move
?^ scrys
=/ scry-result .^(* i.scrys)
$(scrys t.scrys, in.async-input `[i.scrys %scry-result scry-result])
=> .(active `(unit eval-form:eval:tapp-async)`active) :: TMI
=^ moves=(list move) this-tapp
=^ final-moves=(list move) this-tapp
?- -.eval-result.r
%next `this-tapp
%fail (fail-async [contracts err]:eval-result.r)
%done (done-async [contracts value]:eval-result.r)
==
[(weld moves.r moves) this-tapp]
[(weld moves final-moves) this-tapp]
::
:: Fails currently-running async
::

View File

@ -1,7 +1,7 @@
::
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ act=action:chat
++ grow

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ str=streams:chat
++ grow
@ -13,7 +13,7 @@
^- ^json
%+ frond %chat
%- pairs
:~
:~
::
[%inbox (conf:enjs:hall-json inbox.str)]
::

View File

@ -2,8 +2,8 @@
::
/? 309
::
/- hall
/+ chat, hall-json
/- chat, hall
/+ hall-json
::
|_ upd=update:chat
++ grow

View File

@ -1,6 +1,4 @@
::
::
/+ launch
/- launch
::
|_ act=action:launch
::

View File

@ -35,6 +35,8 @@
;~(pfix col (more net (cook crip (star ;~(less net prn)))))
==
listen-api+(su ;~(plug sym ;~(pfix col sym)))
export+so
import+(ot app+so base64-jam+so ~)
as+(ot mark+(su sym) next+source ~)
hoon+(ot code+so next+source ~)
==

View File

@ -1,12 +0,0 @@
::
:::: /hoon/json/lens/mar
::
/? 310
::
:::: ~fyr
::
|_ jon/json
++ grab |% ++ noun json
--
++ grow |% ++ json jon
-- --

View File

@ -47,7 +47,7 @@
::
++ new-collection
%- ot:dejs
:~ name+(su:dejs sym)
:~ name+so:dejs
title+so:dejs
comments+comment-config
allow-edit+edit-config
@ -57,8 +57,8 @@
++ new-post
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
name+(su:dejs sym)
coll+so:dejs
name+so:dejs
title+so:dejs
comments+comment-config
perm+perm-config
@ -68,40 +68,40 @@
++ new-comment
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
name+(su:dejs sym)
content+so:dejs
==
::
++ delete-collection
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ delete-post
%- ot:dejs
:~ coll+(su:dejs sym)
post+(su:dejs sym)
:~ coll+so:dejs
post+so:dejs
==
::
++ delete-comment
%- ot:dejs
:~ coll+(su:dejs sym)
post+(su:dejs sym)
comment+(su:dejs sym)
:~ coll+so:dejs
post+so:dejs
comment+so:dejs
==
::
++ edit-collection
%- ot:dejs
:~ name+(su:dejs sym)
:~ name+so:dejs
title+so:dejs
==
::
++ edit-post
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
name+(su:dejs sym)
coll+so:dejs
name+so:dejs
title+so:dejs
comments+comment-config
perm+perm-config
@ -110,9 +110,9 @@
::
++ edit-comment
%- ot:dejs
:~ coll+(su:dejs sym)
name+(su:dejs sym)
id+(su:dejs sym)
:~ coll+so:dejs
name+so:dejs
id+so:dejs
content+so:dejs
==
::
@ -147,7 +147,7 @@
::
++ invite
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
title+so:dejs
who+(ar:dejs (su:dejs fed:ag))
==
@ -155,36 +155,36 @@
++ reject-invite
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ serve
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ unserve
%- ot:dejs
:~ coll+(su:dejs sym)
:~ coll+so:dejs
==
::
++ subscribe
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ unsubscribe
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
coll+so:dejs
==
::
++ read
%- ot:dejs
:~ who+(su:dejs fed:ag)
coll+(su:dejs sym)
post+(su:dejs sym)
coll+so:dejs
post+so:dejs
==
::
--

View File

@ -19,6 +19,21 @@
[%coll s+col.upd]
[%title s+title.upd]
==
::
%unread
%- pairs
:~ [%add b+add.upd]
:+ %posts
%a
%+ turn ~(tap in keys.upd)
|= [who=@p coll=@tas post=@tas]
^- ^json
%- pairs
:~ [%who (ship who)]
[%coll s+coll]
[%post s+post]
==
==
::
==
::

View File

@ -1,16 +0,0 @@
::
:::: /hoon/snap/mar
::
=, mimes:html
|_ snap/snapshot:jael
++ grow
|%
++ mime [/application/octet-stream (jam snap)]
--
++ grab
|%
++ noun snapshot:jael
++ mime |=([p=mite:eyre q=octs:eyre] (cue q.q))
--
++ grad %mime
--

View File

@ -50,27 +50,6 @@
++ grow
=, enjs
|%
++ lens-json :: json for cli client
^- ?(~ ^json) :: null = ignore
?+ -.sef ~
$tan (wall (turn (flop p.sef) |=(a/tank ~(ram re a))))
$txt s+(crip p.sef)
$sag
=/ =atom (jam q.sef)
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
(pairs file+s+(crip <`path`p.sef>) data+s+enc ~)
$sav
(pairs file+s+(crip <`path`p.sef>) data+s+(crip (en-base64:mimes:html q.sef)) ~)
::
$mor
=+ all=(turn p.sef |=(a/sole-effect lens-json(sef a)))
=. all (skip all |=(a/^json ?=(~ a)))
?~ all ~
?~ t.all i.all
~|(multiple-effects+`(list ^json)`all !!)
==
::
++ json
^- ^json
?+ -.sef

View File

@ -10,12 +10,18 @@
:: Short names are simply the first letter of each word plus `s` if
:: it's a list.
::
/+ pill
=, pill-lib=pill
|%
++ ph-event
$% [%test-done p=?]
aqua-event
==
::
+$ unix-event unix-event:pill-lib
+$ dawn-event dawn-event:pill-lib
+$ pill pill:pill-lib
::
+$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event)]
[%pause-events who=ship]
@ -40,16 +46,6 @@
::
+$ unix-timed-event [tym=@da ue=unix-event]
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%live p=@ud q=(unit @ud)]
[%barn ~]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
unix-task
==
::
+$ unix-effect
%+ pair wire
$% [%blit p=(list blit:dill)]
@ -60,20 +56,8 @@
[%sleep ~]
[%restore ~]
[%init ~]
[%request id=@ud request=request:http]
==
+$ pill
[boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)]
::
+$ dawn-event
$: =seed:able:jael
spon=ship
czar=(map ship [=life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
snap=(unit snapshot:jael)
==
::
+$ vane-move
%+ pair bone
$% [%peer wire dock path]

45
pkg/arvo/sur/chat.hoon Normal file
View File

@ -0,0 +1,45 @@
/- hall
::
|%
+$ diff
$% [%hall-rumor rumor:hall]
[%chat-update update]
[%chat-config streams]
[%json json]
==
::
+$ poke
$% [%hall-action action:hall]
[%launch-action [@tas path @t]]
==
::
+$ streams
$: :: inbox config
::
inbox=config:hall
:: names and configs of all circles we know about
::
configs=(map circle:hall (unit config:hall))
:: messages for all circles we know about
::
messages=(map circle:hall (list envelope:hall))
::
::
circles=(set name:hall)
::
::
peers=(map circle:hall (set @p))
==
::
+$ update
$% [%inbox con=config:hall]
[%message cir=circle:hall env=envelope:hall]
[%messages cir=circle:hall start=@ud end=@ud env=(list envelope:hall)]
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]
--

7
pkg/arvo/sur/launch.hoon Normal file
View File

@ -0,0 +1,7 @@
|%
+$ tile [name=@tas subscribe=path]
::
+$ tile-data (map @tas [jon=json url=@t])
::
+$ action [name=@tas subscribe=path url=@t]
--

View File

@ -15,6 +15,8 @@
{$hoon code/@t next/source} :: end since they
{$tuple next/(list source)} :: don't bunt well
{$listen-api api/term event/term}
{$export app/@t}
{$import app/@t base64-jam/@t}
==
++ sink
$% {$stdout ~}

View File

@ -1,15 +1,15 @@
|%
::
+$ action
$% $: %new-collection
name=@tas
title=@t
$% $: %new-collection
name=@tas
title=@t
com=comment-config
edit=edit-config
perm=perm-config
==
::
$: %new-post
$: %new-post
who=@p
coll=@tas
name=@tas
@ -98,16 +98,6 @@
last-update=@da
==
::
+$ state
$: pubs=(map @tas collection)
subs=(map [ship @tas] collection)
awaiting=(map @tas [builds=(set wire) partial=(unit delta)])
latest=(list [who=ship coll=@tas post=@tas])
unread=(set [who=ship coll=@tas post=@tas])
invites=(map [who=ship coll=@tas] title=@t)
outgoing=(map path bone)
==
::
+$ delta
$% [%collection who=@p col=@tas dat=(each collection-info tang)]
[%post who=@p col=@tas pos=@tas dat=(each [post-info manx @t] tang)]
@ -118,5 +108,6 @@
::
+$ update
$% [%invite add=? who=@p col=@tas title=@t]
[%unread add=? keys=(set [who=@p coll=@tas post=@tas])]
==
--

View File

@ -4,7 +4,8 @@
:: Possible async calls
::
+$ card
$% [%wait wire @da]
$% [%scry =path]
[%wait wire @da]
[%rest wire @da]
[%poke wire dock poke-data]
[%peer wire dock path]
@ -15,22 +16,23 @@
[%connect wire binding:eyre term]
[%http-response =http-event:http]
[%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:kale]
[%source wire whos=(set ship) src=source:jael]
[%sources wire ~]
[%new-event wire =ship =udiff:point:able:kale]
[%listen wire whos=(set ship) =source:kale]
[%new-event wire =ship =udiff:point:able:jael]
[%listen wire whos=(set ship) =source:jael]
==
::
:: Possible async responses
::
+$ sign
$% [%wake error=(unit tang)]
$% [%scry-result result=*]
[%wake error=(unit tang)]
[%coup =dock error=(unit tang)]
[%quit =dock =path]
[%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre]
[%http-response response=client-response:iris]
[%source whos=(set ship) =source:kale]
[%source whos=(set ship) =source:jael]
==
::
:: Outstanding contracts

View File

@ -459,7 +459,7 @@
::
++ dint :: input routing
|= hap/path ^- @tas
?+ hap !!
?+ hap ~|([%bad-dint hap] !!)
{@ $ames *} %a
{@ $boat *} %c
{@ $newt *} %a

View File

@ -481,12 +481,12 @@
|* {a/(unit) b/(unit)}
?~ b a
?~ a b
?.(=(u.a u.b) ~>(%mean.[%leaf "mate"] !!) a)
?.(=(u.a u.b) ~>(%mean.'mate' !!) a)
::
++ need :: demand
~/ %need
|* a/(unit)
?~ a ~>(%mean.[%leaf "need"] !!)
?~ a ~>(%mean.'need' !!)
u.a
::
++ some :: lift (pure)
@ -8927,7 +8927,7 @@
* gen
==
::
++ rake ~>(%mean.[%leaf "rake-hoon"] (need reek))
++ rake ~>(%mean.'rake-hoon' (need reek))
++ reek
^- (unit wing)
?+ gen ~
@ -8941,7 +8941,7 @@
^- term
=+ wig=rake
?. ?=({@ ~} wig)
~>(%mean.[%leaf "rusk-hoon"] !!)
~>(%mean.'rusk-hoon' !!)
i.wig
--
::
@ -9089,7 +9089,7 @@
%void %void
%noun [%atom p.base.skin ~]
[%atom *] ?. (fitz p.base.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max p.base.skin p.ref)
q.ref
@ -9134,7 +9134,7 @@
[%atom *] ?: &(?=(^ q.ref) !=(atom.skin u.q.ref))
%void
?. (fitz aura.skin p.ref)
~>(%mean.[%leaf "atom-mismatch"] !!)
~>(%mean.'atom-mismatch' !!)
:+ %atom
(max aura.skin p.ref)
`atom.skin
@ -9626,14 +9626,14 @@
++ play
^- type
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.p.lug))
(elbo p.lug rig)
::
++ mint
|= gol/type
^- (pair type nock)
=+ lug=(find %read hyp)
?: ?=(%| -.lug) ~>(%mean.[%leaf "hoon"] ?>(?=(~ rig) p.lug))
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug))
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
(etco p.lug rig)
::
@ -9902,7 +9902,7 @@
:- %hold
?. ?=({$core *} p)
~_ (dunk %fire-type)
~>(%mean.[%leaf "fire-core"] !!)
~>(%mean.'fire-core' !!)
=+ dox=[%core q.q.p q.p(r.p %gold)]
?: ?=($dry -.q)
:: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry)
@ -9934,7 +9934,7 @@
[%3 %0 axe]
(flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3)))
::
{$core *} ~>(%mean.[%leaf "fish-core"] !!)
{$core *} ~>(%mean.'fish-core' !!)
{$face *} $(sut q.sut)
{$fork *} =+ yed=~(tap in p.sut)
|- ^- nock
@ -9942,7 +9942,7 @@
{$hint *} $(sut q.sut)
{$hold *}
?: (~(has in vot) sut)
~>(%mean.[%leaf "fish-loop"] !!)
~>(%mean.'fish-loop' !!)
=> %=(. vot (~(put in vot) sut))
$(sut repo)
==
@ -9980,7 +9980,7 @@
{$hint *} (hint p.sut $(sut q.sut))
{$hold *}
?: (~(has in bix) [sut ref])
~>(%mean.[%leaf "fuse-loop"] !!)
~>(%mean.'fuse-loop' !!)
$(sut repo, bix (~(put in bix) [sut ref]))
::
$noun ref
@ -10185,7 +10185,7 @@
|^ ^- {p/type q/nock}
?: ?&(=(%void sut) !?=({$dbug *} gen))
?. |(!vet ?=({$lost *} gen) ?=({$zpzp *} gen))
~>(%mean.[%leaf "mint-vain"] !!)
~>(%mean.'mint-vain' !!)
[%void %0 0]
?- gen
::
@ -10267,7 +10267,7 @@
{$wthx *}
:- (nice bool)
=+ fid=(find %read [[%& 1] q.gen])
~> %mean.[%leaf "mint-fragment"]
~> %mean.'mint-fragment'
?> &(?=(%& -.fid) ?=(%& -.q.p.fid))
(~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid))
::
@ -10294,7 +10294,7 @@
{$lost *}
?: vet
~_ (dunk(sut (play p.gen)) 'lost')
~>(%mean.[%leaf "mint-lost"] !!)
~>(%mean.'mint-lost' !!)
[%void [%0 0]]
::
{$zpmc *}
@ -10311,7 +10311,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mint-open"] !!)
~>(%mean.'mint-open' !!)
$(gen doz)
==
::
@ -10349,7 +10349,7 @@
|= {gol/type dox/type gen/hoon}
|^ ^- {p/type q/type}
?: =(%void sut)
~>(%mean.[%leaf "mull-none"] !!)
~>(%mean.'mull-none' !!)
?- gen
::
{^ *}
@ -10414,9 +10414,9 @@
:- %void
?: =(%void q.fex)
%void
~>(%mean.[%leaf "if-z"] (play(sut q.fex) q.gen))
~>(%mean.'if-z' (play(sut q.fex) q.gen))
?: =(%void q.fex)
~>(%mean.[%leaf "mull-bonk-b"] !!)
~>(%mean.'mull-bonk-b' !!)
$(sut p.fex, dox q.fex, gen q.gen)
=+ ^= ran ^- {p/type q/type}
=+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)]
@ -10424,9 +10424,9 @@
:- %void
?: =(%void q.wux)
%void
~>(%mean.[%leaf "if-a"] (play(sut q.wux) r.gen))
~>(%mean.'if-a' (play(sut q.wux) r.gen))
?: =(%void q.wux)
~>(%mean.[%leaf "mull-bonk-c"] !!)
~>(%mean.'mull-bonk-c' !!)
$(sut p.wux, dox q.wux, gen r.gen)
[(nice (fork p.hiq p.ran ~)) (fork q.hiq q.ran ~)]
::
@ -10436,11 +10436,11 @@
q=(cove q:(mint(sut dox) %noun [%wing q.gen]))
=+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)]
?. &(=(p.syx q.syx) =(p.pov q.pov))
~>(%mean.[%leaf "mull-bonk-a"] !!)
~>(%mean.'mull-bonk-a' !!)
(beth bool)
::
{$wthx *}
~> %mean.[%leaf "mull-bonk-x"]
~> %mean.'mull-bonk-x'
=+ :- =+ (find %read [[%& 1] q.gen])
?> &(?=(%& -.-) ?=(%& -.q.p.-))
new=[type=p.q.p.- axis=(tend p.p.-)]
@ -10456,7 +10456,7 @@
{$lost *}
?: vet
:: ~_ (dunk(sut (play p.gen)) 'also')
~>(%mean.[%leaf "mull-skip"] !!)
~>(%mean.'mull-skip' !!)
(beth %void)
::
{$zpts *} (beth %noun)
@ -10468,7 +10468,7 @@
{$zpvt *}
=+ [(feel p.gen) (feel(sut dox) p.gen)]
?. =(-< ->)
~>(%mean.[%leaf "mull-bonk-f"] !!)
~>(%mean.'mull-bonk-f' !!)
?: -<
$(gen q.gen)
$(gen r.gen)
@ -10478,7 +10478,7 @@
=+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "mull-open"] !!)
~>(%mean.'mull-open' !!)
$(gen doz)
==
::
@ -10559,6 +10559,7 @@
gil/(set {p/type q/type}) :: assume nest
==
=< dext
~% %nest-in ..$ ~
|%
++ deem
|= {mel/vair ram/vair}
@ -10595,12 +10596,16 @@
== == ==
::
++ dext
=< $
~% %nest-dext + ~
|.
^- ?
=- ?: - &
?. tel |
:: ~_ (dunk %need)
:: ~_ (dunk(sut ref) %have)
~>(%mean.[%leaf "nest-fail"] !!)
~> %mean.'nest-fail'
!!
?: =(sut ref) &
?- sut
$void sint
@ -10769,7 +10774,8 @@
* =+ doz=~(open ap gen)
?: =(doz gen)
~_ (show [%c 'hoon'] [%q gen])
~>(%mean.[%leaf "play-open"] !!)
~> %mean.'play-open'
!!
$(gen doz)
==
:: ::
@ -10997,7 +11003,7 @@
{$hint *} q.sut
{$hold *} (rest [[p.sut q.sut] ~])
$noun (fork [%atom %$ ~] [%cell %noun %noun] ~)
* ~>(%mean.[%leaf "repo-fltt"] !!)
* ~>(%mean.'repo-fltt' !!)
==
::
++ rest
@ -11005,7 +11011,7 @@
|= leg/(list {p/type q/hoon})
^- type
?: (lien leg |=({p/type q/hoon} (~(has in fan) [p q])))
~>(%mean.[%leaf "rest-loop"] !!)
~>(%mean.'rest-loop' !!)
=> .(fan (~(gas in fan) leg))
%- fork
%~ tap in
@ -14134,7 +14140,7 @@
:: %mean.[%leaf "need"]
::
:: XX I'm not sure if the `[%leaf "need"]` bit represents a literal
:: AST fragment or an expression that evaluates to `[%leaf "need"]. I'm
:: AST fragment or an expression that evaluates to `[%leaf "need"]`. I'm
:: going to assume the latter for now.
::
++ tiscol-to-plum
@ -15904,7 +15910,6 @@
|* tem=rule
%- star
;~ pose
whit
;~(pfix bas tem)
;~(less tem prn)
==
@ -17290,6 +17295,14 @@
=+ new=(~(mint ut sut) %noun gen)
[new +>+<.$(mit (~(put by mit) [sut gen] new))]
::
++ slam :: ++slam, cached
|= [gat=vase sam=vase]
^- [vase worm]
=/ sut=type [%cell p.gat p.sam]
=/ gen=hoon [%cnsg [%$ ~] [%$ 2] [%$ 3] ~]
=^ new=type +>+<.$ (play sut gen)
[[new (slum q.gat q.sam)] +>+<.$]
::
++ slap :: ++slap, cached
|= {vax/vase gen/hoon}
^- {vase worm}

View File

@ -22,9 +22,9 @@
== ::
$: %j :: to %jael
$> $? %meet :: neighbor
%pubs :: view public keys
%public-keys :: view public keys
%turf :: view domains
%vein :: view private keys
%private-keys :: view private keys
== ::
task:able:jael ::
== ::
@ -37,9 +37,9 @@
$>(%wake gift:able:behn) :: timer activate
== ::
$: %j :: from %jael
$> $? %pubs :: public keys
$> $? %public-keys :: public keys
%turf :: bind to domains
%vein :: private keys
%private-keys :: private keys
== ::
gift:able:jael ::
== ::
@ -270,7 +270,7 @@
::
=/ bil=(unit deed)
=/ rac (clan:title our)
?. ?| ?=(?(%earl %pawn) rac)
?. ?| ?=(%pawn rac)
&(!?=(%czar rac) =(our seg))
==
~
@ -832,20 +832,6 @@
=* wed u.law
?> ^- ?
?- (clan:title her)
%earl
:: signed by parent
::
=/ seg (^sein:title her)
=/ yig
?: =(our seg)
sen:gus
cluy:(myx:gus seg)
?& =(lyf.yig life.wed)
?=(^ oath.wed)
.= (need (sure:as:cub.yig u.oath.wed))
(shaf %earl (sham [her life.wed pass.wed]))
==
::
%pawn
:: self-signed, life 1, address is fingerprint
::
@ -919,10 +905,7 @@
:: if :her is a comet, or a moon of a known ship, proceed
::
=/ =rank:title (clan:title her)
?: ?| ?=(%pawn rank)
?& ?=(%earl rank)
!=(~ lew.wod.dur:(myx:gus (sein-scry her)))
== ==
?: ?=(%pawn rank)
apse
:: otherwise, drop the packet
::
@ -1358,7 +1341,7 @@
?- -.bon
%beer
=/ =wire /pubs/(scot %p p.bon)
:_ fox [hen [%pass wire %j %pubs p.bon]]~
:_ fox [hen [%pass wire %j %public-keys (silt p.bon ~)]]~
::
%bock
:: ignore %turf if we haven't yet learned a unix duct
@ -1421,20 +1404,23 @@
::
%sake
=/ =wire /our/(scot %p our)
:_ fox [hen [%pass wire %j %vein ~]]~
:_ fox [hen [%pass wire %j %private-keys ~]]~
::
%wine
:_ fox
=+ fom=~(rend co %$ %p p.bon)
:~ :- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
q.bon
==
==
[[(print hen p.bon q.bon) ~] fox]
==
::
++ print
|= [hen=duct who=ship =tape]
^- move
=+ fom=~(rend co %$ %p who)
:- hen
:+ %slip %d
:+ %flog %text
;: weld
"; "
fom
tape
==
::
++ knap
@ -1453,30 +1439,44 @@
%mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code
$(sih [%g %mean `[%mack +>+.sih]])
::
%pubs
%public-keys
?. ?=([%pubs @ ~] tea)
~& [%strange-pubs tea]
[~ +>]
[~ +>.$]
?: ?& ?=(%diff -.public-keys-result.sih)
?=(%rift -.diff.public-keys-result.sih)
==
(sink hen [who [from to]:diff]:public-keys-result.sih)
?: ?& ?=(%diff -.public-keys-result.sih)
!?=(%keys -.diff.public-keys-result.sih)
==
[~ +>.$]
=/ her=ship (slav %p i.t.tea)
=/ gus (~(us go ton.fox) our)
=/ diz (myx:gus her)
?: =(0 life.sih)
:: this should clear lew.wod.dur.diz because it means
:: we no longer trust that their public key came to
:: us honestly (becuse of a %jael snapshot restore).
:: in practice, that crashes in ++cluy:las:as:go, so
:: we ignore for now.
~& [%ames-hear-empty-pub her]
[~ +>.$]
=/ ded=deed
[life.sih (~(got by pubs.sih) life.sih) oath=~]
=. lew.wod.dur.diz `ded
=/ ded=(unit deed)
?: ?=(%full -.public-keys-result.sih)
~| [her=her public-keys-result=public-keys-result.sih]
=/ a-point=(unit point:able:jael)
(~(get by points.public-keys-result.sih) her)
?~ a-point
~
=/ a-pass=pass pass:(~(got by keys.u.a-point) life.u.a-point)
`[life.u.a-point a-pass oath=~]
?> ?=(%keys -.diff.public-keys-result.sih)
?> =(her who.public-keys-result.sih)
=/ a-key-update=key-update:point:able:jael
to.diff.public-keys-result.sih
`[life.a-key-update pass.a-key-update oath=~]
?~ ded
[~ +>.$]
=. lew.wod.dur.diz `u.ded
=. ton.fox (~(su go ton.fox) (nux:gus diz))
[~ +>.$]
::
%unto [~ +>]
::
%vein
%private-keys
?. ?=([%our @ ~] tea)
~& [%strange-vein tea]
[~ +>]
@ -1521,6 +1521,17 @@
$(p.fuy t.p.fuy, out (weld (flop toe) out))
==
::
++ sink
|= [hen=duct who=ship from=rift to=rift]
^- [(list move) _+>]
?: =(our who)
[[(print hen who ", you have sunk") ~] +>.$]
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[(print hen who " has sunk") ~] +>.$]
::
++ knob
~/ %knob
|= [hen=duct kyz=task:able]
@ -1585,25 +1596,6 @@
fox(bad (~(del in bad.fox) p.kyz))
~& [%block p.kyz]
fox(bad (~(put in bad.fox) p.kyz))
::
%sunk
=* who p.kyz
=* lyf q.kyz
?: =(our who)
?: (lth lyf p:(head val.ton.fox))
:: replaying our old sinkage, ignore
:: XX review
::
[~ fox]
:: XX include some helpful instructions here
::
:_ fox
[%wine who ", you have sunk"]~
::
=: hoc.ton.fox (~(del by hoc.ton.fox) who)
wab.zac.fox (~(del by wab.zac.fox) who)
==
[[%wine who " has sunk"]~ fox]
::
%vega
:: re-initialize our cryptosuite B cores

View File

@ -101,8 +101,11 @@
++ wake
|= error=(unit tang)
^+ [moves state]
:: no-op on spurious but innocuous unix wakeups
::
?~ timers.state ~| %behn-wake-no-timer^error !!
?~ 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
@ -111,7 +114,6 @@
:: if unix woke us too early, retry by resetting the unix wakeup timer
::
?: (gth date.i.timers.state now)
~? debug=%.n [%behn-wake-too-soon `@dr`(sub date.i.timers.state now)]
set-unix-wake(next-wake.state ~)
:: pop first timer, tell vane it has elapsed, and adjust next unix wakeup
::
@ -197,7 +199,6 @@
:: ignore duplicates
::
?: =(t i.timers)
~? debug=%.n [%behn-set-duplicate t]
timers
:: timers at the same date form a fifo queue
::
@ -214,7 +215,6 @@
:: if we don't have this timer, no-op
::
?~ timers
~? debug=%.n [%behn-unset-missing t]
~
?: =(i.timers t)
t.timers
@ -260,11 +260,10 @@
:: +load: migrate an old state to a new behn version
::
++ load
|= old=*
|= old=behn-state
^+ behn-gate
::
~| %behn-load-fail
behn-gate(state (behn-state old))
behn-gate(state old)
:: +scry: view timer state
::
:: TODO: not referentially transparent w.r.t. elapsed timers,

View File

@ -497,6 +497,9 @@
%wipe ::
== ::
task:able:ford ::
== ::
$: %j :: by %jael
$>(%public-keys task:able:jael) ::
== == ::
++ riot (unit rant) :: response+complete
++ sign :: in result $<-
@ -524,6 +527,9 @@
$: %f :: by %ford
$>(%made gift:able:ford) ::
== ::
$: %j :: by %jael
$>(%public-keys gift:able:jael) ::
== ::
$: @tas :: by any
$>(%crud vane-task) :: XX strange
== == ::
@ -2402,7 +2408,6 @@
:: Must uni the old-lat into the new-lat so that if we recreate
:: the same blob hash, we use the old blob not the new one. Else
:: you get mutually recurring %delta blobs.
::
++ add-blobs
|= [new-blobs=(map path blob) old-lat=(map lobe blob)]
^- (map lobe blob)
@ -2632,22 +2637,24 @@
::
=* ruf |4.+6.^$
::
=+ ^- [hun=(unit duct) rede]
=+ ^- [mow=(list move) hun=(unit duct) rede]
?. =(our her)
:: no duct, foreign +rede or default
::
:- ~
:+ ?: (~(has by hoy.ruf) her)
~
[hun.rom.ruf %pass /sinks %j %public-keys (silt her ~)]~
~
=/ rus rus:(~(gut by hoy.ruf) her *rung)
%+ ~(gut by rus) syd
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~]
:: administrative duct, domestic +rede
::
:- `hun.rom.ruf
:+ ~ `hun.rom.ruf
=/ jod (~(gut by dos.rom.ruf) syd *dojo)
[lim=now ref=~ [qyx dom per pew]:jod]
::
=* red=rede ->
=| mow/(list move)
=* red=rede ->+
|%
++ abet :: resolve
^- [(list move) raft]
@ -4107,7 +4114,7 @@
%boat
:_ ..^$
[hen %give %hill (turn ~(tap by mon.ruf) head)]~
::.
::
%cred
=. cez.ruf
?~ cew.req (~(del by cez.ruf) nom.req)
@ -4151,17 +4158,15 @@
[[[hen %slip %d %flog req] ~] ..^$]
::
%drop
?: =(~ act.ruf)
~& %clay-idle
[~ ..^$]
~& :- %clay-cancelling
?> ?=(^ act.ruf)
[hen -.req -.eval-data]:u.act.ruf
=. act.ruf ~
?~ cue.ruf
[~ ..^$]
=/ =duct duct:(need ~(top to cue.ruf))
[[duct %pass /queued-request %b %wait now]~ ..^$]
~? =(~ act.ruf)
[%clay-idle cue-length=~(wyt in cue.ruf)]
~? ?=(^ act.ruf)
[%clay-cancelling hen -.req -.eval-data]:u.act.ruf
=. act.ruf ~
?~ cue.ruf
[~ ..^$]
=/ =duct duct:(need ~(top to cue.ruf))
[[duct %pass /queued-request %b %wait now]~ ..^$]
::
%info
?: =(%$ des.req)
@ -4304,49 +4309,6 @@
=/ den ((de our now ski hen ruf) our des.req)
abet:(perm:den pax.req rit.req)
[mos ..^$]
::
%sunk
~& rift=[p.req q.req]
~& desks=(turn ~(tap by dos.rom.ruf) head)
~& hoy=(turn ~(tap by hoy.ruf) head)
::
?: =(our p.req)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) p.req)
?~ foreign-desk
~& [%never-heard-of-her p.req q.req]
[~ ..^$]
~& old-rift=rit.u.foreign-desk
?: (gte rit.u.foreign-desk q.req)
~& 'replaying sunk, so not clearing state'
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) p.req)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
%vega [~ ..^$]
::
@ -4446,30 +4408,30 @@
::
++ stay [%1 ruf]
++ take :: accept response
|= {tea/wire hen/duct hin/(hypo sign)}
|= [tea=wire hen=duct hin=(hypo sign)]
^+ [*(list move) ..^$]
?: ?=({$commit @ *} tea)
?: ?=([%commit @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-commit:den q.hin)
[mos ..^$]
::
?: ?=({$merge @ *} tea)
?: ?=([%merge @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-merge:den q.hin)
[mos ..^$]
::
?: ?=({$mount @ *} tea)
?: ?=([%mount @ *] tea)
=* syd i.t.tea
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
abet:(take-mount:den q.hin)
[mos ..^$]
::
?: ?=({%foreign-request @ @ @ *} tea)
?: ?=([%foreign-request @ @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=/ inx (slav %ud i.t.t.t.tea)
@ -4478,7 +4440,7 @@
abet:(take-foreign-request:den inx q.hin)
[mos ..^$]
::
?: ?=({%foreign-update @ @ *} tea)
?: ?=([%foreign-update @ @ *] tea)
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=^ mos ruf
@ -4486,8 +4448,8 @@
abet:(take-foreign-update:den q.hin)
[mos ..^$]
::
?: ?=({$blab care @ @ *} tea)
?> ?=($made +<.q.hin)
?: ?=([%blab care @ @ *] tea)
?> ?=(%made +<.q.hin)
?. ?=([%complete %success *] result.q.hin)
~| %blab-fail
~> %mean.|.((made-result-as-error:ford result.q.hin))
@ -4495,14 +4457,59 @@
:_ ..^$ :_ ~
:* hen %slip %b %drip !>
:* %writ ~
^- {care case @tas}
^- [care case @tas]
[i.t.tea ;;(case +>:(slay i.t.t.tea)) i.t.t.t.tea]
::
`path`t.t.t.t.tea
`cage`(result-to-cage:ford build-result.result.q.hin)
== ==
::
?: ?=([%sinks ~] tea)
?> ?=(%public-keys +<.q.hin)
?: ?=(%full -.public-keys-result.q.hin)
[~ ..^$]
?. ?=(%rift -.diff.public-keys-result.q.hin)
[~ ..^$]
=/ who who.public-keys-result.q.hin
=/ to-rift to.diff.public-keys-result.q.hin
::
?: =(our who)
[~ ..^$]
:: Cancel subscriptions
::
=/ foreign-desk=(unit rung)
(~(get by hoy.ruf) who)
?~ foreign-desk
[~ ..^$]
?: (gte rit.u.foreign-desk to-rift)
[~ ..^$]
=/ cancel-ducts=(list duct)
%- zing ^- (list (list duct))
%+ turn ~(tap by rus.u.foreign-desk)
|= [=desk =rede]
^- (list duct) %- zing ^- (list (list duct))
%+ turn ~(tap by qyx.rede)
|= [=wove ducts=(set duct)]
:: ~& [%sunk-wove desk (print-wove wove) ducts]
~(tap in ducts)
=/ cancel-moves=(list move)
%+ turn cancel-ducts
|= =duct
[duct %slip %b %drip !>([%writ ~])]
:: Clear ford cache
::
=/ clear-ford-cache-moves=(list move)
:~ [hen %pass /clear/keep %f %keep 0 1]
[hen %pass /clear/wipe %f %wipe 100]
[hen %pass /clear/kep %f %keep 2.048 64]
==
:: delete local state of foreign desk
::
=. hoy.ruf (~(del by hoy.ruf) who)
[(weld clear-ford-cache-moves cancel-moves) ..^$]
::
?- -.+.q.hin
%public-keys ~|([%public-keys-raw tea] !!)
%init-clad
~|(%clad-not-real !!)
::

View File

@ -297,7 +297,6 @@
[[151 %noun] %j our %sein da+now /(scot %p who)]
::
++ init :: initialize
~& [%dill-init our ram]
^+ .
=. moz
:_ moz
@ -305,7 +304,6 @@
.
::
++ mere :: continue init
~& [%dill-mere our ram]
^+ .
=/ myt (flop (fall tem ~))
=/ can (clan:title our)
@ -514,6 +512,8 @@
=/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %j u.boot]~)
:: we are subsequently initialized. single-home
@ -539,10 +539,6 @@
=? p.task ?=([%crud %hax-heft ~] p.task) [%heft ~]
::
$(hen u.hey.all, wrapped-task p.task)
:: a %sunk notification from %jail comes in on an unfamiliar duct
::
?: ?=(%sunk -.task)
[~ ..^$]
:: a %vega notification on kernel upgrade comes in on an unfamiliar duct
::
?: ?=(%vega -.task)

View File

@ -374,6 +374,9 @@
#topborder {
border-top: 3px #fff solid;
}
#ship-name {
font-family: 'Source Code Pro', monospace, sans-serif;
}
h1 {
line-height: 77px;
font-size: 64px;
@ -425,7 +428,7 @@
;div#main
;div#inner
;h1#topborder:"Welcome"
;h1:"{(scow %p our)}"
;h1#ship-name:"{(scow %p our)}"
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;input(type "password", name "password", placeholder "passcode", autofocus "true");
;input(type "hidden", name "redirect", value redirect-str);
@ -802,7 +805,7 @@
::
:_ state
:_ ~
:^ duct %pass /run-app/[app.act]
:^ duct %pass /run-app-request/[app.act]
^- note
:^ %g %deal [our our]
::
@ -847,7 +850,7 @@
%app
:_ state
:_ ~
:^ duct %pass /run-app/[app.action]
:^ duct %pass /run-app-request/[app.action]
^- note
:^ %g %deal [our our]
:: todo: i don't entirely understand gall; there's a way to make a gall
@ -892,12 +895,9 @@
%app
:_ state
:_ ~
:^ duct %pass /run-app/[app.action.u.connection]
:^ duct %pass /run-app-cancel/[app.action.u.connection]
^- note
:^ %g %deal [our our]
:: todo: i don't entirely understand gall; there's a way to make a gall
:: use a %handle arm instead of a sub-%poke with the
:: %handle-http-request type.
::
^- cush:gall
:* app.action.u.connection
@ -2029,13 +2029,14 @@
?+ i.wire
~|([%bad-take-wire wire] !!)
::
%run-app run-app
%run-build run-build
%channel channel
%acme acme-ack
%run-app-request run-app-request
%run-app-cancel run-app-cancel
%run-build run-build
%channel channel
%acme acme-ack
==
::
++ run-app
++ run-app-request
::
?> ?=([%g %unto *] sign)
::
@ -2060,6 +2061,18 @@
=^ moves server-state.ax (handle-response http-event.p.sign)
[moves http-server-gate]
::
++ run-app-cancel
::
?> ?=([%g %unto *] sign)
::
:: we explicitly don't care about the return value of a
:: %handle-http-cancel. It is purely a notification and we don't care if
:: it succeeds or not. The user might not have implemented
:: +poke-handle-http-cancel or it might have crashed, but since it's a
:: notification, we don't don't care about its return value.
::
[~ http-server-gate]
::
++ run-build
::
?> ?=([%f %made *] sign)

View File

@ -6168,12 +6168,6 @@
=^ moves state.ax cancel:this-event
::
[moves ford-gate]
::
:: %sunk: foreign ship has lost continutity
::
%sunk
::
[~ ford-gate]
::
:: %vega: learn of kernel upgrade
::

View File

@ -1334,21 +1334,19 @@
%keep `%f
%kill `%f
%look `%j
%listen `%k
%listen `%j
%merg `%c
%mint `%j
%mont `%c
%new-event `%k
%moon `%j
%nuke `%a
%ogre `%c
%perm `%c
%rest `%b
%snap `%j
%sources `%k
%rekey `%j
%wait `%b
%want `%a
%warp `%c
%wind `%j
%wash `%g
%wipe `%f
::
%request `%i
@ -1381,8 +1379,6 @@
::
$init
[~ ..^$(sys.mast.all hen)]
::
$sunk [~ ..^$]
::
$vega [~ ..^$]
::
@ -1397,6 +1393,10 @@
=+ mes=;;({@ud roon} r.q.hic)
=< mo-abet
(mo-gawd:(mo-abed:mo hen) him dap mes)
::
%wash
=. bum.mast.all (~(run by bum.mast.all) |=(=seat seat(vel *worm)))
[~ ..^$]
::
$wegh
=/ =mass

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -72,9 +72,9 @@
++ life @ud :: ship key revision
++ rift @ud :: ship continuity
++ mime {p/mite q/octs} :: mimetyped data
::
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
++ octs {p/@ud q/@t} :: octet-stream
++ sock {p/ship q/ship} :: outgoing [our his]
@ -203,9 +203,6 @@
:: boot completed (XX legacy)
::
[%init p=ship]
:: peer discontinuity
::
[%sunk p=ship q=rift]
:: kernel upgraded
::
[%vega ~]
@ -217,7 +214,7 @@
[%west p=ship q=path r=*]
==
:: ::::
:::: ++http ::
:::: ++http ::
:: ::::
:: http: shared representations of http concepts
::
@ -393,7 +390,6 @@
$>(%init vane-task) :: report install
{$kick p/@da} :: wake up
{$nuke p/@p} :: toggle auto-block
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$wake ~} :: timer activate
$>(%wegh vane-task) :: report memory
@ -628,7 +624,6 @@
{$dirk des/desk} :: mark mount dirty
{$ogre pot/$@(desk beam)} :: delete mount point
{$perm des/desk pax/path rit/rite} :: change permissions
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
{$warp wer/ship rif/riff} :: internal file req
{$werp who/ship wer/ship rif/riff} :: external file req
@ -795,7 +790,6 @@
$>(%init vane-task) :: after gall ready
{$lyra p/@t q/@t} :: upgrade kernel
{$noop ~} :: no operation
$>(%sunk vane-task) :: report death
{$talk p/tank} ::
{$text p/tape} ::
{$veer p/@ta q/path r/@t} :: install vane
@ -1182,9 +1176,6 @@
:: %kill: stop a build; send on same duct as original %build request
::
[%kill ~]
:: %sunk: receive a report that a foreign ship has lost continuity
::
$>(%sunk vane-task)
:: %vega: report kernel upgrade
::
$>(%vega vane-task)
@ -1879,9 +1870,9 @@
$% {$conf p/dock q/culm} :: configure app
$>(%init vane-task) :: set owner
{$deal p/sock q/cush} :: full transmission
$>(%sunk vane-task) :: report death
$>(%vega vane-task) :: report upgrade
$>(%west vane-task) :: network request
[%wash ~] :: clear caches
$>(%wegh vane-task) :: report memory
== ::
-- ::able
@ -2061,257 +2052,48 @@
:: ::::
++ able ^?
=, pki
=, rights
|%
:: %jael has two general kinds of task: changes
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %jael only talks to %ames and %behn. we send messages
:: through %ames and use %behn timers.
::
++ logs :: on-chain changes
%+ map event-id:ethereum-types :: per event log
diff-azimuth:azimuth-types :: the change
++ action :: balance change
%+ pair ship :: partner
%+ each bump :: &/liability change
bump :: |/asset change
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ balance :: balance sheet
%+ pair ::
(map ship safe) :: liabilities
(map ship safe) :: assets
:: ::
++ vent-result :: %vent result
$% [%snap snap=snapshot:jael] :: restore snapshot
[%chain can=chain] :: get new events
== ::
:: ::
++ chain :: batch of changes
%+ each logs :: & all events
logs :: | new events
++ change :: urbit change
$% [%ethe can=chain] :: on-chain change
[%meet who=ship =life =pass] :: meet in new era
$: %rite :: rights change
rex/ship :: issuer
pal/ship :: issued to
del/bump :: change
== == ::
++ gift :: out result <-$
$% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%pubs public] :: public keys
[%turf turf=(list turf)] :: domains
[%vest p=tally] :: balance update
[%vein =life vein=(map life ring)] :: private keys
[%vine p=(list change)] :: all raw changes
[%vent p=vent-result] :: ethereum changes
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-result] :: ethereum changes
== ::
:: ::
++ public :: public key state
$: life=life :: current key number
pubs=(map life pass) :: pubkeys by number
== ::
++ remote :: remote notification
%+ each safe :: &/addition
safe :: |/replacement
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
++ tally :: balance update
%+ each balance :: complete
action :: change
::
+= task :: in request ->$
$~ [%vega ~] ::
$% [%burn p=ship q=safe] :: destroy rights
[%hail p=ship q=remote] :: remote update
$: %dawn :: boot from keys
$% $: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
spon=[=ship point:azimuth-types] :: sponsor
czar=(map ship [=rift =life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%look src=(each ship purl:eyre)] :: set ethereum source
[%mint p=ship q=safe] :: create rights
[%move p=ship q=ship r=safe] :: transfer from=to
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%nuke ~] :: cancel tracker from
[%pubs =ship] :: view public keys
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%moon =ship =udiff:point] :: register moon keys
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%rekey =life =ring] :: update private keys
[%turf ~] :: view domains
$>(%vega vane-task) :: report upgrade
[%vein ~] :: view signing keys
[%vent ~] :: view ethereum events
[%vest ~] :: view public balance
[%vine ~] :: view secret history
$>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
++ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
++ snapshot :: rewind point
=, azimuth-types ::
$: kyz=(map ship public:able) :: public key state
$= eth ::
$: dns=dnses :: on-chain dns state
pos=(map ship point) :: on-chain ship state
== ::
eth-bookmark
==
:: +eth-bookmark: cursor into the ethereum chain
::
++ eth-bookmark
$: heard=(set event-id:ethereum-types)
latest-block=@ud
==
:: +state-eth-node: state of a connection to an ethereum node
::
++ state-eth-node :: node config + meta
$: source=(each ship node-src) :: learning from
foreign-block=@ud :: node's latest block
eth-bookmark
== ::
:: ::
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
::TODO update to fit azimuth-style keys
:: the urbit meta-certificate (++will) is a sequence
:: of certificates (++cert). each cert in a will
:: revokes and replaces the previous cert. the
:: version number of a ship is a ++life.
::
:: the deed contains an ++arms, a definition
:: of cosmetic identity; a semi-trusted parent,
:: which signs the initial certificate and provides
:: routing services; and a dirty bit. if the dirty
:: bit is set, the new life of this ship may have
:: lost information that the old life had.
::
++ hand @uvH :: 128-bit hash
++ mind {who/ship lyf/life} :: key identifier
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
:: ::
:::: ++rights:jael :: (1h3) claims
:: ::::
++ rights ^?
=, pki
|%
:: %jael tracks promises (++rite) from ship to ship.
:: a rite may be any right, badge, asset, secret, etc.
:: un-shared secret or private asset is stored as a
:: rite from self to self.
::
:: each rite is really a class of rights, and often
:: has its own internal set or map structure.
::
:: present kinds of rite:
::
:: %apple: application secret for a web api.
:: %block: the promisee is banned.
:: %email: email tied to promissee's ship.
:: %final: ship/ticket pair, ready to launch.
:: %fungi: fungible, countable asset.
:: %guest: permission to adopt foreign child.
:: %hotel: block of unissued children.
:: %jewel: urbit private keys.
:: %login: user's login passcode.
:: %pword: password for a website/api.
:: %token: user access token for a web api.
:: %urban: symmetric key for urbit networking.
::
:: %fungi keys can be anything, but don't reuse
:: currency codes. codes for urbit invitations:
:: %ugl == galaxy, %usr == star, %upl == planet
::
:: you can think of [our her rite] as an rdf triple.
::
++ bill (pair @da @) :: expiring value
++ bump :: rights change
$: mor/safe :: add rights
les/safe :: lose rights
== ::
++ dorm (pair ship bloq) :: issuing group
++ pile (tree (pair @ @)) :: efficient ship set
++ rite :: urbit commitment
$% {$apple p/(map site @)} :: web api key
{$block ~} :: banned
{$email p/(set @t)} :: email addresses
{$final p/(map ship @pG)} :: ticketed ships
{$fungi p/(map term @ud)} :: fungibles
{$guest ~} :: refugee visa
{$hotel p/(map dorm pile)} :: reserved block
{$jewel p/(map life ring)} :: private keyring
{$login p/(set @pG)} :: login secret
{$pword p/(map site (map @t @t))} :: web passwd by user
{$token p/(map site (map @t @t))} :: app tokens by user
{$urban p/(map hand bill)} :: urbit symmetric keys
== ::
++ site (list @ta) :: [%com %yahoo %www ~]
++ safe (tree rite) :: rights set
-- :: rights
-- :: jael
:: ::::
:::: ++kale :: (1h) security
:: ::::
++ kale ^?
|%
:: ::
:::: ++able:kale :: (1h1) arvo moves
:: ::::
++ able ^?
=, pki
|%
:: %kale has two general kinds of task: changes
:: and change subscriptions.
::
:: change tasks are designed to match high-level
:: operations - for instance, we have %burn, %mint,
:: and %move, not just a single delta operation.
:: more of these operations will probably be added,
:: and invariants enforced at transaction end.
::
:: subscriptions are also user-focused - for instance,
:: %vein sends all the information needed to maintain
:: the secure channel, both rights and certificates.
:: the security-critical tasks (%veil, %vein, %vine)
:: should probably be bound to a whitelisted duct set.
:: (all secrets are redacted from %vest gifts.)
::
:: %kale only talks to %ames and itself.
::
++ block
=< block
@ -2378,13 +2160,17 @@
::
++ udiff-to-diff
|= [=a=udiff =a=point]
^- diff
^- (unit diff)
?- +<.a-udiff
%disavow ~|(%udiff-to-diff-disavow !!)
%rift [%rift rift.a-point rift.a-udiff]
%spon [%spon sponsor.a-point sponsor.a-udiff]
%spon `[%spon sponsor.a-point sponsor.a-udiff]
%rift
?: =(rift.a-udiff +(rift.a-point))
`[%rift rift.a-point rift.a-udiff]
~
::
%keys
:+ %keys
:^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff
==
@ -2431,71 +2217,17 @@
a-point(sponsor to.diff)
==
--
::
+$ public-keys-result
$% [%full points=(map ship point)]
[%diff who=ship =diff:point]
==
:: ::
++ gift :: out result <-$
$% [%init p=ship] :: report install unix
[%mass p=mass] :: memory usage report
[%mack p=(unit tang)] :: message n/ack
[%source whos=(set ship) src=source] ::
[%turf turf=(list turf)] :: domains
[%private-keys =life vein=(map life ring)] :: private keys
[%public-keys =public-keys-result] :: ethereum changes
== ::
:: +seed: private boot parameters
::
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
::
+= task :: in request ->$
$~ [%vega ~] ::
$% $: %dawn :: boot from keys
=seed:able:kale :: identity params
spon=ship :: sponsor
czar=(map ship [=life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
snap=(unit snapshot) :: head start
== ::
[%fake =ship] :: fake boot
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
[%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates
[%public-keys ships=(set ship)] :: sub to publics
[%sources ~]
[%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot
[%turf ~] :: view domains
[%new-event =ship =udiff:point] :: update from app
$>(%vega vane-task) :: report upgrade
$>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request
[%wind p=@ud] :: rewind before block
== ::
-- ::
:: ::
:::: ::
:: ::
+$ node-src :: ethereum node comms
$: node=purl:eyre :: node url
filter-id=@ud :: current filter
poll-timer=@da :: next filter poll
== ::
::
+$ source (each ship node-src)
+$ source (each ship term)
+$ source-id @udsourceid
+$ snapshot ~
::
:: +state-eth-node: state of a connection to an ethereum node
::
+$ state-eth-node :: node config + meta
$: yen=(set duct)
top-source-id=source-id
$: top-source-id=source-id
sources=(map source-id source)
sources-reverse=(map source source-id)
default-source=source-id
@ -2503,7 +2235,7 @@
ship-sources-reverse=(jug source-id ship)
== ::
:: ::
:::: ++pki:kale :: (1h2) certificates
:::: ++pki:jael :: (1h2) certificates
:: ::::
++ pki ^?
|%
@ -2525,7 +2257,7 @@
++ name (pair @ta @t) :: ascii / unicode
++ oath @ :: signature
-- :: pki
-- :: kale
-- :: jael
:: ::::
:::: ++xmas :: (1i) new network
:: ::::
@ -7315,6 +7047,10 @@
=. size.queue +(size.queue)
::
[~ queue]
:: max is zero, the oldest item to return is the one which just went in.
::
?: =(~ queue.queue)
[`item queue]
:: we're at max capacity, so pop before pushing; size is unchanged
::
=^ oldest queue.queue ~(get to queue.queue)
@ -7728,7 +7464,6 @@
{$g gift:able:gall}
[%i gift:able:iris]
{$j gift:able:jael}
{$k gift:able:kale}
==
::
+$ unix-task :: input from unix
@ -7862,21 +7597,20 @@
:: # diffs
::
++ update
$% [%full ships=(map ship point) dns=dnses heard=events] ::TODO keys
$% [%full ships=(map ship point) dns=dnses heard=events]
[%difs dis=(list (pair event-id diff-azimuth))]
==
::
:: # constants
::
:: contract addresses
::TODO values below are for ropsten, update for mainnet
++ contracts
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract
::
++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet
:: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
++ azimuth
0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb
::
++ linear-star-release
0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801
@ -7893,6 +7627,17 @@
++ public 7.033.765
--
::
:: Testnet contract addresses
::
++ ropsten-contracts
|%
++ azimuth
0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579
::
++ launch 4.601.630
--
::
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
:: hashes of ship event signatures
++ azimuth-events
|%
@ -9071,7 +8816,7 @@
`(cat 3 'gal-' (scot %ud gal))
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'getKeys(uint32)' [%uint gal]~)
(encode-call 'points(uint32)' [%uint gal]~)
[%number boq]
:: +point:give:dawn: Eth RPC for ship's contract state
::
@ -9132,7 +8877,7 @@
::
++ czar
|= rep=octs
^- (unit (map ship [=life =pass]))
^- (unit (map ship [=rift =life =pass]))
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%czar-take-dawn %invalid-json] ~)
@ -9140,27 +8885,31 @@
((ar (ot id+so result+so ~)) u.jon)
?~ res
~&([%czar-take-dawn %invalid-response rep] ~)
=/ dat=(unit (list [who=ship enc=octs aut=octs sut=@ud rev=@ud]))
=/ dat=(unit (list [who=@p point:azimuth-types]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ turn u.res
|= [id=@t result=@t]
^- [who=ship enc=octs aut=octs sut=@ud rev=@ud]
:- `@p`(slav %ud (rsh 3 4 id))
^- [who=ship point:azimuth-types]
=/ who `@p`(slav %ud (rsh 3 4 id))
:- who
%+ point-from-eth
who
:_ *deed:eth-noun
%+ decode-results
result
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
point:eth-type
?~ dat
~&([%bloq-take-dawn %invalid-galaxy-table] ~)
:- ~
%+ roll u.dat
|= $: [who=ship enc=octs aut=octs sut=@ud rev=@ud]
kyz=(map ship [=life =pass])
|= $: [who=ship =point:azimuth-types]
kyz=(map ship [=rift =life =pass])
==
^+ kyz
=/ pub=pass
(pass-from-eth enc aut sut)
(~(put by kyz) who [rev pub])
?~ net.point
kyz
(~(put by kyz) who [continuity-number life pass]:u.net.point)
:: +point:take:dawn: parse ship's contract state
::
++ point
@ -9225,56 +8974,6 @@
(~(put by tuf) q.i.dom p.i.dom)
$(dom t.dom)
--
:: |snap:dawn restore from snapshot
::
++ snap
!:
|%
:: +bloq:snap:dawn: extract block number
::
++ bloq
|= snap=snapshot:jael
^- (unit @ud)
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
latest-block.snap
:: +czar:snap:dawn: extract galaxy table
::
++ czar
|= snap=snapshot:jael
^- (unit (map ship [=life =pass]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%- ~(gas by *(map ship [=life =pass]))
%+ turn (gulf 0 255)
|= gal=@
^- [ship [life pass]]
:- gal
~| czar-gal=gal
[life pass]:(need net:(~(got by pos.eth.snap) gal))
:: +point:snap:dawn: extract ship's contract state
::
++ point
|= [who=ship snap=snapshot:jael]
^- (unit point:azimuth)
(~(get by pos.eth.snap) who)
:: +turf:snap:dawn: extract network domains
::
++ turf
|= snap=snapshot:jael
^- (unit (list ^turf))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ murn
^- (list host:eyre)
%+ murn
^- (list @t)
~[pri sec ter]:dns.eth.snap
|= dom=@t
^- (unit host:eyre)
(rush dom thos:de-purl:html)
|=(a=host:eyre ?:(?=(%| -.a) ~ (some p.a)))
--
:: +veri:dawn: validate keys, life, discontinuity, &c
::
++ veri
@ -9299,28 +8998,10 @@
[%& (^sein:title who.seed)]
::
%earl
:: a moon must be signed by the parent
::
?~ sig.seed
[%| %missing-sig]
:: the parent must be launched
::
?~ net.point
[%| %parent-not-keyed]
:: life must match parent's
::
?. =(lyf.seed life.u.net.point)
[%| %life-mismatch]
=/ loy (com:nu:crub:crypto pass.u.net.point)
=/ hax (shaf %earl (sham who.seed lyf.seed pub:ex:cub))
:: the signature must be valid
::
?. =((some hax) (sure:as:loy u.sig.seed))
[%| %invalid-sig]
:: XX revisit for rekey
::
?^ live
[%| %already-booted]
[%& (^sein:title who.seed)]
::
*

View File

@ -0,0 +1,37 @@
/+ *test
|%
++ test-slam-wa-dry ^- tang
::
%+ expect-eq
!>(7)
-:(~(slam wa *worm) !>(add) !>([3 4]))
:: +test-slam-wa-wet: does +slam:wa perform correct wet type inference?
::
:: Also test that the cache doesn't gain any new entries when given a
:: sample of a previously seen type.
::
++ test-slam-wa-wet ^- tang
:: use the same .list-type for both calls
::
:: Types defined on different lines won't be noun-equal, and so
:: won't test that the cache kicked in on the second entry.
::
=/ list-type=type -:!>(*(list @))
=| worm0=worm
=+ [res1 worm1]=(~(slam wa worm0) !>(flop) [list-type ~[1 2 3]])
=+ [res2 worm2]=(~(slam wa worm1) !>(flop) [list-type ~[4 5 6]])
::
;: weld
%+ expect-eq
res1
[list-type ~[3 2 1]]
::
%+ expect-eq
res2
[list-type ~[6 5 4]]
::
%+ expect-eq
!> worm1
!> worm2
==
--

View File

@ -18,7 +18,7 @@
ames-gate
now=~1234.5.6
call-args=[duct type=*type %soft %init ~nul]
expected-moves=[[duct %pass wire %j %vein ~] [duct %pass / %j %turf ~] ~]
expected-moves=[[duct %pass wire %j %private-keys ~] [duct %pass / %j %turf ~] ~]
==
::
results1
@ -56,7 +56,7 @@
%: ames-take
ames-gate
now
take-args=[wire duct -:!>([%j %vein vein-data]) [%j %vein vein-data]]
take-args=[wire duct -:!>([%j %private-keys vein-data]) [%j %private-keys vein-data]]
expected-moves=~
==
::
@ -67,7 +67,7 @@
ames-gate
now
call-args=[duct type=*type %soft [%want ~nul /foo 1]]
:~ [duct %pass /pubs/~nul %j %pubs ~nul]
:~ [duct %pass /pubs/~nul %j %public-keys (silt ~nul ~)]
[duct %give %send *lane:ames pact1]
:: XX why ~s4 ??
::

View File

@ -208,12 +208,11 @@
%give
%response
%start
:- 404
:~ ['content-type' 'text/html']
['content-length' '156']
==
::
%+ complete-http-start-event
:- 404
['content-type' 'text/html']~
[~ (error-page:http-server-gate 404 %.n '/' ~)]
complete=%.y
== ==
==
::
@ -272,7 +271,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -287,7 +286,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate)
:- *type
:* %g %unto %http-response
@ -359,7 +358,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -374,7 +373,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate)
:- *type
:* %g %unto %coup ~
@ -384,12 +383,11 @@
^= expected-move
:~ :* duct=~[/http-blah] %give %response
%start
:- 500
:~ ['content-type' 'text/html']
['content-length' '180']
==
::
%+ complete-http-start-event
:- 500
['content-type' 'text/html']~
[~ (internal-server-error:http-server-gate %.n '/' ~)]
complete=%.y
== == ==
::
;: weld
@ -449,7 +447,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -464,7 +462,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
%start
@ -485,7 +483,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
[%continue [~ (as-octs:mimes:html 'ya!')] %.y]
@ -556,7 +554,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/~landscape/inner-path' ~ ~]])
@ -571,7 +569,7 @@
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app/app1 duct=~[/http-blah]
:* wire=/run-app-request/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %http-response
[%start [307 ['location' '/~/login?redirect=/~landscape/inner-path']~] ~ %.y]
@ -624,7 +622,7 @@
:: expect authenticated=%.y in the handle below
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!> :*
@ -736,14 +734,13 @@
==
^= expected-move
:~ :* duct=~[/http-blah] %give %response
:* %start
:- 200
:~ ['content-type' 'text/plain']
['content-length' '13']
==
`[13 'one two three']
%.y
== == == ==
%start
::
%+ complete-http-start-event
:- 200
['content-type' 'text/plain']~
`[13 'one two three']
== == ==
::
;: weld
results1
@ -870,11 +867,10 @@
%give
%response
%start
:- 403
:~ ['content-type' 'text/html']
['content-length' '182']
==
::
%+ complete-http-start-event
:- 403
['content-type' 'text/html']~
:- ~
%- error-page:http-server-gate :*
403
@ -882,8 +878,6 @@
'/~/channel/1234567890abcdef'
~
==
::
complete=%.y
== ==
==
::
@ -1814,7 +1808,7 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-request/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-request
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
@ -1848,19 +1842,38 @@
(expect-eq !>(~[/http-blah]) !>(duct))
::
%+ expect-gall-deal
:+ /run-app/app1 [~nul ~nul]
:+ /run-app-cancel/app1 [~nul ~nul]
^- cush:gall
:* %app1 %poke %handle-http-cancel
!>([%.n %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~]])
==
card
==
:: app1 doesn't have a %handle-http-cancel arm, but that's fine and doesn't
:: crash eyre when it sends its error coup back because we take no action on
:: the response to handle-http-cancel.
::
=^ results5 http-server-gate
%- http-server-take :*
http-server-gate
now=~1111.1.4
scry=scry-provides-code
^= take-args
:* wire=/run-app-cancel/app1 duct=~[/http-blah]
^- (hypo sign:http-server-gate) :- *type
:* %g %unto %coup
`[[%leaf "error! error! error!"] ~]
==
==
expected-move=~
==
::
;: weld
results1
results2
results3
results4
results5
==
::
++ http-server-call
@ -2031,12 +2044,11 @@
%give
%response
%start
:- 200
:~ ['content-type' 'text/html']
['content-length' '1752']
==
::
%+ complete-http-start-event
:- 200
['content-type' 'text/html']~
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
complete=%.y
== ==
==
:: a response post redirects back to the application, setting cookie
@ -2182,4 +2194,12 @@
:: This is the default code for a fakeship.
::
[~ ~ %noun !>(.~lidlut-tabwed-savheb-loslux)]
:: produce the body of a %start http-event with the correct content-length
::
++ complete-http-start-event
|= [response-header:http data=(unit octs)]
=- [[status-code -] data %.y]
?~ data headers
%+ weld headers
['content-length' (crip ((d-co:co 1) p.u.data))]~
--

View File

@ -1,159 +0,0 @@
/+ *test
::
/= jael-raw /: /===/sys/vane/jael
/!noun/
=/ type-spear -:!>(jael-raw)
::
=/ test-pit=vase !>(.)
=/ jael-gate (jael-raw test-pit)
::
|%
:: tests that booting into %jael inits other vanes
::
++ test-boot-dawn
:: +key ~nul
=/ key=ring
0w8O.k5Ry4.QsKQq.1k~uj.DBOU4.numfq.nXOwa.cSk7B.VcHVm.
-8~kX.3ALiG.rQjOi.HZ9hj.84b6G.P5pCZ.UtNtt.Lh9TE.2DQJ2
=/ url (de-purl:html 'http://localhost:8545')
=/ dan
[`seed:able:jael`[~nul 1 key ~] ~nul ~ [/org/urbit ~] 0 url ~]
::
=^ results1 jael-gate
=/ hen=duct
[/ /term/1 / ~]
%- jael-call
:* jael-gate
now=~1234.5.6
call-args=[hen type=*type %dawn dan]
:~ [hen %slip %a %init ~nul]
[hen %slip %c %init ~nul]
[hen %slip %g %init ~nul]
[hen %slip %d %init ~nul]
[hen %slip %e %init ~nul]
[hen %give %init ~nul]
[hen %pass /~nul/init %b %wait +(~1234.5.6)]
== ==
::
=^ results2 jael-gate
=/ wir=wire
/our/~nul/now/(scot %da (add ~s1 ~1234.5.6))
%- jael-call-with-comparator :*
jael-gate
now=(add ~s1 ~1234.5.6)
call-args=[duct=[/ /term/1 wir ~] type=*type %vein ~]
^= comparator
|= moves=(list move:jael-gate)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> [%give %vein 1 (my [1 key] ~)]
!> q:(head moves)
== ==
::
=^ results3 jael-gate
::
=/ request=request:http
%+ light-json-request:rpc:ethereum
(need url)
%+ request-to-json:rpc:ethereum
`'block number'
[%eth-block-number ~]
::
%- jael-take-with-comparator :*
jael-gate
now=(add ~s2 ~1234.5.6)
take-args=[wire=/~nul/init duct=[/ /term/1 ~] type=*type %b %wake ~]
^= comparator
|= moves=(list move:jael-gate)
?> ?=(^ moves)
?> ?=([* %pass * %i %request *] i.moves)
;: weld
%+ expect-eq
!> 1
!> (lent moves)
::
%+ expect-eq
!> request
!> request.q.q.i.moves
== ==
::
:(weld results1 results2 results3)
::
++ jael-call
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-call-with-comparator
|= $: jael-gate=_jael-gate
now=@da
call-args=[=duct wrapped-task=(hypo (hobo task:able:jael-gate))]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- call:jael call-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
::
++ jael-take
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
expected-moves=(list move:jael-gate)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> moves
::
[output jael-gate]
::
++ jael-take-with-comparator
|= $: jael-gate=_jael-gate
now=@da
take-args=[=wire =duct wrapped-task=(hypo sign:jael-gate)]
move-comparator=$-((list move:jael-gate) tang)
==
^- [tang _jael-gate]
::
=/ jael (jael-gate our=~nul now=now eny=`@`0xdead.beef scry=*sley)
::
=^ moves jael-gate
%- take:jael take-args
::
=/ output=tang (move-comparator moves)
::
[output jael-gate]
--

View File

@ -125,4 +125,29 @@
results1
results2
==
::
++ test-put-zero
::
=| q=(capped-queue @u)
=. max-size.q 0
:: specialize type
::
=+ to-capped-queue=(to-capped-queue @u)
:: push enough values to evict one
::
::
=^ maybe1 q (~(put to-capped-queue q) 5)
=/ results1
%+ expect-eq
!> [~ 5]
!> maybe1
=/ results2
%+ expect-eq
!> 0
!> size.q
::
;: weld
results1
results2
==
--

View File

@ -28,25 +28,6 @@
%- crip
%+ weld "0x"
(render-hex-bytes:ethereum 20 `@`azimuth:contracts:^azimuth)
:: snapshot
::
++ snap
=| =snapshot:jael
%_ snapshot
kyz ~
::
dns.eth
['urbit.org' 'urbit.org' '']
::
pos.eth
%- malt
:* ~zod^pot
~marzod^pot
(turn (gulf 1 255) |=(gal=@ gal^pot))
==
::
latest-block 4.230.000
==
::
++ test-give-bloq
=/ oct
@ -116,16 +97,34 @@
'3defb87516f42ce4327820b588002aa53e52527af8d23bee4aa215fa296bdf5f'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000002'
'"},{"id":"gal-1","jsonrpc":"2.0","result":"'
'0xb727e38d031162e50913b2e37a2e29d4ba457eff4f7fd4ac47dc68fcb54260d3'
'b8bfe4789483c171f7fa359438cdcc8d268d40fe08d6c1d8b36267748d2139f8'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000003'
'"},{"id":"gal-2","jsonrpc":"2.0","result":"'
'0x0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000001'
'0000000000000000000000000000000000000000000000000000000000000004'
'"}]'
==
=/ kyz
@ -139,8 +138,8 @@
823.313.739.767.009.446.819.531.923.255.637.798.148.055.143.938.146
%+ expect-eq
!> :- ~
%- ~(gas by *(map ship [=life =pass]))
[[~zod 1 zod.kyz] [~nec 1 nec.kyz] [~bud 0 'b'] ~]
%- ~(gas by *(map ship [=rift =life =pass]))
[[~zod 2 1 zod.kyz] [~nec 3 1 nec.kyz] [~bud 4 1 'b'] ~]
!> (czar:take:dawn oct)
::
++ test-take-point
@ -186,26 +185,6 @@
!> [~ [/org/urbit ~]]
!> (turf:take:dawn oct)
::
++ test-snap-bloq
%+ expect-eq
!> [~ 4.230.000]
!> (bloq:snap:dawn snap)
::
++ test-snap-point
%+ expect-eq
!> [~ pot]
!> (point:snap:dawn ~zod snap)
::
++ test-snap-czar
%+ expect-eq
!> 256
!> ~(wyt by (need (czar:snap:dawn snap)))
::
++ test-snap-turf
%+ expect-eq
!> [~ `(list turf)`~[~['org' 'urbit'] ~['org' 'urbit']]]
!> (turf:snap:dawn snap)
::
++ test-veri-good
=/ sed [~zod 1 sec ~]
%+ expect-eq
@ -254,15 +233,6 @@
!> [%& (^sein:title who)]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-missing-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
[who 1 sec:ex:cub ~]
%+ expect-eq
!> [%| %missing-sig]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-parent-not-keyed
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
@ -275,53 +245,6 @@
!> [%| %parent-not-keyed]
!> (veri:dawn sed =>(pot .(net ~)) ~)
::
++ test-veri-earl-life-mismatch
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 2 sec:ex:cub `sig]
%+ expect-eq
!> [%| %life-mismatch]
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-invalid-sig
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
;: weld
=/ sed
=/ sig
%- sign:as:cub
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
::
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 2 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %invalid-sig]
!> (veri:dawn sed pot ~)
==
::
++ test-veri-earl-already-booted
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who ~simtel-mithet-dozzod-dozzod
=/ sed
=/ sig
%- sign:as:(nol:nu:crub:crypto sec)
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %already-booted]
!> (veri:dawn sed pot `[1 |])
::
++ test-veri-pawn-good
=/ cub (pit:nu:crub:crypto 24 %foo)
=/ who=ship `@`fig:ex:cub

View File

@ -113,6 +113,33 @@ class sourceAction(argparse.Action):
else:
return {self.which: new_value}
class importFileAction(argparse.Action):
"""Handles the import statement.
The --import statement reads in a jammed noun file from the current working
directory and stuffs it the base64 encoded version which gets passed into
your Urbit.
"""
def __call__(self, parser, res, new_value, option_string):
logging.debug('%r %r' % (new_value, option_string))
logging.debug('source %s' % res.source)
logging.debug('level %s' % res.level)
# We check to see if there's a "{new_value}.jam" file in the current
# working directory. If there isn't, we error
data = ""
filename = new_value + ".jam"
with open(filename, 'rb') as f:
data = f.read()
if data == "":
raise ValueError('Failed to read jamfile')
base_data = base64.b64encode(data)
res.source = {"import": {"app": new_value, "base64-jam": base_data}}
class transformerAction(argparse.Action):
"""Handle transformer flag.
@ -310,6 +337,14 @@ parser.add_argument('-l', '--listen-api', which='listen-api',
metavar='api:event',
help='listen to event from api',
action=sourceAction)
parser.add_argument('-e', '--export', which='export',
metavar='app-name',
help='exports the application state',
action=sourceAction)
parser.add_argument('-i', '--import',
metavar='app-name',
help='imports the application state',
action=importFileAction)
parser.add_argument('-m', '--mark', which='as',
metavar='mark',
help='transform a source to another mark',
@ -390,8 +425,13 @@ url = "http://localhost:%s" % PORT
r = requests.post(url, data=json.dumps(payload))
if r.text[0] == '"':
print r.text[1:-1].decode('string_escape')
if r.headers.get('content-type') == 'application/octet-stream':
name = r.headers.get('content-disposition').split('filename=',1)[1][1:-1]
with open(name, 'wb') as f:
for block in r.iter_content(1024):
f.write(block)
elif r.text[0] == '"':
print r.text[1:-1].encode('utf-8').decode('string_escape')
elif r.text[0] == '{':
# print r.text
json_data = json.loads(r.text)

84
pkg/interface/.gitignore vendored Normal file
View File

@ -0,0 +1,84 @@
#Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.swp
.DS_Store
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
apps/*/dist/
*/dist/
*/node_modules/
*/.DS_Store
.urbitrc
# vim swap files
*.swo
*.swp
*.swn
# built js and css files
apps/publish/urbit/app/publish/js/*
apps/publish/urbit/app/publish/css/*
apps/chat/urbit/app/chat/js/*
apps/chat/urbit/app/chat/css/*
apps/clock/urbit/app/clock/js/*
apps/launch/urbit/app/launch/js/*
apps/timer/urbit/app/timer/js/*
apps/weather/urbit/app/weather/js/*

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