fine: actively fetch rift for moons

This commit is contained in:
Philip Monk 2023-06-14 23:28:37 -07:00
parent f68f3dc833
commit 238a36de1d
2 changed files with 74 additions and 9 deletions

View File

@ -118,6 +118,11 @@
=. state new-state
loop(old-ships t.old-ships)
::
:: NB: !! This includes our own ship, and for moons, this is what
:: has caused Jael to fetch our own rift from our parent. This
:: role may be taken by Ames's subscription to %public-keys, but
:: this must be tested before changing the behavior here.
::
=/ new-ships (saxo:title our now our)
|- ^- (quip card _state)
=* loop $

View File

@ -1074,6 +1074,17 @@
--
--
--
::
+$ ames-state-14
$: peers=(map ship ship-state)
=unix=duct
=life
=rift
crypto-core=acru:ames
=bug
snub=[form=?(%allow %deny) ships=(set ship)]
cong=[msg=@ud mem=@ud]
==
:: $bug: debug printing configuration
::
:: veb: verbosity toggles
@ -1207,7 +1218,8 @@
[%11 ames-state-11]
[%12 ames-state-12]
[%13 ames-state-13]
[%14 ^ames-state]
[%14 ames-state-14]
[%15 ^ames-state]
==
::
|= [now=@da eny=@ rof=roof]
@ -1330,7 +1342,7 @@
:: lifecycle arms; mostly pass-throughs to the contained adult ames
::
++ scry scry:adult-core
++ stay [%14 %larva queued-events ames-state.adult-gate]
++ stay [%15 %larva queued-events ames-state.adult-gate]
++ load
|= $= old
$% $: %4
@ -1404,6 +1416,13 @@
[%adult state=ames-state-13]
== ==
$: %14
$% $: %larva
events=(qeu queued-event)
state=ames-state-14
==
[%adult state=ames-state-14]
== ==
$: %15
$% $: %larva
events=(qeu queued-event)
state=_ames-state.adult-gate
@ -1517,12 +1536,23 @@
=. queued-events events.old
larval-gate
::
[%14 %adult *] (load:adult-core %14 state.old)
[%14 %adult *]
=. cached-state `[%14 state.old]
~> %slog.0^leaf/"ames: larva reload"
larval-gate
::
[%14 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. cached-state `[%14 state.old]
=. queued-events events.old
=. adult-gate (load:adult-core %14 state.old)
larval-gate
::
[%15 %adult *] (load:adult-core %15 state.old)
::
[%15 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old
=. adult-gate (load:adult-core %15 state.old)
larval-gate
==
::
@ -1567,7 +1597,9 @@
13+(state-12-to-13:load:adult-core +.u.cached-state)
=? u.cached-state ?=(%13 -.u.cached-state)
14+(state-13-to-14:load:adult-core +.u.cached-state)
?> ?=(%14 -.u.cached-state)
=? u.cached-state ?=(%14 -.u.cached-state)
15+(state-14-to-15:load:adult-core +.u.cached-state)
?> ?=(%15 -.u.cached-state)
=. ames-state.adult-gate +.u.cached-state
[moz larval-core(cached-state ~)]
--
@ -2260,6 +2292,9 @@
::
=~ (emit duct %pass /turf %j %turf ~)
(emit duct %pass /private-keys %j %private-keys ~)
?: ?=(%earl (clan:title our))
(emit duct %pass /public-keys %j %public-keys [n=our ~ ~])
event-core
==
:: +on-priv: set our private key to jael's response
::
@ -2321,6 +2356,8 @@
++ on-publ-breach
|= =ship
^+ event-core
?: =(our ship)
event-core
::
=/ ship-state (~(get by peers.ames-state) ship)
:: we shouldn't be hearing about ships we don't care about
@ -2383,6 +2420,8 @@
=public-key
==
^+ event-core
?: =(our ship)
event-core
::
=/ ship-state (~(get by peers.ames-state) ship)
?. ?=([~ %known *] ship-state)
@ -2412,6 +2451,9 @@
|= [=ship sponsor=(unit ship)]
^+ event-core
::
?: =(our ship)
event-core
::
?~ sponsor
%- (slog leaf+"ames: {(scow %p ship)} lost sponsor, ignoring" ~)
event-core
@ -2435,6 +2477,10 @@
::
=+ ^- [=ship =point] i.points
::
?: =(our ship)
=. rift.ames-state rift.point
$(points t.points)
::
?. (~(has by keys.point) life.point)
$(points t.points)
::
@ -2499,6 +2545,9 @@
++ on-publ-rift
|= [=ship =rift]
^+ event-core
?: =(our ship)
=. rift.ames-state rift
event-core
?~ ship-state=(~(get by peers.ames-state) ship)
:: print error here? %rift was probably called before %keys
::
@ -4649,15 +4698,15 @@
[moves ames-gate]
:: +stay: extract state before reload
::
++ stay [%14 %adult ames-state]
++ stay [%15 %adult ames-state]
:: +load: load in old state after reload
::
++ load
=< |= $= old-state
$% [%14 ^ames-state]
$% [%15 ^ames-state]
==
^+ ames-gate
?> ?=(%14 -.old-state)
?> ?=(%15 -.old-state)
ames-gate(ames-state +.old-state)
:: all state transitions are called from larval ames
::
@ -4801,7 +4850,7 @@
::
++ state-13-to-14
|= old=ames-state-13
^- ^ames-state
^- ames-state-14
=- old(peers -)
%- ~(run by peers.old)
|= old=ship-state-13
@ -4815,6 +4864,14 @@
%+ gas:((on @ud want) lte) ~
%+ turn (tap:(deq:keen-state-13 want) wan.old)
|= =want [fra .]:want
::
++ state-14-to-15
|= old=ames-state-14
^- ^ames-state
=? rift.old ?=(%earl (clan:title our))
!< =rift
q:(need (need (rof ~ %j `beam`[[our %rift %da now] /(scot %p our)])))
old
--
:: +scry: dereference namespace
::
@ -5012,5 +5069,8 @@
?~ keen=(~(get by keens.u.peer) path)
[~ ~]
``noun+!>(listeners:u.keen)
::
[%rift ~]
``noun+!>(rift.ames-state)
==
--