Merge remote-tracking branch 'origin/dist' into lf/nu-hark-store

This commit is contained in:
Liam Fitzgerald 2021-09-06 14:34:46 +10:00
commit f24fbe3eba
145 changed files with 397 additions and 6564 deletions

View File

@ -18,17 +18,26 @@
$: starting=(map yarn [=trying =vase])
running=trie
tid=(map tid yarn)
serving=(map tid [@ta =mark])
serving=(map tid [@ta =mark =desk])
==
::
+$ clean-slate-any
$^ clean-slate-ket
$% clean-slate-sig
clean-slate-1
clean-slate-2
clean-slate
==
::
+$ clean-slate
$: %3
starting=(map yarn [=trying =vase])
running=(list yarn)
tid=(map tid yarn)
serving=(map tid [@ta =mark =desk])
==
::
+$ clean-slate-2
$: %2
starting=(map yarn [=trying =vase])
running=(list yarn)
@ -158,9 +167,11 @@
=+ !<(any=clean-slate-any old-state)
=? any ?=(^ -.any) (old-to-1 any)
=? any ?=(~ -.any) (old-to-1 any)
=^ upgrade-cards any
=^ cards-to-2 any
(old-to-2 any)
?> ?=(%2 -.any)
=^ cards-to-3 any
(old-to-3 any)
?> ?=(%3 -.any)
::
=. tid.state tid.any
=/ yarns=(list yarn)
@ -173,7 +184,7 @@
(handle-stop-thread:sc (yarn-to-tid i.yarns) |)
=^ cards-2 this
$(yarns t.yarns)
[:(weld upgrade-cards cards-1 cards-2) this]
[:(weld cards-to-2 cards-to-3 cards-1 cards-2) this]
::
++ old-to-1
|= old=clean-slate-ket
@ -182,9 +193,9 @@
::
++ old-to-2
|= old=clean-slate-any
^- (quip card clean-slate)
?> ?=(?(%1 %2) -.old)
?: ?=(%2 -.old)
^- (quip card clean-slate-any)
?> ?=(?(%1 %2 %3) -.old)
?: ?=(?(%2 %3) -.old)
`old
:- ~[bind-eyre:sc]
:* %2
@ -193,6 +204,23 @@
tid.old
~
==
::
++ old-to-3
|= old=clean-slate-any
^- (quip card clean-slate)
?> ?=(?(%2 %3) -.old)
?: ?=(%3 -.old)
`old
:- ~
:* %3
starting.old
running.old
tid.old
%- ~(gas by *(map tid [@ta =mark =desk]))
%+ turn ~(tap by serving.old)
|=([=tid id=@ta =mark] [tid id mark q.byk.bowl])
==
--
::
++ on-poke
@ -295,7 +323,7 @@
=* output-mark i.t.t.t.t.site.url
=/ =tid (new-thread-id thread)
=. serving.state
(~(put by serving.state) tid [eyre-id output-mark])
(~(put by serving.state) tid [eyre-id output-mark desk])
:: TODO: speed this up somehow. we spend about 15ms in this arm alone
::
=+ .^
@ -490,7 +518,7 @@
=- (fall - `state)
%+ bind
(~(get by serving.state) tid)
|= [eyre-id=@ta output=mark]
|= [eyre-id=@ta output=mark =desk]
:_ state(serving (~(del by serving.state) tid))
%+ give-simple-payload:app:server eyre-id
^- simple-payload:http
@ -520,11 +548,11 @@
=- (fall - `state)
%+ bind
(~(get by serving.state) tid)
|= [eyre-id=@ta output=mark]
|= [eyre-id=@ta output=mark =desk]
=+ .^
=tube:clay
%cc
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[output]/json
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/[output]/json
==
:_ state(serving (~(del by serving.state) tid))
%+ give-simple-payload:app:server eyre-id
@ -602,5 +630,5 @@
::
++ clean-state
!> ^- clean-slate
2+state(running (turn (tap-yarn running.state) head))
3+state(running (turn (tap-yarn running.state) head))
--

View File

@ -1 +0,0 @@
../../base-dev/lib/docket.hoon

View File

@ -1 +0,0 @@
../../base-dev/mar/docket.hoon

View File

@ -1 +0,0 @@
../../base-dev/sur/docket.hoon

View File

@ -1,218 +0,0 @@
/- *bill
=, clay
=* dude dude:gall
|%
:: $diff: subscription update
::
+$ diff
$% [%block =desk =arak =weft blockers=(set desk)]
[%reset =desk =arak]
[%merge =desk =arak]
[%merge-sunk =desk =arak =tang]
[%merge-fail =desk =arak =tang]
[%suspend =desk =arak]
[%revive =desk =arak]
==
:: $arak: foreign vat tracker
::
:: .next is a list of pending commits with future kelvins
::
+$ arak
$: =ship
=desk
=aeon
next=(list [=aeon =weft])
=rein
==
:: $rein: diff from desk manifest
::
:: .liv: suspended?
:: .add: agents not in manifest that should be running
:: .sub: agents in manifest that should not be running
::
+$ rein
$: liv=_&
add=(set dude)
sub=(set dude)
==
::
+$ vat [=desk hash=@uv =cass =arak]
:: +report-vats: report on all desk installations
::
++ report-vats
|= [our=@p now=@da]
^- tang
=+ .^ raz=(list vat)
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
==
(turn raz |=(v=vat (report-vat our now v)))
:: +report-vat: report on a single desk installation
::
++ report-vat
|= [our=ship now=@da vat]
^- tank
=+ .^(=weft %cx /(scot %p our)/[desk]/(scot %da now)/sys/kelvin)
:+ %rose ["" "{<desk>}" "::"]
^- tang
=- ?: =(~ next.arak) -
%+ snoc -
leaf/"pending: {<(turn next.arak |=([@ lal=@tas num=@] [lal num]))>}"
^- tang
=/ meb (mergebase-hashes our desk now arak)
=/ sat ?:(liv.rein.arak "running" "suspended")
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}"
leaf/"source ship: {<ship.arak>}"
leaf/"source desk: {<desk.arak>}"
leaf/"source aeon: {<aeon.arak>}"
leaf/"status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
==
:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
::
++ read-kelvin-foreign
|= [=ship =desk =aeon]
^- weft
=/ her (scot %p ship)
=/ syd (scot %tas desk)
=/ yon (scot %ud aeon)
::
=/ dom .^(dome cv/~[her syd yon])
=/ tak (scot %uv (~(got by hit.dom) let.dom))
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
=/ bob .^(blob cs/~[her syd yon %blob lob])
::
;; weft
?- -.bob
%direct q.q.bob
%delta q.r.bob
==
:: +read-kelvin-local: read /sys/kelvin from a local desk
::
++ read-kelvin-local
|= [our=ship =desk now=@da]
^- (unit weft)
=/ pax (en-beam [our desk da+now] /sys/kelvin)
?~ =<(fil .^(arch cy/pax))
~
[~ .^(weft cx/pax)]
:: +read-bill: read contents of /desk/bill manifest
::
++ read-bill
|= [our=ship =desk now=@da]
=/ pax (en-beam [our desk da+now] /desk/bill)
?~ =<(fil .^(arch cy/pax))
*bill
.^(bill cx/pax)
:: +is-fish: should dill link .dude?
::
++ is-fish |=([=dude =bill] .?((find ~[dude] (read-fish bill))))
:: +get-apps-diff: which agents should be started and stopped
::
++ get-apps-diff
|= [our=ship =desk now=@da =rein]
^- [liv=(list dude) ded=(list dude)]
=/ =bill (read-bill our desk now)
=/ wan (sy (get-apps-want bill rein))
=/ hav (sy (get-apps-live our desk now))
=/ liv ~(tap in (~(dif in wan) hav))
=/ ded ~(tap in (~(dif in hav) wan))
[liv ded]
::
++ get-apps-live
|= [our=ship =desk now=@da]
^- (list dude)
%+ murn (get-apps-have our desk now)
|=([=dude live=?] ?.(live ~ `dude))
:: +get-apps-have: find which apps Gall is running on a desk
::
++ get-apps-have
|= [our=ship =desk now=@da]
^- (list [=dude live=?])
%~ tap in
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
:: +get-apps-want: find which apps should be running on a desk
::
++ get-apps-want
|= [=bill =rein]
^- (list dude)
=/ duz (read-apes bill)
=. duz (skip duz ~(has in sub.rein))
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
duz
::
++ mergebase-hashes
|= [our=@p =desk now=@da =arak]
=/ her (scot %p ship.arak)
=/ ego (scot %p our)
=/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
::
++ enjs
=, enjs:format
|%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim
|= t=@
^- json
(numb (fall (mole |.((unm:chrono:userlib t))) 0))
::
++ cass
|= c=^cass
%- pairs
:~ ud+(numb ud.c)
da+(tim da.c)
==
::
++ vat
|= v=^vat
%- pairs
:~ desk+s+desk.v
hash+s+(scot %uv hash.v)
cass+(cass cass.v)
arak+(arak arak.v)
==
::
++ weft
|= w=^weft
%- pairs
:~ name+s+lal.w
kelvin+(numb num.w)
==
::
++ woof
|= w=[=aeon =^weft]
%- pairs
:~ aeon+(numb aeon.w)
weft+(weft weft.w)
==
::
++ rein
|= r=^rein
%- pairs
:~ add+a+(turn ~(tap in add.r) (lead %s))
sub+a+(turn ~(tap in sub.r) (lead %s))
==
::
++ arak
|= a=^arak
%- pairs
:~ ship+s+(scot %p ship.a)
desk+s+desk.a
aeon+(numb aeon.a)
next+a+(turn next.a woof)
rein+(rein rein.a)
==
--
--

1
pkg/arvo/sur/hood.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/hood.hoon

218
pkg/base-dev/sur/hood.hoon Normal file
View File

@ -0,0 +1,218 @@
/- *bill
=, clay
=* dude dude:gall
|%
:: $diff: subscription update
::
+$ diff
$% [%block =desk =arak =weft blockers=(set desk)]
[%reset =desk =arak]
[%merge =desk =arak]
[%merge-sunk =desk =arak =tang]
[%merge-fail =desk =arak =tang]
[%suspend =desk =arak]
[%revive =desk =arak]
==
:: $arak: foreign vat tracker
::
:: .next is a list of pending commits with future kelvins
::
+$ arak
$: =ship
=desk
=aeon
next=(list [=aeon =weft])
=rein
==
:: $rein: diff from desk manifest
::
:: .liv: suspended?
:: .add: agents not in manifest that should be running
:: .sub: agents in manifest that should not be running
::
+$ rein
$: liv=_&
add=(set dude)
sub=(set dude)
==
::
+$ vat [=desk hash=@uv =cass =arak]
:: +report-vats: report on all desk installations
::
++ report-vats
|= [our=@p now=@da]
^- tang
=+ .^ raz=(list vat)
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
==
(turn raz |=(v=vat (report-vat our now v)))
:: +report-vat: report on a single desk installation
::
++ report-vat
|= [our=ship now=@da vat]
^- tank
=+ .^(=weft %cx /(scot %p our)/[desk]/(scot %da now)/sys/kelvin)
:+ %rose ["" "{<desk>}" "::"]
^- tang
=- ?: =(~ next.arak) -
%+ snoc -
leaf/"pending: {<(turn next.arak |=([@ lal=@tas num=@] [lal num]))>}"
^- tang
=/ meb (mergebase-hashes our desk now arak)
=/ sat ?:(liv.rein.arak "running" "suspended")
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}"
leaf/"source ship: {<ship.arak>}"
leaf/"source desk: {<desk.arak>}"
leaf/"source aeon: {<aeon.arak>}"
leaf/"status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
==
:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
::
++ read-kelvin-foreign
|= [=ship =desk =aeon]
^- weft
=/ her (scot %p ship)
=/ syd (scot %tas desk)
=/ yon (scot %ud aeon)
::
=/ dom .^(dome cv/~[her syd yon])
=/ tak (scot %uv (~(got by hit.dom) let.dom))
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
=/ bob .^(blob cs/~[her syd yon %blob lob])
::
;; weft
?- -.bob
%direct q.q.bob
%delta q.r.bob
==
:: +read-kelvin-local: read /sys/kelvin from a local desk
::
++ read-kelvin-local
|= [our=ship =desk now=@da]
^- (unit weft)
=/ pax (en-beam [our desk da+now] /sys/kelvin)
?~ =<(fil .^(arch cy/pax))
~
[~ .^(weft cx/pax)]
:: +read-bill: read contents of /desk/bill manifest
::
++ read-bill
|= [our=ship =desk now=@da]
=/ pax (en-beam [our desk da+now] /desk/bill)
?~ =<(fil .^(arch cy/pax))
*bill
.^(bill cx/pax)
:: +is-fish: should dill link .dude?
::
++ is-fish |=([=dude =bill] .?((find ~[dude] (read-fish bill))))
:: +get-apps-diff: which agents should be started and stopped
::
++ get-apps-diff
|= [our=ship =desk now=@da =rein]
^- [liv=(list dude) ded=(list dude)]
=/ =bill (read-bill our desk now)
=/ wan (sy (get-apps-want bill rein))
=/ hav (sy (get-apps-live our desk now))
=/ liv ~(tap in (~(dif in wan) hav))
=/ ded ~(tap in (~(dif in hav) wan))
[liv ded]
::
++ get-apps-live
|= [our=ship =desk now=@da]
^- (list dude)
%+ murn (get-apps-have our desk now)
|=([=dude live=?] ?.(live ~ `dude))
:: +get-apps-have: find which apps Gall is running on a desk
::
++ get-apps-have
|= [our=ship =desk now=@da]
^- (list [=dude live=?])
%~ tap in
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
:: +get-apps-want: find which apps should be running on a desk
::
++ get-apps-want
|= [=bill =rein]
^- (list dude)
=/ duz (read-apes bill)
=. duz (skip duz ~(has in sub.rein))
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
duz
::
++ mergebase-hashes
|= [our=@p =desk now=@da =arak]
=/ her (scot %p ship.arak)
=/ ego (scot %p our)
=/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
::
++ enjs
=, enjs:format
|%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim
|= t=@
^- json
(numb (fall (mole |.((unm:chrono:userlib t))) 0))
::
++ cass
|= c=^cass
%- pairs
:~ ud+(numb ud.c)
da+(tim da.c)
==
::
++ vat
|= v=^vat
%- pairs
:~ desk+s+desk.v
hash+s+(scot %uv hash.v)
cass+(cass cass.v)
arak+(arak arak.v)
==
::
++ weft
|= w=^weft
%- pairs
:~ name+s+lal.w
kelvin+(numb num.w)
==
::
++ woof
|= w=[=aeon =^weft]
%- pairs
:~ aeon+(numb aeon.w)
weft+(weft weft.w)
==
::
++ rein
|= r=^rein
%- pairs
:~ add+a+(turn ~(tap in add.r) (lead %s))
sub+a+(turn ~(tap in sub.r) (lead %s))
==
::
++ arak
|= a=^arak
%- pairs
:~ ship+s+(scot %p ship.a)
desk+s+desk.a
aeon+(numb aeon.a)
next+a+(turn next.a woof)
rein+(rein rein.a)
==
--
--

1
pkg/garden/lib/agentio.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/agentio.hoon

1
pkg/garden/lib/azimuth.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/azimuth.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/azimuthio.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b158.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b173.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b174.hoon

1
pkg/garden/lib/bip32.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/bip32.hoon

1
pkg/garden/lib/bip39.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/bip39.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip39/english.hoon

1
pkg/garden/lib/dbug.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/dbug.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/default-agent.hoon

1
pkg/garden/lib/docket.hoon Symbolic link
View File

@ -0,0 +1 @@
../../garden-dev/lib/docket.hoon

1
pkg/garden/lib/ethio.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/ethio.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/build.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/complete.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/easy-print.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/json.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/parser.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/language-server/rune-snippet.hoon

1
pkg/garden/lib/server.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/server.hoon

1
pkg/garden/lib/shoe.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/shoe.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/skeleton.hoon

1
pkg/garden/lib/sole.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/sole.hoon

1
pkg/garden/lib/strand.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/strand.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/strandio.hoon

1
pkg/garden/lib/treaty.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/treaty.hoon

1
pkg/garden/lib/verb.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/verb.hoon

1
pkg/garden/mar/belt.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/belt.hoon

1
pkg/garden/mar/bill.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/bill.hoon

1
pkg/garden/mar/blit.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/blit.hoon

View File

@ -1,25 +0,0 @@
/+ dock=docket
|_ =docket:dock
++ grow
|%
++ mime
^- ^mime
[/text/x-docket (as-octt:mimes:html (spit-docket:mime:dock docket))]
++ noun docket
++ json (docket:enjs:dock docket)
--
++ grab
|%
::
++ mime
|= [=mite len=@ud tex=@]
^- docket:dock
%- need
%- from-clauses:mime:dock
!<((list clause:dock) (slap !>(~) (ream tex)))
::
++ noun docket:dock
--
++ grad %noun
--

1
pkg/garden/mar/docket.hoon Symbolic link
View File

@ -0,0 +1 @@
../../garden-dev/mar/docket.hoon

1
pkg/garden/mar/hoon.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/hoon.hoon

1
pkg/garden/mar/htm.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/htm.hoon

1
pkg/garden/mar/html.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/html.hoon

1
pkg/garden/mar/httr.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/httr.hoon

1
pkg/garden/mar/hymn.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/hymn.hoon

1
pkg/garden/mar/js.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/js.hoon

1
pkg/garden/mar/json.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/json.hoon

View File

@ -0,0 +1 @@
../../../../base-dev/mar/json/rpc/response.hoon

1
pkg/garden/mar/kelvin.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/kelvin.hoon

View File

@ -0,0 +1 @@
../../../../base-dev/mar/language-server/rpc/notification.hoon

View File

@ -0,0 +1 @@
../../../../base-dev/mar/language-server/rpc/request.hoon

View File

@ -0,0 +1 @@
../../../../base-dev/mar/language-server/rpc/response.hoon

1
pkg/garden/mar/mime.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/mime.hoon

1
pkg/garden/mar/noun.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/noun.hoon

1
pkg/garden/mar/path.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/path.hoon

1
pkg/garden/mar/png.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/png.hoon

1
pkg/garden/mar/purl.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/purl.hoon

View File

@ -0,0 +1 @@
../../../base-dev/mar/sole/action.hoon

View File

@ -0,0 +1 @@
../../../base-dev/mar/sole/effect.hoon

1
pkg/garden/mar/svg.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/svg.hoon

1
pkg/garden/mar/tang.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/tang.hoon

1
pkg/garden/mar/tape.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/tape.hoon

View File

@ -0,0 +1 @@
../../base-dev/mar/txt-diff.hoon

1
pkg/garden/mar/txt.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/txt.hoon

1
pkg/garden/mar/udon.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/udon.hoon

1
pkg/garden/mar/umd.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/umd.hoon

1
pkg/garden/mar/urb.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/urb.hoon

1
pkg/garden/mar/urbit.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/urbit.hoon

1
pkg/garden/mar/woff2.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/woff2.hoon

1
pkg/garden/mar/xml.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/xml.hoon

1
pkg/garden/sur/bill.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/bill.hoon

1
pkg/garden/sur/docket.hoon Symbolic link
View File

@ -0,0 +1 @@
../../garden-dev/sur/docket.hoon

View File

@ -1,206 +0,0 @@
/- *bill
=, clay
=* dude dude:gall
|%
:: $diff: subscription update
::
+$ diff
$% [%block =desk =arak =weft blockers=(set desk)]
[%reset =desk =arak]
[%merge =desk =arak]
[%merge-sunk =desk =arak =tang]
[%merge-fail =desk =arak =tang]
[%suspend =desk =arak]
[%revive =desk =arak]
==
:: $arak: foreign vat tracker
::
:: .next is a list of pending commits with future kelvins
::
+$ arak
$: =ship
=desk
=aeon
next=(list [=aeon =weft])
=rein
==
:: $rein: diff from desk manifest
::
:: .liv: suspended?
:: .add: agents not in manifest that should be running
:: .sub: agents in manifest that should not be running
::
+$ rein
$: liv=_&
add=(set dude)
sub=(set dude)
==
::
+$ vat [=desk hash=@uv =cass =arak]
:: +report-vats: report on all desk installations
::
++ report-vats
|= [our=@p now=@da]
^- tang
=+ .^ raz=(list vat)
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
==
(turn raz |=(v=vat (report-vat our now v)))
:: +report-vat: report on a single desk installation
::
++ report-vat
|= [our=ship now=@da vat]
^- tank
=+ .^(=weft %cx /(scot %p our)/[desk]/(scot %da now)/sys/kelvin)
:+ %rose ["" "{<desk>}" "::"]
^- tang
=- ?: =(~ next.arak) -
%+ snoc -
leaf/"pending: {<(turn next.arak |=([@ lal=@tas num=@] [lal num]))>}"
^- tang
=/ meb (mergebase-hashes our desk now arak)
=/ sat ?:(liv.rein.arak "running" "suspended")
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}"
leaf/"remote aeon: {<aeon.arak>}"
leaf/"status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
==
::
++ read-kelvin-foreign
|= [=ship =desk =aeon]
^- weft
=/ her (scot %p ship)
=/ syd (scot %tas desk)
=/ yon (scot %ud aeon)
::
=/ dom .^(dome cv/~[her syd yon])
=/ tak (scot %uv (~(got by hit.dom) let.dom))
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
=/ bob .^(blob cs/~[her syd yon %blob lob])
::
;; weft
?- -.bob
%direct q.q.bob
%delta q.r.bob
==
:: +read-bill: read contents of /desk/bill manifest
::
++ read-bill
|= [our=ship =desk now=@da]
=/ pax (en-beam [our desk da+now] /desk/bill)
?~ =<(fil .^(arch cy/pax))
*bill
.^(bill cx/pax)
:: +is-fish: should dill link .dude?
::
++ is-fish |=([=dude =bill] .?((find ~[dude] (read-fish bill))))
:: +get-apps-diff: which agents should be started and stopped
::
++ get-apps-diff
|= [our=ship =desk now=@da =rein]
^- [liv=(list dude) ded=(list dude)]
=/ =bill (read-bill our desk now)
=/ wan (sy (get-apps-want bill rein))
=/ hav (sy (get-apps-live our desk now))
=/ liv ~(tap in (~(dif in wan) hav))
=/ ded ~(tap in (~(dif in hav) wan))
[liv ded]
::
++ get-apps-live
|= [our=ship =desk now=@da]
^- (list dude)
%+ murn (get-apps-have our desk now)
|=([=dude live=?] ?.(live ~ `dude))
:: +get-apps-have: find which apps Gall is running on a desk
::
++ get-apps-have
|= [our=ship =desk now=@da]
^- (list [=dude live=?])
%~ tap in
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
:: +get-apps-want: find which apps should be running on a desk
::
++ get-apps-want
|= [=bill =rein]
^- (list dude)
=/ duz (read-apes bill)
=. duz (skip duz ~(has in sub.rein))
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
duz
::
++ mergebase-hashes
|= [our=@p =desk now=@da =arak]
=/ her (scot %p ship.arak)
=/ ego (scot %p our)
=/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
::
++ enjs
=, enjs:format
|%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim
|= t=@
^- json
(numb (fall (mole |.((unm:chrono:userlib t))) 0))
::
++ cass
|= c=^cass
%- pairs
:~ ud+(numb ud.c)
da+(tim da.c)
==
::
++ vat
|= v=^vat
%- pairs
:~ desk+s+desk.v
hash+s+(scot %uv hash.v)
cass+(cass cass.v)
arak+(arak arak.v)
==
::
++ weft
|= w=^weft
%- pairs
:~ name+s+lal.w
kelvin+(numb num.w)
==
::
++ woof
|= w=[=aeon =^weft]
%- pairs
:~ aeon+(numb aeon.w)
weft+(weft weft.w)
==
::
++ rein
|= r=^rein
%- pairs
:~ add+a+(turn ~(tap in add.r) (lead %s))
sub+a+(turn ~(tap in sub.r) (lead %s))
==
::
++ arak
|= a=^arak
%- pairs
:~ ship+s+(scot %p ship.a)
desk+s+desk.a
aeon+(numb aeon.a)
next+a+(turn next.a woof)
rein+(rein rein.a)
==
--
--

1
pkg/garden/sur/hood.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/hood.hoon

1
pkg/garden/sur/sole.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/sole.hoon

1
pkg/garden/sur/spider.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/spider.hoon

1
pkg/garden/sur/verb.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/sur/verb.hoon

View File

@ -135,7 +135,7 @@
^- (quip card (unit vase))
=/ transform
%. *indexed-post:store
.^(post-transform (scry:hc %cf %home /[u.mark]/transform-add-nodes))
.^(post-transform (scry:hc %cf q.byk.bowl /[u.mark]/transform-add-nodes))
=/ [* result=(list [index:store node:store])]
%+ roll
(flatten-node-map ~(tap by nodes.q.update))
@ -303,7 +303,7 @@
[[%no %no %no] ~]
=/ key [u.mark (perm-mark-name perm)]
=/ convert
.^(post-to-permission (scry %cf %home /[u.mark]/(perm-mark-name perm)))
.^(post-to-permission (scry %cf q.byk.bowl /[u.mark]/(perm-mark-name perm)))
:- ((convert indexed-post) vip)
%- zing
:~ ?: (~(has by graph-to-mark.cache) resource)

View File

@ -1,139 +0,0 @@
=>
|%
++ card card:agent:gall
--
::
|_ =bowl:gall
++ scry
|= [desk=@tas =path]
%+ weld
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
path
::
++ pass
|_ =wire
++ poke
|= [=dock =cage]
[%pass wire %agent dock %poke cage]
::
++ poke-our
|= [app=term =cage]
^- card
(poke [our.bowl app] cage)
::
++ poke-self
|= =cage
^- card
(poke-our dap.bowl cage)
::
++ arvo
|= =note-arvo
^- card
[%pass wire %arvo note-arvo]
::
++ watch
|= [=dock =path]
[%pass (watch-wire path) %agent dock %watch path]
::
++ watch-our
|= [app=term =path]
(watch [our.bowl app] path)
::
++ watch-wire
|= =path
^+ wire
?. ?=(~ wire)
wire
agentio-watch+path
::
++ leave
|= =dock
[%pass wire %agent dock %leave ~]
::
++ leave-our
|= app=term
(leave our.bowl app)
::
++ leave-path
|= [=dock =path]
=. wire
(watch-wire path)
(leave dock)
::
++ wait
|= p=@da
(arvo %b %wait p)
::
++ rest
|= p=@da
(arvo %b %wait p)
::
++ warp
|= [wer=ship =riff:clay]
(arvo %c %warp wer riff)
::
++ warp-our
|= =riff:clay
(warp our.bowl riff)
::
:: right here, right now
++ warp-slim
|= [genre=?(%sing %next) =care:clay =path]
=/ =mood:clay
[care r.byk.bowl path]
=/ =rave:clay
?:(?=(%sing genre) [genre mood] [genre mood])
(warp-our q.byk.bowl `rave)
::
++ connect
|= [=binding:eyre app=term]
(arvo %e %connect binding app)
--
::
++ fact-curry
|* [=mark =mold]
|= [paths=(list path) fac=mold]
(fact mark^!>(fac) paths)
::
++ fact-kick
|= [=path =cage]
^- (list card)
:~ (fact cage ~[path])
(kick ~[path])
==
::
++ fact-init
|= =cage
^- card
[%give %fact ~ cage]
::
++ fact-init-kick
|= =cage
^- (list card)
:~ (fact cage ~)
(kick ~)
==
::
++ fact
|= [=cage paths=(list path)]
^- card
[%give %fact paths cage]
::
++ fact-all
|= =cage
^- (unit card)
=/ paths=(set path)
%- ~(gas in *(set path))
%+ turn ~(tap by sup.bowl)
|=([duct ship =path] path)
?: =(~ paths) ~
`(fact cage ~(tap in paths))
::
++ kick
|= paths=(list path)
[%give %kick paths ~]
::
++ kick-only
|= [=ship paths=(list path)]
[%give %kick paths `ship]
--

View File

@ -0,0 +1 @@
../../base-dev/lib/agentio.hoon

View File

@ -1,454 +0,0 @@
:: azimuth: constants and utilities
::
/+ 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
--
::
:: Local contract addresses
::
:: These addresses are only reproducible if you use the deploy
:: script in bridge
::
++ local-contracts
|%
++ ecliptic
0x56db.68f2.9203.ff44.a803.faa2.404a.44ec.bb7a.7480
++ azimuth
0x863d.9c2e.5c4c.1335.96cf.ac29.d552.55f0.d0f8.6381
++ delegated-sending
0xb71c.0b6c.ee1b.cae5.6dfe.95cd.9d3e.41dd.d7ea.fc43
++ linear-star-release
0x3c3.dc12.be65.8158.d1d7.f9e6.6e08.ec40.99c5.68e4
++ conditional-star-release
0x35eb.3b10.2d9c.1b69.ac14.69c1.b1fe.1799.850c.d3eb
++ launch 0
++ public 0
--
::
:: ++ 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
==
::
:: spawn state
::
?. ?=(?(%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)
--
::
++ 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]]
==
--
--

View File

@ -0,0 +1 @@
../../base-dev/lib/azimuth.hoon

View File

@ -1,146 +0,0 @@
/- 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

@ -0,0 +1 @@
../../base-dev/lib/azimuthio.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b158.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b173.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip/b174.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/bip32.hoon

View File

@ -0,0 +1 @@
../../base-dev/lib/bip39.hoon

View File

@ -0,0 +1 @@
../../../base-dev/lib/bip39/english.hoon

View File

@ -1,155 +0,0 @@
:: dbug: agent wrapper for generic debugging tools
::
:: usage: %-(agent:dbug your-agent)
::
|%
+$ poke
$% [%bowl ~]
[%state grab=cord]
[%incoming =about]
[%outgoing =about]
==
::
+$ about
$@ ~
$% [%ship =ship]
[%path =path]
[%wire =wire]
[%term =term]
==
::
++ agent
|= =agent:gall
^- agent:gall
!.
|_ =bowl:gall
+* this .
ag ~(. agent bowl)
::
++ on-poke
|= [=mark =vase]
^- (quip card:agent:gall agent:gall)
?. ?=(%dbug mark)
=^ cards agent (on-poke:ag mark vase)
[cards this]
=/ dbug
!<(poke vase)
=; =tang
((%*(. slog pri 1) tang) [~ this])
?- -.dbug
%bowl [(sell !>(bowl))]~
::
%state
=? grab.dbug =('' grab.dbug) '-'
=; product=^vase
[(sell product)]~
=/ state=^vase
:: if the underlying app has implemented a /dbug/state scry endpoint,
:: use that vase in place of +on-save's.
::
=/ result=(each ^vase tang)
(mule |.(q:(need (need (on-peek:ag /x/dbug/state)))))
?:(?=(%& -.result) p.result on-save:ag)
%+ slap
(slop state !>([bowl=bowl ..zuse]))
(ream grab.dbug)
::
%incoming
=; =tang
?^ tang tang
[%leaf "no matching subscriptions"]~
%+ murn
%+ sort ~(tap by sup.bowl)
|= [[* a=[=ship =path]] [* b=[=ship =path]]]
(aor [path ship]:a [path ship]:b)
|= [=duct [=ship =path]]
^- (unit tank)
=; relevant=?
?. relevant ~
`>[path=path from=ship duct=duct]<
?: ?=(~ about.dbug) &
?- -.about.dbug
%ship =(ship ship.about.dbug)
%path ?=(^ (find path.about.dbug path))
%wire %+ lien duct
|=(=wire ?=(^ (find wire.about.dbug wire)))
%term !!
==
::
%outgoing
=; =tang
?^ tang tang
[%leaf "no matching subscriptions"]~
%+ murn
%+ sort ~(tap by wex.bowl)
|= [[[a=wire *] *] [[b=wire *] *]]
(aor a b)
|= [[=wire =ship =term] [acked=? =path]]
^- (unit tank)
=; relevant=?
?. relevant ~
`>[wire=wire agnt=[ship term] path=path ackd=acked]<
?: ?=(~ about.dbug) &
?- -.about.dbug
%ship =(ship ship.about.dbug)
%path ?=(^ (find path.about.dbug path))
%wire ?=(^ (find wire.about.dbug wire))
%term =(term term.about.dbug)
==
==
::
++ on-peek
|= =path
^- (unit (unit cage))
?. ?=([@ %dbug *] path)
(on-peek:ag path)
?+ path [~ ~]
[%u %dbug ~] ``noun+!>(&)
[%x %dbug %state ~] ``noun+!>(on-save:ag)
[%x %dbug %subscriptions ~] ``noun+!>([wex sup]:bowl)
==
::
++ on-init
^- (quip card:agent:gall agent:gall)
=^ cards agent on-init:ag
[cards this]
::
++ on-save on-save:ag
::
++ on-load
|= old-state=vase
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-load:ag old-state)
[cards this]
::
++ on-watch
|= =path
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-watch:ag path)
[cards this]
::
++ on-leave
|= =path
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-leave:ag path)
[cards this]
::
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-agent:ag wire sign)
[cards this]
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-arvo:ag wire sign-arvo)
[cards this]
::
++ on-fail
|= [=term =tang]
^- (quip card:agent:gall agent:gall)
=^ cards agent (on-fail:ag term tang)
[cards this]
--
--

1
pkg/landscape/lib/dbug.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/lib/dbug.hoon

View File

@ -1,69 +0,0 @@
/+ skeleton
|* [agent=* help=*]
?: ?=(%& help)
~| %default-agent-helpfully-crashing
skeleton
|_ =bowl:gall
++ on-init
`agent
::
++ on-save
!>(~)
::
++ on-load
|= old-state=vase
`agent
::
++ on-poke
|= =cage
~| "unexpected poke to {<dap.bowl>} with mark {<p.cage>}"
!!
::
++ on-watch
|= =path
~| "unexpected subscription to {<dap.bowl>} on path {<path>}"
!!
::
++ on-leave
|= path
`agent
::
++ on-peek
|= =path
~| "unexpected scry into {<dap.bowl>} on path {<path>}"
!!
::
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card:agent:gall _agent)
?- -.sign
%poke-ack
?~ p.sign
`agent
%- (slog leaf+"poke failed from {<dap.bowl>} on wire {<wire>}" u.p.sign)
`agent
::
%watch-ack
?~ p.sign
`agent
=/ =tank leaf+"subscribe failed from {<dap.bowl>} on wire {<wire>}"
%- (slog tank u.p.sign)
`agent
::
%kick `agent
%fact
~| "unexpected subscription update to {<dap.bowl>} on wire {<wire>}"
~| "with mark {<p.cage.sign>}"
!!
==
::
++ on-arvo
|= [=wire =sign-arvo]
~| "unexpected system response {<-.sign-arvo>} to {<dap.bowl>} on wire {<wire>}"
!!
::
++ on-fail
|= [=term =tang]
%- (slog leaf+"error in {<dap.bowl>}" >term< tang)
`agent
--

View File

@ -0,0 +1 @@
../../base-dev/lib/default-agent.hoon

View File

@ -0,0 +1 @@
../../garden-dev/lib/docket.hoon

View File

@ -1,257 +0,0 @@
:: ethio: Asynchronous Ethereum input/output functions.
::
/- rpc=json-rpc
/+ ethereum, strandio
=, ethereum-types
=, jael
::
=> |%
+$ topics (list ?(@ux (list @ux)))
--
|%
:: +request-rpc: send rpc request, with retry
::
++ request-rpc
|= [url=@ta id=(unit @t) req=request:rpc:ethereum]
=/ m (strand:strandio ,json)
^- form:m
;< res=(list [id=@t =json]) bind:m
(request-batch-rpc-strict url [id req]~)
?: ?=([* ~] res)
(pure:m json.i.res)
%+ strand-fail:strandio
%unexpected-multiple-results
[>(lent res)< ~]
:: +request-batch-rpc-strict: send rpc requests, with retry
::
:: sends a batch request. produces results for all requests in the batch,
:: but only if all of them are successful.
::
++ request-batch-rpc-strict
|= [url=@ta reqs=(list [id=(unit @t) req=request:rpc:ethereum])]
|^ %+ (retry:strandio results)
`10
attempt-request
::
+$ results (list [id=@t =json])
::
++ attempt-request
=/ m (strand:strandio ,(unit results))
^- form:m
;< responses=(list response:rpc) bind:m
(request-batch-rpc-loose url reqs)
=- ?~ err
(pure:m `res)
(pure:m ~)
%+ roll responses
|= $: rpc=response:rpc
[res=results err=(list [id=@t code=@t message=@t])]
==
?: ?=(%error -.rpc)
[res [+.rpc err]]
?. ?=(%result -.rpc)
[res [['' 'ethio-rpc-fail' (crip <rpc>)] err]]
[[+.rpc res] err]
--
:: +request-batch-rpc-loose: send rpc requests, with retry
::
:: sends a batch request. produces results for all requests in the batch,
:: including the ones that are unsuccessful.
::
++ request-batch-rpc-loose
|= [url=@ta reqs=(list [id=(unit @t) req=request:rpc:ethereum])]
|^ %+ (retry:strandio results)
`10
attempt-request
::
+$ result response:rpc
+$ results (list response:rpc)
::
++ attempt-request
=/ m (strand:strandio ,(unit results))
^- form:m
=/ =request:http
:* method=%'POST'
url=url
header-list=['Content-Type'^'application/json' ~]
::
^= body
%- some %- as-octt:mimes:html
%- en-json:html
a+(turn reqs request-to-json:rpc:ethereum)
==
;< ~ bind:m
(send-request:strandio request)
;< rep=(unit client-response:iris) bind:m
take-maybe-response:strandio
?~ rep
(pure:m ~)
(parse-responses u.rep)
::
++ parse-responses
|= =client-response:iris
=/ m (strand:strandio ,(unit results))
^- 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 ~)
=/ array=(unit (list response:rpc))
((ar:dejs-soft:format parse-one-response) u.jon)
?~ array
(strand-fail:strandio %rpc-result-incomplete-batch >u.jon< ~)
(pure:m 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 ~) ~)
--
::
:: +read-contract: calls a read function on a contract, produces result hex
::
++ read-contract
|= [url=@t req=proto-read-request:rpc:ethereum]
=/ m (strand:strandio ,@t)
;< res=(list [id=@t res=@t]) bind:m
(batch-read-contract-strict url [req]~)
?: ?=([* ~] res)
(pure:m res.i.res)
%+ strand-fail:strandio
%unexpected-multiple-results
[>(lent res)< ~]
:: +batch-read-contract-strict: calls read functions on contracts
::
:: sends a batch request. produces results for all requests in the batch,
:: but only if all of them are successful.
::
++ batch-read-contract-strict
|= [url=@t reqs=(list proto-read-request:rpc:ethereum)]
|^ =/ m (strand:strandio ,results)
^- form:m
;< res=(list [id=@t =json]) bind:m
%+ request-batch-rpc-strict url
(turn reqs proto-to-rpc)
=+ ^- [=results =failures]
(roll res response-to-result)
?~ failures (pure:m results)
(strand-fail:strandio %batch-read-failed-for >failures< ~)
::
+$ results (list [id=@t res=@t])
+$ failures (list [id=@t =json])
::
++ proto-to-rpc
|= proto-read-request:rpc:ethereum
^- [(unit @t) request:rpc:ethereum]
:- id
:+ %eth-call
^- call:rpc:ethereum
[~ to ~ ~ ~ `tape`(encode-call:rpc:ethereum function arguments)]
[%label %latest]
::
++ response-to-result
|= [[id=@t =json] =results =failures]
^+ [results failures]
?: ?=(%s -.json)
[[id^p.json results] failures]
[results [id^json failures]]
--
::
::
++ get-latest-block
|= url=@ta
=/ m (strand:strandio ,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:strandio ,block)
^- form:m
|^
%+ (retry:strandio ,block) `10
=/ m (strand:strandio ,(unit block))
^- form:m
;< =json bind:m
%+ request-rpc url
:- `'block by number'
[%eth-get-block-by-number number |]
(pure:m (parse-block json))
::
++ parse-block
|= =json
^- (unit block)
=< ?~(. ~ `[[&1 &2] |2]:u)
^- (unit [@ @ @])
~| json
%. json
=, dejs-soft:format
%- ot
:~ hash+parse-hex
number+parse-hex
'parentHash'^parse-hex
==
::
++ parse-hex |=(=json `(unit @)`(some (parse-hex-result:rpc:ethereum json)))
--
::
++ get-logs-by-hash
|= [url=@ta =hash:block contracts=(list address) =topics]
=/ m (strand:strandio (list event-log:rpc:ethereum))
^- form:m
;< =json bind:m
%+ request-rpc url
:* `'logs by hash'
%eth-get-logs-by-hash
hash
contracts
topics
==
%- pure:m
(parse-event-logs:rpc:ethereum json)
::
++ get-logs-by-range
|= $: url=@ta
contracts=(list address)
=topics
=from=number:block
=to=number:block
==
=/ m (strand:strandio (list event-log:rpc:ethereum))
^- form:m
;< =json bind:m
%+ request-rpc url
:* `'logs by range'
%eth-get-logs
`number+from-number
`number+to-number
contracts
topics
==
%- pure:m
(parse-event-logs:rpc:ethereum json)
::
++ get-next-nonce
|= [url=@ta =address]
=/ m (strand:strandio ,@ud)
^- form:m
;< =json bind:m
%^ request-rpc url `'nonce'
[%eth-get-transaction-count address [%label %latest]]
%- pure:m
(parse-eth-get-transaction-count:rpc:ethereum json)
--

View File

@ -0,0 +1 @@
../../base-dev/lib/ethio.hoon

View File

@ -1,61 +0,0 @@
/- *language-server
::
|%
++ parse-error
|= =tape
^- (unit [=path =range])
=/ parse-pair
%+ cook
|=([row=@ud col=@ud] [(dec row) col])
(ifix [sel ser] ;~((glue ace) dem dem))
=/ parse-path
%+ cook
|=(p=path (slag 3 p))
(ifix [fas (jest '::')] (more fas urs:ab))
=/ parse-full
;~(plug parse-path ;~(sfix ;~((glue dot) parse-pair parse-pair) gar))
(rust tape parse-full)
::
++ get-errors-from-tang
|= [uri=@t =tang]
^- (list range)
=/ =path
(uri-to-path uri)
%+ murn tang
|= =tank
^- (unit range)
?. ?=([%leaf *] tank)
~
=/ error
(parse-error p.tank)
?~ error
~
?: =(path path.u.error)
`range.u.error
~
::
++ uri-to-path
|= uri=@t
^- path
=/ pier-root=(set cord)
%- sy
['app' 'gen' 'lib' 'mar' 'ren' 'sur' 'sys' 'test' ~]
=/ path=(list cord)
(parse-uri uri)
|-
?< ?=(~ path)
?: (~(has in pier-root) i.path)
`^path`path
$(path t.path)
::
++ parse-uri
|= uri=@t
=- (fall - /fail)
%+ rush uri
%+ more
;~(pose (plus fas) dot)
%+ cook
crip
(star ;~(pose col hep alf))
::
--

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