Merge pull request #978 from urbit/ames-jael-scrys

scry for +life in %ames (fewer %open packets)
This commit is contained in:
Joe Bryan 2019-01-11 18:00:19 -05:00 committed by GitHub
commit b1861d4bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -510,31 +510,44 @@
++ am :: am ++ am :: am
~% %ames-am ..is ~ ~% %ames-am ..is ~
|_ [our=ship now=@da fox=fort ski=sley] :: protocol engine |_ [our=ship now=@da fox=fort ski=sley] :: protocol engine
:: +deed: scry for our deed :: +deed-scry: for a +deed at a +life
:: ::
++ deed ++ deed-scry
~/ %deed ~/ %deed-scry
|= [who=ship lyf=life] |= [who=ship lyf=life]
^- (unit ^deed) ^- (unit deed)
=; ded =; ded
?~(ded ~ u.ded) ?~(ded ~ u.ded)
;; (unit (unit ^deed)) ;; (unit (unit deed))
%- (sloy-light ski) %- (sloy-light ski)
=/ pur=spur =/ pur=spur
/(scot %ud lyf)/(scot %p who) /(scot %ud lyf)/(scot %p who)
[[151 %noun] %j our %deed da+now pur] [[151 %noun] %j our %deed da+now pur]
:: +sein: scry for sponsor :: +life-scry: for a +life
:: ::
++ sein ++ life-scry
~/ %life-scry
|= who=ship
^- (unit life)
=; lyf
?~(lyf ~ u.lyf)
;; (unit (unit life))
%- (sloy-light ski)
=/ pur=spur
/(scot %p who)
[[151 %noun] %j our %life da+now pur]
:: +sein-scry: for sponsor
::
++ sein-scry
~/ %sein ~/ %sein
|= who=ship |= who=ship
;; ship ;; ship
%- need %- need %- need %- need
%- (sloy-light ski) %- (sloy-light ski)
[[151 %noun] %j our %sein da+now /(scot %p who)] [[151 %noun] %j our %sein da+now /(scot %p who)]
:: +saxo: scry for sponsorship chain :: +saxo-scry: for sponsorship chain
:: ::
++ saxo ++ saxo-scry
~/ %saxo ~/ %saxo
|= who=ship |= who=ship
;; (list ship) ;; (list ship)
@ -566,7 +579,7 @@
law.ton law.ton
:: save our deed (for comet/moon communication) :: save our deed (for comet/moon communication)
:: ::
(need (deed our life)) (need (deed-scry our life))
:: ::
val.ton val.ton
:: save our secrets, ready for action :: save our secrets, ready for action
@ -741,13 +754,13 @@
?^ ram raz.bah ?^ ram raz.bah
%+ ~(put by raz.bah) cha %+ ~(put by raz.bah) cha
rum(dod &, bum ?~(cop bum.rum (~(put by bum.rum) did.rum u.cop))) rum(dod &, bum ?~(cop bum.rum (~(put by bum.rum) did.rum u.cop)))
=/ seg (sein her) =/ seg (sein-scry her)
=^ roc diz (zuul:diz now seg [%back cop dam ~s0]) =^ roc diz (zuul:diz now seg [%back cop dam ~s0])
(busk(diz (wast:diz ryn)) xong roc) (busk(diz (wast:diz ryn)) xong roc)
:: XX move this logic into %zuse, namespaced under %jael? :: XX move this logic into %zuse, namespaced under %jael?
:: ::
++ deng :: deng:ho:um:am ++ deng :: deng:ho:um:am
|= law=(unit ^deed) :: accept inline deed |= law=(unit deed) :: accept inline deed
^+ diz ^+ diz
?: |(=(~ law) =(lew.wod.dur.diz law)) ?: |(=(~ law) =(lew.wod.dur.diz law))
diz diz
@ -787,7 +800,7 @@
:: our sponsor :: our sponsor
:: ::
?& !?=(%czar (clan:title our)) ?& !?=(%czar (clan:title our))
=(her (sein our)) =(her (sein-scry our))
== ==
== ==
diz(lew.wod.dur law) diz(lew.wod.dur law)
@ -827,11 +840,8 @@
:: (to avoid dropping the packet, if possible). :: (to avoid dropping the packet, if possible).
:: ::
=? lew.wod.dur.diz ?=(~ lew.wod.dur.diz) =? lew.wod.dur.diz ?=(~ lew.wod.dur.diz)
:: we could get the life from the packet if %open =/ life (life-scry her)
:: for now, we guess 1 for the life ?~(life ~ (deed-scry her u.life))
:: XX revise
::
(deed her 1)
:: if we have a deed, proceed :: if we have a deed, proceed
:: ::
?^ lew.wod.dur.diz ?^ lew.wod.dur.diz
@ -841,14 +851,14 @@
:: XX TOFU is unnecessary if we include keys :: XX TOFU is unnecessary if we include keys
:: for the full sponsorship chain in the boot event :: for the full sponsorship chain in the boot event
:: ::
?: =(her (sein our)) ?: =(her (sein-scry our))
apse apse
:: if :her is a comet, or a moon of a known ship, proceed :: if :her is a comet, or a moon of a known ship, proceed
:: ::
=/ =rank:title (clan:title her) =/ =rank:title (clan:title her)
?: ?| ?=(%pawn rank) ?: ?| ?=(%pawn rank)
?& ?=(%earl rank) ?& ?=(%earl rank)
!=(~ lew.wod.dur:(myx:gus (sein her))) !=(~ lew.wod.dur:(myx:gus (sein-scry her)))
== == == ==
apse apse
:: otherwise, drop the packet :: otherwise, drop the packet
@ -938,7 +948,7 @@
^+ . :: send new ack ^+ . :: send new ack
:: ~& [%back kay dam] :: ~& [%back kay dam]
=* cop `coop`?:(=(%good kay) ~ ``[%dead-packet ~]) =* cop `coop`?:(=(%good kay) ~ ``[%dead-packet ~])
=/ seg (sein her) =/ seg (sein-scry her)
=^ pax diz (zuul:diz now seg [%back cop dam ~s0]) =^ pax diz (zuul:diz now seg [%back cop dam ~s0])
+>(+> (busk(diz (wast:diz ryn)) xong pax)) +>(+> (busk(diz (wast:diz ryn)) xong pax))
:: ::
@ -1090,7 +1100,7 @@
|= [gom=soup ham=meal] |= [gom=soup ham=meal]
:: ~& [%wind her gom] :: ~& [%wind her gom]
^+ +> ^+ +>
=/ seg (sein her) =/ seg (sein-scry her)
=^ wyv diz (zuul:diz now seg ham) =^ wyv diz (zuul:diz now seg ham)
=^ feh puz (whap:puz now gom wyv) =^ feh puz (whap:puz now gom wyv)
(busk xong feh) (busk xong feh)
@ -1102,11 +1112,18 @@
=/ sex=@ud sed.rol =/ sex=@ud sed.rol
:: ~& [%tx [our her] cha sex] :: ~& [%tx [our her] cha sex]
:: if we don't have a public key for :her, :: if we don't have a public key for :her,
:: request keys and proceed (skin will be %open) :: subscribe to %jael for keys and proceed
:: ::
:: XX update state so we only ask once? :: XX update state so we only ask once?
:: ::
=? bin =(~ lew.wod.dur.diz) :_(bin [%beer her]) =? bin =(~ lew.wod.dur.diz) :_(bin [%beer her])
:: if we don't have a public key for :her,
:: scry into %jael for them.
:: (skin will only be %open if the scry is ~)
::
=? lew.wod.dur.diz =(~ lew.wod.dur.diz)
=/ life (life-scry her)
?~(life ~ (deed-scry her u.life))
=. ryl.bah =. ryl.bah
%+ ~(put by ryl.bah) cha %+ ~(put by ryl.bah) cha
%= rol %= rol
@ -1166,8 +1183,8 @@
:: ::
++ xong :: xong:ho:um:am ++ xong :: xong:ho:um:am
^- (list ship) :: route unto ^- (list ship) :: route unto
=/ fro (saxo our) =/ fro (saxo-scry our)
=/ too (saxo her) =/ too (saxo-scry her)
=+ ^= oot ^- (list ship) =+ ^= oot ^- (list ship)
=| oot=(list ship) =| oot=(list ship)
|- ^+ oot |- ^+ oot
@ -1181,7 +1198,7 @@
++ kick :: kick:um:am ++ kick :: kick:um:am
|= hen=duct :: test connection |= hen=duct :: test connection
^+ +> ^+ +>
=/ hoy (tail (saxo our)) =/ hoy (tail (saxo-scry our))
|- ^+ +>.^$ |- ^+ +>.^$
?~ hoy ?~ hoy
+>.^$ +>.^$
@ -1318,7 +1335,7 @@
:: ::
=? moz ?& ?=(%duke (clan:title her)) =? moz ?& ?=(%duke (clan:title her))
?=(%king (clan:title our)) ?=(%king (clan:title our))
=(our (~(sein am [our now fox ski]) her)) =(our (~(sein-scry am [our now fox ski]) her))
== ==
=/ cmd [%meet her] =/ cmd [%meet her]
=/ pok [%dns %poke `cage`[%dns-command !>(cmd)]] =/ pok [%dns %poke `cage`[%dns-command !>(cmd)]]