Merge branch 'master' into release/next-userspace

This commit is contained in:
Matilde Park 2020-12-09 11:51:54 -05:00
commit 8c313eba67
164 changed files with 7021 additions and 7718 deletions

View File

@ -268,6 +268,13 @@ Contributions:
[..]
```
Ensure the Vere release is marked as the 'latest' release and upload the two
`.tgz` files to the release as `darwin.tgz` and `linux64.tgz`;
this allows us to programmatically retrieve the latest release at
[urbit.org/install/mac/latest/](https://urbit.org/install/mac/latest) and
[urbit.org/install/linux64/latest](https://urbit.org/install/linux64/latest),
respectively.
The same schpeel re: release candidates applies here.
Note that the release notes indicate which version of Urbit OS the Vere release

View File

@ -4,7 +4,7 @@ build:
nix-build -A urbit -A herb --no-out-link
install:
nix-env -f . -iA urbit -iA urbit-debug -iA herb
nix-env -f . -iA urbit -iA herb
release:
sh/release

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1e3ad5f88585ef7938cc2c6b5e37a05e04b7a4e5a9d66f1e9e4c20bfa2d303e8
size 5356007
oid sha256:61e583dd7db795dac4a7c31bfd3ee8b240e679bb882e35d4e7d1acb5f9f2f3d6
size 8270131

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ddcdd98af2befa672da7bbf74ba5170cd5b079f2fb75deb24685608da6a29c8
size 2841752
oid sha256:185ea5e76dc48695e55efc543377e0682e485f81b16e3b443f9be881d026d4f2
size 2616564

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae42d143088198dea06be473b43450c1478c094e19f69e79305e63da1c49a832
size 9581384
oid sha256:d9ec1e0a325bc754493e32c3f2d62d13620db1b1afac40ef45b1718eb10ff8f3
size 10037688

View File

@ -153,7 +153,8 @@ let
contents = {
"${name}/urbit" = "${urbit}/bin/urbit";
"${name}/urbit-worker" = "${urbit}/bin/urbit-worker";
"${name}/urbit-king" = "${urbit-king}/bin/urbit-king";
# temporarily removed for compatibility reasons
# "${name}/urbit-king" = "${urbit-king}/bin/urbit-king";
};
};

View File

@ -28,7 +28,6 @@ done
# FIXME: reduce this list
cp $ARVO/app/lens.hoon ./pier/home/app/
cp $ARVO/app/dojo.hoon ./pier/home/app/
cp $ARVO/lib/base64.hoon ./pier/home/lib/
cp $ARVO/lib/plume.hoon ./pier/home/lib/
cp $ARVO/lib/server.hoon ./pier/home/lib/
cp $ARVO/lib/sole.hoon ./pier/home/lib/

View File

@ -1,5 +1,5 @@
/- asn1
/+ base64, der, primitive-rsa, *pkcs, *jose, default-agent, verb
/+ der, primitive-rsa, *pkcs, *jose, default-agent, verb
=, eyre
=* rsa primitive-rsa
::
@ -7,11 +7,11 @@
:: +en-base64url: url-safe base64 encoding, without padding
::
++ en-base64url
~(en base64 | &)
~(en base64:mimes:html | &)
:: +de-base64url: url-safe base64 decoding, without padding
::
++ de-base64url
~(de base64 | &)
~(de base64:mimes:html | &)
:: +join-turf
::
++ join-turf

View File

@ -21,30 +21,28 @@
:: We get ++unix-event and ++pill from /-aquarium
::
/- aquarium
/+ pill, default-agent, aqua-azimuth, dbug, verb
/+ pill, azimuth, default-agent, aqua-azimuth, dbug, verb
=, pill-lib=pill
=, aquarium
=> $~ |%
+$ versioned-state
$% state-0
state-1
==
+$ state-0
$: %0
pil=pill
assembled=*
tym=@da
fleet-snaps=(map term (map ship pier))
piers=(map ship pier)
==
+$ state-1
$: %1
pil=pill
assembled=*
tym=@da
fleet-snaps=(map term fleet)
piers=fleet
==
:: XX temporarily shadowed, fix and remove
::
+$ pill
$: boot-ova=*
kernel-ova=(list unix-event)
userspace-ova=(list unix-event)
==
::
+$ fleet [ships=(map ship pier) azi=az-state]
+$ pier
@ -55,7 +53,7 @@
==
--
::
=| state-1
=| state-0
=* state -
=<
%- agent:dbug
@ -79,13 +77,6 @@
:: wipe fleets and piers rather than give them falsely nulled azimuth state
::
%0
%_ $
-.old %1
fleet-snaps.old *(map term fleet)
piers.old *fleet
==
::
%1
[cards this(state old)]
==
::
@ -520,7 +511,7 @@
:: should be deleted now that aqua is capable of managing azimuth state
:: internally. Its been left this way for now until all the ph tests
:: can be rewritten
=/ keys=dawn-event:able:jael (dawn who.ae)
=/ keys=dawn-event:jael (dawn who.ae)
=. this abet-pe:(publish-effect:(pe who.ae) [/ %sleep ~])
=/ initted
=< plow
@ -736,7 +727,7 @@
::
++ dawn
|= who=ship
^- dawn-event:able:jael
^- dawn-event:jael
?> ?=(?(%czar %king %duke) (clan:title who))
=/ spon=(list [ship point:azimuth])
%- flop
@ -759,7 +750,7 @@
?: ?=(%czar (clan:title ship))
[a-point]~
[a-point $(who ship)]
=/ =seed:able:jael
=/ =seed:jael
=/ life-rift (~(got by lives.azi.piers) who)
=/ =life lyfe.life-rift
[who life sec:ex:(get-keys:aqua-azimuth who life) ~]

View File

@ -1,6 +1,6 @@
/- eth-watcher
/+ default-agent, verb
=, able:jael
/+ ethereum, azimuth, default-agent, verb
=, jael
|%
++ app-state
$: %0

View File

@ -5,7 +5,7 @@
/- inv=invite-store, *metadata-store, *group-store, hook=chat-hook, view=chat-view, *group
/+ default-agent, verb, dbug, store=chat-store, group-store, grpl=group,
resource, *migrate
~% %chat-hook-top ..is ~
~% %chat-hook-top ..part ~
|%
+$ card card:agent:gall
::
@ -370,7 +370,7 @@
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
@ -690,13 +690,14 @@
=/ length (lent envs)
=/ latest
?~ backlog-latest length
?: (gth u.backlog-latest length) length
?: (gth u.backlog-latest length) 0
(sub length u.backlog-latest)
=. envs (scag latest envs)
=/ =vase !>([%messages pas 0 latest envs])
%- zing
:~ [%give %fact ~ %chat-update !>([%create pas])]~
?. ?&(?=(^ backlog-latest) (~(has by allow-history) pas)) ~
?: =(0 latest) ~
[%give %fact ~ %chat-update vase]~
[%give %kick [%backlog pax]~ `src.bol]~
==

View File

@ -3,7 +3,7 @@
:: data store that holds linear sequences of chat messages
::
/+ store=chat-store, default-agent, verb, dbug, group-store, *migrate
~% %chat-store-top ..is ~
~% %chat-store-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state

View File

@ -19,7 +19,7 @@
resource,
mdl=metadata
::
~% %chat-view-top ..is ~
~% %chat-view-top ..part ~
|%
+$ versioned-state
$% state-0

View File

@ -1,9 +1,6 @@
:: claz: command line azimuth, for the power-user
::
/+ *claz, verb, default-agent
::
=, ethereum
=, azimuth
/+ *claz, *ethereum, *azimuth, verb, default-agent
::
|%
+$ state-0

View File

@ -15,7 +15,7 @@
resource,
grpl=group,
*migrate
~% %contact-hook-top ..is ~
~% %contact-hook-top ..part ~
|%
+$ card card:agent:gall
::
@ -195,7 +195,7 @@
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this

View File

@ -66,7 +66,7 @@
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%e %bound *] sign-arvo)
?. ?=([%eyre %bound *] sign-arvo)
(on-arvo:def wire sign-arvo)
~? !accepted.sign-arvo
[dap.bowl "bind rejected!" binding.sign-arvo]

View File

@ -117,7 +117,7 @@
|= [our=ship dir=beam]
|%
++ default-app %hood
++ hoon-parser (vang | (en-beam:format dir))
++ hoon-parser (vang | (en-beam dir))
++ our p.dir
::
++ parse-command-line ;~(sfix parse-command (star ace) (just '\0a'))
@ -248,7 +248,7 @@
::
=? a &(?=(^ a) =('' i.a))
t.a
(fall (de-beam:format a) [`beak`[p q r]:dir a])
(fall (de-beam a) [`beak`[p q r]:dir a])
=+ vez=hoon-parser
(sear plex:vez (stag %clsg poor:vez))
::
@ -269,7 +269,7 @@
++ parse-rood
:: XX should this use +hoon-parser instead to normalize the case?
::
=> (vang | (en-beam:format dir))
=> (vang | (en-beam dir))
;~ pose
rood
::
@ -542,9 +542,9 @@
?: ?=([@ ~] pax) ~[i.pax %home '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
=. dir (need (de-beam:format pax))
=. dir (need (de-beam pax))
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam:format he-beak s.dir))]
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
==
::
%poke
@ -560,7 +560,7 @@
%file
%- he-card(poy ~)
:* %pass /file %arvo %c
%info (foal:space:userlib (en-beam:format p.p.mad) cay)
%info (foal:space:userlib (en-beam p.p.mad) cay)
==
::
%flat
@ -874,12 +874,12 @@
%dv (dy-sing hand+p.bil %a (snoc p.bil %hoon))
%ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil)
%sa
=+ .^(=dais:clay cb+(en-beam:format he-beak /[p.bil]))
=+ .^(=dais:clay cb+(en-beam he-beak /[p.bil]))
(dy-hand p.bil bunt:dais)
::
%as
=/ cag=cage (dy-cage p.q.bil)
=+ .^(=tube:clay cc+(en-beam:format he-beak /[p.cag]/[p.bil]))
=+ .^(=tube:clay cc+(en-beam he-beak /[p.cag]/[p.bil]))
(dy-hand p.bil (tube q.cag))
::
%do
@ -1183,7 +1183,7 @@
%stdout [%show %0]
%output-file $(sink.com [%command (cat 3 '@' pax.sink.com)])
%output-pill $(sink.com [%command (cat 3 '.' pax.sink.com)])
%output-clay [%file (need (de-beam:format pax.sink.com))]
%output-clay [%file (need (de-beam pax.sink.com))]
%url [%http %post (crip (en-purl:html url.sink.com))]
%to-api !!
%send-api [%poke our.hid api.sink.com]
@ -1254,7 +1254,7 @@
=+ vex=((full parse-command-line:he-parser) [1 1] txt)
?. ?=([* ~ [* @ %ex *] *] vex)
(he-tab-not-hoon pos :(weld buf (tufa buf.say) "\0a"))
=/ typ p:(slop q:he-hoon-head !>(..dawn))
=/ typ p:(slop q:he-hoon-head !>(..zuse))
=/ tl (tab-list-hoon:auto typ p.q.q.p.u.q.vex)
=/ advance (advance-hoon:auto typ p.q.q.p.u.q.vex)
=? res ?=(^ advance)

View File

@ -13,7 +13,7 @@
:: waiting for confirms every 4 txs
:: :eth-sender [%send %/txs/txt 4 `index+50 ~]
::
/+ default-agent, verb
/+ ethereum, default-agent, verb
::
|%
++ state-0

View File

@ -1,9 +1,9 @@
:: eth-watcher: ethereum event log collector
::
/- *eth-watcher, spider
/+ default-agent, verb, dbug
/+ ethereum, default-agent, verb, dbug
=, ethereum-types
=, able:jael
=, jael
::
=> |%
+$ card card:agent:gall

View File

@ -7,9 +7,7 @@
:: - receive timestamps, process events
::
/- eth-watcher
/+ default-agent, verb
=, ethereum
=, azimuth
/+ *ethereum, *azimuth, default-agent, verb
::
=> |%
+$ state-0
@ -254,8 +252,8 @@
?- -.diff
%history ~& [%got-history (lent loglist.diff)]
[loglist.diff state(qued ~, seen ~)]
%log ~& %got-log
[[event-log.diff ~] state]
%logs ~& %got-log
[loglist.diff state]
%disavow ~& %disavow-unimplemented
[~ state]
==

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v6.cmrce.5ass7.5gfqi.7c8cg.mdo7n
++ hash 0v2.u8gnq.ipqi1.eksfl.qtd8n.0d56e
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0

View File

@ -1,6 +1,6 @@
/- *resource
/+ store=graph-store, graph, default-agent, verb, dbug, pull-hook
~% %graph-pull-hook-top ..is ~
~% %graph-pull-hook-top ..part ~
|%
+$ card card:agent:gall
++ config

View File

@ -6,7 +6,7 @@
/+ default-agent
/+ dbug
/+ push-hook
~% %graph-push-hook-top ..is ~
~% %graph-push-hook-top ..part ~
|%
+$ card card:agent:gall
++ config

View File

@ -3,7 +3,7 @@
::
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug,
*migrate
~% %graph-store-top ..is ~
~% %graph-store-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state
@ -946,7 +946,7 @@
[%try-rejoin @ *]
=/ rid=resource:store (de-path:res t.t.wire)
=/ nack-count (slav %ud i.t.wire)
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
=/ new=^wire [%try-rejoin (scot %ud +(nack-count)) t.t.wire]

View File

@ -4,7 +4,7 @@
::
/- *group, *invite-store, *resource
/+ default-agent, verb, dbug, store=group-store, grpl=group, pull-hook
~% %group-hook-top ..is ~
~% %group-hook-top ..part ~
|%
+$ card card:agent:gall
::

View File

@ -5,7 +5,7 @@
/- *group, *invite-store
/+ default-agent, verb, dbug, store=group-store, grpl=group, push-hook,
resource
~% %group-hook-top ..is ~
~% %group-hook-top ..part ~
|%
+$ card card:agent:gall

View File

@ -244,7 +244,7 @@
(on-arvo:def wire sign-arvo)
=/ =resource (de-path:resource t.t.wire)
=/ nack-count=@ud (slav %ud i.t.wire)
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this

View File

@ -3,7 +3,7 @@
/- store=hark-store, post, group-store, metadata-store, hook=hark-chat-hook
/+ resource, metadata, default-agent, dbug, chat-store, grpl=group
::
~% %hark-chat-hook-top ..is ~
~% %hark-chat-hook-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state

View File

@ -3,7 +3,7 @@
/- store=hark-store, post, group-store, metadata-store, hook=hark-graph-hook
/+ resource, metadata, default-agent, dbug, graph-store
::
~% %hark-graph-hook-top ..is ~
~% %hark-graph-hook-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state

View File

@ -3,7 +3,7 @@
/- store=hark-store, post, group-store, metadata-store, hook=hark-group-hook
/+ resource, metadata, default-agent, dbug, graph-store
::
~% %hark-group-hook-top ..is ~
~% %hark-group-hook-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state

View File

@ -3,7 +3,7 @@
/- store=hark-store, post, group-store, metadata-store
/+ resource, metadata, default-agent, dbug, graph-store
::
~% %hark-store-top ..is ~
~% %hark-store-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state
@ -258,7 +258,7 @@
^- (quip card _this)
?. ?=([%autoseen ~] wire)
(on-arvo:def wire sign-arvo)
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
:_ this(last-seen now.bowl)
~[autoseen-timer:ha]
::

View File

@ -1,7 +1,7 @@
:: herm: stand-in for term.c with http interface
::
/+ default-agent, dbug, verb
=, able:jael
=, jael
|%
+$ state-0 [%0 ~]
--
@ -65,7 +65,7 @@
:: pass on dill blits for the session
::
[%view %$ ~]
?. ?=([%d %blit *] sign-arvo)
?. ?=([%dill %blit *] sign-arvo)
~| [%unexpected-sign [- +<]:sign-arvo]
!!
:_ this
@ -78,7 +78,7 @@
[%tube @ @ ~]
=* from i.t.wire
=* to i.t.t.wire
?. ?=([%c %writ *] sign-arvo)
?. ?=([%clay %writ *] sign-arvo)
~| [%unexpected-sign [- +<]:sign-arvo]
!!
:_ this

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.js"></script>
<script src="/~landscape/js/bundle/index.649a8f56804ea2cb643c.js"></script>
<script src="/~landscape/js/bundle/index.32d8bdcd85b05e36f1c2.js"></script>
</body>
</html>

View File

@ -100,8 +100,8 @@
^- (quip card _this)
=^ cards state
?+ sign-arvo (on-arvo:def wire sign-arvo)
[%e %bound *] `state
[%c *] (handle-build:lsp wire +.sign-arvo)
[%eyre %bound *] `state
[%clay *] (handle-build:lsp wire +.sign-arvo)
==
[cards this]
::
@ -234,7 +234,7 @@
`state
::
++ handle-build
|= [=path =gift:able:clay]
|= [=path =gift:clay]
^- (quip card _state)
?> ?=([%writ *] gift)
=/ uri=@t

View File

@ -1,5 +1,5 @@
/- lens, *sole
/+ base64, *server, default-agent
/+ *server, default-agent
/= lens-mark /mar/lens/command :: TODO: ask clay to build a $tube
=, format
|%
@ -51,6 +51,11 @@
++ on-poke
|= [=mark =vase]
^- (quip card:agent:gall _this)
::
?: &(?=(%noun mark) ?=(%cancel q.vase))
~& %lens-cancel
[~ this(job.state ~)]
::
?. ?=(%handle-http-request mark)
(on-poke:def mark vase)
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
@ -83,7 +88,7 @@
[%pass /export %agent [our.bowl app.source.com] %watch /export]~
::
%import
?~ enc=(de:base64 base64-jam.source.com)
?~ enc=(de:base64:mimes:html base64-jam.source.com)
!!
::
=/ c=* (cue q.u.enc)
@ -96,7 +101,7 @@
=/ jon
=/ =atom (jam (export-all our.bowl now.bowl))
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
=/ enc (en:base64:mimes:html octs)
(pairs:enjs:format file+s+output data+s+enc ~)
:_ this
%+ give-simple-payload:app eyre-id
@ -104,7 +109,7 @@
::
%import-all
~& %import-all
=/ enc (de:base64 base64-jam.source.com)
=/ enc (de:base64:mimes:html base64-jam.source.com)
?~ enc !!
=/ by-app ;;((list [@tas *]) (cue q.u.enc))
:_ this
@ -192,7 +197,7 @@
=/ jon=json
=/ =atom (jam data)
=/ =octs [(met 3 atom) atom]
=/ enc (en:base64 octs)
=/ enc (en:base64:mimes:html octs)
(pairs:enjs:format file+s+output data+s+enc ~)
::
:_ this
@ -222,13 +227,11 @@
[%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))
data+s+(en:base64:mimes:html (met 3 q.fec) q.fec)
==
::
%mor

View File

@ -7,7 +7,7 @@
::
/- *metadata-store, *metadata-hook
/+ default-agent, dbug, verb, grpl=group, *migrate
~% %metadata-hook-top ..is ~
~% %metadata-hook-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state
@ -67,7 +67,7 @@
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this

View File

@ -10,7 +10,7 @@
:: talk to its own star.
::
/+ default-agent, verb
=* point point:able:kale
=* point point:kale
::
|%
+$ card card:agent:gall

View File

@ -5,9 +5,9 @@
:: looks at our invite tree, adds our siblings to group at +group-path
::
/- group-store, spider
/+ default-agent, verb
/+ ethereum, azimuth, default-agent, verb
=, ethereum-types
=, able:jael
=, jael
::
=> |%
++ group-path /invite-peers

View File

@ -4,7 +4,7 @@
::
/- *s3
/+ s3-json, default-agent, verb, dbug
~% %s3-top ..is ~
~% %s3-top ..part ~
|%
+$ card card:agent:gall
+$ versioned-state

View File

@ -362,7 +362,7 @@
=. starting.state
(~(jab by starting.state) yarn |=([=trying =vase] [%none vase]))
~| sign+[- +<]:sign-arvo
?> ?=([?(%b %c) %writ *] sign-arvo)
?> ?=([?(%behn %clay) %writ *] sign-arvo)
=/ =riot:clay p.sign-arvo
?~ riot
(thread-fail-not-running tid %build-thread-error *tang)

View File

@ -3,4 +3,4 @@
:- %say
|= [* [her=ship ~] ~]
:- %aqua-events
[%init-ship her `*dawn-event:able:jael]~
[%init-ship her `*dawn-event:jael]~

View File

@ -12,145 +12,8 @@
arg=$@(~ [top=path ~])
~
==
::
:: we're creating an event series E whose lifecycle can be computed
:: with the urbit lifecycle formula L, `[2 [0 3] [0 2]]`. that is:
:: if E is the list of events processed by a computer in its life,
:: its final state is S, where S is nock(E L).
::
:: in practice, the first five nouns in E are: two boot formulas,
:: a hoon compiler as a nock formula, the same compiler as source,
:: and the arvo kernel as source.
::
:: after the first five special events, we enter an iterative
:: sequence of regular events which continues for the rest of the
:: computer's life. during this sequence, each state is a function
:: that, passed the next event, produces the next state.
::
:: a regular event is a `[date wire type data]` tuple, where `date` is a
:: 128-bit Urbit date; `wire` is an opaque path which output can
:: match to track causality; `type` is a symbol describing the type
:: of input; and `data` is input data specific to `type`.
::
:: in real life we don't actually run the lifecycle loop,
:: since real life is updated incrementally and also cares
:: about things like output. we couple to the internal
:: structure of the state machine and work directly with
:: the underlying arvo engine.
::
:: this arvo core, which is at `+7` (Lisp `cddr`) of the state
:: function (see its public interface in `sys/arvo`), gives us
:: extra features, like output, which are relevant to running
:: a real-life urbit vm, but don't affect the formal definition.
::
:: so a real-life urbit interpreter is coupled to the shape of
:: the arvo core. it becomes very hard to change this shape.
:: fortunately, it is not a very complex interface.
::
:- %noun
::
:: boot-one: lifecycle formula
::
=+ ^= boot-one
::
:: event 1 is the lifecycle formula which computes the final
:: state from the full event sequence.
::
:: the formal urbit state is always just a gate (function)
:: which, passed the next event, produces the next state.
::
=> [boot-formula=* full-sequence=*]
!= ::
:: first we use the boot formula (event 1) to set up
:: the pair of state function and main sequence. the boot
:: formula peels off the first 5 events
:: to set up the lifecycle loop.
::
=+ [state-gate main-sequence]=.*(full-sequence boot-formula)
::
:: in this lifecycle loop, we replace the state function
:: with its product, called on the next event, until
:: we run out of events.
::
|- ?@ main-sequence
state-gate
%= $
main-sequence +.main-sequence
state-gate .*(state-gate [%9 2 %10 [6 %1 -.main-sequence] %0 1])
==
::
:: boot-two: startup formula
::
=+ ^= boot-two
::
:: event 2 is the startup formula, which verifies the compiler
:: and starts the main lifecycle.
::
=> :* :: event 3: a formula producing the hoon compiler
::
compiler-formula=**
::
:: event 4: hoon compiler source, compiling to event 2
::
compiler-source=*@t
::
:: event 5: arvo kernel source
::
arvo-source=*@t
::
:: events 6..n: main sequence with normal semantics
::
main-sequence=**
==
!= :_ main-sequence
::
:: activate the compiler gate. the product of this formula
:: is smaller than the formula. so you might think we should
:: save the gate itself rather than the formula producing it.
:: but we have to run the formula at runtime, to register jets.
::
:: as always, we have to use raw nock as we have no type.
:: the gate is in fact ++ride.
::
~> %slog.[0 leaf+"1-b"]
=+ ^= compiler-gate
.*(0 compiler-formula)
::
:: compile the compiler source, producing (pair span nock).
:: the compiler ignores its input so we use a trivial span.
::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=+ ^= compiler-tool
.*(compiler-gate [%9 2 %10 [6 %1 [%noun compiler-source]] %0 1])
::
:: switch to the second-generation compiler. we want to be
:: able to generate matching reflection nouns even if the
:: language changes -- the first-generation formula will
:: generate last-generation spans for `!>`, etc.
::
~> %slog.[0 leaf+"1-d"]
=. compiler-gate .*(0 +:compiler-tool)
::
:: get the span (type) of the kernel core, which is the context
:: of the compiler gate. we just compiled the compiler,
:: so we know the span (type) of the compiler gate. its
:: context is at tree address `+>` (ie, `+7` or Lisp `cddr`).
:: we use the compiler again to infer this trivial program.
::
~> %slog.[0 leaf+"1-e"]
=+ ^= kernel-span
-:.*(compiler-gate [%9 2 %10 [6 %1 [-.compiler-tool '+>']] %0 1])
::
:: compile the arvo source against the kernel core.
::
~> %slog.[0 leaf+"1-f"]
=+ ^= kernel-tool
.*(compiler-gate [%9 2 %10 [6 %1 [kernel-span arvo-source]] %0 1])
::
:: create the arvo kernel, whose subject is the kernel core.
::
~> %slog.[0 leaf+"1-g"]
.*(+>:compiler-gate +:kernel-tool)
^- pill:pill
::
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
@ -165,7 +28,7 @@
:: compiler-twig: compiler as hoon expression
::
~& %brass-parsing
=+ compiler-twig=(ream compiler-source)
=+ compiler-twig=(rain /sys/hoon/hoon compiler-source)
~& %brass-parsed
::
:: compiler-formula: compiler as nock formula
@ -180,22 +43,19 @@
::
:: boot-ova: startup events
::
=+ ^= boot-ova ^- (list *)
:~ boot-one
boot-two
compiler-formula
compiler-source
arvo-source
==
=/ boot-ova=(list)
:~ aeon:eden:part
boot:eden:part
compiler-formula
compiler-source
arvo-source
==
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::
=/ bas=path (flop (tail (flop sys)))
:+ %pill %brass
:+ boot-ova
:~ :~ //arvo
%what
[/sys/hoon hoon/compiler-source]
[/sys/arvo hoon/arvo-source]
==
:~ (boot-ovum:pill compiler-source arvo-source)
(file-ovum2:pill bas)
==
[(file-ovum:pill bas) ~]

View File

@ -4,8 +4,7 @@
::
:: eg: |claz-invites ~marzod 1 10 %/example-invites/txt
::
/+ keygen
=, ethereum
/+ keygen, *ethereum
::
:- %say
|= $: [now=@da eny=@uvJ =beak]
@ -37,5 +36,5 @@
;: weld
(scow %p who) ","
(slag 1 (scow %q ticket)) ","
(address-to-hex:ethereum owner)
(address-to-hex owner)
==

View File

@ -38,7 +38,7 @@
=+((pars bek.arg) [who dez (opt-case caz) gem])
==
++ opt-case |=(a=case ?:(=(*case cas) a cas)) :: override
++ pars |=(a=beaky `[[who=ship dez=desk caz=case] *]`(need (de-beam:format a)))
++ pars |=(a=beaky `[[who=ship dez=desk caz=case] *]`(need (de-beam a)))
++ pars-src
|= syd=$@(desk beaky)
?@ syd syd

View File

@ -13,7 +13,7 @@
=rift
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
^- (unit [=ship =udiff:point:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=([?(%earl %pawn)] ran)
@ -30,4 +30,4 @@
?. =(*^rift rift)
rift
+(.^(^rift j+/(scot %p our)/rift/(scot %da now)/(scot %p mon)))
`[mon *id:block:able:jael %rift rift]
`[mon *id:block:jael %rift rift]

View File

@ -14,7 +14,7 @@
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
^- (unit [=ship =udiff:point:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=([?(%earl %pawn)] ran)
@ -35,11 +35,11 @@
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life eny)))
=/ =seed:able:jael
=/ =seed:jael
[mon life 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]
`[mon *id:block:jael %keys life 1 pass]

View File

@ -13,7 +13,7 @@
public-key=pass
==
:- %helm-moon
^- (unit [=ship =udiff:point:able:jael])
^- (unit [=ship =udiff:point:jael])
=* our p.bec
=/ ran (clan:title our)
?: ?=([?(%earl %pawn)] ran)
@ -34,11 +34,11 @@
?. =(*pass public-key)
public-key
=/ cub (pit:nu:crub:crypto 512 (shaz (jam mon life=1 eny)))
=/ =seed:able:jael
=/ =seed: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]
`[mon *id:block:jael %keys 1 1 pass]

View File

@ -11,7 +11,7 @@
[[pax=path pot=$@(~ [v=@tas ~])] ~]
==
?~ pot
=+ bem=(need (de-beam:format pax))
=+ bem=(need (de-beam pax))
$(pot ~[?^(s.bem (rear s.bem) q.bem)])
:- %kiln-mount
[pax v.pot]

View File

@ -3,6 +3,7 @@
:::: /hoon/ivory/gen
::
/? 310
/+ pill
::
::::
!:
@ -12,73 +13,64 @@
~
==
:- %noun
:: sys: root path to boot system, `/~me/[desk]/now/sys`
::
^- pill:pill
=/ sys=path
?^ arg top.arg
/(scot %p p.bec)/[q.bec]/(scot %da now)/sys
:: compiler-source: hoon source file producing compiler, `sys/hoon`
=/ lib
(welp (flop (tail (flop sys))) /lib)
::
=/ compiler-source
.^(@t %cx (welp sys /hoon/hoon))
:: compiler-hoon: compiler as hoon expression
|^ =/ ver
=/ sub *(trap vase)
=. sub (build-sys sub %hoon)
=. sub (build-sys sub %arvo)
=. sub (build-sys sub %lull)
=. sub (build-sys sub %zuse)
=. sub (build-lib sub & %ethereum)
=. sub (build-lib sub & %azimuth)
(build-lib sub | %vere)
=/ nok !.
=> *[ver=(trap vase) ~]
!= q:$:ver
ivory/[nok ver ~]
::
:: Parsed with a static path for reproducibility.
++ build-sys
|= [sub=(trap vase) nam=term] ^- (trap vase)
~> %slog.[0 leaf+"ivory: building /sys/{(trip nam)}"]
(swat sub (rain /sys/[nam]/hoon .^(@t cx+(welp sys /[nam]/hoon))))
::
~& %ivory-parsing
=/ compiler-hoon (rain /sys/hoon/hoon compiler-source)
~& %ivory-parsed
:: arvo-source: hoon source file producing arvo kernel, `sys/arvo`
++ build-lib
|= [sub=(trap vase) imp=? nam=term] ^- (trap vase)
~> %slog.[0 leaf+"ivory: building /lib/{(trip nam)}"]
=/ hun=hoon
%+ mist /lib/[nam]/hoon
.^(@t cx+(welp lib /[nam]/hoon))
?. imp (swat sub hun)
(swel sub [%ktts nam hun])
:: +mist: +rain but skipping past ford runes
::
=/ arvo-source
.^(@t %cx (welp sys /arvo/hoon))
:: whole-hoon: arvo within compiler
::
:: Parsed with a static path for reproducibility.
::
=/ whole-hoon=hoon
:+ %tsgr compiler-hoon
:+ %tsgl (rain /sys/arvo/hoon arvo-source)
[%$ 7]
:: compile the whole schmeer
::
~& %ivory-compiling
=/ whole-formula
q:(~(mint ut %noun) %noun whole-hoon)
~& %ivory-compiled
:: zuse-ovo: standard library installation event
::
:: Arvo parses the %veer card contents with +rain;
:: we include a static path for reproducibility.
::
=/ zuse-ovo=ovum
:~ //arvo
%what
[/sys/hoon hoon/compiler-source]
[/sys/arvo hoon/arvo-source]
[/sys/lull hoon/.^(@ %cx (weld sys /lull/hoon))]
[/sys/zuse hoon/.^(@ %cx (weld sys /zuse/hoon))]
++ mist
|= [bon=path txt=@]
^- hoon
=+ vas=vast
~| bon
%+ scan (trip txt)
%- full
=; fud
(ifix [;~(plug gay fud) gay] tall:vas(wer bon))
%- star
;~ pose vul
%+ ifix [fas (just `@`10)]
(star ;~(less (just `@`10) next))
==
:: installed: Arvo gate (formal instance) with %zuse installed
:: +swel: +swat but with +slop
::
:: The :zuse-ovo event occurs at a defaulted date for reproducibility.
::
~& %zuse-installing
=/ installed
.* 0
:+ %7 whole-formula
[%9 2 %10 [6 %1 *@da zuse-ovo] %0 1]
~& %zuse-installed
:: our boot-ova is a list containing one massive formula:
::
:: We evaluate :whole-formula (for jet registration),
:: then ignore the result and produces :installed
::
=/ boot-ova=(list)
[[%7 whole-formula %1 installed] ~]
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::
:: Our kernel event-list is ~, as we've already installed them.
:: Our userspace event-list is ~, as this pill must be compact.
::
[boot-ova ~ ~]
++ swel
|= [tap=(trap vase) gen=hoon]
^- (trap vase)
=/ gun (~(mint ut p:$:tap) %noun gen)
=> [tap=tap gun=gun]
|. ~+
=/ pro q:$:tap
[[%cell p.gun p:$:tap] [.*(pro q.gun) pro]]
--

View File

@ -1,7 +1,7 @@
:: Create a private key-file
::
/- *sole
/+ *generators
/+ *generators, ethereum
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
@ -26,6 +26,6 @@
%+ print leaf+" networking: 0x{(render-hex-bytes:ethereum 32 cry)}"
%+ print leaf+"ethereum public keys:"
::
=/ sed=seed:able:jael
=/ sed=seed:jael
[who life sec:ex:cub ~]
%- produce [%atom (scot %uw (jam sed))]

View File

@ -1,8 +0,0 @@
:: serve a notebook in your filesystem
::
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[name=term ~] ~]
==
:- %publish-action
[%serve name]

View File

@ -1,8 +0,0 @@
:: subscribe to a publish notebook
::
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[=ship name=term ~] ~]
==
:- %publish-action
[%subscribe ship name]

View File

@ -65,30 +65,13 @@
=< q
%^ spin
^- (list ovum)
:~ :~ //arvo
%what
[/sys/hoon hoon/compiler-src]
[/sys/arvo hoon/arvo-src]
==
:~ (boot-ovum:pill compiler-src arvo-src)
(file-ovum2:pill (flop (tail (flop sys))))
==
.*(0 arvo-formula)
|= [ovo=ovum ken=*]
[~ (slum ken [now ovo])]
::
:: boot-one: lifecycle formula (from +brass)
::
=/ boot-one
=> [boot-formula=** full-sequence=**]
!= =+ [state-gate main-sequence]=.*(full-sequence boot-formula)
|-
?@ main-sequence
state-gate
%= $
main-sequence +.main-sequence
state-gate .*(state-gate [%9 2 %10 [6 %1 -.main-sequence] %0 1])
==
::
:: kernel-formula
::
:: We evaluate :arvo-formula (for jet registration),
@ -106,7 +89,7 @@
:: boot-ova
::
=/ boot-ova=(list)
[boot-one boot-two kernel-formula ~]
[aeon:eden:part boot-two kernel-formula ~]
::
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::
@ -114,6 +97,7 @@
:: Our userspace event-list is a list containing a full %clay
:: filesystem sync event.
::
:+ %pill %solid
:+ boot-ova ~
=/ bas (flop (tail (flop sys)))
[(file-ovum:pill bas) ~]

View File

@ -5,5 +5,5 @@
[%tang >timers< ~]
.^ (list [date=@da =duct])
%bx
(en-beam:format [p.bec %$ r.bec] /debug/timers)
(en-beam [p.bec %$ r.bec] /debug/timers)
==

View File

@ -1,4 +1,5 @@
/- *aquarium
/+ ethereum, azimuth
::
|%
::
@ -133,14 +134,14 @@
==
::
++ number-to-hash
|= =number:block:able:jael
|= =number:block: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
|= =hash:block:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
@ -156,8 +157,8 @@
logs.azi
::
++ logs-by-hash
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
|= =hash:block:jael
=/ =number:block:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json

View File

@ -1,145 +1,433 @@
/+ strandio
=, strand=strand:strandio
=, able:jael
|%
++ tract azimuth:contracts:azimuth
++ fetch-point
|= [url=@ta who=ship]
=/ m (strand ,point:azimuth)
^- form:m
=/ =request:rpc:ethereum
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call:rpc:ethereum 'points(uint32)' [%uint `@`who]~)
[%label %latest]
;< jon=json bind:m (request-rpc url `'point' request)
=/ res=cord (so:dejs:format jon)
=/ =point:eth-noun:azimuth
(decode-results:abi:ethereum res point:eth-type:azimuth)
::
=/ =request:rpc:ethereum
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call:rpc:ethereum 'rights(uint32)' [%uint `@`who]~)
[%label %latest]
;< jon=json bind:m (request-rpc url `'deed' request)
=/ res=cord (so:dejs:format jon)
=/ =deed:eth-noun:azimuth
(decode-results:abi:ethereum res deed:eth-type:azimuth)
::
(pure:m (point-from-eth:azimuth who point deed))
:: azimuth: constants and utilities
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
=/ m (strand ,json)
^- form:m
%+ (retry json) `10
=/ m (strand ,(unit json))
^- form:m
|^
=/ =request:http
:* method=%'POST'
url=url
header-list=['Content-Type'^'application/json' ~]
^= body
%- some %- as-octt:mimes:html
%- en-json:html
(request-to-json:rpc:ethereum id req)
/+ ethereum
::
=> => [azimuth-types ethereum-types .]
|%
+$ complete-ship
$: state=point
history=(list diff-point) ::TODO maybe block/event nr? :: newest first
keys=(map life pass)
==
::
++ fleet (map @p complete-ship)
::
++ eth-type
|%
++ point
:~ [%bytes-n 32] :: encryptionKey
[%bytes-n 32] :: authenticationKey
%bool :: hasSponsor
%bool :: active
%bool :: escapeRequested
%uint :: sponsor
%uint :: escapeRequestedTo
%uint :: cryptoSuiteVersion
%uint :: keyRevisionNumber
%uint :: continuityNumber
==
++ deed
:~ %address :: owner
%address :: managementProxy
%address :: spawnProxy
%address :: votingProxy
%address :: transferProxy
==
--
::
++ eth-noun
|%
+$ point
$: encryption-key=octs
authentication-key=octs
has-sponsor=?
active=?
escape-requested=?
sponsor=@ud
escape-to=@ud
crypto-suite=@ud
key-revision=@ud
continuity-number=@ud
==
+$ deed
$: owner=address
management-proxy=address
spawn-proxy=address
voting-proxy=address
transfer-proxy=address
==
--
::
++ function
|%
++ azimuth
$% [%points who=@p]
[%rights who=@p]
[%get-spawned who=@p]
[%dns-domains ind=@ud]
==
--
::
:: # diffs
::
++ update
$% [%full ships=(map ship point) dns=dnses heard=events]
[%difs dis=(list (pair event-id diff-azimuth))]
==
::
:: # constants
::
:: contract addresses
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract
::
++ azimuth
0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb
::
++ ecliptic
0x6ac0.7b7c.4601.b5ce.11de.8dfe.6335.b871.c7c4.dd4d
::
++ linear-star-release
0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801
::
++ conditional-star-release
0x8c24.1098.c3d3.498f.e126.1421.633f.d579.86d7.4aea
::
++ delegated-sending
0xf790.8ab1.f1e3.52f8.3c5e.bc75.051c.0565.aeae.a5fb
::
:: launch: block number of azimuth deploy
::
++ launch 6.784.800
::
:: public: block number of azimuth becoming independent
::
++ public 7.033.765
--
::
:: Testnet contract addresses
::
++ ropsten-contracts
|%
++ azimuth
0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579
::
++ ecliptic
0x8b9f.86a2.8921.d9c7.05b3.113a.755f.b979.e1bd.1bce
::
++ linear-star-release
0x1f8e.dd03.1ee4.1474.0aed.b39b.84fb.8f2f.66ca.422f
::
++ conditional-star-release
0x0
::
++ delegated-sending
0x3e8c.a510.354b.c2fd.bbd6.1502.52d9.3105.c9c2.7bbe
::
++ launch 4.601.630
++ public launch
--
::
:: ++ azimuth 0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381 :: local bridge
:: hashes of ship event signatures
++ azimuth-events
|%
::
:: OwnerChanged(uint32,address)
++ owner-changed
0x16d0.f539.d49c.6cad.822b.767a.9445.bfb1.
cf7e.a6f2.a6c2.b120.a7ea.4cc7.660d.8fda
::
:: Activated(uint32)
++ activated
0xe74c.0380.9d07.69e1.b1f7.06cc.8414.258c.
d1f3.b6fe.020c.d15d.0165.c210.ba50.3a0f
::
:: Spawned(uint32,uint32)
++ spawned
0xb2d3.a6e7.a339.f5c8.ff96.265e.2f03.a010.
a854.1070.f374.4a24.7090.9644.1508.1546
::
:: EscapeRequested(uint32,uint32)
++ escape-requested
0xb4d4.850b.8f21.8218.141c.5665.cba3.79e5.
3e9b.b015.b51e.8d93.4be7.0210.aead.874a
::
:: EscapeCanceled(uint32,uint32)
++ escape-canceled
0xd653.bb0e.0bb7.ce83.93e6.24d9.8fbf.17cd.
a590.2c83.28ed.0cd0.9988.f368.90d9.932a
::
:: EscapeAccepted(uint32,uint32)
++ escape-accepted
0x7e44.7c9b.1bda.4b17.4b07.96e1.00bf.7f34.
ebf3.6dbb.7fe6.6549.0b1b.fce6.246a.9da5
::
:: LostSponsor(uint32,uint32)
++ lost-sponsor
0xd770.4f9a.2519.3dbd.0b0c.b4a8.09fe.ffff.
a7f1.9d1a.ae88.17a7.1346.c194.4482.10d5
::
:: ChangedKeys(uint32,bytes32,bytes32,uint32,uint32)
++ changed-keys
0xaa10.e7a0.117d.4323.f1d9.9d63.0ec1.69be.
bb3a.988e.8957.70e3.5198.7e01.ff54.23d5
::
:: BrokeContinuity(uint32,uint32)
++ broke-continuity
0x2929.4799.f1c2.1a37.ef83.8e15.f79d.d91b.
cee2.df99.d63c.d1c1.8ac9.68b1.2951.4e6e
::
:: ChangedSpawnProxy(uint32,address)
++ changed-spawn-proxy
0x9027.36af.7b3c.efe1.0d9e.840a.ed0d.687e.
35c8.4095.122b.2505.1a20.ead8.866f.006d
::
:: ChangedTransferProxy(uint32,address)
++ changed-transfer-proxy
0xcfe3.69b7.197e.7f0c.f067.93ae.2472.a9b1.
3583.fecb.ed2f.78df.a14d.1f10.796b.847c
::
:: ChangedManagementProxy(uint32,address)
++ changed-management-proxy
0xab9c.9327.cffd.2acc.168f.afed.be06.139f.
5f55.cb84.c761.df05.e051.1c25.1e2e.e9bf
::
:: ChangedVotingProxy(uint32,address)
++ changed-voting-proxy
0xcbd6.269e.c714.57f2.c7b1.a227.74f2.46f6.
c5a2.eae3.795e.d730.0db5.1768.0c61.c805
::
:: ChangedDns(string,string,string)
++ changed-dns
0xfafd.04ad.e1da.ae2e.1fdb.0fc1.cc6a.899f.
d424.063e.d5c9.2120.e67e.0730.53b9.4898
--
--
::
:: logic
::
|%
++ pass-from-eth
|= [enc=octs aut=octs sut=@ud]
^- pass
%^ cat 3 'b'
?. &(=(1 sut) =(p.enc 32) =(p.aut 32))
(cat 8 0 0)
(cat 8 q.aut q.enc)
::
++ point-from-eth
|= [who=@p point:eth-noun deed:eth-noun]
^- point
::
:: ownership
::
:+ :* owner
management-proxy
voting-proxy
transfer-proxy
==
::
:: network state
::
?. active ~
:- ~
:* key-revision
::
(pass-from-eth encryption-key authentication-key crypto-suite)
::
continuity-number
::
[has-sponsor `@p`sponsor]
::
?. escape-requested ~
``@p`escape-to
==
;< ~ bind:m (send-request:strandio request)
;< rep=(unit client-response:iris) bind:m
take-maybe-response:strandio
?~ rep
(pure:m ~)
(parse-response u.rep)
::
++ parse-response
|= =client-response:iris
=/ m (strand ,(unit json))
^- form:m
?> ?=(%finished -.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 ~)
=, dejs-soft:format
=/ array=(unit (list response:rpc:jstd))
((ar parse-one-response) u.jon)
?~ array
=/ res=(unit response:rpc:jstd) (parse-one-response u.jon)
?~ res
(strand-fail:strandio %request-rpc-parse-error >id< ~)
?: ?=(%error -.u.res)
(strand-fail:strandio %request-rpc-error >id< >+.res< ~)
?. ?=(%result -.u.res)
(strand-fail:strandio %request-rpc-fail >u.res< ~)
(pure:m `res.u.res)
(strand-fail:strandio %request-rpc-batch >%not-implemented< ~)
:: (pure:m `[%batch u.array])
:: spawn state
::
++ parse-one-response
|= =json
^- (unit response:rpc:jstd)
=/ res=(unit [@t ^json])
%. json
=, dejs-soft:format
(ot id+so result+some ~)
?^ res `[%result u.res]
~| parse-one-response=json
:+ ~ %error %- need
%. json
=, dejs-soft:format
(ot id+so error+(ot code+no message+so ~) ~)
?. ?=(?(%czar %king) (clan:title who)) ~
:- ~
:* spawn-proxy
~ ::TODO call getSpawned to fill this
==
::
++ event-log-to-point-diff
=, azimuth-events
=, abi:ethereum
|= log=event-log:rpc:ethereum
^- (unit (pair ship diff-point))
~? ?=(~ mined.log) %processing-unmined-event
::
?: =(i.topics.log owner-changed)
=/ [who=@ wer=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %owner wer]
::
?: =(i.topics.log activated)
=/ who=@
(decode-topics t.topics.log ~[%uint])
`[who %activated who]
::
?: =(i.topics.log spawned)
=/ [pre=@ who=@]
(decode-topics t.topics.log ~[%uint %uint])
`[pre %spawned who]
::
?: =(i.topics.log escape-requested)
=/ [who=@ wer=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %escape `wer]
::
?: =(i.topics.log escape-canceled)
=/ who=@ (decode-topics t.topics.log ~[%uint])
`[who %escape ~]
::
?: =(i.topics.log escape-accepted)
=/ [who=@ wer=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %sponsor & wer]
::
?: =(i.topics.log lost-sponsor)
=/ [who=@ pos=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %sponsor | pos]
::
?: =(i.topics.log changed-keys)
=/ who=@ (decode-topics t.topics.log ~[%uint])
=/ [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who %keys rev (pass-from-eth enc aut sut)]
::
?: =(i.topics.log broke-continuity)
=/ who=@ (decode-topics t.topics.log ~[%uint])
=/ num=@ (decode-results data.log ~[%uint])
`[who %continuity num]
::
?: =(i.topics.log changed-management-proxy)
=/ [who=@ sox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %management-proxy sox]
::
?: =(i.topics.log changed-voting-proxy)
=/ [who=@ tox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %voting-proxy tox]
::
?: =(i.topics.log changed-spawn-proxy)
=/ [who=@ sox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %spawn-proxy sox]
::
?: =(i.topics.log changed-transfer-proxy)
=/ [who=@ tox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %transfer-proxy tox]
::
:: warn about unimplemented events, but ignore
:: the ones we know are harmless.
~? ?! .= i.topics.log
:: OwnershipTransferred(address,address)
0x8be0.079c.5316.5914.1344.cd1f.d0a4.f284.
1949.7f97.22a3.daaf.e3b4.186f.6b64.57e0
[%unimplemented-event i.topics.log]
~
::
++ apply-point-diff
|= [pot=point dif=diff-point]
^- point
?- -.dif
%full new.dif
::
%activated
%_ pot
net `[0 0 0 &^(^sein:title who.dif) ~]
kid ?. ?=(?(%czar %king) (clan:title who.dif)) ~
`[0x0 ~]
==
::
:: ownership
::
%owner pot(owner.own new.dif)
%transfer-proxy pot(transfer-proxy.own new.dif)
%management-proxy pot(management-proxy.own new.dif)
%voting-proxy pot(voting-proxy.own new.dif)
::
:: networking
::
?(%keys %continuity %sponsor %escape)
?> ?=(^ net.pot)
?- -.dif
%keys
pot(life.u.net life.dif, pass.u.net pass.dif)
::
%sponsor
%= pot
sponsor.u.net new.dif
escape.u.net ?:(has.new.dif ~ escape.u.net.pot)
==
::
%continuity pot(continuity-number.u.net new.dif)
%escape pot(escape.u.net new.dif)
==
::
:: spawning
::
?(%spawned %spawn-proxy)
?> ?=(^ kid.pot)
?- -.dif
%spawned
=- pot(spawned.u.kid -)
(~(put in spawned.u.kid.pot) who.dif)
::
%spawn-proxy pot(spawn-proxy.u.kid new.dif)
==
==
::
++ parse-id
|= id=@t
^- azimuth:function
|^
~| id
%+ rash id
;~ pose
(function %points 'points' shipname)
(function %get-spawned 'getSpawned' shipname)
(function %dns-domains 'dnsDomains' dem:ag)
==
::
++ function
|* [tag=@tas fun=@t rul=rule]
;~(plug (cold tag (jest fun)) (ifix [pal par] rul))
::
++ shipname
;~(pfix sig fed:ag)
--
::
++ retry
|* result=mold
|= [crash-after=(unit @ud) computation=_*form:(strand (unit result))]
=/ m (strand ,result)
=| try=@ud
|- ^- form:m
=* loop $
?: =(crash-after `try)
(strand-fail:strandio %retry-too-many ~)
;< ~ bind:m (backoff:strandio try ~m1)
;< res=(unit result) bind:m computation
?^ res
(pure:m u.res)
loop(try +(try))
::
++ get-latest-block
|= url=@ta
=/ m (strand ,block)
^- form:m
;< =json bind:m (request-rpc url `'block number' %eth-block-number ~)
(get-block-by-number url (parse-eth-block-number:rpc:ethereum json))
::
++ get-block-by-number
|= [url=@ta =number:block]
=/ m (strand ,block)
^- form:m
|^
;< =json bind:m
(request-rpc url `'block by number' %eth-get-block-by-number number |)
=/ =block (parse-block json)
?. =(number number.id.block)
(strand-fail:strandio %reorg-detected >number< >block< ~)
(pure:m block)
::
++ parse-block
|= =json
^- block
=< [[&1 &2] |2]
^- [@ @ @]
~| json
%. json
=, dejs:format
%- ot
:~ hash+parse-hex-result:rpc:ethereum
number+parse-hex-result:rpc:ethereum
'parentHash'^parse-hex-result:rpc:ethereum
++ function-to-call
|%
++ azimuth
|= cal=azimuth:function
^- [id=@t dat=call-data:rpc:ethereum]
?- -.cal
%points
:- (crip "points({(scow %p who.cal)})")
['points(uint32)' ~[uint+`@`who.cal]]
::
%rights
:- (crip "rights({(scow %p who.cal)})")
['rights(uint32)' ~[uint+`@`who.cal]]
::
%get-spawned
:- (crip "getSpawned({(scow %p who.cal)})")
['getSpawned(uint32)' ~[uint+`@`who.cal]]
::
%dns-domains
:- (crip "dnsDomains({(scow %ud ind.cal)})")
['dnsDomains(uint256)' ~[uint+ind.cal]]
==
--
--

146
pkg/arvo/lib/azimuthio.hoon Normal file
View File

@ -0,0 +1,146 @@
/- rpc=json-rpc
/+ ethereum, azimuth, strandio
=, strand=strand:strandio
=, jael
|%
++ tract azimuth:contracts:azimuth
++ fetch-point
|= [url=@ta who=ship]
=/ m (strand ,point:azimuth)
^- form:m
=/ =request:rpc:ethereum
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call:rpc:ethereum 'points(uint32)' [%uint `@`who]~)
[%label %latest]
;< jon=json bind:m (request-rpc url `'point' request)
=/ res=cord (so:dejs:format jon)
=/ =point:eth-noun:azimuth
(decode-results:abi:ethereum res point:eth-type:azimuth)
::
=/ =request:rpc:ethereum
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call:rpc:ethereum 'rights(uint32)' [%uint `@`who]~)
[%label %latest]
;< jon=json bind:m (request-rpc url `'deed' request)
=/ res=cord (so:dejs:format jon)
=/ =deed:eth-noun:azimuth
(decode-results:abi:ethereum res deed:eth-type:azimuth)
::
(pure:m (point-from-eth:azimuth who point deed))
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
=/ m (strand ,json)
^- form:m
%+ (retry json) `10
=/ m (strand ,(unit json))
^- form:m
|^
=/ =request:http
:* method=%'POST'
url=url
header-list=['Content-Type'^'application/json' ~]
^= body
%- some %- as-octt:mimes:html
%- en-json:html
(request-to-json:rpc:ethereum id req)
==
;< ~ bind:m (send-request:strandio request)
;< rep=(unit client-response:iris) bind:m
take-maybe-response:strandio
?~ rep
(pure:m ~)
(parse-response u.rep)
::
++ parse-response
|= =client-response:iris
=/ m (strand ,(unit json))
^- form:m
?> ?=(%finished -.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 ~)
=, dejs-soft:format
=/ array=(unit (list response:rpc))
((ar parse-one-response) u.jon)
?~ array
=/ res=(unit response:rpc) (parse-one-response u.jon)
?~ res
(strand-fail:strandio %request-rpc-parse-error >id< ~)
?: ?=(%error -.u.res)
(strand-fail:strandio %request-rpc-error >id< >+.res< ~)
?. ?=(%result -.u.res)
(strand-fail:strandio %request-rpc-fail >u.res< ~)
(pure:m `res.u.res)
(strand-fail:strandio %request-rpc-batch >%not-implemented< ~)
:: (pure:m `[%batch u.array])
::
++ parse-one-response
|= =json
^- (unit response:rpc)
=/ res=(unit [@t ^json])
%. json
=, dejs-soft:format
(ot id+so result+some ~)
?^ res `[%result u.res]
~| parse-one-response=json
:+ ~ %error %- need
%. json
=, dejs-soft:format
(ot id+so error+(ot code+no message+so ~) ~)
--
::
++ retry
|* result=mold
|= [crash-after=(unit @ud) computation=_*form:(strand (unit result))]
=/ m (strand ,result)
=| try=@ud
|- ^- form:m
=* loop $
?: =(crash-after `try)
(strand-fail:strandio %retry-too-many ~)
;< ~ bind:m (backoff:strandio try ~m1)
;< res=(unit result) bind:m computation
?^ res
(pure:m u.res)
loop(try +(try))
::
++ get-latest-block
|= url=@ta
=/ m (strand ,block)
^- form:m
;< =json bind:m (request-rpc url `'block number' %eth-block-number ~)
(get-block-by-number url (parse-eth-block-number:rpc:ethereum json))
::
++ get-block-by-number
|= [url=@ta =number:block]
=/ m (strand ,block)
^- form:m
|^
;< =json bind:m
(request-rpc url `'block by number' %eth-get-block-by-number number |)
=/ =block (parse-block json)
?. =(number number.id.block)
(strand-fail:strandio %reorg-detected >number< >block< ~)
(pure:m block)
::
++ parse-block
|= =json
^- block
=< [[&1 &2] |2]
^- [@ @ @]
~| json
%. json
=, dejs:format
%- ot
:~ hash+parse-hex-result:rpc:ethereum
number+parse-hex-result:rpc:ethereum
'parentHash'^parse-hex-result:rpc:ethereum
==
--
--

View File

@ -1,133 +0,0 @@
:: |base64: flexible base64 encoding for little-endian atoms
::
:: pad: include padding when encoding, require when decoding
:: url: use url-safe characters '-' for '+' and '_' for '/'
::
::
=+ [pad=& url=|]
|%
::
+$ byte @D
+$ word24 @
::
++ div-ceil
:: divide, rounding up.
|= [x=@ y=@] ^- @
?: =(0 (mod x y))
(div x y)
+((div x y))
::
++ explode-bytes
:: Explode a bytestring into list of bytes. Result is in LSB order.
|= =octs ^- (list byte)
=/ atom-byte-width (met 3 q.octs)
=/ leading-zeros (sub p.octs atom-byte-width)
(weld (reap leading-zeros 0) (rip 3 q.octs))
::
++ explode-words
:: Explode a bytestring to words of bit-width `wid`. Result is in LSW order.
|= [wid=@ =octs]
^- (list @)
=/ atom-bit-width (met 0 q.octs)
=/ octs-bit-width (mul 8 p.octs)
=/ atom-word-width (div-ceil atom-bit-width wid)
=/ rslt-word-width (div-ceil octs-bit-width wid)
=/ pad (sub rslt-word-width atom-word-width)
=/ x (rip [0 wid] q.octs)
%+ weld x
(reap pad 0)
::
:: +en:base64: encode +octs to base64 cord
::
:: Encode an `octs` into a base64 string.
::
:: First, we break up the input into a list of 24-bit words. The input
:: might not be a multiple of 24-bits, so we add 0-2 padding bytes at
:: the end (to the least-significant side, with a left-shift).
::
:: Then, we encode each block into four base64 characters.
::
:: Finally we remove the padding that we added at the beginning: for
:: each byte that was added, we replace one character with an = (unless
:: `pad` is false, in which case we just remove the extra characters).
::
++ en
^- $-(octs cord)
::
=/ cha
?: url
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
::
|^ |= bs=octs ^- cord
=/ [padding=@ blocks=(list word24)]
(octs-to-blocks bs)
(crip (flop (unpad padding (encode-blocks blocks))))
::
++ octs-to-blocks
|= bs=octs ^- [padding=@ud (list word24)]
=/ padding=@ud (~(dif fo 3) 0 p.bs)
=/ padded=octs [(add padding p.bs) (lsh [3 padding] (rev 3 bs))]
[padding (explode-words 24 padded)]
::
++ unpad
|= [extra=@ t=tape] ^- tape
=/ without (slag extra t)
?. pad without
(weld (reap extra '=') without)
::
++ encode-blocks
|= ws=(list word24) ^- tape
(zing (turn ws encode-block))
::
++ encode-block
|= w=word24 ^- tape
=/ a (cut 3 [(cut 0 [0 6] w) 1] cha)
=/ b (cut 3 [(cut 0 [6 6] w) 1] cha)
=/ c (cut 3 [(cut 0 [12 6] w) 1] cha)
=/ d (cut 3 [(cut 0 [18 6] w) 1] cha)
~[a b c d]
--
::
:: +de:base64: decode base64 cord to (unit @)
::
++ de
|= a=cord
^- (unit octs)
(rush a parse)
:: +parse:base64: parse base64 cord to +octs
::
++ parse
=< ^- $-(nail (like octs))
%+ sear reduce
;~ plug
%- plus ;~ pose
(cook |=(a=@ (sub a 'A')) (shim 'A' 'Z'))
(cook |=(a=@ (sub a 'G')) (shim 'a' 'z'))
(cook |=(a=@ (add a 4)) (shim '0' '9'))
(cold 62 (just ?:(url '-' '+')))
(cold 63 (just ?:(url '_' '/')))
==
(stun 0^2 (cold %0 tis))
==
|%
:: +reduce:parse:base64: reduce, measure, and swap base64 digits
::
++ reduce
|= [dat=(list @) dap=(list @)]
^- (unit octs)
=/ lat (lent dat)
=/ lap (lent dap)
=/ dif (~(dif fo 4) 0 lat)
?: &(pad !=(dif lap))
:: padding required and incorrect
~&(%base-64-padding-err-one ~)
?: &(!pad !=(0 lap))
:: padding not required but present
~&(%base-64-padding-err-two ~)
=/ len (sub (mul 3 (div (add lat dif) 4)) dif)
:+ ~ len
%+ swp 3
(rep [0 6] (flop (weld dat (reap dif 0))))
--
--

View File

@ -1,8 +1,7 @@
:: claz: call data generation
::
/- *claz
::
=, ethereum
/+ *ethereum, azimuth
::
|%
++ read-invites ::TODO lib

View File

@ -1,5 +1,5 @@
/- *contact-view, *contact-hook
/+ base64, group-store, resource
/+ group-store, resource
|%
++ nu :: parse number as hex
|= jon=json
@ -222,7 +222,7 @@
?- -.avatar
%url avatar
%octt
=. octs.avatar (need (de:base64 q.octs.avatar))
=. octs.avatar (need (de:base64:mimes:html q.octs.avatar))
avatar
==
::

866
pkg/arvo/lib/ethereum.hoon Normal file
View File

@ -0,0 +1,866 @@
:: ethereum: utilities
::
=, ethereum-types
|%
:: deriving and using ethereum keys
::
++ key
|%
++ address-from-pub
=, keccak:crypto
|= pub=@
%+ end [3 20]
%+ keccak-256 64
(rev 3 64 pub)
::
++ address-from-prv
(cork pub-from-prv address-from-pub)
::
++ pub-from-prv
=, secp256k1:secp:crypto
|= prv=@
%- serialize-point
(priv-to-pub prv)
::
++ sign-transaction
=, crypto
|= [tx=transaction:rpc pk=@]
^- @ux
:: hash the raw transaction data
=/ hash=@
=/ dat=@
%- encode-atoms:rlp
:: with v=chain-id, r=0, s=0
tx(chain-id [chain-id.tx 0 0 ~])
=+ wid=(met 3 dat)
%- keccak-256:keccak
[wid (rev 3 wid dat)]
:: sign transaction hash with private key
=+ (ecdsa-raw-sign:secp256k1:secp hash pk)
:: complete transaction is raw data, with r and s
:: taken from the signature, and v as per eip-155
%- encode-atoms:rlp
tx(chain-id [:(add (mul chain-id.tx 2) 35 v) r s ~])
--
::
:: rlp en/decoding
::NOTE https://github.com/ethereum/wiki/wiki/RLP
::
++ rlp
|%
::NOTE rlp encoding doesn't really care about leading zeroes,
:: but because we need to disinguish between no-bytes zero
:: and one-byte zero (and also empty list) we end up with
:: this awful type...
+$ item
$% [%l l=(list item)]
[%b b=byts]
==
:: +encode-atoms: encode list of atoms as a %l of %b items
::
++ encode-atoms
|= l=(list @)
^- @
%+ encode %l
%+ turn l
|=(a=@ b+[(met 3 a) a])
::
++ encode
|= in=item
|^ ^- @
?- -.in
%b
?: &(=(1 wid.b.in) (lte dat.b.in 0x7f))
dat.b.in
=- (can 3 ~[b.in [(met 3 -) -]])
(encode-length wid.b.in 0x80)
::
%l
=/ out=@
%+ roll l.in
|= [ni=item en=@]
(cat 3 (encode ni) en)
%^ cat 3 out
(encode-length (met 3 out) 0xc0)
==
::
++ encode-length
|= [len=@ off=@]
?: (lth len 56) (add len off)
=- (cat 3 len -)
:(add (met 3 len) off 55)
--
:: +decode-atoms: decode expecting a %l of %b items, producing atoms within
::
++ decode-atoms
|= dat=@
^- (list @)
=/ i=item (decode dat)
~| [%unexpected-data i]
?> ?=(%l -.i)
%+ turn l.i
|= i=item
~| [%unexpected-list i]
?> ?=(%b -.i)
dat.b.i
::
++ decode
|= dat=@
^- item
=/ bytes=(list @) (flop (rip 3 dat))
=? bytes ?=(~ bytes) ~[0]
|^ item:decode-head
::
++ decode-head
^- [done=@ud =item]
?~ bytes
~| %rlp-unexpected-end
!!
=* byt i.bytes
:: byte in 0x00-0x79 range encodes itself
::
?: (lte byt 0x79)
:- 1
[%b 1^byt]
:: byte in 0x80-0xb7 range encodes string length
::
?: (lte byt 0xb7)
=+ len=(sub byt 0x80)
:- +(len)
:- %b
len^(get-value 1 len)
:: byte in 0xb8-0xbf range encodes string length length
::
?: (lte byt 0xbf)
=+ led=(sub byt 0xb7)
=+ len=(get-value 1 led)
:- (add +(led) len)
:- %b
len^(get-value +(led) len)
:: byte in 0xc0-f7 range encodes list length
::
?: (lte byt 0xf7)
=+ len=(sub byt 0xc0)
:- +(len)
:- %l
%. len
decode-list(bytes (slag 1 `(list @)`bytes))
:: byte in 0xf8-ff range encodes list length length
::
?: (lte byt 0xff)
=+ led=(sub byt 0xf7)
=+ len=(get-value 1 led)
:- (add +(led) len)
:- %l
%. len
decode-list(bytes (slag +(led) `(list @)`bytes))
~| [%rip-not-bloq-3 `@ux`byt]
!!
::
++ decode-list
|= rem=@ud
^- (list item)
?: =(0 rem) ~
=+ ^- [don=@ud =item] ::TODO =/
decode-head
:- item
%= $
rem (sub rem don)
bytes (slag don bytes)
==
::
++ get-value
|= [at=@ud to=@ud]
^- @
(rep 3 (flop (swag [at to] bytes)))
--
--
::
:: abi en/decoding
::NOTE https://solidity.readthedocs.io/en/develop/abi-spec.html
::
++ abi
=> |%
:: solidity types. integer bitsizes ignored
++ etyp
$@ $? :: static
%address %bool
%int %uint
%real %ureal
:: dynamic
%bytes %string
==
$% :: static
[%bytes-n n=@ud]
:: dynamic
[%array-n t=etyp n=@ud]
[%array t=etyp]
==
::
:: solidity-style typed data. integer bitsizes ignored
++ data
$% [%address p=address]
[%string p=tape]
[%bool p=?]
[%int p=@sd]
[%uint p=@ud]
[%real p=@rs]
[%ureal p=@urs]
[%array-n p=(list data)]
[%array p=(list data)]
[%bytes-n p=octs] ::TODO just @, because context knows length?
[%bytes p=octs]
==
--
=, mimes:html
|%
:: encoding
::
++ encode-args
:: encode list of arguments.
::
|= das=(list data)
^- tape
(encode-data [%array-n das])
::
++ encode-data
:: encode typed data into ABI bytestring.
::
|= dat=data
^- tape
?+ -.dat
~| [%unsupported-type -.dat]
!!
::
%array-n
:: enc(X) = head(X[0]) ... head(X[k-1]) tail(X[0]) ... tail(X[k-1])
:: where head and tail are defined for X[i] being of a static type as
:: head(X[i]) = enc(X[i]) and tail(X[i]) = "" (the empty string), or as
:: head(X[i]) = enc(len( head(X[0])..head(X[k-1])
:: tail(X[0])..tail(X[i-1]) ))
:: and tail(X[i]) = enc(X[i]) otherwise.
::
:: so: if it's a static type, data goes in the head. if it's a dynamic
:: type, a reference goes into the head and data goes into the tail.
::
:: in the head, we first put a placeholder where references need to go.
=+ hol=(reap 64 'x')
=/ hes=(list tape)
%+ turn p.dat
|= d=data
?. (is-dynamic-type d) ^$(dat d)
hol
=/ tas=(list tape)
%+ turn p.dat
|= d=data
?. (is-dynamic-type d) ""
^$(dat d)
:: once we know the head and tail, we can fill in the references in head.
=- (weld nes `tape`(zing tas))
^- [@ud nes=tape]
=+ led=(lent (zing hes))
%+ roll hes
|= [t=tape i=@ud nes=tape]
:- +(i)
:: if no reference needed, just put the data.
?. =(t hol) (weld nes t)
:: calculate byte offset of data we need to reference.
=/ ofs=@ud
=- (div - 2) :: two hex digits per byte.
%+ add led :: count head, and
%- lent %- zing :: count all tail data
(scag i tas) :: preceding ours.
=+ ref=^$(dat [%uint ofs])
:: shouldn't hit this unless we're sending over 2gb of data?
~| [%weird-ref-lent (lent ref)]
?> =((lent ref) (lent hol))
(weld nes ref)
::
%array :: where X has k elements (k is assumed to be of type uint256):
:: enc(X) = enc(k) enc([X[1], ..., X[k]])
:: i.e. it is encoded as if it were an array of static size k, prefixed
:: with the number of elements.
%+ weld $(dat [%uint (lent p.dat)])
$(dat [%array-n p.dat])
::
%bytes-n
:: enc(X) is the sequence of bytes in X padded with zero-bytes to a
:: length of 32.
:: Note that for any X, len(enc(X)) is a multiple of 32.
~| [%bytes-n-too-long max=32 actual=p.p.dat]
?> (lte p.p.dat 32)
(pad-to-multiple (render-hex-bytes p.dat) 64 %right)
::
%bytes :: of length k (which is assumed to be of type uint256)
:: enc(X) = enc(k) pad_right(X), i.e. the number of bytes is encoded as a
:: uint256 followed by the actual value of X as a byte sequence, followed
:: by the minimum number of zero-bytes such that len(enc(X)) is a
:: multiple of 32.
%+ weld $(dat [%uint p.p.dat])
(pad-to-multiple (render-hex-bytes p.dat) 64 %right)
::
%string
:: enc(X) = enc(enc_utf8(X)), i.e. X is utf-8 encoded and this value is
:: interpreted as of bytes type and encoded further. Note that the length
:: used in this subsequent encoding is the number of bytes of the utf-8
:: encoded string, not its number of characters.
$(dat [%bytes (lent p.dat) (swp 3 (crip p.dat))])
::
%uint
:: enc(X) is the big-endian encoding of X, padded on the higher-order
:: (left) side with zero-bytes such that the length is a multiple of 32
:: bytes.
(pad-to-multiple (render-hex-bytes (as-octs p.dat)) 64 %left)
::
%bool
:: as in the uint8 case, where 1 is used for true and 0 for false
$(dat [%uint ?:(p.dat 1 0)])
::
%address
:: as in the uint160 case
$(dat [%uint `@ud`p.dat])
==
::
++ is-dynamic-type
|= a=data
?. ?=(%array-n -.a)
?=(?(%string %bytes %array) -.a)
&(!=((lent p.a) 0) (lien p.a is-dynamic-type))
::
:: decoding
::
++ decode-topics decode-arguments
::
++ decode-results
:: rex: string of hex bytes with leading 0x.
|* [rex=@t tys=(list etyp)]
=- (decode-arguments - tys)
%^ rut 9
(rsh [3 2] rex)
(curr rash hex)
::
++ decode-arguments
|* [wos=(list @) tys=(list etyp)]
=/ wos=(list @) wos :: get rid of tmi
=| win=@ud
=< (decode-from 0 tys)
|%
++ decode-from
|* [win=@ud tys=(list etyp)]
?~ tys !!
=- ?~ t.tys dat
[dat $(win nin, tys t.tys)]
(decode-one win ~[i.tys])
::
++ decode-one
::NOTE we take (list etyp) even though we only operate on
:: a single etyp as a workaround for urbit/arvo#673
|* [win=@ud tys=(list etyp)]
=- [nin dat]=- ::NOTE ^= regular form broken
?~ tys !!
=* typ i.tys
=+ wor=(snag win wos)
?+ typ
~| [%unsupported-type typ]
!!
::
?(%address %bool %uint) :: %int %real %ureal
:- +(win)
?- typ
%address `@ux`wor
%uint `@ud`wor
%bool =(1 wor)
==
::
%string
=+ $(tys ~[%bytes])
[nin (trip (swp 3 q.dat))]
::
%bytes
:- +(win)
:: find the word index of the actual data.
=/ lic=@ud (div wor 32)
:: learn the bytelength of the data.
=/ len=@ud (snag lic wos)
(decode-bytes-n +(lic) len)
::
[%bytes-n *]
:- (add win +((div (dec n.typ) 32)))
(decode-bytes-n win n.typ)
::
[%array *]
:- +(win)
:: find the word index of the actual data.
=. win (div wor 32)
:: read the elements from their location.
%- tail
%^ decode-array-n ~[t.typ] +(win)
(snag win wos)
::
[%array-n *]
(decode-array-n ~[t.typ] win n.typ)
==
::
++ decode-bytes-n
|= [fro=@ud bys=@ud]
^- octs
:: parse {bys} bytes from {fro}.
:- bys
%+ rsh
:- 3
=+ (mod bys 32)
?:(=(0 -) - (sub 32 -))
%+ rep 8
%- flop
=- (swag [fro -] wos)
+((div (dec bys) 32))
::
++ decode-array-n
::NOTE we take (list etyp) even though we only operate on
:: a single etyp as a workaround for urbit/arvo#673
::NOTE careful! produces lists without type info
=| res=(list)
|* [tys=(list etyp) fro=@ud len=@ud]
^- [@ud (list)]
?~ tys !!
?: =(len 0) [fro (flop `(list)`res)]
=+ (decode-one fro ~[i.tys]) :: [nin=@ud dat=*]
$(res ^+(res [dat res]), fro nin, len (dec len))
--
--
::
:: communicating with rpc nodes
::NOTE https://github.com/ethereum/wiki/wiki/JSON-RPC
::
++ rpc
:: types
::
=> =, abi
=, format
|%
:: raw call data
++ call-data
$: function=@t
arguments=(list data)
==
::
:: raw transaction data
+$ transaction
$: nonce=@ud
gas-price=@ud
gas=@ud
to=address
value=@ud
data=@ux
chain-id=@ux
==
::
:: ethereum json rpc api
::
:: supported requests.
++ request
$% [%eth-block-number ~]
[%eth-call cal=call deb=block]
$: %eth-new-filter
fro=(unit block)
tob=(unit block)
adr=(list address)
top=(list ?(@ux (list @ux)))
==
[%eth-get-block-by-number bon=@ud txs=?]
[%eth-get-filter-logs fid=@ud]
$: %eth-get-logs
fro=(unit block)
tob=(unit block)
adr=(list address)
top=(list ?(@ux (list @ux)))
==
$: %eth-get-logs-by-hash
has=@
adr=(list address)
top=(list ?(@ux (list @ux)))
==
[%eth-get-filter-changes fid=@ud]
[%eth-get-transaction-count adr=address =block]
[%eth-get-transaction-receipt txh=@ux]
[%eth-send-raw-transaction dat=@ux]
==
::
::TODO clean up & actually use
++ response
$% ::TODO
[%eth-new-filter fid=@ud]
[%eth-get-filter-logs los=(list event-log)]
[%eth-get-logs los=(list event-log)]
[%eth-get-logs-by-hash los=(list event-log)]
[%eth-got-filter-changes los=(list event-log)]
[%eth-transaction-hash haz=@ux]
==
::
++ event-log
$: :: null for pending logs
$= mined %- unit
$: log-index=@ud
transaction-index=@ud
transaction-hash=@ux
block-number=@ud
block-hash=@ux
removed=?
==
::
address=@ux
data=@t
:: event data
::
:: For standard events, the first topic is the event signature
:: hash. For anonymous events, the first topic is the first
:: indexed argument.
:: Note that this does not support the "anonymous event with
:: zero topics" case. This has dubious usability, and using
:: +lest instead of +list saves a lot of ?~ checks.
::
topics=(lest @ux)
==
::
:: data for eth_call.
++ call
$: from=(unit address)
to=address
gas=(unit @ud)
gas-price=(unit @ud)
value=(unit @ud)
data=tape
==
::
:: minimum data needed to construct a read call
++ proto-read-request
$: id=(unit @t)
to=address
call-data
==
::
:: block to operate on.
++ block
$% [%number n=@ud]
[%label l=?(%earliest %latest %pending)]
==
--
::
:: logic
::
|%
++ encode-call
|= call-data
^- tape
::TODO should this check to see if the data matches the function signature?
=- :(weld "0x" - (encode-args arguments))
%+ scag 8
%+ render-hex-bytes 32
%- keccak-256:keccak:crypto
(as-octs:mimes:html function)
::
:: building requests
::
++ json-request
=, eyre
|= [url=purl jon=json]
^- hiss
:^ url %post
%- ~(gas in *math)
~['Content-Type'^['application/json']~]
(some (as-octt (en-json:html jon)))
:: +light-json-request: like json-request, but for %l
::
:: TODO: Exorcising +purl from our system is a much longer term effort;
:: get the current output types for now.
::
++ light-json-request
|= [url=purl:eyre jon=json]
^- request:http
::
:* %'POST'
(crip (en-purl:html url))
~[['content-type' 'application/json']]
(some (as-octt (en-json:html jon)))
==
::
++ batch-read-request
|= req=(list proto-read-request)
^- json
a+(turn req read-request)
::
++ read-request
|= proto-read-request
^- json
%+ request-to-json id
:+ %eth-call
^- call
[~ to ~ ~ ~ `tape`(encode-call function arguments)]
[%label %latest]
::
++ request-to-json
=, enjs:format
|= [riq=(unit @t) req=request]
^- json
%- pairs
=; r=[met=@t pas=(list json)]
::TODO should use request-to-json:rpc:jstd,
:: and probably (fall riq -.req)
:* jsonrpc+s+'2.0'
method+s+met.r
params+a+pas.r
::TODO would just jamming the req noun for id be a bad idea?
?~ riq ~
[id+s+u.riq]~
==
?- -.req
%eth-block-number
['eth_blockNumber' ~]
::
%eth-call
:- 'eth_call'
:~ (eth-call-to-json cal.req)
(block-to-json deb.req)
==
::
%eth-new-filter
:- 'eth_newFilter'
:_ ~
:- %o %- ~(gas by *(map @t json))
=- (murn - same)
^- (list (unit (pair @t json)))
:~ ?~ fro.req ~
`['fromBlock' (block-to-json u.fro.req)]
::
?~ tob.req ~
`['toBlock' (block-to-json u.tob.req)]
::
::TODO fucking tmi
?: =(0 (lent adr.req)) ~
:+ ~ 'address'
?: =(1 (lent adr.req)) (tape (address-to-hex (snag 0 adr.req)))
:- %a
(turn adr.req (cork address-to-hex tape))
::
?~ top.req ~
:+ ~ 'topics'
(topics-to-json top.req)
==
::
%eth-get-block-by-number
:- 'eth_getBlockByNumber'
:~ (tape (num-to-hex bon.req))
b+txs.req
==
::
%eth-get-filter-logs
['eth_getFilterLogs' (tape (num-to-hex fid.req)) ~]
::
%eth-get-logs
:- 'eth_getLogs'
:_ ~
:- %o %- ~(gas by *(map @t json))
=- (murn - same)
^- (list (unit (pair @t json)))
:~ ?~ fro.req ~
`['fromBlock' (block-to-json u.fro.req)]
::
?~ tob.req ~
`['toBlock' (block-to-json u.tob.req)]
::
?: =(0 (lent adr.req)) ~
:+ ~ 'address'
?: =(1 (lent adr.req)) (tape (address-to-hex (snag 0 adr.req)))
:- %a
(turn adr.req (cork address-to-hex tape))
::
?~ top.req ~
:+ ~ 'topics'
(topics-to-json top.req)
==
::
%eth-get-logs-by-hash
:- 'eth_getLogs'
:_ ~ :- %o
%- ~(gas by *(map @t json))
=- (murn - same)
^- (list (unit (pair @t json)))
:~ `['blockHash' (tape (transaction-to-hex has.req))]
::
?: =(0 (lent adr.req)) ~
:+ ~ 'address'
?: =(1 (lent adr.req)) (tape (address-to-hex (snag 0 adr.req)))
:- %a
(turn adr.req (cork address-to-hex tape))
::
?~ top.req ~
:+ ~ 'topics'
(topics-to-json top.req)
==
::
%eth-get-filter-changes
['eth_getFilterChanges' (tape (num-to-hex fid.req)) ~]
::
%eth-get-transaction-count
:- 'eth_getTransactionCount'
:~ (tape (address-to-hex adr.req))
(block-to-json block.req)
==
::
%eth-get-transaction-receipt
['eth_getTransactionReceipt' (tape (transaction-to-hex txh.req)) ~]
::
%eth-send-raw-transaction
['eth_sendRawTransaction' (tape (num-to-hex dat.req)) ~]
==
::
++ eth-call-to-json
=, enjs:format
|= cal=call
^- json
:- %o %- ~(gas by *(map @t json))
=- (murn - same)
^- (list (unit (pair @t json)))
:~ ?~ from.cal ~
`['from' (tape (address-to-hex u.from.cal))]
::
`['to' (tape (address-to-hex to.cal))]
::
?~ gas.cal ~
`['gas' (tape (num-to-hex u.gas.cal))]
::
?~ gas-price.cal ~
`['gasPrice' (tape (num-to-hex u.gas-price.cal))]
::
?~ value.cal ~
`['value' (tape (num-to-hex u.value.cal))]
::
?~ data.cal ~
`['data' (tape data.cal)]
==
::
++ block-to-json
|= dob=block
^- json
?- -.dob
%number s+(crip '0' 'x' ((x-co:co 1) n.dob))
%label s+l.dob
==
::
++ topics-to-json
|= tos=(list ?(@ux (list @ux)))
^- json
:- %a
=/ ttj
;: cork
(cury render-hex-bytes 32)
prefix-hex
tape:enjs:format
==
%+ turn tos
|= t=?(@ (list @))
?@ t
?: =(0 t) ~
(ttj `@`t)
a+(turn t ttj)
::
:: parsing responses
::
::TODO ++ parse-response |= json ^- response
::
++ parse-hex-result
|= j=json
^- @
?> ?=(%s -.j)
(hex-to-num p.j)
::
++ parse-eth-new-filter-res parse-hex-result
::
++ parse-eth-block-number parse-hex-result
::
++ parse-transaction-hash parse-hex-result
::
++ parse-eth-get-transaction-count parse-hex-result
::
++ parse-event-logs
(ar:dejs:format parse-event-log)
::
++ parse-event-log
=, dejs:format
|= log=json
^- event-log
=- ((ot -) log)
:~ =- ['logIndex'^(cu - (mu so))]
|= li=(unit @t)
?~ li ~
=- `((ou -) log) ::TODO not sure if elegant or hacky.
:~ 'logIndex'^(un (cu hex-to-num so))
'transactionIndex'^(un (cu hex-to-num so))
'transactionHash'^(un (cu hex-to-num so))
'blockNumber'^(un (cu hex-to-num so))
'blockHash'^(un (cu hex-to-num so))
'removed'^(uf | bo)
==
::
address+(cu hex-to-num so)
data+so
::
=- topics+(cu - (ar so))
|= r=(list @t)
^- (lest @ux)
?> ?=([@t *] r)
:- (hex-to-num i.r)
(turn t.r hex-to-num)
==
--
::
:: utilities
::TODO give them better homes!
::
++ num-to-hex
|= n=@
^- tape
%- prefix-hex
?: =(0 n)
"0"
%- render-hex-bytes
(as-octs:mimes:html n)
::
++ address-to-hex
|= a=address
^- tape
%- prefix-hex
(render-hex-bytes 20 `@`a)
::
++ transaction-to-hex
|= h=@
^- tape
%- prefix-hex
(render-hex-bytes 32 h)
::
++ prefix-hex
|= a=tape
^- tape
['0' 'x' a]
::
++ render-hex-bytes
:: atom to string of hex bytes without 0x prefix and dots.
|= a=octs
^- tape
((x-co:co (mul 2 p.a)) q.a)
::
++ pad-to-multiple
|= [wat=tape mof=@ud wer=?(%left %right)]
^- tape
=+ len=(lent wat)
?: =(0 len) (reap mof '0')
=+ mad=(mod len mof)
?: =(0 mad) wat
=+ tad=(reap (sub mof mad) '0')
%- weld
?:(?=(%left wer) [tad wat] [wat tad])
::
++ hex-to-num
|= a=@t
(rash (rsh [3 2] a) hex)
--

View File

@ -1,8 +1,9 @@
:: ethio: Asynchronous Ethereum input/output functions.
::.
/+ strandio
::
/- rpc=json-rpc
/+ ethereum, strandio
=, ethereum-types
=, able:jael
=, jael
::
=> |%
+$ topics (list ?(@ux (list @ux)))
@ -37,13 +38,13 @@
++ attempt-request
=/ m (strand:strandio ,(unit results))
^- form:m
;< responses=(list response:rpc:jstd) bind:m
;< responses=(list response:rpc) bind:m
(request-batch-rpc-loose url reqs)
=- ?~ err
(pure:m `res)
(pure:m ~)
%+ roll responses
|= $: rpc=response:rpc:jstd
|= $: rpc=response:rpc
[res=results err=(list [id=@t code=@t message=@t])]
==
?: ?=(%error -.rpc)
@ -63,8 +64,8 @@
`10
attempt-request
::
+$ result response:rpc:jstd
+$ results (list response:rpc:jstd)
+$ result response:rpc
+$ results (list response:rpc)
::
++ attempt-request
=/ m (strand:strandio ,(unit results))
@ -98,7 +99,7 @@
=/ jon=(unit json) (de-json:html body)
?~ jon
(pure:m ~)
=/ array=(unit (list response:rpc:jstd))
=/ array=(unit (list response:rpc))
((ar:dejs-soft:format parse-one-response) u.jon)
?~ array
(strand-fail:strandio %rpc-result-incomplete-batch >u.jon< ~)
@ -106,7 +107,7 @@
::
++ parse-one-response
|= =json
^- (unit response:rpc:jstd)
^- (unit response:rpc)
=/ res=(unit [@t ^json])
%. json
=, dejs-soft:format

View File

@ -43,10 +43,10 @@
::
++ poke-rekey :: rotate private keys
|= des=@t
=/ sed=(unit seed:able:jael)
=/ sed=(unit seed:jael)
%+ biff
(bind (slaw %uw des) cue)
(soft seed:able:jael)
(soft seed:jael)
=< abet
?~ sed
~& %invalid-private-key
@ -67,13 +67,13 @@
=. p.hot (scag 2 p.hot) :: ignore subdomain
=. dat (scot %uw (en:crub:crypto ames-secret dat))
=- abet:(emit %pass /write %arvo %c %info -)
=/ byk=path (en-beam:format byk.bowl(r da+now.bowl) ~)
=/ byk=path (en-beam byk.bowl(r da+now.bowl) ~)
=+ .^(=tube:clay cc+(welp byk /mime/atom))
=/ =cage atom+(tube !>([/ (as-octs:mimes:html dat)]))
(foal:space:userlib :(welp byk sec+p.hot /atom) cage)
::
++ poke-moon :: rotate moon keys
|= sed=(unit [=ship =udiff:point:able:jael])
|= sed=(unit [=ship =udiff:point:jael])
=< abet
?~ sed
this

View File

@ -109,10 +109,12 @@
++ on-peek
|= =path
^- (unit (unit cage))
?+ path [~ ~]
[%x %kiln %ota ~] ``noun+!>(ota)
[%x %kiln %our ~] ``noun+!>(our)
[%x %kiln %base-hash ~] ``noun+!>((base-hash:version our now))
?+ path [~ ~]
[%x %kiln %ota ~] ``noun+!>(ota)
[%x %kiln %our ~] ``noun+!>(our)
[%x %kiln %base-hash ~]
=/ ver (base-hash:version our now)
``noun+!>(?~(ver 0v0 i.ver))
==
::
++ poke-commit

View File

@ -1,14 +1,14 @@
/+ base64, primitive-rsa, *pkcs
/+ primitive-rsa, *pkcs
=* rsa primitive-rsa
|%
:: +en-base64url: url-safe base64 encoding, without padding
::
++ en-base64url
~(en base64 | &)
~(en base64:mimes:html | &)
:: +de-base64url: url-safe base64 decoding, without padding
::
++ de-base64url
~(de base64 | &)
~(de base64:mimes:html | &)
:: |octn: encode/decode unsigned atoms as big-endian octet stream
::
++ octn

View File

@ -0,0 +1,31 @@
:: json-rpc: protocol utilities
::
/- *json-rpc
|%
++ request-to-hiss
|= [url=purl:eyre req=request]
^- hiss:eyre
:- url
:+ %post
%- ~(gas in *math:eyre)
~['Content-Type'^['application/json']~]
%- some
%- as-octt:mimes:html
(en-json:html (request-to-json req))
::
++ request-to-json
|= request
^- json
%- pairs:enjs:format
:~ jsonrpc+s+'0.2'
id+s+id
method+s+method
::
:- %params
^- json
?- -.params
%list [%a +.params]
%object [%o (~(gas by *(map @t json)) +.params)]
==
==
--

View File

@ -2,7 +2,7 @@
::
/- keygen
::
/+ bip32, bip39
/+ ethereum, bip32, bip39
::
=, keygen
::

View File

@ -1,4 +1,4 @@
|%
^? |%
++ remake-set
|* s=(tree)
(sy ~(tap in s))

View File

@ -190,7 +190,7 @@
=/ m (strand ,~)
^- form:m
~& > "starting {<ship>}"
;< ~ bind:m (send-events (init:util ship `*dawn-event:able:jael))
;< ~ bind:m (send-events (init:util ship `*dawn-event:jael))
(check-ship-booted ship)
::
++ real-ship
@ -202,7 +202,7 @@
(check-ship-booted ship)
::
++ raw-ship
|= [=ship keys=(unit dawn-event:able:jael)]
|= [=ship keys=(unit dawn-event:jael)]
=/ m (strand ,~)
^- form:m
~& > "starting {<ship>}"

View File

@ -16,7 +16,7 @@
:: Start a ship (low-level; prefer +raw-ship)
::
++ init
|= [who=ship keys=(unit dawn-event:able:jael)]
|= [who=ship keys=(unit dawn-event:jael)]
^- (list aqua-event)
[%init-ship who keys]~
::

View File

@ -4,19 +4,31 @@
|%
::
+$ pill
$: boot-ova=*
kernel-ova=(list unix-event)
userspace-ova=(list unix-event)
==
$% [%ivory p=(list)]
$: %pill
nam=term
boot-ova=(list)
kernel-ova=(list unix-event)
userspace-ova=(list unix-event)
== ==
::
+$ unix-event
%+ pair wire
$% [%wack p=@]
[%what p=(list (pair path (cask)))]
[%whom p=ship]
[%boot ? $%($>(%fake task:able:jael) $>(%dawn task:able:jael))]
[%boot ? $%($>(%fake task:jael) $>(%dawn task:jael))]
unix-task
==
:: +boot-ovum: boostrap kernel filesystem load
::
++ boot-ovum
|= [hoon=cord arvo=cord]
:~ //arvo
%what
[/sys/hoon hoon/hoon]
[/sys/arvo hoon/arvo]
==
:: +file-ovum: userspace filesystem load
::
:: bas: full path to / directory
@ -82,7 +94,7 @@
=/ dat .^(json %cx pax)
(as-octt:mimes:html (en-json:html dat))
::
[%txt *]
[?(%md %txt) *]
=/ dat .^(wain %cx pax)
(as-octs:mimes:html (of-wain:format dat))
::

View File

@ -1,5 +1,5 @@
/- asn1
/+ primitive-rsa, der, base64
/+ primitive-rsa, der
=* rsa primitive-rsa
:::: %/lib/pkcs
|%
@ -58,7 +58,7 @@
^- wain
:: XX validate label?
:- (rap 3 ['-----BEGIN ' lab '-----' ~])
=/ a (en:base64 len `@`der)
=/ a (en:base64:mimes:html len `@`der)
|- ^- wain
?~ a
[(rap 3 ['-----END ' lab '-----' ~]) ~]
@ -74,7 +74,7 @@
?. =((rap 3 ['-----BEGIN ' lab '-----' ~]) i.mep) ~
?. =((rap 3 ['-----END ' lab '-----' ~]) (snag a t.mep)) ~
^- (unit [@ @])
(de:base64 (rap 3 (scag a t.mep)))
(de:base64:mimes:html (rap 3 (scag a t.mep)))
--
:: |pkcs1: RSA asymmetric cryptography (rfc3447)
::

View File

@ -1,4 +0,0 @@
/- sur=publish
/+ elem-to-react-json
^?
sur

View File

@ -173,7 +173,7 @@
|= tin=strand-input:strand
?+ in.tin `[%skip ~]
~ `[%wait ~]
[~ %sign [%wait @ ~] %b %wake *]
[~ %sign [%wait @ ~] %behn %wake *]
?. |(?=(~ until) =(`u.until (slaw %da i.t.wire.u.in.tin)))
`[%skip ~]
?~ error.sign-arvo.u.in.tin
@ -340,7 +340,7 @@
;< ~ bind:m (send-raw-card card)
|= tin=strand-input:strand
=* loop $
?: ?& ?=([~ %sign [%timeout @ ~] %b %wake *] in.tin)
?: ?& ?=([~ %sign [%timeout @ ~] %behn %wake *] in.tin)
=((scot %da when) i.t.wire.u.in.tin)
==
`[%fail %timeout ~]
@ -370,7 +370,7 @@
|= tin=strand-input:strand
?+ in.tin `[%skip ~]
~ `[%wait ~]
[~ %sign [%request ~] %i %http-response %finished *]
[~ %sign [%request ~] %iris %http-response %finished *]
`[%done client-response.sign-arvo.u.in.tin]
==
::
@ -395,9 +395,9 @@
|= tin=strand-input:strand
?+ in.tin `[%skip ~]
~ `[%wait ~]
[~ %sign [%request ~] %i %http-response %cancel *]
[~ %sign [%request ~] %iris %http-response %cancel *]
`[%done ~]
[~ %sign [%request ~] %i %http-response %finished *]
[~ %sign [%request ~] %iris %http-response %finished *]
`[%done `client-response.sign-arvo.u.in.tin]
==
::
@ -516,7 +516,7 @@
|= tin=strand-input:strand
?+ in.tin `[%skip ~]
~ `[%wait ~]
[~ %sign * ?(%b %c) %writ *]
[~ %sign * ?(%behn %clay) %writ *]
?. =(wire wire.u.in.tin)
`[%skip ~]
`[%done +>.sign-arvo.u.in.tin]

View File

@ -1,106 +0,0 @@
|%
:: $test: a test with a fully resolved path
::
+$ test [=path func=test-func]
:: $test-arm: a test with a name (derived from its arm name in a test core)
::
+$ test-arm [name=term func=test-func]
:: $test-func: a single test, as a gate; sample is entropy, produces failures
::
+$ test-func (trap tang)
--
|%
++ run-test
:: executes an individual test.
|= [pax=path test=test-func]
^- [ok=? =tang]
=+ name=(spud pax)
=+ run=(mule test)
?- -.run
%| :- %| :: the stack is already flopped for output?
;: weld
p.run
`tang`[[%leaf (weld "CRASHED " name)] ~]
==
%& ?: =(~ p.run)
&+[[%leaf (weld "OK " name)] ~]
:: Create a welded list of all failures indented.
:- %|
%- flop
;: weld
`tang`[[%leaf (weld "FAILED " name)] ~]
::TODO indent
:: %+ turn p:run
:: |= [i=tape]
:: ^- tank
:: [%leaf (weld " " i)]
p.run
==
==
:: +filter-tests-by-prefix
::
++ filter-tests-by-prefix
|= [prefix=path tests=(list test)]
^+ tests
::
=/ prefix-length=@ud (lent prefix)
::
%+ skim tests
::
|= [=path *]
=(prefix (scag prefix-length path))
:: +resolve-test-paths: add test names to file paths to form full identifiers
::
++ resolve-test-paths
|= paths-to-tests=(map path (list test-arm))
^- (list test)
::
%- sort :_ |=([a=test b=test] !(aor path.a path.b))
::
^- (list test)
%- zing
%+ turn ~(tap by paths-to-tests)
|= [=path test-arms=(list test-arm)]
^- (list test)
:: strip off leading 'tests' from :path
::
=. path
?> ?=(^ path)
?> ?=(%tests i.path)
t.path
:: for each test, add the test's name to :path
::
%+ turn test-arms
|= =test-arm
^- test
[(weld path /[name.test-arm]) func.test-arm]
:: +get-test-arms: convert test arms to functions and produce them
::
++ get-test-arms
|= [test-core-type=type test-core=*]
^- (list test-arm)
::
=/ arms=(list @tas) (sloe test-core-type)
::
%+ turn (skim arms has-test-prefix)
|= name=term
^- test-arm
::
=/ run-arm=[=type =nock]
~| [%failed-to-compile-test-arm name]
(~(mint ut test-core-type) p:!>(*tang) [%limb name])
::
:- name
^- test-func
::
|.
;; tang
.* test-core
nock.run-arm
:: +has-test-prefix: does the arm define a test we should run?
::
++ has-test-prefix
|= a=term ^- ?
=((end [3 5] a) 'test-')
--

316
pkg/arvo/lib/vere.hoon Normal file
View File

@ -0,0 +1,316 @@
:: runtime support code
::
/+ ethereum, azimuth
=> [ethereum=ethereum azimuth=azimuth ..zuse] =>
|%
::
:: |dawn: pre-boot request/response de/serialization and validation
::
++ dawn
=> |%
:: +live: public network state of a ship
::
+$ live (unit [=life breach=?])
--
|%
:: +come:dawn: mine a comet under a star
::
:: Randomly generates comet addresses until we find one whose parent is
:: in the list of supplied stars. Errors if any supplied ship
:: is not a star.
::
++ come
|= [tar=(list ship) eny=@uvJ]
::
=| stars=(set ship)
=. stars
|- ^+ stars
?~ tar stars
::
~| [%come-not-king i.tar]
?> ?=(%king (clan:title i.tar))
$(tar t.tar, stars (~(put in stars) i.tar))
::
|- ^- seed:jael
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ who=ship `@`fig:ex:cub
:: disallow 64-bit or smaller addresses
::
?. ?=(%pawn (clan:title who))
$(eny +(eny))
?: (~(has in stars) (^sein:title who))
[who 1 sec:ex:cub ~]
$(eny +(eny))
:: |give:dawn: produce requests for pre-boot validation
::
++ give
=, rpc:ethereum
=, abi:ethereum
=/ tract azimuth:contracts:azimuth
|%
:: +bloq:give:dawn: Eth RPC for latest block number
::
++ bloq
^- octs
%- as-octt:mimes:html
%- en-json:html
%+ request-to-json
`~.0
[%eth-block-number ~]
:: +czar:give:dawn: Eth RPC for galaxy table
::
++ czar
|= boq=@ud
^- octs
%- as-octt:mimes:html
%- en-json:html
:- %a
%+ turn (gulf 0 255)
|= gal=@
%+ request-to-json
`(cat 3 'gal-' (scot %ud gal))
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'points(uint32)' [%uint gal]~)
[%number boq]
:: +point:give:dawn: Eth RPC for ship's contract state
::
++ point
|= [boq=@ud who=ship]
^- octs
%- as-octt:mimes:html
%- en-json:html
%+ request-to-json
`~.0
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'points(uint32)' [%uint `@`who]~)
[%number boq]
:: +turf:give:dawn: Eth RPC for network domains
::
++ turf
|= boq=@ud
^- octs
%- as-octt:mimes:html
%- en-json:html
:- %a
%+ turn (gulf 0 2)
|= idx=@
%+ request-to-json
`(cat 3 'turf-' (scot %ud idx))
:+ %eth-call
=- [from=~ to=tract gas=~ price=~ value=~ data=-]
(encode-call 'dnsDomains(uint256)' [%uint idx]~)
[%number boq]
--
:: |take:dawn: parse responses for pre-boot validation
::
++ take
=, abi:ethereum
=, rpc:ethereum
=, azimuth
=, dejs-soft:format
|%
:: +bloq:take:dawn: parse block number
::
++ bloq
|= rep=octs
^- (unit @ud)
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%bloq-take-dawn %invalid-json] ~)
=/ res=(unit cord) ((ot result+so ~) u.jon)
?~ res
~&([%bloq-take-dawn %invalid-response rep] ~)
=/ out
%- mule |.
(hex-to-num:ethereum u.res)
?: ?=(%& -.out)
(some p.out)
~&([%bloq-take-dawn %invalid-block-number] ~)
:: +czar:take:dawn: parse galaxy table
::
++ czar
|= rep=octs
^- (unit (map ship [=rift =life =pass]))
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%czar-take-dawn %invalid-json] ~)
=/ res=(unit (list [@t @t]))
((ar (ot id+so result+so ~)) u.jon)
?~ res
~&([%czar-take-dawn %invalid-response rep] ~)
=/ dat=(unit (list [who=@p point:azimuth-types]))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ turn u.res
|= [id=@t result=@t]
^- [who=ship point:azimuth-types]
=/ who `@p`(slav %ud (rsh [3 4] id))
:- who
%+ point-from-eth
who
:_ *deed:eth-noun
%+ decode-results
result
point:eth-type
?~ dat
~&([%bloq-take-dawn %invalid-galaxy-table] ~)
:- ~
%+ roll u.dat
|= $: [who=ship =point:azimuth-types]
kyz=(map ship [=rift =life =pass])
==
^+ kyz
?~ net.point
kyz
(~(put by kyz) who [continuity-number life pass]:u.net.point)
:: +point:take:dawn: parse ship's contract state
::
++ point
|= [who=ship rep=octs]
^- (unit point:azimuth)
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%point-take-dawn %invalid-json] ~)
=/ res=(unit cord) ((ot result+so ~) u.jon)
?~ res
~&([%point-take-dawn %invalid-response rep] ~)
~? =(u.res '0x')
:- 'bad result from node; is azimuth address correct?'
azimuth:contracts
=/ out
%- mule |.
%+ point-from-eth
who
:_ *deed:eth-noun ::TODO call rights to fill
(decode-results u.res point:eth-type)
?: ?=(%& -.out)
(some p.out)
~&([%point-take-dawn %invalid-point] ~)
:: +turf:take:dawn: parse network domains
::
++ turf
|= rep=octs
^- (unit (list ^turf))
=/ jon=(unit json) (de-json:html q.rep)
?~ jon
~&([%turf-take-dawn %invalid-json] ~)
=/ res=(unit (list [@t @t]))
((ar (ot id+so result+so ~)) u.jon)
?~ res
~&([%turf-take-dawn %invalid-response rep] ~)
=/ dat=(unit (list (pair @ud ^turf)))
=- ?:(?=(%| -.out) ~ (some p.out))
^= out %- mule |.
%+ turn u.res
|= [id=@t result=@t]
^- (pair @ud ^turf)
:- (slav %ud (rsh [3 5] id))
=/ dom=tape
(decode-results result [%string]~)
=/ hot=host:eyre
(scan dom thos:de-purl:html)
?>(?=(%& -.hot) p.hot)
?~ dat
~&([%turf-take-dawn %invalid-domains] ~)
:- ~
=* dom u.dat
:: sort by id, ascending, removing duplicates
::
=| tuf=(map ^turf @ud)
|- ^- (list ^turf)
?~ dom
%+ turn
%+ sort ~(tap by tuf)
|=([a=(pair ^turf @ud) b=(pair ^turf @ud)] (lth q.a q.b))
head
=? tuf !(~(has by tuf) q.i.dom)
(~(put by tuf) q.i.dom p.i.dom)
$(dom t.dom)
--
:: +veri:dawn: validate keys, life, discontinuity, &c
::
++ veri
|= [=seed:jael =point:azimuth =live]
^- (unit error=term)
=/ rac (clan:title who.seed)
=/ cub (nol:nu:crub:crypto key.seed)
?- rac
%pawn
:: a comet address is the fingerprint of the keypair
::
?. =(who.seed `@`fig:ex:cub)
`%key-mismatch
:: a comet can never be breached
::
?^ live
`%already-booted
:: a comet can never be re-keyed
::
?. ?=(%1 lyf.seed)
`%invalid-life
~
::
%earl
~
::
*
:: on-chain ships must be launched
::
?~ net.point
`%not-keyed
=* net u.net.point
:: boot keys must match the contract
::
?. =(pub:ex:cub pass.net)
~& [%key-mismatch pub:ex:cub pass.net]
`%key-mismatch
:: life must match the contract
::
?. =(lyf.seed life.net)
`%life-mismatch
:: the boot life must be greater than and discontinuous with
:: the last seen life (per the sponsor)
::
?: ?& ?=(^ live)
?| ?=(%| breach.u.live)
(lte life.net life.u.live)
== ==
`%already-booted
:: produce the sponsor for vere
::
~? !has.sponsor.net
[%no-sponsorship-guarantees-from who.sponsor.net]
~
==
:: +sponsor:dawn: retreive sponsor from point
::
++ sponsor
|= [who=ship =point:azimuth]
^- (each ship error=term)
?- (clan:title who)
%pawn [%& (^sein:title who)]
%earl [%& (^sein:title who)]
%czar [%& (^sein:title who)]
*
?~ net.point
[%| %not-booted]
?. has.sponsor.u.net.point
[%| %no-sponsor]
[%& who.sponsor.u.net.point]
==
--
--
::
=/ pit !>(.)
=> |%
++ load _[~ ..load] :: +4
++ peek _~ :: +22
++ poke _[~ ..poke] :: +23
++ wish :: +10
|= txt=*
q:(slap pit (ream ;;(@t txt)))
--
::
|=(* .(+> +:(poke +<)))

View File

@ -1,3 +1,4 @@
/+ azimuth
::
|_ upd=update:azimuth
::

View File

@ -1,7 +1,5 @@
:: blit: runtime blit structure
::
/+ base64
::
|_ =blit:dill
++ grad %noun
:: +grab: convert from
@ -30,13 +28,13 @@
%sag
%- pairs
:~ 'path'^(path p.blit)
'file'^s+(en:base64 (as-octs:mimes:html (jam q.blit)))
'file'^s+(en:base64:mimes:html (as-octs:mimes:html (jam q.blit)))
==
::
%sav
%- pairs
:~ 'path'^(path p.blit)
'file'^s+(en:base64 (as-octs:mimes:html q.blit))
'file'^s+(en:base64:mimes:html (as-octs:mimes:html q.blit))
==
::
%klr

View File

@ -1,7 +1,7 @@
:: list of ethereum transactions
::
/+ *ethereum
=, format
=, ethereum
=, rpc
=, mimes:html
::

View File

@ -1,5 +1,5 @@
::
=, rpc:jstd
/- *json-rpc
::
|_ res=response
::

View File

@ -3,7 +3,6 @@
::
/? 310
/- sole
/+ base64
!:
::
::::

View File

@ -28,7 +28,7 @@
+$ pill pill:pill-lib
::
+$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event:able:jael)]
$% [%init-ship who=ship keys=(unit dawn-event:jael)]
[%pause-events who=ship]
[%snap-ships lab=term hers=(list ship)]
[%restore-snap lab=term]

View File

@ -1,6 +1,7 @@
:: eth-watcher: ethereum event log collector
::
=, able:jael
/+ ethereum
=, jael
|%
+$ config
$: :: url: ethereum node rpc endpoint

View File

@ -0,0 +1,21 @@
:: json-rpc: protocol types
::
|%
+$ request
$: id=@t
method=@t
params=request-params
==
::
+$ request-params
$% [%list (list json)]
[%object (list (pair @t json))]
==
+$ response
$~ [%fail *httr:eyre]
$% [%result id=@t res=json]
[%error id=@t code=@t message=@t] ::TODO data?
[%fail hit=httr:eyre]
[%batch bas=(list response)]
==
--

View File

@ -18,7 +18,7 @@
[%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:jael]
[%sources wire ~]
[%new-event wire =ship =udiff:point:able:jael]
[%new-event wire =ship =udiff:point:jael]
[%listen wire whos=(set ship) =source:jael]
[%flog wire flog:dill]
==

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,13 @@
:::: /sys/hoon ::
:: ::
=< ride
=> %141 =>
=> %140 =>
:: ::
:::: 0: version stub ::
:: ::
~% %k.141 ~ ~ ::
~% %k.140 ~ ~ ::
|%
++ hoon-version 141
++ hoon-version +
-- =>
~% %one + ~
:: # %base
@ -1905,17 +1905,17 @@
++ map
|$ [key value] :: table
$| (tree (pair key value))
|=(a=(tree (pair)) ~(apt by a))
|=(a=(tree (pair)) ?:(=(~ a) & ~(apt by a)))
::
++ qeu
|$ [item] :: queue
$| (tree item)
|=(a=(tree) ~(apt to a))
|=(a=(tree) ?:(=(~ a) & ~(apt to a)))
::
++ set
|$ [item] :: set
$| (tree item)
|=(a=(tree) ~(apt in a))
|=(a=(tree) ?:(=(~ a) & ~(apt in a)))
::
:::: 2l: container from container ::
:: ::
@ -5867,10 +5867,7 @@
~+
;~ pose
%+ stag %blob
%+ sear
:: XX use +mole once available
::
|=(a=@ `(unit)`=/(b (mule |.((cue a))) ?-(-.b %| ~, %& `p.b)))
%+ sear |=(a=@ (mole |.((cue a))))
;~(pfix (just '0') vum:ag)
::
(stag %$ crub)
@ -6609,11 +6606,6 @@
== ::
+$ what (unit (pair cord (list sect))) :: help slogan/section
+$ wing (list limb) :: search path
+$ worm :: compiler cache
$: nes=(set ^) :: ++nest
pay=(map (pair type hoon) type) :: ++play
mit=(map (pair type hoon) (pair type nock)) :: ++mint
== ::
::
:: +block: abstract identity of resource awaited
::
@ -6697,9 +6689,8 @@
:: 5b: macro expansion ::
:: 5c: compiler backend and prettyprinter ::
:: 5d: parser ::
:: 5e: caching compiler ::
:: 5f: molds and mold builders ::
:: 5g: profiling support (XX remove) ::
:: 5e: molds and mold builders ::
:: 5f: profiling support (XX remove) ::
::
~% %pen
+
@ -10091,7 +10082,7 @@
::
[%dtkt *]
=+ nef=$(gen [%kttr p.gen])
[p.nef [%12 [%1 %151 p.nef] q:$(gen q.gen, gol %noun)]]
[p.nef [%12 [%1 hoon-version p.nef] q:$(gen q.gen, gol %noun)]]
::
[%dtls *] [(nice [%atom %$ ~]) [%4 q:$(gen p.gen, gol [%atom %$ ~])]]
[%sand *] [(nice (play gen)) [%1 q.gen]]
@ -11585,6 +11576,14 @@
%- ~(play ut p.vax)
[%wtgr [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%$ 1]]
(~(fuse ut p.vax) [%cell %noun %noun])
:: +swat: deferred +slap
::
++ swat
|= [tap=(trap vase) gen=hoon]
^- (trap vase)
=/ gun (~(mint ut p:$:tap) %noun gen)
|. ~+
[p.gun .*(q:$:tap q.gun)]
::
:::: 5d: parser
::
@ -13814,144 +13813,7 @@
~< %slog.[0 leaf/"ride: compiled"]
(~(mint ut typ) %noun gen)
::
:::: 5e: caching compiler
::
++ wa :: cached compile
|_ worm
++ nell |=(ref=type (nest [%cell %noun %noun] ref)) :: nest in cell
++ nest :: nest:ut, cached
|= [sut=type ref=type]
^- [? worm]
?: (~(has in nes) [sut ref]) [& +>+<]
?. (~(nest ut sut) | ref)
~& %nest-failed
=+ foo=(skol ref)
=+ bar=(skol sut)
~& %nest-need
~> %slog.[0 bar]
~& %nest-have
~> %slog.[0 foo]
[| +>+<.$]
[& +>+<(nes (~(put in nes) [sut ref]))]
::
++ call :: call gate
|= [vax=vase nam=term som=(each vase ^)]
^- [vase worm]
=^ duf +>+<.$ (open vax nam som)
(slap duf [%limb %$])
::
++ open :: assemble door
|= [vax=vase nam=term som=(each vase ^)]
^- [vase worm]
=* key [%cncb [[%& 2] ~] [[[%& 6] ~] [%$ 3]] ~]
=^ dor +>+<.$ (slap vax [%limb nam])
=^ mes +>+<.$ (slot 6 dor)
=^ hip +>+<.$
?- -.som
%& (nest p.mes p.p.som)
%| (nets p.mes -.p.som)
==
?> hip
[[p.dor q.dor(+6 +7.som)] +>+<.$]
::
++ neat :: type compliance
|= [typ=type som=(each vase ^)]
^- worm
=^ hip +>+<.$
?- -.som
%& (nest typ p.p.som)
%| (nets typ -.p.som)
==
?> hip
+>+<.$
::
++ nets :: typeless nest
|= [sut=* ref=*]
^- [? worm]
?: (~(has in nes) [sut ref]) [& +>+<]
=+ gat=|=([a=type b=type] (~(nest ut a) | b))
?. (? (slum gat [sut ref]))
~& %nets-failed
=+ tag=`*`skol
=+ foo=(tank (slum tag ref))
=+ bar=(tank (slum tag sut))
~& %nets-need
~> %slog.[0 bar]
~& %nets-have
~> %slog.[0 foo]
[| +>+<.$]
[& +>+<.$(nes (~(put in nes) [sut ref]))]
:: +play: +play:ut, cached
::
++ play
|= [sut=type gen=hoon]
^- [type worm]
=+ old=(~(get by pay) [sut gen])
?^ old [u.old +>+<.$]
=+ new=(~(play ut sut) gen)
[new +>+<.$(pay (~(put by pay) [sut gen] new))]
:: +mint: +mint:ut to noun, cached
::
++ mint
|= [sut=type gen=hoon]
^- [(pair type nock) worm]
=+ old=(~(get by mit) [sut gen])
?^ old [u.old +>+<.$]
=+ new=(~(mint ut sut) %noun gen)
[new +>+<.$(mit (~(put by mit) [sut gen] new))]
:: +slam: +slam:ut, cached
::
++ slam
|= [gat=vase sam=vase]
=/ 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:ut, cached
::
++ slap
|= [vax=vase gen=hoon]
^- [vase worm]
=^ gun +>+< (mint p.vax gen)
[[p.gun .*(q.vax q.gun)] +>+<.$]
:: +slot: +slot:ut, cached
::
++ slot
|= [axe=@ vax=vase]
^- [vase worm]
=^ gun +>+< (mint p.vax [%$ axe])
[[p.gun .*(q.vax [0 axe])] +>+<.$]
:: +slym: +slym:ut, cached
::
++ slym
|= [gat=vase sam=*]
^- [vase worm]
(slap gat(+<.q sam) [%limb %$])
::
++ sped :: specialize vase
|= vax=vase
^- [vase worm]
=+ ^= gen ^- hoon
?@ q.vax [%wtts [%base [%atom %$]] [%& 1]~]
?@ -.q.vax [%wtts [%leaf %tas -.q.vax] [%& 2]~]
[%wtts [%base %cell] [%& 1]~]
=^ typ +>+<.$ (play p.vax [%wtgr gen [%$ 1]])
[[typ q.vax] +>+<.$]
::
++ spot :: slot then sped
|= [axe=@ vax=vase]
^- [vase worm]
=^ xav +>+< (slot axe vax)
(sped xav)
::
++ stop :: sped then slot
|= [axe=@ vax=vase]
^- [vase worm]
=^ xav +>+< (sped vax)
(slot axe xav)
--
::
:::: 5f: molds and mold builders
:::: 5e: molds and mold builders
::
+$ mane $@(@tas [@tas @tas]) :: XML name+space
+$ manx $~([[%$ ~] ~] [g=marx c=marl]) :: dynamic XML node
@ -13960,7 +13822,6 @@
+$ mart (list [n=mane v=tape]) :: XML attributes
+$ marx $~([%$ ~] [n=mane a=mart]) :: dynamic XML tag
+$ mite (list @ta) :: mime type
+$ monk (each ship [p=@tas q=@ta]) :: general identity
+$ pass @ :: public key
+$ ring @ :: private key
+$ ship @p :: network identity
@ -13968,7 +13829,7 @@
+$ spur path :: ship desk case spur
+$ time @da :: galactic time
::
:::: 5g: profiling support (XX move)
:::: 5f: profiling support (XX move)
::
::
++ pi-heck

File diff suppressed because it is too large Load Diff

View File

@ -90,9 +90,8 @@
!:
=/ protocol-version=?(%0 %1 %2 %3 %4 %5 %6 %7) %0
=, ames
=, able
=* point point:able:jael
=* public-keys-result public-keys-result:able:jael
=* point point:jael
=* public-keys-result public-keys-result:jael
:: veb: verbosity flags
::
=/ veb-all-off
@ -105,7 +104,7 @@
rot=`?`%.n :: routing attempts
==
=>
~% %ames ..is ~
~% %ames ..part ~
|%
+| %helpers
:: +trace: print if .verb is set and we're tracking .ship
@ -598,8 +597,8 @@
:: $queued-event: event to be handled after initial boot completes
::
+$ queued-event
$% [%call =duct type=* wrapped-task=(hobo task)]
[%take =wire =duct type=* =sign]
$% [%call =duct wrapped-task=(hobo task)]
[%take =wire =duct =sign]
==
:: $note: request to other vane
::
@ -634,11 +633,11 @@
:: $sign: response from other vane
::
+$ sign
$~ [%b %wake ~]
$% $: %b
$% [%wake error=(unit tang)]
$~ [%behn %wake ~]
$% $: %behn
$% $>(%wake gift:behn)
== ==
$: %j
$: %jael
$% [%private-keys =life vein=(map life ring)]
[%public-keys =public-keys-result]
[%turf turfs=(list turf)]
@ -721,39 +720,34 @@
--
:: external vane interface
::
|= pit=vase
|= our=ship
:: larval ames, before %born sets .unix-duct; wraps adult ames core
::
=< =* adult-gate .
=| queued-events=(qeu queued-event)
::
|= [our=ship now=@da eny=@ rof=roof]
|= [now=@da eny=@ rof=roof]
=* larval-gate .
=* adult-core (adult-gate +<)
=* scry-gate (en-sley rof)
|%
:: +call: handle request $task
::
++ call
|= [=duct dud=(unit goof) type=* wrapped-task=(hobo task)]
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
::
=/ =task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud or %hole
:: reject larval error notifications
::
=? task ?=(^ dud)
?- -.task
%crud ~|(%crud-in-crud !!)
%hear [%hole [lane blob]:task]
* [%crud -.task tang.u.dud]
==
?^ dud
~|(%ames-larval-call-dud (mean tang.u.dud))
::
:: %born: set .unix-duct and start draining .queued-events
::
?: ?=(%born -.task)
:: process %born using wrapped adult ames
::
=^ moves adult-gate (call:adult-core duct dud type task)
=^ moves adult-gate (call:adult-core duct dud task)
:: if no events were queued up, metamorphose
::
?~ queued-events
@ -767,12 +761,12 @@
::
:: XX what to do with errors?
::
=. queued-events (~(put to queued-events) %call duct type task)
=. queued-events (~(put to queued-events) %call duct task)
[~ larval-gate]
:: +take: handle response $sign
::
++ take
|= [=wire =duct dud=(unit goof) type=* =sign]
|= [=wire =duct dud=(unit goof) =sign]
?^ dud
~|(%ames-larval-take-dud (mean tang.u.dud))
:: enqueue event if not a larval drainage timer
@ -780,11 +774,11 @@
:: XX what to do with errors?
::
?. =(/larva wire)
=. queued-events (~(put to queued-events) %take wire duct type sign)
=. queued-events (~(put to queued-events) %take wire duct sign)
[~ larval-gate]
:: larval event drainage timer; pop and process a queued event
::
?. ?=([%b %wake *] sign)
?. ?=([%behn %wake *] sign)
~> %slog.0^leaf/"ames: larva: strange sign"
[~ larval-gate]
:: if crashed, print, dequeue, and set next drainage timer
@ -817,15 +811,14 @@
=^ first-event queued-events ~(get to queued-events)
=^ moves adult-gate
?- -.first-event
%call (call:adult-core [duct ~ type wrapped-task]:+.first-event)
%take (take:adult-core [wire duct ~ type sign]:+.first-event)
%call (call:adult-core [duct ~ wrapped-task]:+.first-event)
%take (take:adult-core [wire duct ~ sign]:+.first-event)
==
:: .queued-events has been cleared; metamorphose
::
?~ queued-events
~> %slog.0^leaf/"ames: metamorphosis"
[moves adult-gate]
~> %slog.0^leaf/"ames: larva: drain"
:: set timer to drain next event
::
=. moves :_(moves [duct %pass /larva %b %wait now])
@ -858,39 +851,34 @@
::
=<
=| =ames-state
|= [our=ship now=@da eny=@ rof=roof]
|= [now=@da eny=@ rof=roof]
=* ames-gate .
=* veb veb.bug.ames-state
=* scry-gate (en-sley rof)
|%
:: +call: handle request $task
::
++ call
|= [=duct dud=(unit goof) type=* wrapped-task=(hobo task)]
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
^- [(list move) _ames-gate]
::
=/ =task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud or %hole
::
=? task ?=(^ dud)
?- -.task
%crud ~|(%crud-in-crud !!)
%hear [%hole [lane blob]:task]
* [%crud -.task tang.u.dud]
==
::
=/ event-core (per-event [our now eny scry-gate] duct ames-state)
=/ event-core (per-event [now eny rof] duct ames-state)
::
=^ moves ames-state
=< abet
:: handle error notifications
::
?^ dud
?+ -.task
(on-crud:event-core -.task tang.u.dud)
%hear (on-hole:event-core [lane blob]:task)
==
::
?- -.task
%born on-born:event-core
%crud (on-crud:event-core [p q]:task)
%hear (on-hear:event-core [lane blob]:task)
%heed (on-heed:event-core ship.task)
%hole (on-hole:event-core [lane blob]:task)
%init (on-init:event-core ship=p.task)
%init on-init:event-core
%jilt (on-jilt:event-core ship.task)
%sift (on-sift:event-core ships.task)
%spew (on-spew:event-core veb.task)
@ -904,13 +892,13 @@
:: +take: handle response $sign
::
++ take
|= [=wire =duct dud=(unit goof) type=* =sign]
|= [=wire =duct dud=(unit goof) =sign]
^- [(list move) _ames-gate]
?^ dud
~|(%ames-take-dud (mean tang.u.dud))
::
::
=/ event-core (per-event [our now eny scry-gate] duct ames-state)
=/ event-core (per-event [now eny rof] duct ames-state)
::
=^ moves ames-state
=< abet
@ -918,11 +906,11 @@
[@ %done *] (on-take-done:event-core wire error.sign)
[@ %boon *] (on-take-boon:event-core wire payload.sign)
::
[%b %wake *] (on-take-wake:event-core wire error.sign)
[%behn %wake *] (on-take-wake:event-core wire error.sign)
::
[%j %turf *] (on-take-turf:event-core turfs.sign)
[%j %private-keys *] (on-priv:event-core [life vein]:sign)
[%j %public-keys *] (on-publ:event-core wire public-keys-result.sign)
[%jael %turf *] (on-take-turf:event-core turfs.sign)
[%jael %private-keys *] (on-priv:event-core [life vein]:sign)
[%jael %public-keys *] (on-publ:event-core wire public-keys-result.sign)
==
::
[moves ames-gate]
@ -938,9 +926,10 @@
:: +scry: dereference namespace
::
++ scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=* lot=coin $/r.bem
@ -1054,7 +1043,7 @@
++ per-event
=| moves=(list move)
~% %event-gate ..per-event ~
|= [[our=ship now=@da eny=@ scry-gate=sley] =duct =ames-state]
|= [[now=@da eny=@ rof=roof] =duct =ames-state]
=* veb veb.bug.ames-state
~% %event-core ..$ ~
|%
@ -1158,8 +1147,7 @@
%- silt
;; (list [@da ^duct])
=< q.q %- need %- need
%- scry-gate
[[%141 %noun] ~ %b [[our %timers da+now] /]]
(rof ~ %b [[our %timers da+now] /])
=/ to-stir
%+ skip next-real-wakes
|= [=ship =bone =@da]
@ -1410,7 +1398,6 @@
:: +on-init: first boot; subscribe to our info from jael
::
++ on-init
|= our=ship
^+ event-core
::
=~ (emit duct %pass /turf %j %turf ~)
@ -1662,8 +1649,7 @@
^- ship
;; ship
=< q.q %- need %- need
%- scry-gate
[[%141 %noun] ~ %j `beam`[[our %sein %da now] /(scot %p who)]]
(rof ~ %j `beam`[[our %sein %da now] /(scot %p who)])
--
:: +on-take-turf: relay %turf move from jael to unix
::
@ -1682,7 +1668,7 @@
=/ turfs
;; (list turf)
=< q.q %- need %- need
(scry-gate [%141 %noun] ~ %j `beam`[[our %turf %da now] /])
(rof ~ %j `beam`[[our %turf %da now] /])
::
(emit unix-duct.ames-state %give %turf turfs)
:: +on-trim: handle request to free memory

View File

@ -3,20 +3,20 @@
!? 164
::
=, behn
|= pit=vase
|= our=ship
=> |%
+$ move [p=duct q=(wite note gift:able)]
+$ move [p=duct q=(wite note gift)]
+$ note :: out request $->
$~ [%b %wait *@da] ::
$% $: %b :: to self
$>(%wait task:able) :: set timer
$>(%wait task) :: set timer
== ::
$: %d :: to %dill
$>(%flog task:able:dill) :: log output
$>(%flog task:dill) :: log output
== == ::
+$ sign
$~ [%b %wake ~]
$% [%b $>(%wake gift:able)]
$~ [%behn %wake ~]
$% [%behn $>(%wake gift)]
==
::
+$ behn-state
@ -38,11 +38,11 @@
--
::
=>
~% %behn ..is ~
~% %behn ..part ~
|%
++ per-event
=| moves=(list move)
|= [[our=ship now=@da =duct] state=behn-state]
|= [[now=@da =duct] state=behn-state]
::
|%
:: %entry-points
@ -179,7 +179,7 @@
::
++ set-unix-wake
=< [moves state]
~% %set-unix-wake ..is ~ |-
~% %set-unix-wake ..part ~ |-
^+ event-core
::
=* next-wake next-wake.state
@ -213,7 +213,7 @@
:: +set-timer: set a timer, maintaining order
::
++ set-timer
~% %set-timer ..is ~
~% %set-timer ..part ~
|= t=timer
^+ timers.state
=/ found (find-ducts date.t)
@ -254,36 +254,32 @@
::
=| behn-state
=* state -
|= [our=ship now=@da eny=@uvJ rof=roof]
|= [now=@da eny=@uvJ rof=roof]
=* behn-gate .
^?
|%
:: +call: handle a +task:able:behn request
:: +call: handle a +task:behn request
::
++ call
~% %behn-call ..is ~
~% %behn-call ..part ~
|= $: hen=duct
dud=(unit goof)
type=*
wrapped-task=(hobo task:able)
wrapped-task=(hobo task)
==
^- [(list move) _behn-gate]
::
=/ =task:able ((harden task:able) wrapped-task)
::
:: error notifications "downcast" to %crud
::
=? task ?=(^ dud)
~| %crud-in-crud
?< ?=(%crud -.task)
[%crud -.task tang.u.dud]
::
=/ event-core (per-event [our now hen] state)
=/ =task ((harden task) wrapped-task)
=/ event-core (per-event [now hen] state)
::
=^ moves state
::
:: handle error notifications
::
?^ dud
(crud:event-core -.task tang.u.dud)
::
?- -.task
%born born:event-core
%crud (crud:event-core [p q]:task)
%rest (rest:event-core date=p.task)
%drip (drip:event-core move=p.task)
%huck (huck:event-core syn.task)
@ -305,9 +301,10 @@
:: which might or might not show up in the product
::
++ scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=* lot=coin $/r.bem
@ -373,14 +370,14 @@
::
++ stay state
++ take
|= [tea=wire hen=duct dud=(unit goof) hin=(hypo sign)]
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
^- [(list move) _behn-gate]
?^ dud
~|(%behn-take-dud (mean tang.u.dud))
::
?> ?=([%drip @ ~] tea)
=/ event-core (per-event [our now hen] state)
=/ event-core (per-event [now hen] state)
=^ moves state
(take-drip:event-core (slav %ud i.t.tea) error.q.hin)
(take-drip:event-core (slav %ud i.t.tea) error.hin)
[moves behn-gate]
--

View File

@ -9,7 +9,7 @@
:: worth noting that many of the clay-related structures are defined in zuse.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|= pit=vase
|= our=ship
=, clay
=> |%
+$ aeon @ud :: version number
@ -282,21 +282,21 @@
$: rus=(map desk rede) :: neighbor desks
==
::
+$ move [p=duct q=(wind note gift:able)] :: local move
+$ move [p=duct q=(wind note gift)] :: local move
+$ note :: out request $->
$~ [%b %wait *@da] ::
$% $: %$ :: to arvo
$>(%what waif) ::
== ::
$: %a :: to %ames
$>(%plea task:able:ames) ::
$>(%plea task:ames) ::
== ::
$: %b :: to %behn
$> $? %drip ::
%rest ::
%wait ::
== ::
task:able:behn ::
task:behn ::
== ::
$: %c :: to %clay
$> $? %info :: internal edit
@ -305,46 +305,43 @@
%warp ::
%werp ::
== ::
task:able ::
task ::
== ::
$: %d :: to %dill
$>(%flog task:able:dill) ::
$>(%flog task:dill) ::
== ::
$: %g :: to %gall
$>(%deal task:able:gall) ::
$>(%deal task:gall) ::
== ::
$: %j :: by %jael
$>(%public-keys task:able:jael) ::
$>(%public-keys task:jael) ::
== == ::
+$ riot (unit rant) :: response+complete
+$ sign :: in result $<-
$~ [%b %wake ~] ::
$% $: %a :: by %ames
$~ [%behn %wake ~] ::
$% $: %ames ::
$> $? %boon :: response
%done :: (n)ack
%lost :: lost boon
== ::
gift:able:ames ::
gift:ames ::
== ::
$: %b :: by %behn
$% $>(%wake gift:able:behn) :: timer activate
$>(%writ gift:able) :: XX %slip
$: %behn ::
$% $>(%wake gift:behn) :: timer activate
$>(%writ gift) :: XX %slip
== == ::
$: %c :: by %clay
$: %clay ::
$> $? %mere ::
%note ::
%writ ::
== ::
gift:able ::
gift ::
== ::
$: %j :: by %jael
$>(%public-keys gift:able:jael) ::
== ::
$: @tas :: by any
$>(%crud vane-task) :: XX strange
$: %jael ::
$>(%public-keys gift:jael) ::
== == ::
-- =>
~% %clay-utilities ..is ~
~% %clay-utilities ..part ~
:: %utilities
::
|%
@ -984,11 +981,11 @@
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ de :: per desk
|= [our=ship now=@da ski=sley hen=duct raft]
|= [now=@da rof=roof hen=duct raft]
|= [her=ship syd=desk]
:: XX ruf=raft crashes in the compiler
::
=* ruf |4.+6.^$
=* ruf |3.+6.^$
::
=/ [mow=(list move) hun=(unit duct) rede]
?. =(our her)
@ -1568,7 +1565,7 @@
=^ hon tep (build tep /sys/hoon hoon.ref !>(**) !,(*hoon ..ride))
=^ rav tep (build tep /sys/arvo arvo.ref hon !,(*hoon ..part))
=^ lul tep (build tep /sys/lull lull.ref rav !,(*hoon .))
=^ zus tep (build tep /sys/zuse zuse.ref rav !,(*hoon .))
=^ zus tep (build tep /sys/zuse zuse.ref lul !,(*hoon .))
[hon rav lul zus]
::
++ build
@ -1596,17 +1593,9 @@
++ deep
|= [pax=path src=cord]
^- ?
:: XX use roof
::
:: =/ dat (rof `[our ~ ~] $/[[our $/da/now] mod/fat/pax])
:: ?: |(?=(~ dat) ?=(~ u.dat)) |
:: =/ nod !<((axal (cask)) q.u.u.dat)
::
=/ dat
;; (unit (unit (axal (cask))))
((sloy-light ski) [hoon-version %noun] %$ our %$ da/now mod/fat/pax)
=/ dat (rof `[our ~ ~] $/[[our $/da/now] mod/fat/pax])
?: |(?=(~ dat) ?=(~ u.dat)) |
=* nod u.u.dat
=/ nod !<((axal (cask)) q.u.u.dat)
&(?=(^ fil.nod) ?=(%hoon p.u.fil.nod) =(src q.u.fil.nod))
--
::
@ -3625,7 +3614,7 @@
:^ ~ ~ %uvs !>
^- (list @uv)
=/ him (slav %p i.t.pax)
=/ other dom:((de our now ski hen ruf) him i.t.t.pax)
=/ other dom:((de now rof hen ruf) him i.t.t.pax)
?: =(0 let.other)
~
=/ our-yaki (~(got by hut.ran) (~(got by hit.dom) yon))
@ -3885,25 +3874,21 @@
$: ver=%6 :: vane version
ruf=raft :: revision tree
== ::
|= [our=ship now=@da eny=@uvJ rof=roof] :: current invocation
=* ski (en-sley rof)
|= [now=@da eny=@uvJ rof=roof] :: current invocation
|% ::
++ call :: handle request
|= $: hen=duct
dud=(unit goof)
type=*
wrapped-task=(hobo task:able)
wrapped-task=(hobo task)
==
^- [(list move) _..^$]
::
=/ req=task:able ((harden task:able) wrapped-task)
=/ req=task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud
:: XX handle error notifications
::
=? req ?=(^ dud)
~| %crud-in-crud
?< ?=(%crud -.req)
[%crud -.req tang.u.dud]
?^ dud
[[[hen %slip %d %flog %crud [-.req tang.u.dud]] ~] ..^$]
::
?- -.req
%boat
@ -3919,7 +3904,7 @@
=/ des ~(tap in ~(key by dos.rom.ruf))
|-
?~ des [[[hen %give %done ~] mos] ..^^$]
=/ den ((de our now ski hen ruf) our i.des)
=/ den ((de now rof hen ruf) our i.des)
=^ mor ruf
=< abet:wake
?: ?=(^ cew.req) den
@ -3948,9 +3933,6 @@
|= [p=path r=rule]
(~(has in who.r) |+nom.req)
--
::
%crud
[[[hen %slip %d %flog req] ~] ..^$]
::
%drop
~& %clay-idle
@ -3974,7 +3956,7 @@
%dif ~|(%dif-not-implemented !!)
==
=^ mos ruf
=/ den ((de our now ski hen ruf) our des.req)
=/ den ((de now rof hen ruf) our des.req)
abet:(info:den deletes changes)
[mos ..^$]
::
@ -3994,7 +3976,7 @@
?~ dos
!! :: fire next in queue
=^ mos ruf
=/ den ((de our now ski hen ruf) our q.bem)
=/ den ((de now rof hen ruf) our q.bem)
abet:(into:den s.bem all.req fis.req)
[mos ..^$]
::
@ -4002,14 +3984,14 @@
?: =(%$ des.req)
~&(%merg-no-desk !!)
=^ mos ruf
=/ den ((de our now ski hen ruf) our des.req)
=/ den ((de now rof hen ruf) our des.req)
abet:(start-merge:den her.req dem.req cas.req how.req)
[mos ..^$]
::
%mont
=. hez.ruf ?^(hez.ruf hez.ruf `[[%$ %sync ~] ~])
=^ mos ruf
=/ den ((de our now ski hen ruf) p.bem.req q.bem.req)
=/ den ((de now rof hen ruf) p.bem.req q.bem.req)
abet:(mount:den pot.req r.bem.req s.bem.req)
[mos ..^$]
::
@ -4046,7 +4028,7 @@
::
%park
=^ mos ruf
=/ den ((de our now ski hen ruf) our des.req)
=/ den ((de now rof hen ruf) our des.req)
abet:(park:den | [yok ran]:req)
[mos ..^$]
::
@ -4054,13 +4036,13 @@
=/ [syd=desk =yoki] (need pud.ruf)
=. pud.ruf ~
=^ mos ruf
=/ den ((de our now ski hen ruf) our syd)
=/ den ((de now rof hen ruf) our syd)
abet:(park:den & yoki *rang)
[mos ..^$]
::
%perm
=^ mos ruf
=/ den ((de our now ski hen ruf) our des.req)
=/ den ((de now rof hen ruf) our des.req)
abet:(perm:den pax.req rit.req)
[mos ..^$]
::
@ -4083,7 +4065,7 @@
?~ desks
[~ ..^^$]
=^ moves-1 ..^^$ $(desks t.desks)
=^ moves-2 ruf abet:wake:((de our now ski hen ruf) [ship desk]:i.desks)
=^ moves-2 ruf abet:wake:((de now rof hen ruf) [ship desk]:i.desks)
[(weld moves-1 moves-2) ..^^$]
[wake-moves ..^$]
::
@ -4102,7 +4084,7 @@
?> ?=(%warp -.req)
=* rif rif.req
=^ mos ruf
=/ den ((de our now ski hen ruf) wer.req p.rif)
=/ den ((de now rof hen ruf) wer.req p.rif)
=< abet
?~ q.rif
cancel-request:den
@ -4117,7 +4099,7 @@
?: ?=([%backfill *] pax)
=+ ;;(=fill res)
=^ mos ruf
=/ den ((de our now ski hen ruf) our desk.fill)
=/ den ((de now rof hen ruf) our desk.fill)
abet:(give-backfill:den lobe.fill)
[[[hen %give %done ~] mos] ..^$]
?> ?=([%question *] pax)
@ -4135,9 +4117,10 @@
..^$(ruf +.old)
::
++ scry :: inspect
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=/ why=shop &/p.bem
=* syd q.bem
=/ lot=coin $/r.bem
@ -4158,7 +4141,7 @@
::TODO if it ever gets filled properly, pass in the full fur.
::
=/ for=(unit ship) ?~(lyc ~ ?~(u.lyc ~ `n.u.lyc))
=/ den ((de our now ski [/scryduct ~] ruf) his syd)
=/ den ((de now rof [/scryduct ~] ruf) his syd)
=/ result (mule |.(-:(aver:den for u.run u.luk tyl)))
?: ?=(%| -.result)
%- (slog >%clay-scry-fail< p.result)
@ -4195,36 +4178,36 @@
==
::
++ take :: accept response
|= [tea=wire hen=duct dud=(unit goof) hin=(hypo sign)]
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
^+ [*(list move) ..^$]
?^ dud
~|(%clay-take-dud (mean tang.u.dud))
::
?: ?=([%merge @ @ @ @ ~] tea)
?> ?=(%writ +<.q.hin)
?> ?=(%writ +<.hin)
=* syd i.t.tea
=/ ali-ship (slav %p i.t.t.tea)
=* ali-desk i.t.t.t.tea
=/ germ (germ i.t.t.t.t.tea)
=^ mos ruf
=/ den ((de our now ski hen ruf) our i.t.tea)
abet:(merge:den ali-ship ali-desk germ p.q.hin)
=/ den ((de now rof hen ruf) our i.t.tea)
abet:(merge:den ali-ship ali-desk germ p.hin)
[mos ..^$]
::
?: ?=([%foreign-warp *] tea)
?> ?=(%writ +<.q.hin)
?> ?=(%writ +<.hin)
:_ ..^$
[hen %give %boon `(unit rand)`(bind `riot`p.q.hin rant-to-rand)]~
[hen %give %boon `(unit rand)`(bind `riot`p.hin rant-to-rand)]~
::
?: ?=([%warp-index @ @ @ ~] tea)
?+ +<.q.hin ~| %clay-warp-index-strange !!
?+ +<.hin ~| %clay-warp-index-strange !!
%done
?~ error.q.hin
?~ error.hin
[~ ..^$]
:: TODO better error handling
::
~& %clay-take-warp-index-error^our^tea^tag.u.error.q.hin
%- (slog tang.u.error.q.hin)
~& %clay-take-warp-index-error^our^tea^tag.u.error.hin
%- (slog tang.u.error.hin)
[~ ..^$]
::
%lost
@ -4233,27 +4216,27 @@
!!
::
%boon
=+ ;; res=(unit rand) payload.q.hin
=+ ;; res=(unit rand) payload.hin
::
=/ her=ship (slav %p i.t.tea)
=/ =desk (slav %tas i.t.t.tea)
=/ index=@ud (slav %ud i.t.t.t.tea)
::
=^ mos ruf
=/ den ((de our now ski hen ruf) her desk)
=/ den ((de now rof hen ruf) her desk)
abet:(take-foreign-answer:den index res)
[mos ..^$]
==
::
?: ?=([%back-index @ @ @ ~] tea)
?+ +<.q.hin ~| %clay-backfill-index-strange !!
?+ +<.hin ~| %clay-backfill-index-strange !!
%done
?~ error.q.hin
?~ error.hin
[~ ..^$]
:: TODO better error handling
::
~& %clay-take-backfill-index-error^our^tea^tag.u.error.q.hin
%- (slog tang.u.error.q.hin)
~& %clay-take-backfill-index-error^our^tea^tag.u.error.hin
%- (slog tang.u.error.hin)
[~ ..^$]
::
%lost
@ -4262,23 +4245,23 @@
!!
::
%boon
=+ ;; =blob payload.q.hin
=+ ;; =blob payload.hin
::
=/ her=ship (slav %p i.t.tea)
=/ =desk (slav %tas i.t.t.tea)
=/ index=@ud (slav %ud i.t.t.t.tea)
::
=^ mos ruf
=/ den ((de our now ski hen ruf) her desk)
=/ den ((de now rof hen ruf) her desk)
abet:abet:(take-backfill:(foreign-update:den index) blob)
[mos ..^$]
==
::
?: ?=([%sinks ~] tea)
?> ?=(%public-keys +<.q.hin)
?. ?=(%breach -.public-keys-result.q.hin)
?> ?=(%public-keys +<.hin)
?. ?=(%breach -.public-keys-result.hin)
[~ ..^$]
=/ who who.public-keys-result.q.hin
=/ who who.public-keys-result.hin
?: =(our who)
[~ ..^$]
:: Cancel subscriptions
@ -4304,29 +4287,27 @@
=. hoy.ruf (~(del by hoy.ruf) who)
[cancel-moves ..^$]
::
?- -.+.q.hin
?- -.+.hin
%public-keys ~|([%public-keys-raw tea] !!)
%crud
[[[hen %slip %d %flog +.q.hin] ~] ..^$]
::
%mere
?: ?=(%& -.p.+.q.hin)
?: ?=(%& -.p.+.hin)
~& 'initial merge succeeded'
[~ ..^$]
~> %slog.
:^ 0 %rose [" " "[" "]"]
:^ leaf+"initial merge failed"
leaf+"my most sincere apologies"
>p.p.p.+.q.hin<
q.p.p.+.q.hin
>p.p.p.+.hin<
q.p.p.+.hin
[~ ..^$]
::
%note [[hen %give +.q.hin]~ ..^$]
%note [[hen %give +.hin]~ ..^$]
%wake
:: TODO: handle behn errors
::
?^ error.q.hin
[[hen %slip %d %flog %crud %wake u.error.q.hin]~ ..^$]
?^ error.hin
[[hen %slip %d %flog %crud %wake u.error.hin]~ ..^$]
::
?. ?=([%tyme @ @ ~] tea)
~& [%clay-strange-timer tea]
@ -4334,7 +4315,7 @@
=/ her (slav %p i.t.tea)
=/ syd (slav %tas i.t.t.tea)
=^ mos ruf
=/ den ((de our now ski hen ruf) her syd)
=/ den ((de now rof hen ruf) her syd)
abet:wake:den
[mos ..^$]
::
@ -4347,7 +4328,7 @@
[~ ..^$]
::
%done
?~ error=error.q.hin
?~ error=error.hin
[~ ..^$]
%- (slog >%clay-lost< >tag.u.error< tang.u.error)
[~ ..^$]

View File

@ -1,7 +1,7 @@
!:
:: dill (4d), terminal handling
::
|= pit=vase
|= our=ship
=, dill
=> |% :: interface tiles
+$ gill (pair ship term) :: general contact
@ -30,7 +30,7 @@
+$ mess ::
$% [%dill-belt p=(hypo dill-belt)] ::
== ::
+$ move [p=duct q=(wind note gift:able)] :: local move
+$ move [p=duct q=(wind note gift)] :: local move
+$ note :: out request $->
$~ [%d %verb ~] ::
$% $: %$ ::
@ -41,63 +41,56 @@
%perm :: change permissions
%warp :: wait for clay hack
== ::
task:able:clay ::
task:clay ::
== ::
$: %d ::
$> $? %crud ::
%heft ::
%init :: XX obsolete?
%text ::
%verb ::
== ::
task:able:dill ::
task:dill ::
== ::
$: %g ::
$> $? %conf ::
%deal ::
%goad ::
== ::
task:able:gall ::
task:gall ::
== ::
$: %j ::
$> $? %dawn ::
%fake ::
== ::
task:able:jael ::
task:jael ::
== == ::
+$ sign :: in result $<-
$~ [%j %init *@p] ::
$% $: %b ::
$% $>(%writ gift:able:clay) :: XX %slip
$>(%mere gift:able:clay) :: XX %slip
$~ [%dill %blit ~] ::
$% $: %behn ::
$% $>(%writ gift:clay) :: XX %slip
$>(%mere gift:clay) :: XX %slip
== == ::
$: %c ::
$: %clay ::
$> $? %mere ::
%note ::
%writ ::
== ::
gift:able:clay ::
gift:clay ::
== ::
$: %d ::
$>(%blit gift:able:dill) ::
$: %dill ::
$>(%blit gift:dill) ::
== ::
$: %g ::
$: %gall ::
$> $? %onto ::
%unto ::
== ::
gift:able:gall ::
== ::
$: %j ::
$> $? %init ::
== ::
gift:able:jael ::
gift:gall ::
== == ::
:::::::: :: dill tiles
--
=| all=axle
|= [our=ship now=@da eny=@uvJ rof=roof] :: current invocation
=* ski (en-sley rof)
=> ~% %dill ..is ~
|= [now=@da eny=@uvJ rof=roof] :: current invocation
=> ~% %dill ..part ~
|%
++ as :: per cause
=| moz=(list move)
@ -107,7 +100,7 @@
[(flop moz) all(dug (~(put by dug.all) hen +<+))]
::
++ call :: receive input
|= kyz=task:able
|= kyz=task
^+ +>
?+ -.kyz ~& [%strange-kiss -.kyz] +>
%flow +>
@ -146,12 +139,12 @@
$(wall t.wall, +>.^$ (from %out (tuba i.wall)))
::
++ dump :: pass down to hey
|= git=gift:able
|= git=gift
?> ?=(^ hey.all)
+>(moz [[u.hey.all %give git] moz])
::
++ done :: return gift
|= git=gift:able
|= git=gift
=- +>.$(moz (weld - moz))
%+ turn
:- hen
@ -207,11 +200,10 @@
:: XX move
::
++ sein
|= who=ship
;; ship
%- need %- need
%- (sloy-light ski)
[[151 %noun] %j our %sein da+now /(scot %p who)]
^- ship
=/ dat=(unit (unit cage))
(rof `[our ~ ~] j/[[our sein/da/now] /(scot %p our)])
;;(ship q.q:(need (need dat)))
::
++ init :: initialize
(pass /merg/home [%c %merg %kids our %home da+now %init])
@ -223,7 +215,7 @@
=. tem ~
=. +> (pass / %g %conf ram)
=? +> ?=(?(%earl %duke %king) can)
(ota (sein our) %kids)
(ota sein %kids)
:: make kids desk publicly readable, so syncs work.
::
=. +> (show %kids)
@ -263,19 +255,14 @@
|= [tea=wire sih=sign]
^+ +>
?- sih
[%j %init *]
:: pass thru to unix
::
+>(moz :_(moz [hen %give +.sih]))
::
[%g %onto *]
[%gall %onto *]
:: ~& [%take-gall-onto +>.sih]
?- -.+>.sih
%| (crud %onto p.p.+>.sih)
%& (done %blit [%lin (tuba "{<p.p.sih>}")]~)
==
::
[%g %unto *]
[%gall %unto *]
:: ~& [%take-gall-unto +>.sih]
?- -.+>.sih
%poke-ack ?~(p.p.+>.sih +>.$ (crud %coup u.p.p.+>.sih))
@ -286,18 +273,18 @@
%fact (from ;;(dill-blit q:`vase`+>+>.sih))
==
::
[%c %note *]
[%clay %note *]
(from %out (tuba p.sih ' ' ~(ram re q.sih)))
::
[?(%b %c) %writ *]
[?(%behn %clay) %writ *]
init
::
[?(%b %c) %mere *]
[?(%behn %clay) %mere *]
?: ?=(%& -.p.sih)
mere
(mean >%dill-mere-fail< >p.p.p.sih< q.p.p.sih)
::
[%d %blit *]
[%dill %blit *]
(done +.sih)
==
--
@ -313,12 +300,11 @@
++ call :: handle request
|= $: hen=duct
dud=(unit goof)
type=*
wrapped-task=(hobo task:able)
wrapped-task=(hobo task)
==
^+ [*(list move) ..^$]
~| wrapped-task
=/ task=task:able ((harden task:able) wrapped-task)
=/ task=task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud
::
@ -334,14 +320,14 @@
?> =(~ hey.all)
=. hey.all `hen
=/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
((soft $>($?(%dawn %fake) task:jael)) p.task)
?~ boot
~& %dill-no-boot
~& p.task
~| invalid-boot-event+hen !!
=. lit.all lit.task
[[hen %pass / %j u.boot]~ ..^$]
:: we are subsequently initialized. single-home
:: we are subsequently initialized.
::
?: ?=(%init -.task)
?> =(~ dug.all)
@ -413,9 +399,10 @@
..^$(all old)
::
++ scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=* lot=coin $/r.bem
@ -456,7 +443,7 @@
++ stay all
::
++ take :: process move
|= [tea=wire hen=duct dud=(unit goof) hin=(hypo sign)]
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
^+ [*(list move) ..^$]
?^ dud
~|(%dill-take-dud (mean tang.u.dud))
@ -466,8 +453,8 @@
:: :hen is an unrecognized duct
:: could be before %boot (or %boot failed)
::
~& [%dill-take-no-flow hen -.q.hin +<.q.hin]
~& [%dill-take-no-flow hen -.hin +<.hin]
[~ ..^$]
=^ moz all abet:(take:u.nus tea q.hin)
=^ moz all abet:(take:u.nus tea hin)
[moz ..^$]
--

View File

@ -1,7 +1,7 @@
!:
:: lighter than eyre
::
|= pit=vase
|= our=ship
=, eyre
:: internal data structures
::
@ -17,7 +17,7 @@
=duct
::
::
card=(wind note gift:able)
card=(wind note gift)
==
:: +note: private request from eyre to another vane
::
@ -42,25 +42,17 @@
$: %g
::
::
$>(%deal task:able:gall)
$>(%deal task:gall)
== ==
:: +sign: private response from another vane to eyre
::
+$ sign
$% :: %b: from behn
::
$: %b
::
::
$% $: %behn
$% [%wake error=(unit tang)]
== ==
:: %g: from gall
::
$: %g
::
::
gift:able:gall
:: $>(%unto gift:able:gall)
$: %gall
gift:gall
:: $>(%unto gift:gall)
== ==
--
:: more structures
@ -552,7 +544,7 @@
++ per-server-event
:: gate that produces the +per-server-event core from event information
::
|= [[our=@p eny=@ =duct now=@da scry=sley] state=server-state]
|= [[eny=@ =duct now=@da rof=roof] state=server-state]
=/ eyre-id (scot %ta (cat 3 'eyre_' (scot %uv (sham duct))))
|%
:: +request-local: bypass authentication for local lens connections
@ -634,12 +626,12 @@
%gen
=/ bek=beak [our desk.generator.action da+now]
=/ sup=spur path.generator.action
=/ ski (scry [%141 %noun] ~ %ca bek sup)
=/ ski (rof ~ %ca bek sup)
=/ cag=cage (need (need ski))
?> =(%vase p.cag)
=/ gat=vase !<(vase q.cag)
=/ res=toon
%- mock :_ (sloy scry)
%- mock :_ (look rof ~)
:_ [%9 2 %0 1] |.
%+ slam
%+ slam gat
@ -661,8 +653,7 @@
authenticated.inbound-request.connection
url.request.inbound-request.connection
leaf+"scry blocked on"
>p.res<
~
(fall (bind (bind ((soft path) p.res) smyt) (late ~)) ~)
==
=/ result ;;(simple-payload:http +.p.res)
:: ensure we have a valid content-length header
@ -757,7 +748,7 @@
++ do-scry
|= [care=term =desk =path]
^- (unit (unit cage))
(scry [%141 %noun] ~ care [our desk da+now] path)
(rof ~ care [our desk da+now] path)
::
++ error-response
|= [status=@ud =tape]
@ -1016,11 +1007,9 @@
::
++ code
^- @ta
::
=+ pax=/(scot %p our)/code/(scot %da now)/(scot %p our)
=+ res=((sloy scry) [151 %noun] %j pax)
::
(rsh 3 (scot %p (@ (need (need res)))))
=/ res=(unit (unit cage))
(rof ~ %j [our %code da+now] /(scot %p our))
(rsh 3 (scot %p ;;(@ q.q:(need (need res)))))
:: +session-cookie-string: compose session cookie
::
++ session-cookie-string
@ -1525,7 +1514,7 @@
::NOTE assertions in this block because =* is flimsy
?> ?=([%| *] state.u.channel)
:+ p.state.u.channel %give
^- gift:able
^- gift
:* %response %continue
::
^= data
@ -1580,7 +1569,7 @@
=? moves &(kicking ?=([%| *] state.u.channel))
:_ moves
:+ p.state.u.channel %give
^- gift:able
^- gift
:* %response %continue
::
^= data
@ -1615,7 +1604,7 @@
::
=* have=mark mark.event
=/ val=(unit (unit cage))
(scry [%141 %noun] ~ %cb [our %home da+now] /[have])
(rof ~ %cb [our %home da+now] /[have])
?. ?=([~ ~ *] val)
((slog leaf+"eyre: no mark {(trip have)}" ~) ~)
=+ !<(=dais:clay q.u.u.val)
@ -1639,7 +1628,7 @@
=* desc=tape "from {(trip have)} to json"
=/ tube=(unit tube:clay)
=/ tuc=(unit (unit cage))
(scry [%141 %noun] ~ %cc [our %home da+now] /[have]/json)
(rof ~ %cc [our %home da+now] /[have]/json)
?. ?=([~ ~ *] tuc) ~
`!<(tube:clay q.u.u.tuc)
?~ tube
@ -2099,30 +2088,22 @@
=| ax=axle
:: a vane is activated with current date, entropy, and a namespace function
::
|= [our=ship now=@da eny=@uvJ rof=roof]
=* scry-gate (en-sley rof)
|= [now=@da eny=@uvJ rof=roof]
:: allow jets to be registered within this core
::
~% %http-server ..is ~
~% %http-server ..part ~
|%
++ call
|= [=duct dud=(unit goof) type=* wrapped-task=(hobo task:able)]
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
^- [(list move) _http-server-gate]
::
=/ task=task:able ((harden task:able) wrapped-task)
=/ task=task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud
:: XX handle error notifications
::
=? task ?=(^ dud)
~| %crud-in-crud
?< ?=(%crud -.task)
[%crud -.task tang.u.dud]
::
:: %crud: notifies us of an event failure
::
?: ?=(%crud -.task)
?^ dud
=/ moves=(list move)
[[duct %slip %d %flog task] ~]
[[duct %slip %d %flog %crud [-.task tang.u.dud]] ~]
[moves http-server-gate]
:: %init: tells us what our ship name is
::
@ -2142,7 +2123,7 @@
:: XX cancel active too if =(0 trim-priority) ?
::
?: ?=(%trim -.task)
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
=* by-channel by-channel:(per-server-event event-args)
=* channel-state channel-state.server-state.ax
::
@ -2190,7 +2171,7 @@
[closed-connections server-state.ax]
::
=/ event-args
[[our eny duct.i.connections now scry-gate] server-state.ax]
[[eny duct.i.connections now rof] server-state.ax]
=/ cancel-request cancel-request:(per-server-event event-args)
=^ moves server-state.ax cancel-request
::
@ -2212,7 +2193,7 @@
~> %slog.[0 leaf+"eyre: code-changed: throwing away cookies and sessions"]
=. authentication-state.server-state.ax *authentication-state
::
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
=* by-channel by-channel:(per-server-event event-args)
=* channel-state channel-state.server-state.ax
::
@ -2228,7 +2209,7 @@
::
:: all other commands operate on a per-server-event
::
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
=/ server (per-server-event event-args)
::
?- -.task
@ -2315,16 +2296,13 @@
==
::
++ take
|= [=wire =duct dud=(unit goof) wrapped-sign=(hypo sign)]
|= [=wire =duct dud=(unit goof) =sign]
^- [(list move) _http-server-gate]
?^ dud
~|(%eyre-take-dud (mean tang.u.dud))
:: unwrap :sign, ignoring unneeded +type in :p.wrapped-sign
::
=/ =sign q.wrapped-sign
=> %= .
sign
?: ?=(%g -.sign)
?: ?=(%gall -.sign)
?> ?=(%unto +<.sign)
sign
sign
@ -2347,7 +2325,7 @@
::
++ run-app-request
::
?> ?=([%g %unto *] sign)
?> ?=([%gall %unto *] sign)
::
::
?> ?=([%poke-ack *] p.sign)
@ -2358,7 +2336,7 @@
[~ http-server-gate]
:: we have an error; propagate it to the client
::
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
=/ handle-gall-error
handle-gall-error:(per-server-event event-args)
=^ moves server-state.ax
@ -2367,10 +2345,10 @@
::
++ watch-response
::
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
::
?> ?=([@ *] t.wire)
?: ?=([%g %unto %watch-ack *] sign)
?: ?=([%gall %unto %watch-ack *] sign)
?~ p.p.sign
:: received a positive acknowledgment: take no action
::
@ -2382,13 +2360,13 @@
=^ moves server-state.ax (handle-gall-error u.p.p.sign)
[moves http-server-gate]
::
?: ?=([%g %unto %kick ~] sign)
?: ?=([%gall %unto %kick ~] sign)
=/ handle-response handle-response:(per-server-event event-args)
=^ moves server-state.ax
(handle-response %continue ~ &)
[moves http-server-gate]
::
?> ?=([%g %unto %fact *] sign)
?> ?=([%gall %unto %fact *] sign)
=/ =mark p.cage.p.sign
=/ =vase q.cage.p.sign
?. ?= ?(%http-response-header %http-response-data %http-response-cancel)
@ -2412,7 +2390,7 @@
::
++ channel
::
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=/ event-args [[eny duct now rof] server-state.ax]
:: channel callback wires are triples.
::
?> ?=([@ @ @t *] wire)
@ -2421,7 +2399,7 @@
~|([%bad-channel-wire wire] !!)
::
%timeout
?> ?=([%b %wake *] sign)
?> ?=([%behn %wake *] sign)
?^ error.sign
[[duct %slip %d %flog %crud %wake u.error.sign]~ http-server-gate]
=/ discard-channel
@ -2438,7 +2416,7 @@
[moves http-server-gate]
::
?(%poke %subscription)
?> ?=([%g %unto *] sign)
?> ?=([%gall %unto *] sign)
~| wire
?> ?=([@ @ @t @ *] wire)
=* channel-id i.t.t.wire
@ -2455,7 +2433,7 @@
::
++ sessions
::
?> ?=([%b %wake *] sign)
?> ?=([%behn %wake *] sign)
::
?^ error.sign
[[duct %slip %d %flog %crud %wake u.error.sign]~ http-server-gate]
@ -2480,7 +2458,7 @@
(min next expiry-time)
::
++ acme-ack
?> ?=([%g %unto *] sign)
?> ?=([%gall %unto *] sign)
::
?> ?=([%poke-ack *] p.sign)
?~ p.p.sign
@ -2505,9 +2483,10 @@
:: +scry: request a path in the urbit namespace
::
++ scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=/ lot=coin $/r.bem
@ -2554,7 +2533,7 @@
:^ ~ ~ %noun
!> ^- ?
%- =< request-is-logged-in:authentication
(per-server-event [our eny *duct now scry-gate] server-state.ax)
(per-server-event [eny *duct now rof] server-state.ax)
%*(. *request:http header-list ['cookie' u.cookies]~)
==
?. ?=(%$ ren)

View File

@ -1,10 +0,0 @@
!:
|= pit=vase
|= [our=ship now=@da eny=@uvJ rof=roof]
|%
++ call |=(* ((slog leaf+"ford: gone (+call)" ~) `..^$))
++ take |=(* ((slog leaf+"ford: gone (+take)" ~) `..^$))
++ scry |=(* ``mass+!>(*(list mass)))
++ stay ~
++ load |=(* ..^$)
--

View File

@ -1,8 +1,9 @@
!:
:: :: %gall, agent execution
!? 163
::
::::
|= pit=vase
|= our=ship
=, gall
=>
|%
@ -140,10 +141,9 @@
::
=< =* adult-gate .
=| =spore
|= [our=ship now=@da eny=@uvJ rof=roof]
|= [now=@da eny=@uvJ rof=roof]
=* pupal-gate .
=* adult-core (adult-gate +<)
=* ski (en-sley rof)
=< |%
++ call ^call
++ load ^load
@ -196,7 +196,7 @@
[moves adult-gate]
::
++ call
|= [=duct dud=(unit goof) typ=type wrapped-task=(hobo task:able)]
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
=* call-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
@ -205,13 +205,13 @@
?^ dud
~> %slog.[0 leaf+"gall: pupa call dud"]
(mean >mote.u.dud< tang.u.dud)
=/ task ((harden task:able:gall) wrapped-task)
=/ task ((harden task:gall) wrapped-task)
(molt duct `[duct %slip %g task])
::
++ scry scry:adult-core
++ stay ~|(%gall-subinvolution !!)
++ take
|= [=wire =duct dud=(unit goof) typ=type sign=sign-arvo]
|= [=wire =duct dud=(unit goof) sign=sign-arvo]
=* take-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
@ -237,9 +237,8 @@
:: adult gall vane interface, for type compatibility with pupa
::
=| state=state-7
|= [our=ship now=@da eny=@uvJ rof=roof]
|= [now=@da eny=@uvJ rof=roof]
=* gall-payload .
=* ski (en-sley rof)
=< ~% %gall-wrap ..mo ~
|%
++ call ^call
@ -248,7 +247,7 @@
++ stay ^stay
++ take ^take
--
~% %gall-top ..is ~
~% %gall-top ..part ~
|%
:: +mo: Arvo-level move handling
::
@ -267,7 +266,7 @@
++ mo-abed |=(hun=duct mo-core(hen hun))
++ mo-abet [(flop moves) gall-payload]
++ mo-pass |=(p=[wire note-arvo] mo-core(moves [[hen pass+p] moves]))
++ mo-give |=(g=gift:able mo-core(moves [[hen give+g] moves]))
++ mo-give |=(g=gift mo-core(moves [[hen give+g] moves]))
:: +mo-boot: ask %ford to build us a core for the specified agent.
::
++ mo-boot
@ -384,7 +383,7 @@
|= [dap=term =case:clay]
^- (each agent tang)
=/ bek=beak [our %home case]
=/ sky (ski [%141 %noun] ~ %ca bek /app/[dap]/hoon)
=/ sky (rof ~ %ca bek /app/[dap]/hoon)
?~ sky |+[leaf+"gall: {<dap>} scry blocked"]~
?~ u.sky |+[leaf+"gall: {<dap>} scry failed"]~
=/ =cage u.u.sky
@ -508,7 +507,7 @@
++ mo-handle-sys-era
|= [=path =sign-arvo]
^+ mo-core
?> ?=([%j %public-keys *] sign-arvo)
?> ?=([%jael %public-keys *] sign-arvo)
?> ?=([%era ~] path)
?. ?=(%breach -.public-keys-result.sign-arvo)
mo-core
@ -523,7 +522,7 @@
=/ [dap=term her=@ta desk=@ta dat=@ta ~] t.path
=/ tim (slav da+dat)
=/ =beak [(slav %p her) desk da+tim]
?> ?=([?(%b %c) %writ *] sign-arvo)
?> ?=([?(%behn %clay) %writ *] sign-arvo)
|^ ^+ mo-core
?~ p.sign-arvo
(fail leaf+"gall: failed to build agent {<dap>}" ~)
@ -550,7 +549,7 @@
|= [=path =sign-arvo]
^+ mo-core
?> ?=([%lyv ~] path)
?> ?=([?(%b %c) %wris *] sign-arvo)
?> ?=([?(%behn %clay) %wris *] sign-arvo)
=/ bek=beak [our %home p.sign-arvo]
=/ nex=(list [=care:clay =^path]) ~(tap in q.sign-arvo)
~> %slog.[0 leaf+"gall: reloading agents"]
@ -577,7 +576,7 @@
^+ mo-core
::
?> ?=([%lag ~] path)
?> ?=([%a %clog *] sign-arvo)
?> ?=([%ames %clog *] sign-arvo)
::
=/ agents=(list term) ~(tap in ~(key by yokes.state))
|- ^+ mo-core
@ -600,7 +599,7 @@
=/ him (slav %p i.t.path)
=/ dap i.t.t.path
::
?> ?=([?(%g %b) %unto *] sign-arvo)
?> ?=([?(%gall %behn) %unto *] sign-arvo)
=/ =sign:agent +>.sign-arvo
::
?- -.sign
@ -633,7 +632,7 @@
=/ foreign-agent i.t.t.wire
::
?+ sign-arvo !!
[%a %done *]
[%ames %done *]
=^ remote-request outstanding.state
?~ t.t.t.wire
=/ full-wire sys+wire
@ -666,7 +665,7 @@
%missing (mo-give:(mo-give %unto %watch-ack err) %unto %poke-ack err)
==
::
[%a %boon *]
[%ames %boon *]
?^ t.t.t.wire
:: kill subscriptions which use the old wire format
::
@ -674,7 +673,7 @@
=/ =ames-response ;;(ames-response payload.sign-arvo)
(mo-handle-ames-response ames-response)
::
[%a %lost *]
[%ames %lost *]
:: note this should only happen on reverse bones, so only facts
:: and kicks
::
@ -711,7 +710,7 @@
?. =(nonce.u.yoke i.t.path)
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
mo-core
?. ?=([?(%g %b) %unto *] sign-arvo)
?. ?=([?(%gall %behn) %unto *] sign-arvo)
?: ?=(%| -.agent.u.yoke)
%- (slog leaf+"gall: {<dap>} dozing, dropping {<+<.sign-arvo>}" ~)
mo-core
@ -762,7 +761,7 @@
=/ card
?: ?=(%& -.blocker)
[%slip %g %deal sock dap p.blocker]
[%pass /clear-huck %b %huck %g %unto p.blocker]
[%pass /clear-huck %b %huck `sign-arvo`[%gall %unto p.blocker]]
[duct card]
$(moves [move moves])
:: +mo-filter-queue: remove all blocked tasks from ship.
@ -834,7 +833,7 @@
::
%raw-poke
=/ =case:clay da+now
=/ sky (ski [%141 %noun] ~ %cb [our %home case] /[mark.deal])
=/ sky (rof ~ %cb [our %home case] /[mark.deal])
?- sky
?(~ [~ ~])
=/ ror "gall: raw-poke fail :{(trip dap)} {<mark.deal>}"
@ -856,7 +855,7 @@
=/ =case:clay da+now
=/ =mars:clay [p.cage mark]:deal
=/ mars-path /[a.mars]/[b.mars]
=/ sky (ski [%141 %noun] ~ %cc [our %home case] mars-path)
=/ sky (rof ~ %cc [our %home case] mars-path)
?- sky
?(~ [~ ~])
=/ ror "gall: poke cast fail :{(trip dap)} {<mars>}"
@ -937,7 +936,7 @@
::
%d
=/ =case:clay da+now
=/ sky (ski [%141 %noun] ~ %cb [our %home case] /[mark.ames-response])
=/ sky (rof ~ %cb [our %home case] /[mark.ames-response])
?- sky
?(~ [~ ~])
=/ ror "gall: ames mark fail {<mark.ames-response>}"
@ -1103,7 +1102,7 @@
=/ =case:clay da+now
=/ bek=beak [our %home case]
=/ mars-path /[a.mars]/[b.mars]
=/ sky (ski [%141 %noun] ~ %cc bek mars-path)
=/ sky (rof ~ %cc bek mars-path)
?- sky
?(~ [~ ~])
%- (slog leaf+"watch-as fact conversion find-fail" >sky< ~)
@ -1264,7 +1263,7 @@
=/ tub=(unit tube:clay)
?: =(have want) `(bake same ^vase)
=/ tuc=(unit (unit cage))
(ski [%141 %noun] ~ %cc [our %home da+now] /[have]/[want])
(rof ~ %cc [our %home da+now] /[have]/[want])
?. ?=([~ ~ *] tuc) ~
`!<(tube:clay q.u.u.tuc)
?~ tub
@ -1527,7 +1526,7 @@
=. ap-core
(ap-pass wire %agent dock %leave ~)
=/ way [%out (scot %p p.dock) q.dock wire]
(ap-pass way %arvo %b %huck `sign-arvo`[%g %unto %kick ~])
(ap-pass way %arvo %b %huck `sign-arvo`[%gall %unto %kick ~])
:: +ap-mule: run virtualized with intercepted scry, preserving type
::
:: Compare +mute and +mule. Those pass through scry, which
@ -1539,7 +1538,7 @@
++ ap-mule
|= run=_^?(|.(*step:agent))
^- (each step:agent tang)
=/ res (mock [run %9 2 %0 1] (sloy ski))
=/ res (mock [run %9 2 %0 1] (look rof ~))
?- -.res
%0 [%& !<(step:agent [-:!>(*step:agent) p.res])]
%1 [%| (smyt ;;(path p.res)) ~]
@ -1550,7 +1549,7 @@
++ ap-mule-peek
|= run=_^?(|.(*(unit (unit cage))))
^- (each (unit (unit cage)) tang)
=/ res (mock [run %9 2 %0 1] (sloy ski))
=/ res (mock [run %9 2 %0 1] (look rof ~))
?- -.res
%0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])]
%1 [%| (smyt ;;(path p.res)) ~]
@ -1662,13 +1661,13 @@
::
++ call
~% %gall-call +> ~
|= [=duct dud=(unit goof) hic=(hypo (hobo task:able))]
|= [=duct dud=(unit goof) hic=(hobo task)]
^- [(list move) _gall-payload]
?^ dud
~|(%gall-call-dud (mean tang.u.dud))
::
~| [%gall-call-failed duct q.hic]
=/ =task:able ((harden task:able) q.hic)
~| [%gall-call-failed duct hic]
=/ =task ((harden task) hic)
::
=/ mo-core (mo-abed:mo duct)
?- -.task
@ -1708,9 +1707,9 @@
::
++ scry
~/ %gall-scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang care=term bem=beam]
^- (unit (unit cage))
=* care cyr
=/ =shop &/p.bem
=* dap q.bem
=/ =coin $/r.bem
@ -1770,7 +1769,7 @@
::
++ take
~/ %gall-take
|= [=wire =duct dud=(unit goof) typ=type syn=sign-arvo]
|= [=wire =duct dud=(unit goof) syn=sign-arvo]
^- [(list move) _gall-payload]
?^ dud
~&(%gall-take-dud ((slog tang.u.dud) [~ gall-payload]))
@ -1780,7 +1779,7 @@
~| [%gall-take-failed wire]
?> ?=([?(%sys %use) *] wire)
=< mo-abet
%. [t.wire ?:(?=([%b %heck *] syn) syn.syn syn)]
%. [t.wire ?:(?=([%behn %heck *] syn) syn.syn syn)]
?- i.wire
%sys mo-handle-sys:(mo-abed:mo duct)
%use mo-handle-use:(mo-abed:mo duct)

View File

@ -1,7 +1,7 @@
!:
:: http-client
::
|= pit=vase
|= our=ship
=, iris
::
::
@ -19,7 +19,7 @@
=duct
::
::
card=(wind note gift:able)
card=(wind note gift)
==
:: +note: private request from light to another vane
::
@ -102,7 +102,7 @@
:: +per-client-event: per-event client core
::
++ per-client-event
|= [[our=@p eny=@ =duct now=@da scry=sley] =state]
|= [[eny=@ =duct now=@da rof=roof] =state]
|%
:: +request: makes an external web request
::
@ -297,30 +297,22 @@
=| ax=axle
:: a vane is activated with current date, entropy, and a namespace function
::
|= [our=ship now=@da eny=@uvJ rof=roof]
=* scry-gate (en-sley rof)
|= [now=@da eny=@uvJ rof=roof]
:: allow jets to be registered within this core
::
~% %http-client ..is ~
~% %http-client ..part ~
|%
++ call
|= [=duct dud=(unit goof) type=* wrapped-task=(hobo task:able)]
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
^- [(list move) _light-gate]
::
=/ task=task:able ((harden task:able) wrapped-task)
=/ task=task ((harden task) wrapped-task)
::
:: error notifications "downcast" to %crud
:: XX handle error notifications
::
=? task ?=(^ dud)
~| %crud-in-crud
?< ?=(%crud -.task)
[%crud -.task tang.u.dud]
::
:: %crud: notifies us of an event failure
::
?: ?=(%crud -.task)
?^ dud
=/ moves=(list move)
[[duct %slip %d %flog task] ~]
[[duct %slip %d %flog %crud [-.task tang.u.dud]] ~]
[moves light-gate]
:: %trim: in response to memory pressure
::
@ -331,7 +323,7 @@
?: ?=(%vega -.task)
[~ light-gate]
::
=/ event-args [[our eny duct now scry-gate] state.ax]
=/ event-args [[eny duct now rof] state.ax]
=/ client (per-client-event event-args)
?- -.task
::
@ -371,7 +363,7 @@
:: http-client issues no requests to other vanes
::
++ take
|= [=wire =duct dud=(unit goof) wrapped-sign=*]
|= [=wire =duct dud=(unit goof) sign=*]
^- [(list move) _light-gate]
?< ?=(^ dud)
!!
@ -391,9 +383,10 @@
:: +scry: request a path in the urbit namespace
::
++ scry
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=* lot=coin $/r.bem

View File

@ -15,15 +15,14 @@
:: - scry namespace
:: - task for converting invites to tickets
::
|= pit=vase
|= our=ship
=, pki:jael
=, able:jael
=, jael
=, crypto
=, jael
=, ethereum
=, rpc
=, azimuth
=, point=point:able:jael
=, ethereum-types
=, azimuth-types
=, point=point:jael
:: ::::
:::: # models :: data structures
:: ::::
@ -79,16 +78,16 @@
+$ note :: out request $->
$~ [%a %plea *ship *plea:ames] ::
$% $: %a :: to %ames
$>(%plea task:able:ames) :: send request message
$>(%plea task:ames) :: send request message
== ::
$: %b :: to %behn
$>(%wait task:able:behn) :: set timer
$>(%wait task:behn) :: set timer
== ::
$: %e :: to %eyre
[%code-changed ~] :: notify code changed
== ::
$: %g :: to %gall
$>(%deal task:able:gall) :: talk to app
$>(%deal task:gall) :: talk to app
== ::
$: %j :: to self
$>(%listen task) :: set ethereum source
@ -98,20 +97,20 @@
== == == ::
:: ::
+$ sign :: in result $<-
$~ [%a %done ~] ::
$% $: %a ::
$% $>(%boon gift:able:ames) :: message response
$>(%done gift:able:ames) :: message (n)ack
$>(%lost gift:able:ames) :: lost boon
$~ [%behn %wake ~] ::
$% $: %ames ::
$% $>(%boon gift:ames) :: message response
$>(%done gift:ames) :: message (n)ack
$>(%lost gift:ames) :: lost boon
== == ::
$: %b ::
$>(%wake gift:able:behn) ::
$: %behn ::
$>(%wake gift:behn) ::
== ::
$: %g ::
$: %gall ::
$> $? %onto ::
%unto ::
== ::
gift:able:gall ::
gift:gall ::
==
== ::
-- ::
@ -145,7 +144,7 @@
:::: # heavy :: heavy engines
:: ::::
=>
~% %jael ..is ~
~% %jael ..part ~
|%
:: :: ++of
:::: ## main^heavy :: main engine
@ -174,11 +173,9 @@
:: vane interface when that gets cleaned up a bit.
::
=| moz=(list move)
=| $: $: :: our: identity
:: now: current time
=| $: $: :: now: current time
:: eny: unique entropy
::
our=ship
now=@da
eny=@uvJ
==
@ -291,7 +288,7 @@
::
=/ spon-points=(list [ship point])
%+ turn spon.tac
|= [=ship az-point=point:azimuth]
|= [=ship az-point=point:azimuth-types]
~| [%sponsor-point az-point]
?> ?=(^ net.az-point)
:* ship
@ -311,7 +308,7 @@
(~(gas by points) spon-points)
=. +>.$
%- curd =< abet
(public-keys:~(feel su hen our now pki etn) pos.zim.pki %full points)
(public-keys:~(feel su hen now pki etn) pos.zim.pki %full points)
::
:: start subscriptions
::
@ -322,21 +319,21 @@
::
?: &
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
(sources:~(feel su hen now pki etn) ~ [%| %azimuth-tracker])
::
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
(sources:~(feel su hen now pki etn) ~ [%| %azimuth-tracker])
::
*
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen our now pki etn)
%+ sources:~(feel su hen now pki etn)
(silt (turn spon-points head))
[%| %azimuth-tracker]
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%& (need spon-ship)])
(sources:~(feel su hen now pki etn) ~ [%& (need spon-ship)])
==
::
=. moz
@ -348,12 +345,11 @@
:: %jael init must be deferred (makes http requests)
::
^- (list move)
:~ [hen %give %init our]
[hen %slip %e %init our]
[hen %slip %d %init our]
[hen %slip %g %init our]
[hen %slip %c %init our]
[hen %slip %a %init our]
:~ [hen %slip %e %init ~]
[hen %slip %d %init ~]
[hen %slip %g %init ~]
[hen %slip %c %init ~]
[hen %slip %a %init ~]
==
+>.$
::
@ -390,12 +386,11 @@
=. moz
%+ weld moz
^- (list move)
:~ [hen %give %init our]
[hen %slip %e %init our]
[hen %slip %d %init our]
[hen %slip %g %init our]
[hen %slip %c %init our]
[hen %slip %a %init our]
:~ [hen %slip %e %init ~]
[hen %slip %d %init ~]
[hen %slip %g %init ~]
[hen %slip %c %init ~]
[hen %slip %a %init ~]
==
+>.$
::
@ -405,7 +400,7 @@
%listen
~& [%jael-listen whos source]:tac
%- curd =< abet
(sources:~(feel su hen our now pki etn) [whos source]:tac)
(sources:~(feel su hen now pki etn) [whos source]:tac)
::
:: cancel all trackers from duct
:: [%nuke whos=(set ship)]
@ -437,7 +432,7 @@
::
%rekey
%- curd =< abet
(private-keys:~(feel su hen our now pki etn) life.tac ring.tac)
(private-keys:~(feel su hen now pki etn) life.tac ring.tac)
::
:: update private keys
::
@ -449,7 +444,7 @@
~& [%not-our-moon ship.tac]
+>.$
%- curd =< abet
(~(new-event su hen our now pki etn) [ship udiff]~:tac)
(~(new-event su hen now pki etn) [ship udiff]~:tac)
::
:: rotate web login code
::
@ -464,7 +459,7 @@
::
%public-keys
%- curd =< abet
(~(public-keys ~(feed su hen our now pki etn) hen) ships.tac)
(~(public-keys ~(feed su hen now pki etn) hen) ships.tac)
::
:: seen after breach
:: [%meet our=ship who=ship]
@ -500,7 +495,7 @@
:: [%private-keys ~]
::
%private-keys
(curd abet:~(private-keys ~(feed su hen our now pki etn) hen))
(curd abet:~(private-keys ~(feed su hen now pki etn) hen))
::
:: authenticated remote request
:: [%west p=ship q=path r=*]
@ -532,25 +527,25 @@
|= [tea=wire hen=duct hin=sign]
^+ +>
?- hin
[%a %done *]
[%ames %done *]
?~ error.hin +>.$
~& [%done-bad tag.u.error.hin]
%- (slog tang.u.error.hin)
::TODO fail:et
+>.$
::
[%a %boon *]
[%ames %boon *]
=+ ;; [%public-keys-result =public-keys-result] payload.hin
%- curd =< abet
(public-keys:~(feel su hen our now pki etn) pos.zim.pki public-keys-result)
(public-keys:~(feel su hen now pki etn) pos.zim.pki public-keys-result)
::
[%a %lost *]
[%ames %lost *]
:: TODO: better error handling
::
~| %jael-ames-lost
!!
::
[%b %wake *]
[%behn %wake *]
?^ error.hin
%- %+ slog
leaf+"jael unable to resubscribe, run :azimuth-tracker|listen"
@ -561,13 +556,13 @@
=/ =source (~(got by sources.etn) source-id)
=/ ships (~(get ju ship-sources-reverse.etn) source-id)
%- curd =< abet
(sources:~(feel su hen our now pki etn) ships source)
(sources:~(feel su hen now pki etn) ships source)
::
[%g %onto *]
[%gall %onto *]
~& [%jael-onto tea hin]
+>.$
::
[%g %unto *]
[%gall %unto *]
?- +>-.hin
%kick ~|([%jael-unexpected-quit tea hin] !!)
%poke-ack
@ -587,7 +582,7 @@
=* app i.tea
=+ ;;(=udiffs:point q.q.cage.p.+>.hin)
%- curd =< abet
(~(new-event su hen our now pki etn) udiffs)
(~(new-event su hen now pki etn) udiffs)
==
==
:: :: ++curd:of
@ -612,7 +607,6 @@
::
=| moz=(list move)
=| $: hen=duct
our=ship
now=@da
state-pki-1
state-eth-node
@ -620,8 +614,8 @@
:: moz: moves in reverse order
:: pki: relative urbit state
::
=* pki ->+>-
=* etn ->+>+
=* pki ->+<
=* etn ->+>
|%
++ this-su .
:: :: ++abet:su
@ -671,7 +665,7 @@
?~ yez this-su
=* d i.yez
=. this-su
?. &(?=([[%a @ @ *] *] d) !=(%public-keys i.t.i.d))
?. &(?=([[%ames @ @ *] *] d) !=(%public-keys i.t.i.d))
%- emit
[d %give %public-keys public-keys-result]
%- emit
@ -978,13 +972,10 @@
:: lex: all durable %jael state
::
=| lex=state-1
|= $: ::
:: our: identity
:: now: current time
|= $: :: now: current time
:: eny: unique entropy
:: ski: namespace resolver
::
our=ship
now=@da
eny=@uvJ
rof=roof
@ -998,15 +989,15 @@
::
hen=duct
dud=(unit goof)
hic=(hypo (hobo task:able))
hic=(hobo task)
==
^- [(list move) _..^$]
?^ dud
~|(%jael-call-dud (mean tang.u.dud))
::
=/ =task:able ((harden task:able) q.hic)
=/ =task ((harden task) hic)
=^ did lex
abet:(~(call of [our now eny] lex) hen task)
abet:(~(call of [now eny] lex) hen task)
[did ..^$]
:: :: ++load
++ load :: upgrade
@ -1015,9 +1006,10 @@
..^$(lex old)
:: :: ++scry
++ scry :: inspect
|= [lyc=gang cyr=term bem=beam]
^- roon
|= [lyc=gang car=term bem=beam]
^- (unit (unit cage))
=* ren cyr
=* ren car
=* why=shop &/p.bem
=* syd q.bem
=* lot=coin $/r.bem
@ -1195,7 +1187,7 @@
?~ who [~ ~]
:^ ~ ~ %atom
!> ^- ship
(~(sein of [our now eny] lex) u.who)
(~(sein of [now eny] lex) u.who)
::
%saxo
?. ?=([@ ~] tyl) [~ ~]
@ -1205,7 +1197,7 @@
?~ who [~ ~]
:^ ~ ~ %noun
!> ^- (list ship)
(~(saxo of [our now eny] lex) u.who)
(~(saxo of [now eny] lex) u.who)
::
%subscriptions
?. ?=([@ ~] tyl) [~ ~]
@ -1235,12 +1227,12 @@
tea=wire
hen=duct
dud=(unit goof)
hin=(hypo sign)
hin=sign
==
^- [(list move) _..^$]
?^ dud
~|(%jael-take-dud (mean tang.u.dud))
::
=^ did lex abet:(~(take of [our now eny] lex) tea hen q.hin)
=^ did lex abet:(~(take of [now eny] lex) tea hen hin)
[did ..^$]
--

File diff suppressed because it is too large Load Diff

View File

@ -102,7 +102,7 @@
::
++ handle-arvo-response
|= [=wire =sign-arvo]
?> ?=([%b %wake *] sign-arvo)
?> ?=([%behn %wake *] sign-arvo)
?> ?=([@ *] wire)
=/ who (,@p (slav %p i.wire))
=^ cards piers

View File

@ -1,7 +1,7 @@
:: Pass-through Eyre driver
::
/- spider, *aquarium
/+ ph-io, util=ph-util, strandio
/+ ethereum, azimuth, ph-io, util=ph-util, strandio
=, strand=strand:spider
|%
+$ state
@ -191,14 +191,14 @@
==
::
++ number-to-hash
|= =number:block:able:jael
|= =number:block: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
|= =hash:block:jael
(add launch:contracts:azimuth (div hash 0x1.0000))
::
++ logs-by-range
@ -214,8 +214,8 @@
logs.state
::
++ logs-by-hash
|= =hash:block:able:jael
=/ =number:block:able:jael (hash-to-number hash)
|= =hash:block:jael
=/ =number:block:jael (hash-to-number hash)
(logs-by-range number number)
::
++ logs-to-json
@ -287,7 +287,7 @@
0w9N.5uIvA.Jg0cx.NCD2R.o~MtZ.uEQOB.9uTbp.6LHvg.0yYTP.
3q3td.T4UF0.d5sDL.JGpZq.S3A92.QUuWg.IHdw7.izyny.j9W92
(pit:nu:crub:crypto 512 (shaz (jam who life=1 %entropy)))
=/ =seed:able:jael
=/ =seed:jael
[who 1 sec:ex:cub ~]
=/ =pass pub:ex:cub
=/ com=tape
@ -299,8 +299,8 @@
==
::
++ dawn
|= [who=ship seed=(unit seed:able:jael)]
^- dawn-event:able:jael
|= [who=ship seed=(unit seed:jael)]
^- dawn-event:jael
=/ spon=(list [ship point:azimuth])
%- flop
|- ^- (list [ship point:azimuth])
@ -322,7 +322,7 @@
?: ?=(%czar (clan:title ship))
[a-point]~
[a-point $(who ship)]
=/ =seed:able:jael
=/ =seed:jael
?^ seed
u.seed
=/ life-rift (~(got by lives.state) who)

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