mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-24 10:33:22 +03:00
Merge remote-tracking branch 'origin/master' into philip/agent-clay
This commit is contained in:
commit
79f520c56c
@ -27,12 +27,12 @@ identity, use [Bridge][brid].
|
||||
## Install
|
||||
|
||||
To install and run Urbit, please follow the instructions at
|
||||
[urbit.org/using/install][start]. You'll be on the live network in a
|
||||
[urbit.org/install][start]. You'll be on the live network in a
|
||||
few minutes.
|
||||
|
||||
If you're interested in Urbit development, keep reading.
|
||||
|
||||
[start]: https://urbit.org/using/install/
|
||||
[start]: https://urbit.org/install/
|
||||
|
||||
## Development
|
||||
|
||||
|
203
pkg/arvo/lib/test/ames-gall.hoon
Normal file
203
pkg/arvo/lib/test/ames-gall.hoon
Normal file
@ -0,0 +1,203 @@
|
||||
/+ *test, test-pub, test-sub
|
||||
/= ames-raw /sys/vane/ames
|
||||
/= gall-raw /sys/vane/gall
|
||||
::
|
||||
=/ ames-bunt (ames-raw ~zod)
|
||||
=/ gall-bunt (gall-raw ~zod)
|
||||
:: basic helpers
|
||||
::
|
||||
|%
|
||||
++ make-gall
|
||||
|= =ship
|
||||
=/ gall-pupa (gall-raw ship)
|
||||
=/ gall-core (gall-pupa now=~1111.1.1 eny=`@`0xdead.beef scry=*roof)
|
||||
=+ [out adult]=(call:gall-core duct=~[/init] dud=~ task=[%init ~])
|
||||
adult
|
||||
::
|
||||
++ ames-nec-bud
|
||||
:: create ~nec
|
||||
::
|
||||
=/ nec (ames-raw ~nec)
|
||||
=. now.nec ~1111.1.1
|
||||
=. eny.nec 0xdead.beef
|
||||
=. life.ames-state.nec 2
|
||||
=. rof.nec |=(* ``[%noun !>(*(list turf))])
|
||||
=. crypto-core.ames-state.nec (pit:nu:crub:crypto 512 (shaz 'nec'))
|
||||
=/ nec-pub pub:ex:crypto-core.ames-state.nec
|
||||
=/ nec-sec sec:ex:crypto-core.ames-state.nec
|
||||
:: create ~bud
|
||||
::
|
||||
=/ bud (ames-raw ~bud)
|
||||
=. now.bud ~1111.1.1
|
||||
=. eny.bud 0xbeef.dead
|
||||
=. life.ames-state.bud 3
|
||||
=. rof.bud |=(* ``[%noun !>(*(list turf))])
|
||||
=. crypto-core.ames-state.bud (pit:nu:crub:crypto 512 (shaz 'bud'))
|
||||
=/ bud-pub pub:ex:crypto-core.ames-state.bud
|
||||
=/ bud-sec sec:ex:crypto-core.ames-state.bud
|
||||
::
|
||||
=/ nec-sym (derive-symmetric-key:ames-raw bud-pub nec-sec)
|
||||
=/ bud-sym (derive-symmetric-key:ames-raw nec-pub bud-sec)
|
||||
?> =(nec-sym bud-sym)
|
||||
:: tell ~nec about ~bud
|
||||
::
|
||||
=. peers.ames-state.nec
|
||||
%+ ~(put by peers.ames-state.nec) ~bud
|
||||
=| =peer-state:ames
|
||||
=. -.peer-state
|
||||
:* symmetric-key=bud-sym
|
||||
life=3
|
||||
rift=0
|
||||
public-key=bud-pub
|
||||
sponsor=~bud
|
||||
==
|
||||
=. route.peer-state `[direct=%.y `lane:ames`[%& ~bud]]
|
||||
[%known peer-state]
|
||||
:: tell ~bud about ~nec
|
||||
::
|
||||
=. peers.ames-state.bud
|
||||
%+ ~(put by peers.ames-state.bud) ~nec
|
||||
=| =peer-state:ames
|
||||
=. -.peer-state
|
||||
:* symmetric-key=nec-sym
|
||||
life=2
|
||||
rift=0
|
||||
public-key=nec-pub
|
||||
sponsor=~nec
|
||||
==
|
||||
=. route.peer-state `[direct=%.y `lane:ames`[%& ~nec]]
|
||||
[%known peer-state]
|
||||
:: metamorphose
|
||||
::
|
||||
=> .(nec +:(call:(nec) ~[//unix] ~ %born ~))
|
||||
=> .(bud +:(call:(bud) ~[//unix] ~ %born ~))
|
||||
::
|
||||
[nec=nec bud=bud]
|
||||
--
|
||||
:: forward-declare to avoid repeated metamorphoses
|
||||
=/ gall-adult (make-gall ~zod)
|
||||
=/ ames-adult nec:ames-nec-bud
|
||||
:: main core
|
||||
::
|
||||
|%
|
||||
+$ gall-gate _gall-adult
|
||||
+$ ames-gate _ames-adult
|
||||
::
|
||||
++ nec-bud
|
||||
=/ a ames-nec-bud
|
||||
=/ gall-nec (make-gall ~nec)
|
||||
=. gall-nec (load-agent ~nec gall-nec %sub test-sub)
|
||||
=/ gall-bud (make-gall ~bud)
|
||||
=. gall-bud (load-agent ~bud gall-bud %pub test-pub)
|
||||
:* nec=[ames=nec.a gall=gall-nec]
|
||||
bud=[ames=bud.a gall=gall-bud]
|
||||
==
|
||||
:: +gall-check-call: run gall task, assert produces expected-moves
|
||||
::
|
||||
++ gall-check-call
|
||||
|= $: =gall-gate
|
||||
[now=@da eny=@ =roof]
|
||||
[=duct task=(hobo task:gall)]
|
||||
expected-moves=(list move:gall-bunt)
|
||||
==
|
||||
^- [tang ^gall-gate]
|
||||
=/ gall-core (gall-gate now eny roof)
|
||||
=^ moves gall-gate (call:gall-core duct dud=~ task)
|
||||
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
|
||||
::
|
||||
++ gall-call
|
||||
|= [=gall-gate =duct task=(hobo task:gall) =roof]
|
||||
%. [duct dud=~ task]
|
||||
call:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||
:: +gall-check-take: run gall sign, assert produces expected-moves
|
||||
::
|
||||
++ gall-check-take
|
||||
|= $: =gall-gate
|
||||
[now=@da eny=@ =roof]
|
||||
[=wire =duct =sign-arvo]
|
||||
expected-moves=(list move:gall-bunt)
|
||||
==
|
||||
^- [tang ^gall-gate]
|
||||
=/ gall-core (gall-gate now eny roof)
|
||||
=^ moves gall-gate (take:gall-core wire duct dud=~ sign-arvo)
|
||||
[(expect-eq !>(expected-moves) !>(moves)) gall-gate]
|
||||
::
|
||||
++ gall-take
|
||||
|= [=gall-gate =wire =duct =sign-arvo =roof]
|
||||
%. [wire duct dud=~ sign-arvo]
|
||||
take:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||
:: +ames-check-call: run gall task, assert produces expected-moves
|
||||
::
|
||||
++ ames-check-call
|
||||
|= $: =ames-gate
|
||||
[now=@da eny=@ =roof]
|
||||
[=duct task=(hobo task:ames)]
|
||||
expected-moves=(list move:ames-bunt)
|
||||
==
|
||||
^- [tang ^ames-gate]
|
||||
=/ ames-core (ames-gate now eny roof)
|
||||
=^ moves ames-gate (call:ames-core duct dud=~ task)
|
||||
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
|
||||
::
|
||||
++ ames-call
|
||||
|= [=ames-gate =duct task=(hobo task:ames) =roof]
|
||||
%. [duct dud=~ task]
|
||||
call:(ames-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||
:: +ames: run ames sign, assert produces expected-moves
|
||||
::
|
||||
++ ames-check-take
|
||||
|= $: =ames-gate
|
||||
[now=@da eny=@ =roof]
|
||||
[=wire =duct =sign:ames-bunt]
|
||||
expected-moves=(list move:ames-bunt)
|
||||
==
|
||||
^- [tang ^ames-gate]
|
||||
=/ ames-core (ames-gate now eny roof)
|
||||
=^ moves ames-gate (take:ames-core wire duct dud=~ sign)
|
||||
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
|
||||
::
|
||||
++ ames-scry-peer
|
||||
|= $: =ames-gate
|
||||
[now=@da eny=@ =roof]
|
||||
our=ship
|
||||
her=ship
|
||||
==
|
||||
^- peer-state:ames
|
||||
=- ?>(?=(%known -<) ->)
|
||||
!< ship-state:ames
|
||||
=< q
|
||||
%- need %- need
|
||||
%- scry:(ames-gate now eny roof)
|
||||
[~ %x [[our %$ da+now] /peers/(scot %p her)]]
|
||||
::
|
||||
++ gall-scry-nonce
|
||||
|= $: =gall-gate
|
||||
[now=@da eny=@ =roof]
|
||||
our=ship
|
||||
=dude:gall
|
||||
sub=[=ship =term =wire]
|
||||
==
|
||||
^- @ud
|
||||
!< @ud
|
||||
=< q
|
||||
%- need %- need
|
||||
%- scry:(gall-gate now eny roof)
|
||||
[~ %n [[our dude da+now] [(scot %p ship.sub) [term wire]:sub]]]
|
||||
::
|
||||
++ load-agent
|
||||
|= [=ship =gall-gate =dude:gall =agent:gall]
|
||||
=^ * gall-gate
|
||||
(gall-call gall-gate ~[/jolt] [%jolt %base dude] *roof)
|
||||
=^ * gall-gate
|
||||
=/ =sign-arvo
|
||||
:+ %clay %writ
|
||||
`[[%a da+~1111.1.1 %base] /app/[dude]/hoon vase+!>(!>(agent))]
|
||||
%: gall-take
|
||||
gall-gate
|
||||
/sys/cor/[dude]/(scot %p ship)/base/(scot %da ~1111.1.1)
|
||||
~[/jolt]
|
||||
sign-arvo
|
||||
*roof
|
||||
==
|
||||
gall-gate
|
||||
--
|
36
pkg/arvo/lib/test/pub.hoon
Normal file
36
pkg/arvo/lib/test/pub.hoon
Normal file
@ -0,0 +1,36 @@
|
||||
/+ default-agent, verb, dbug
|
||||
::
|
||||
=| state=~
|
||||
%- agent:dbug
|
||||
%+ verb &
|
||||
^- agent:gall
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
(on-poke:def +<)
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
`this
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
(on-agent:def +<)
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
(mean ':pub +on-fail' term tang)
|
||||
::
|
||||
++ on-leave
|
||||
|= =path
|
||||
`this
|
||||
::
|
||||
++ on-init `this
|
||||
++ on-save !>(state)
|
||||
++ on-load |=(old=vase `this(state !<(_state old)))
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-peek on-peek:def
|
||||
--
|
47
pkg/arvo/lib/test/sub.hoon
Normal file
47
pkg/arvo/lib/test/sub.hoon
Normal file
@ -0,0 +1,47 @@
|
||||
/+ default-agent, verb, dbug
|
||||
::
|
||||
=| state=~
|
||||
%- agent:dbug
|
||||
%+ verb &
|
||||
^- agent:gall
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
=+ !<(=ship vase)
|
||||
:_ this
|
||||
?+ mark !!
|
||||
%leave [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %leave ~]~
|
||||
%watch [%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~
|
||||
==
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
(on-watch:def +<)
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
=/ =ship (slav %p &2.wire)
|
||||
?+ -.sign !!
|
||||
%fact `this
|
||||
%watch-ack `this
|
||||
%kick
|
||||
[[%pass /sub-foo/(scot %p ship) %agent [ship %pub] %watch /foo]~ this]
|
||||
==
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
(mean ':sub +on-fail' term tang)
|
||||
::
|
||||
++ on-leave
|
||||
|= =path
|
||||
`this
|
||||
::
|
||||
++ on-init `this
|
||||
++ on-save !>(state)
|
||||
++ on-load |=(old=vase `this(state !<(_state old)))
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-peek on-peek:def
|
||||
--
|
@ -1061,7 +1061,7 @@
|
||||
=^ moz u.cached-state
|
||||
?. ?=(%7 -.u.cached-state) [~ u.cached-state]
|
||||
~> %slog.0^leaf/"ames: init daily recork timer"
|
||||
:- [[/ames]~ %pass /recork %b %wait `@da`(add now ~m20)]~
|
||||
:- [[/ames]~ %pass /recork %b %wait `@da`(add now ~d1)]~
|
||||
8+(state-7-to-8:load:adult-core +.u.cached-state)
|
||||
?> ?=(%8 -.u.cached-state)
|
||||
=. ames-state.adult-gate +.u.cached-state
|
||||
@ -1487,6 +1487,8 @@
|
||||
?~ tim acc
|
||||
%- ~(put in acc)
|
||||
[u.tim `^duct`~[ames+(make-pump-timer-wire who b) /ames]]
|
||||
=. want
|
||||
(~(put in want) (add now ~d1) ~[/ames/recork /ames])
|
||||
::
|
||||
=/ have
|
||||
%- ~(gas in *(set [@da ^duct]))
|
||||
@ -1494,7 +1496,7 @@
|
||||
;; (list [@da ^duct])
|
||||
=< q.q %- need %- need
|
||||
(rof ~ %bx [[our %$ da+now] /debug/timers])
|
||||
(skim tim |=([@da hen=^duct] ?=([[%ames %pump *] *] hen)))
|
||||
(skim tim |=([@da hen=^duct] ?=([[%ames ?(%pump %recork) *] *] hen)))
|
||||
::
|
||||
:: set timers for flows that should have one set but don't
|
||||
::
|
||||
@ -1801,7 +1803,7 @@
|
||||
:: if we haven't received an attestation, ask again
|
||||
::
|
||||
?^ error
|
||||
%- (slog leaf+"ames: attestation timer failed: {<u.error>}" ~)
|
||||
%- (slog 'ames: attestation timer failed' u.error)
|
||||
event-core
|
||||
?~ ship=`(unit @p)`(slaw %p i.t.wire)
|
||||
%- (slog leaf+"ames: got timer for strange wire: {<wire>}" ~)
|
||||
@ -1827,7 +1829,11 @@
|
||||
abet:(on-wake:(make-peer-core u.state channel) bone.u.res error)
|
||||
::
|
||||
=. event-core
|
||||
(emit duct %pass /recork %b %wait `@da`(add now ~m20))
|
||||
(emit duct %pass /recork %b %wait `@da`(add now ~d1))
|
||||
::
|
||||
?^ error
|
||||
%- (slog 'ames: recork timer failed' u.error)
|
||||
event-core
|
||||
:: recork up to one bone per peer
|
||||
::
|
||||
=/ pez ~(tap by peers.ames-state)
|
||||
@ -1991,14 +1997,15 @@
|
||||
event-core
|
||||
:: +on-publ-sponsor: handle new or lost sponsor for peer
|
||||
::
|
||||
:: TODO: handle sponsor loss
|
||||
:: TODO: really handle sponsor loss
|
||||
::
|
||||
++ on-publ-sponsor
|
||||
|= [=ship sponsor=(unit ship)]
|
||||
^+ event-core
|
||||
::
|
||||
?~ sponsor
|
||||
~| %ames-lost-sponsor^our^ship !!
|
||||
%- (slog leaf+"ames: {(scow %p ship)} lost sponsor, ignoring" ~)
|
||||
event-core
|
||||
::
|
||||
=/ state=(unit peer-state) (get-peer-state ship)
|
||||
?~ state
|
||||
@ -3074,8 +3081,11 @@
|
||||
::
|
||||
?- -.u.cur
|
||||
%ok
|
||||
=. message-pump (give %done current.state ~)
|
||||
=? message-pump cork (give %cork ~)
|
||||
=. message-pump
|
||||
:: don't give %done for corks
|
||||
::
|
||||
?: cork (give %cork ~)
|
||||
(give %done current.state ~)
|
||||
$(current.state +(current.state))
|
||||
::
|
||||
%nack
|
||||
|
@ -42,9 +42,9 @@
|
||||
:: $move: Arvo-level move
|
||||
::
|
||||
+$ move [=duct move=(wind note-arvo gift-arvo)]
|
||||
:: $state-10: overall gall state, versioned
|
||||
:: $state-11: overall gall state, versioned
|
||||
::
|
||||
+$ state-10 [%10 state]
|
||||
+$ state-11 [%11 state]
|
||||
:: $state: overall gall state
|
||||
::
|
||||
:: system-duct: TODO document
|
||||
@ -141,7 +141,6 @@
|
||||
%poke
|
||||
%leave
|
||||
%missing
|
||||
%cork
|
||||
==
|
||||
:: |migrate: data structures for upgrades
|
||||
::
|
||||
@ -150,7 +149,7 @@
|
||||
:: $spore: structures for update, produced by +stay
|
||||
::
|
||||
+$ spore
|
||||
$: %10
|
||||
$: %11
|
||||
system-duct=duct
|
||||
outstanding=(map [wire duct] (qeu remote-request))
|
||||
contacts=(set ship)
|
||||
@ -176,7 +175,7 @@
|
||||
--
|
||||
:: adult gall vane interface, for type compatibility with pupa
|
||||
::
|
||||
=| state=state-10
|
||||
=| state=state-11
|
||||
|= [now=@da eny=@uvJ rof=roof]
|
||||
=* gall-payload .
|
||||
~% %gall-top ..part ~
|
||||
@ -339,7 +338,7 @@
|
||||
=/ stand
|
||||
(~(gut by outstanding.state) [wire hen] *(qeu remote-request))
|
||||
%+ ~(put by outstanding.state) [wire hen]
|
||||
(~(gas to stand) ?.(?=(%leave -.deal) ~[-.deal] ~[%leave %cork]))
|
||||
(~(gas to stand) ?.(?=(%leave -.deal) ~[-.deal] ~[%leave]))
|
||||
=. mo-core (mo-pass wire note-arvo)
|
||||
?. ?=(%leave -.deal)
|
||||
mo-core
|
||||
@ -511,10 +510,8 @@
|
||||
(~(put to *(qeu remote-request)) %missing)
|
||||
~| [full-wire=full-wire hen=hen stand=stand]
|
||||
=^ rr stand ~(get to stand)
|
||||
~? &(=(rr %cork) ?=(^ stand))
|
||||
[%outstanding-queue-not-empty wire hen]
|
||||
:- rr
|
||||
?: ?=(%cork rr)
|
||||
?: =(~ stand)
|
||||
(~(del by outstanding.state) [full-wire hen])
|
||||
(~(put by outstanding.state) [full-wire hen] stand)
|
||||
:: non-null case of wire is old, remove on next breach after
|
||||
@ -532,7 +529,6 @@
|
||||
%watch (mo-give %unto %watch-ack err)
|
||||
%poke (mo-give %unto %poke-ack err)
|
||||
%leave mo-core
|
||||
%cork mo-core
|
||||
%missing ~>(%slog.[3 'gall: missing'] mo-core)
|
||||
==
|
||||
::
|
||||
@ -549,10 +545,9 @@
|
||||
?- -.ames-response
|
||||
%d (mo-give %unto %raw-fact mark.ames-response noun.ames-response)
|
||||
%x =. mo-core (mo-give %unto %kick ~)
|
||||
=. outstanding.state
|
||||
=/ key [[%sys wire] hen]
|
||||
%+ ~(put by outstanding.state) key
|
||||
(~(put to (~(gut by outstanding.state) key ~)) %cork)
|
||||
=/ key [[%sys wire] hen]
|
||||
=? outstanding.state =(~ (~(gut by outstanding.state) key ~))
|
||||
(~(del by outstanding.state) key)
|
||||
(mo-pass [%sys wire] %a %cork ship)
|
||||
==
|
||||
::
|
||||
@ -931,7 +926,7 @@
|
||||
[%give %kick ~(tap in inbound-paths) ~]~
|
||||
%+ turn ~(tap by boat.yoke)
|
||||
|= [[=wire =dock] ? =path]
|
||||
[%pass (ap-nonce-wire wire dock) %agent dock %leave ~]
|
||||
[%pass wire %agent dock %leave ~]
|
||||
=^ maybe-tang ap-core (ap-ingest ~ |.([will *agent]))
|
||||
ap-core
|
||||
:: +ap-from-internal: internal move to move.
|
||||
@ -1753,20 +1748,21 @@
|
||||
=? old ?=(%7 -.old) (spore-7-to-8 old)
|
||||
=? old ?=(%8 -.old) (spore-8-to-9 old)
|
||||
=? old ?=(%9 -.old) (spore-9-to-10 old)
|
||||
?> ?=(%10 -.old)
|
||||
=? old ?=(%10 -.old) (spore-10-to-11 old)
|
||||
?> ?=(%11 -.old)
|
||||
gall-payload(state old)
|
||||
::
|
||||
+$ spore-any $%(spore spore-7 spore-8 spore-9)
|
||||
+$ spore-9
|
||||
$: %9
|
||||
+$ spore-any $%(spore spore-7 spore-8 spore-9 spore-10)
|
||||
+$ spore-10
|
||||
$: %10
|
||||
system-duct=duct
|
||||
outstanding=(map [wire duct] (qeu remote-request))
|
||||
contacts=(set ship)
|
||||
eggs=(map term egg-9)
|
||||
eggs=(map term egg-10)
|
||||
blocked=(map term (qeu blocked-move))
|
||||
=bug
|
||||
==
|
||||
+$ egg-9
|
||||
+$ egg-10
|
||||
$: control-duct=duct
|
||||
run-nonce=@t
|
||||
sub-nonce=@
|
||||
@ -1779,10 +1775,22 @@
|
||||
=beak
|
||||
marks=(map duct mark)
|
||||
==
|
||||
+$ spore-9
|
||||
$: %9
|
||||
system-duct=duct
|
||||
outstanding=(map [wire duct] (qeu remote-request-9))
|
||||
contacts=(set ship)
|
||||
eggs=(map term egg-10)
|
||||
blocked=(map term (qeu blocked-move))
|
||||
=bug
|
||||
==
|
||||
::
|
||||
+$ remote-request-9 ?(remote-request %cork)
|
||||
::
|
||||
+$ spore-8
|
||||
$: %8
|
||||
system-duct=duct
|
||||
outstanding=(map [wire duct] (qeu remote-request))
|
||||
outstanding=(map [wire duct] (qeu remote-request-9))
|
||||
contacts=(set ship)
|
||||
eggs=(map term egg-8)
|
||||
blocked=(map term (qeu blocked-move))
|
||||
@ -1803,7 +1811,7 @@
|
||||
$: %7
|
||||
wipe-eyre-subs=_| ::NOTE band-aid for #3196
|
||||
system-duct=duct
|
||||
outstanding=(map [wire duct] (qeu remote-request))
|
||||
outstanding=(map [wire duct] (qeu remote-request-9))
|
||||
contacts=(set ship)
|
||||
eggs=(map term egg-8)
|
||||
blocked=(map term (qeu blocked-move))
|
||||
@ -1827,7 +1835,7 @@
|
||||
=- old(- %9, eggs -, blocked [blocked.old *bug])
|
||||
%- ~(run by eggs.old)
|
||||
|= =egg-8
|
||||
^- egg-9
|
||||
^- egg-10
|
||||
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
|
||||
:* control-duct.egg-8
|
||||
run-nonce.egg-8
|
||||
@ -1843,18 +1851,29 @@
|
||||
^- [bitt boat boar]
|
||||
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
|
||||
::
|
||||
:: remove %cork
|
||||
::
|
||||
++ spore-9-to-10
|
||||
|= old=spore-9
|
||||
=- old(- %10, outstanding -)
|
||||
%- ~(run by outstanding.old)
|
||||
|= q=(qeu remote-request-9)
|
||||
%- ~(gas to *(qeu remote-request))
|
||||
%+ murn ~(tap to q)
|
||||
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
|
||||
::
|
||||
:: removed live
|
||||
:: changed old-state from (each vase vase) to [%| vase]
|
||||
:: added code
|
||||
::
|
||||
++ spore-9-to-10
|
||||
|= old=spore-9
|
||||
++ spore-10-to-11
|
||||
|= old=spore-10
|
||||
^- spore
|
||||
%= old
|
||||
- %10
|
||||
- %11
|
||||
eggs
|
||||
%- ~(urn by eggs.old)
|
||||
|= [a=term e=egg-9]
|
||||
|= [a=term e=egg-10]
|
||||
^- egg
|
||||
e(|3 |4.e(|4 `|8.e(old-state [%| p.old-state.e])))
|
||||
==
|
||||
|
@ -30,12 +30,12 @@
|
||||
?. good
|
||||
%+ strand-fail:strandio %bail-early-self-check
|
||||
[>"couldn't access ship on port 80"< ~]
|
||||
;< our=@p bind:m get-our:strandio
|
||||
;< ~ bind:m (watch:strandio /response collector-app /(scot %p our))
|
||||
;< ~ bind:m (poke:strandio collector-app %dns-address !>([%if if]))
|
||||
=/ msg=cord
|
||||
(cat 3 'request for DNS sent to ' (scot %p p:collector-app))
|
||||
;< ~ bind:m (app-message:strandio %dns msg ~)
|
||||
;< our=@p bind:m get-our:strandio
|
||||
;< ~ bind:m (watch:strandio /sub collector-app /(scot %p our))
|
||||
=/ msg=cord
|
||||
(cat 3 'awaiting response from ' (scot %p p:collector-app))
|
||||
;< ~ bind:m (app-message:strandio %dns msg ~)
|
||||
@ -45,7 +45,7 @@
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
;< our=ship bind:m get-our:strandio
|
||||
;< =cage bind:m (take-fact:strandio /(scot %p our))
|
||||
;< =cage bind:m (take-fact:strandio /response)
|
||||
?> ?=(%dns-binding p.cage)
|
||||
=/ =binding:dns !<(binding:dns q.cage)
|
||||
;< good=? bind:m (turf-confirm-install:libdns turf.binding)
|
||||
|
504
pkg/arvo/tests/sys/grq.hoon
Normal file
504
pkg/arvo/tests/sys/grq.hoon
Normal file
@ -0,0 +1,504 @@
|
||||
:: test gall subscription nonce incrementation and ames flow killing
|
||||
::
|
||||
/+ *test, v=test-ames-gall
|
||||
|%
|
||||
++ test-watch
|
||||
%- run-chain
|
||||
|. :- %|
|
||||
=+ nec-bud:v
|
||||
:: uncomment to turn on verbose debug output
|
||||
::=^ * ames.nec
|
||||
:: (ames-call:v ames.nec ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
|
||||
::=^ * ames.bud
|
||||
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
|
||||
:: poke %sub to tell it to subscribe
|
||||
=/ =task:gall [%deal [~nec ~nec] %sub %poke watch+!>(~bud)]
|
||||
=^ t1 gall.nec
|
||||
%: gall-check-call:v gall.nec
|
||||
[~1111.1.1 0xdead.beef *roof]
|
||||
[~[/foo] task]
|
||||
:~ :- ~[/foo] [%give %unto %poke-ack ~]
|
||||
:- ~[/init]
|
||||
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
[%g %deal [~nec ~bud] %pub %watch /foo]
|
||||
== ==
|
||||
==
|
||||
:- t1 |. :- %|
|
||||
:: handle gall passing the %watch to itself, which passes to ames
|
||||
=^ t2 gall.nec
|
||||
%: gall-check-call:v gall.nec
|
||||
[~1111.1.1 0xdead.beef *roof]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%deal [~nec ~bud] %pub %watch /foo]
|
||||
:~ :- ~[/init] [%pass /sys/lag %a %heed ~bud]
|
||||
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
|
||||
==
|
||||
==
|
||||
:- t2 |. :- %|
|
||||
:: subscriber ames handles %plea from gall, gives a packet to vere
|
||||
=^ t3 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.1 0xdead.beef *roof]
|
||||
:- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%plea ~bud %g /ge/pub [%0 %s /foo]]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~bud]
|
||||
0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
|
||||
2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
|
||||
8a00.0200.0132.8fd4.f000
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.1..00.00.01]
|
||||
==
|
||||
==
|
||||
:- t3 |. :- %|
|
||||
:: publisher ames hears %watch, passes to gall
|
||||
=^ t4 ames.bud
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~nec]
|
||||
0xae59.5b29.277b.22c1.20b7.a8db.9086.46df.31bd.f9bc.
|
||||
2633.7300.17d4.f5fc.8be5.8bfe.5c9d.36d9.2ea1.7cb3.
|
||||
8a00.0200.0132.8fd4.f000
|
||||
==
|
||||
:~ :- ~[//unix] [%pass /qos %d %flog %text "; ~nec is your neighbor"]
|
||||
:- ~[//unix]
|
||||
[%pass /bone/~nec/0/1 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
|
||||
==
|
||||
==
|
||||
:- t4 |. :- %|
|
||||
:: publisher gall hears %watch from ames, passes to itself
|
||||
=^ t5 gall.bud
|
||||
%: gall-check-call:v gall.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:- ~[/bone/~nec/0/1 //unix]
|
||||
[%plea ~nec %g /ge/pub [%0 %s /foo]]
|
||||
:~ :- ~[/init] [%pass /sys/lag %a %heed ~nec]
|
||||
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
|
||||
:- ~[/bone/~nec/0/1 //unix]
|
||||
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
|
||||
==
|
||||
==
|
||||
:- t5 |. :- %|
|
||||
:: publisher gall runs %pub with %watch, gives ack to itself
|
||||
=^ t6 gall.bud
|
||||
%: gall-check-call:v gall.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
|
||||
[%deal [~nec ~bud] %pub %watch /foo]
|
||||
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
|
||||
[%give %unto %watch-ack ~]
|
||||
==
|
||||
==
|
||||
:- t6 |. :- %|
|
||||
:: gall gives ack to ames
|
||||
=^ t7 gall.bud
|
||||
%: gall-check-take:v gall.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
|
||||
[%gall %unto %watch-ack ~]
|
||||
:~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
|
||||
==
|
||||
==
|
||||
:- t7 |. :- %|
|
||||
:: publisher ames hears ack from gall, sends over the network
|
||||
=^ t8 ames.bud
|
||||
%: ames-check-take:v ames.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:+ /bone/~nec/0/1 ~[//unix]
|
||||
[%gall %done ~]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~nec]
|
||||
0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
|
||||
2d9d.076e.6d00.0100.0223.9ae9.5000
|
||||
== ==
|
||||
==
|
||||
:- t8 |. :- %|
|
||||
:: subscriber ames hears watch-ack packet, gives to gall
|
||||
=^ t9 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.3 0xdead.beef *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~bud]
|
||||
0x2.0219.8100.0485.5530.3c88.9068.3cc6.484e.
|
||||
2d9d.076e.6d00.0100.0223.9ae9.5000
|
||||
==
|
||||
:~ :- ~[//unix] [%pass /qos %d %flog %text "; ~bud is your neighbor"]
|
||||
:- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%give %done ~]
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.1..00.00.01]
|
||||
==
|
||||
==
|
||||
:- t9 |. :- %|
|
||||
:: gall gives %done to itself
|
||||
=^ t10 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.3 0xdead.beef *roof]
|
||||
:+ /sys/way/~bud/pub
|
||||
~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%ames %done ~]
|
||||
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%give %unto %watch-ack ~]
|
||||
==
|
||||
==
|
||||
:- t10 |. :- %|
|
||||
:: gall gives watch-ack to itself
|
||||
=^ t11 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.3 0xdead.beef *roof]
|
||||
:+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
~[/init]
|
||||
[%gall %unto %watch-ack ~]
|
||||
~
|
||||
==
|
||||
:- t11 |. :- %|
|
||||
:: start the clog and kick process; give clog to publisher gall
|
||||
=^ t12 gall.bud
|
||||
%: gall-check-take:v gall.bud
|
||||
[~1111.1.4 0xbeef.dead *roof]
|
||||
:+ /sys/lag ~[/init]
|
||||
[%ames %clog ~nec]
|
||||
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
|
||||
[%give %unto %kick ~]
|
||||
==
|
||||
==
|
||||
:- t12 |. :- %|
|
||||
:: gall gives %kick %boon to ames
|
||||
=^ t13 gall.bud
|
||||
%: gall-check-take:v gall.bud
|
||||
[~1111.1.4 0xbeef.dead *roof]
|
||||
:+ /sys/req/~nec/pub ~[/bone/~nec/0/1 //unix]
|
||||
[%gall %unto %kick ~]
|
||||
:~ :- ~[/bone/~nec/0/1 //unix] [%give %boon %x ~]
|
||||
==
|
||||
==
|
||||
:- t13 |. :- %|
|
||||
:: ames gives kick over the network
|
||||
=^ t14 ames.bud
|
||||
%: ames-check-take:v ames.bud
|
||||
[~1111.1.4 0xbeef.dead *roof]
|
||||
:+ /bone/~nec/0/1 ~[//unix]
|
||||
[%gall %boon %x ~]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~nec]
|
||||
0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
|
||||
4ca0.801d.3ddc.d400.0100.0223.bc18.1000
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~nec/1 %b %wait ~1111.1.4..00.00.01]
|
||||
==
|
||||
==
|
||||
:- t14 |. :- %|
|
||||
:: subscriber ames receives kick, gives to gall and gives ack to unix
|
||||
=^ t15 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~bud]
|
||||
0xa1fc.cd35.c730.9a00.07e0.90a2.f87c.3657.935e.
|
||||
4ca0.801d.3ddc.d400.0100.0223.bc18.1000
|
||||
==
|
||||
:~ :- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%give %boon %x ~]
|
||||
:- ~[//unix]
|
||||
:* %give %send [%& ~bud]
|
||||
0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
|
||||
9de0.3906.b678.6e00.0200.0132.e55d.5000
|
||||
== ==
|
||||
==
|
||||
:- t15 |. :- %|
|
||||
:: subscriber gall receives kick %boon from ames, gives to self
|
||||
=^ t16 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:+ /sys/way/~bud/pub
|
||||
~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%ames %boon %x ~]
|
||||
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%give %unto %kick ~]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
|
||||
[%pass /sys/way/~bud/pub %a %cork ~bud]
|
||||
==
|
||||
==
|
||||
:: subscriber gall receives %kick from itself
|
||||
=^ t17 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:+ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
~[/init]
|
||||
[%gall %unto %kick ~]
|
||||
:~ :- ~[/init]
|
||||
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
[%g %deal [~nec ~bud] %pub %watch /foo]
|
||||
== ==
|
||||
==
|
||||
:- t17 |. :- %|
|
||||
:: gall receives %deal %watch from itself, passes to ames
|
||||
=^ t18 gall.nec
|
||||
%: gall-check-call:v gall.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
|
||||
[%deal [~nec ~bud] %pub %watch /foo]
|
||||
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
|
||||
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
|
||||
==
|
||||
==
|
||||
:- t18 |. :- %|
|
||||
:: subscriber ames sends new %watch
|
||||
=^ t19 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%plea ~bud %g /ge/pub [%0 %s /foo]]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~bud]
|
||||
0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
|
||||
1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~bud/4 %b %wait ~1111.1.5..00.00.01]
|
||||
==
|
||||
==
|
||||
:- t19 |. :- %|
|
||||
:: subscriber ames sends %cork
|
||||
=^ t20 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.5 0xdead.beef *roof]
|
||||
:- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%cork ~bud]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~bud]
|
||||
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
|
||||
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.5..00.02.00]
|
||||
==
|
||||
==
|
||||
:: publisher ames hears %kick ack
|
||||
:- t20 |. :- %|
|
||||
=^ t21 ames.bud
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.6 0xbeef.dead *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~nec]
|
||||
0xfe.e208.da00.0491.bf7f.9594.2ddc.0948.
|
||||
9de0.3906.b678.6e00.0200.0132.e55d.5000
|
||||
==
|
||||
:~ :- ~[/ames] [%pass /pump/~nec/1 %b %rest ~1111.1.4..00.00.01]
|
||||
==
|
||||
==
|
||||
:: publisher ames hears new %watch
|
||||
:- t21 |. :- %|
|
||||
=^ t22 ames.bud
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.7 0xbeef.dead *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~nec]
|
||||
0xfe.9174.6d7c.e042.4ea7.cf3c.08da.3acf.68ec.3bd1.1f2c.abfe.f500.
|
||||
1897.c42e.a3ec.2159.86d6.e2f1.b344.9d06.b600.0200.0132.ebe7.8800
|
||||
==
|
||||
:~ :- ~[//unix]
|
||||
[%pass /bone/~nec/0/5 %g %plea ~nec %g /ge/pub [%0 %s /foo]]
|
||||
==
|
||||
==
|
||||
:: publisher gall hears new %watch, passes to self
|
||||
:- t22 |. :- %|
|
||||
=^ t23 gall.bud
|
||||
%: gall-check-call:v gall.bud
|
||||
[~1111.1.7 0xbeef.dead *roof]
|
||||
:- ~[/bone/~nec/0/5 //unix]
|
||||
[%plea ~nec %g /ge/pub [%0 %s /foo]]
|
||||
:~ :- ~[/bone/~nec/0/5 //unix]
|
||||
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
|
||||
==
|
||||
==
|
||||
:: publisher gall runs :pub's +on-watch, gives ack to self
|
||||
:- t23 |. :- %|
|
||||
=^ t24 gall.bud
|
||||
%: gall-check-call:v gall.bud
|
||||
[~1111.1.7 0xbeef.dead *roof]
|
||||
:- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
|
||||
[%deal [~nec ~bud] %pub %watch /foo]
|
||||
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
|
||||
[%give %unto %watch-ack ~]
|
||||
==
|
||||
==
|
||||
:: publisher gall hears %watch-ack, gives to ames
|
||||
:- t24 |. :- %|
|
||||
=^ t25 gall.bud
|
||||
%: gall-check-take:v gall.bud
|
||||
[~1111.1.7 0xbeef.dead *roof]
|
||||
:+ /sys/req/~nec/pub ~[/bone/~nec/0/5 //unix]
|
||||
[%gall %unto %watch-ack ~]
|
||||
:~ :- ~[/bone/~nec/0/5 //unix] [%give %done ~]
|
||||
==
|
||||
==
|
||||
:: publisher ames hears done from gall, sends over the network
|
||||
:- t25 |. :- %|
|
||||
=^ t26 ames.bud
|
||||
%: ames-check-take:v ames.bud
|
||||
[~1111.1.7 0xbeef.dead *roof]
|
||||
:+ /bone/~nec/0/5 ~[//unix]
|
||||
[%gall %done ~]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~nec]
|
||||
0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
|
||||
49f4.4848.bfa6.f600.0100.0223.c98c.8800
|
||||
== ==
|
||||
==
|
||||
:: publisher ames hears %cork, passes to itself
|
||||
:- t26 |. :- %|
|
||||
=^ t27 ames.bud
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.8 0xbeef.dead *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~nec]
|
||||
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
|
||||
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
|
||||
==
|
||||
:~ :- ~[//unix] [%pass /bone/~nec/0/1 %a %plea ~nec [%a /close ~]]
|
||||
==
|
||||
==
|
||||
:- t27 |. :- %|
|
||||
:: publisher ames hear cork plea from self, give %done to self
|
||||
=^ t28 ames.bud
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.8 0xbeef.dead *roof]
|
||||
:- ~[/bone/~nec/0/1 //unix]
|
||||
[%plea ~nec [%a /close ~]]
|
||||
:~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
|
||||
==
|
||||
==
|
||||
:: publisher ames hears cork done from self, sends ack packet
|
||||
:- t28 |. :- %|
|
||||
=^ t29 ames.bud
|
||||
%: ames-check-take:v ames.bud
|
||||
[~1111.1.8 0xbeef.dead *roof]
|
||||
:+ /bone/~nec/0/1
|
||||
~[//unix]
|
||||
[%ames %done ~]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~nec]
|
||||
0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
|
||||
1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
|
||||
== ==
|
||||
==
|
||||
:: subscriber ames hears %watch-ack, gives to gall
|
||||
:- t29 |. :- %|
|
||||
=^ t30 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.9 0xdead.beef *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~bud]
|
||||
0x5f5.c27c.c400.0587.8b0d.0a5d.eb8e.39fa.
|
||||
49f4.4848.bfa6.f600.0100.0223.c98c.8800
|
||||
==
|
||||
:~ :- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%give %done ~]
|
||||
:- ~[/ames] [%pass /pump/~bud/4 %b %rest ~1111.1.5..00.00.01]
|
||||
==
|
||||
==
|
||||
:: subscriber gall hears new %watch-ack from ames, gives to self
|
||||
:- t30 |. :- %|
|
||||
=^ t31 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.9 0xdead.beef *roof]
|
||||
:+ /sys/way/~bud/pub
|
||||
:~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%ames %done ~]
|
||||
:~ :- :~ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%give %unto %watch-ack ~]
|
||||
==
|
||||
==
|
||||
:: subscriber gall hears new %watch-ack from self, tells :sub
|
||||
:- t31 |. :- %|
|
||||
=^ t32 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.9 0xdead.beef *roof]
|
||||
:+ /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
|
||||
~[/init]
|
||||
[%gall %unto %watch-ack ~]
|
||||
~
|
||||
==
|
||||
:: subscriber ames hears %cork ack
|
||||
:- t32 |. :- %|
|
||||
=^ t33 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.10 0xdead.beef *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~bud]
|
||||
0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
|
||||
1d87.53fe.d7bb.ad00.0100.0223.c6a8.5800
|
||||
==
|
||||
:~ :- :~ /sys/way/~bud/pub
|
||||
/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%give %done ~]
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.5..00.02.00]
|
||||
==
|
||||
==
|
||||
:: subscriber gall hears %cork ack from ames
|
||||
:- t33 |. :- %|
|
||||
=^ t34 gall.nec
|
||||
%: gall-check-take:v gall.nec
|
||||
[~1111.1.10 0xdead.beef *roof]
|
||||
:+ /sys/way/~bud/pub
|
||||
:~ /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
|
||||
/init
|
||||
==
|
||||
[%ames %done ~]
|
||||
~
|
||||
==
|
||||
:- t34 |. :- %&
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!> (sy 0 ~)
|
||||
!> =< corked
|
||||
%: ames-scry-peer:v
|
||||
ames.nec
|
||||
[~1111.1.10 0xdead.beef *roof]
|
||||
[~nec ~bud]
|
||||
==
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (sy 1 ~)
|
||||
!> =< corked
|
||||
%: ames-scry-peer:v
|
||||
ames.bud
|
||||
[~1111.1.8 0xbeef.dead *roof]
|
||||
[~bud ~nec]
|
||||
==
|
||||
::
|
||||
%+ expect-eq
|
||||
!> 2
|
||||
!> %: gall-scry-nonce:v
|
||||
gall.nec
|
||||
[~1111.1.10 0xdead.beef *roof]
|
||||
~nec %sub
|
||||
[~bud %pub /sub-foo/~bud]
|
||||
==
|
||||
==
|
||||
--
|
@ -38,7 +38,37 @@
|
||||
=/ b (mule a)
|
||||
?- -.b
|
||||
%| ~
|
||||
%& [leaf+"expected failure - succeeded" ~]
|
||||
%& ['expected failure - succeeded' ~]
|
||||
==
|
||||
:: +expect-runs: kicks a trap, expecting success; returns trace on failure
|
||||
::
|
||||
++ expect-success
|
||||
|= a=(trap)
|
||||
^- tang
|
||||
=/ b (mule a)
|
||||
?- -.b
|
||||
%& ~
|
||||
%| ['expected success - failed' p.b]
|
||||
==
|
||||
:: $test-chain: a sequence of tests to be run
|
||||
::
|
||||
+$ test-chain
|
||||
$_
|
||||
|?
|
||||
?: =(0 0)
|
||||
[%& p=*tang]
|
||||
[%| p=[tang=*tang next=^?(..$)]]
|
||||
:: +run-chain: run a sequence of tests, stopping at first failure
|
||||
::
|
||||
++ run-chain
|
||||
|= seq=test-chain
|
||||
^- tang
|
||||
=/ res $:seq
|
||||
?- -.res
|
||||
%& p.res
|
||||
%| ?. =(~ tang.p.res)
|
||||
tang.p.res
|
||||
$(seq next.p.res)
|
||||
==
|
||||
:: +category: prepends a name to an error result; passes successes unchanged
|
||||
::
|
||||
|
25068
pkg/interface/package-lock.json
generated
25068
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@
|
||||
"@tlon/indigo-react": "^1.2.27",
|
||||
"@tlon/sigil-js": "^1.4.5",
|
||||
"@urbit/api": "^2.1.1",
|
||||
"@urbit/http-api": "^2.1.0",
|
||||
"@urbit/http-api": "2.1.1",
|
||||
"any-ascii": "^0.1.7",
|
||||
"aws-sdk": "^2.830.0",
|
||||
"big-integer": "^1.6.48",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {
|
||||
Box,
|
||||
Box
|
||||
} from '@tlon/indigo-react';
|
||||
import React from 'react';
|
||||
import useSettingsState from '~/logic/state/settings';
|
||||
@ -103,7 +103,7 @@ function RemoteContentInner(props: RemoteContentProps) {
|
||||
return (
|
||||
<Box mt={1} mb={2} flexShrink={0}>
|
||||
<RemoteContentWrapper {...wrapperProps} noOp={transcluded} replaced>
|
||||
<RemoteContentImageEmbed url={url} />
|
||||
<RemoteContentImageEmbed url={url} stretch={tall} />
|
||||
</RemoteContentWrapper>
|
||||
</Box>
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
:~ title+'Groups'
|
||||
info+'A suite of applications to communicate on Urbit'
|
||||
color+0xee.5432
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v3.mtkm8.77bad.7j793.jtnl4.pi1mm.glob' 0v3.mtkm8.77bad.7j793.jtnl4.pi1mm]
|
||||
glob-http+['https://bootstrap.urbit.org/glob-0v7.2rpmd.966js.dt2sj.ggv4a.n15nq.glob' 0v7.2rpmd.966js.dt2sj.ggv4a.n15nq]
|
||||
|
||||
base+'landscape'
|
||||
version+[1 1 0]
|
||||
|
@ -22,3 +22,5 @@ export * as hood from './hood';
|
||||
export * from './hood';
|
||||
export * as docket from './docket';
|
||||
export * from './docket';
|
||||
export * as term from './term';
|
||||
export * from './term';
|
||||
|
4
pkg/npm/api/package-lock.json
generated
4
pkg/npm/api/package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@urbit/api",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@urbit/api",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.0",
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Scry } from '../http-api/src'
|
||||
import { Poke } from '../http-api/src/types';
|
||||
import { Poke } from '../lib'
|
||||
import { Belt, Task, SessionTask } from './types';
|
||||
|
||||
export const pokeTask = (session: string, task: Task): Poke<SessionTask> => ({
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@urbit/http-api",
|
||||
"version": "2.1.3",
|
||||
"version": "2.3.0",
|
||||
"license": "MIT",
|
||||
"description": "Library to interact with an Urbit ship over HTTP",
|
||||
"repository": {
|
||||
|
@ -28,11 +28,13 @@ export class Urbit {
|
||||
private uid: string = `${Math.floor(Date.now() / 1000)}-${hexString(6)}`;
|
||||
|
||||
/**
|
||||
* Last Event ID is an auto-updated index of which events have been sent over this channel
|
||||
* lastEventId is an auto-updated index of which events have been *sent* over this channel.
|
||||
* lastHeardEventId is the latest event we have heard back about.
|
||||
* lastAcknowledgedEventId is the latest event we have sent an ack for.
|
||||
*/
|
||||
private lastEventId: number = 0;
|
||||
|
||||
private lastAcknowledgedEventId: number = 0;
|
||||
private lastHeardEventId: number = -1;
|
||||
private lastAcknowledgedEventId: number = -1;
|
||||
|
||||
/**
|
||||
* SSE Client is null for now; we don't want to start polling until it the channel exists
|
||||
@ -142,7 +144,7 @@ export class Urbit {
|
||||
code,
|
||||
verbose = false,
|
||||
}: AuthenticationInterface) {
|
||||
const airlock = new Urbit(`http://${url}`, code);
|
||||
const airlock = new Urbit(url.startsWith('http') ? url : `http://${url}`, code);
|
||||
airlock.verbose = verbose;
|
||||
airlock.ship = ship;
|
||||
await airlock.connect();
|
||||
@ -236,6 +238,13 @@ export class Urbit {
|
||||
}
|
||||
if (!event.id) return;
|
||||
const eventId = parseInt(event.id, 10);
|
||||
if (eventId <= this.lastHeardEventId) {
|
||||
console.log('dropping old or out-of-order event', {
|
||||
eventId, lastHeard: this.lastHeardEventId
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.lastHeardEventId = eventId;
|
||||
if (eventId - this.lastAcknowledgedEventId > 20) {
|
||||
this.ack(eventId);
|
||||
}
|
||||
@ -273,7 +282,7 @@ export class Urbit {
|
||||
) {
|
||||
const funcs = this.outstandingSubscriptions.get(data.id);
|
||||
try {
|
||||
funcs.event(data.json);
|
||||
funcs.event(data.json, data.mark ?? 'json');
|
||||
} catch (e) {
|
||||
console.error('Failed to call subscription event callback', e);
|
||||
}
|
||||
@ -320,7 +329,8 @@ export class Urbit {
|
||||
this.abort = new AbortController();
|
||||
this.uid = `${Math.floor(Date.now() / 1000)}-${hexString(6)}`;
|
||||
this.lastEventId = 0;
|
||||
this.lastAcknowledgedEventId = 0;
|
||||
this.lastHeardEventId = -1;
|
||||
this.lastAcknowledgedEventId = -1;
|
||||
this.outstandingSubscriptions = new Map();
|
||||
this.outstandingPokes = new Map();
|
||||
this.sseClientInitialized = false;
|
||||
@ -330,8 +340,7 @@ export class Urbit {
|
||||
* Autoincrements the next event ID for the appropriate channel.
|
||||
*/
|
||||
private getEventId(): number {
|
||||
this.lastEventId = Number(this.lastEventId) + 1;
|
||||
return this.lastEventId;
|
||||
return ++this.lastEventId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -536,7 +545,12 @@ export class Urbit {
|
||||
const response = await fetch(
|
||||
`${this.url}/~/scry/${app}${path}.json`,
|
||||
this.fetchOptions
|
||||
);
|
||||
)
|
||||
|
||||
if (!response.ok) {
|
||||
return Promise.reject(response);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ export interface SubscriptionInterface {
|
||||
/**
|
||||
* Handle %fact
|
||||
*/
|
||||
event?(data: any): void;
|
||||
event?(data: any, mark: string): void;
|
||||
/**
|
||||
* Handle %kick
|
||||
*/
|
||||
|
@ -131,8 +131,8 @@ describe('subscription', () => {
|
||||
await wait(600);
|
||||
|
||||
expect(airlock.onOpen).toBeCalled();
|
||||
expect(params.event).toHaveBeenNthCalledWith(1, firstEv);
|
||||
expect(params.event).toHaveBeenNthCalledWith(2, secondEv);
|
||||
expect(params.event).toHaveBeenNthCalledWith(1, firstEv, 'json');
|
||||
expect(params.event).toHaveBeenNthCalledWith(2, secondEv, 'json');
|
||||
}, 800);
|
||||
it('should poke', async () => {
|
||||
fetchSpy = jest.spyOn(window, 'fetch');
|
||||
|
Loading…
Reference in New Issue
Block a user