From 0252d71553c0a0363c47b08cb57113cd1dec82d9 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 4 Mar 2022 18:11:16 -0600 Subject: [PATCH 01/16] gall: WIP added sub-nonce to state and wire --- pkg/arvo/sys/vane/gall.hoon | 39 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index af07252e2..72ebeafa1 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -45,6 +45,8 @@ :: $yoke: agent runner state :: :: control-duct: TODO document +:: run-nonce: unique for each rebuild +:: sub-nonce: app-wide global %watch nonce :: live: is this agent running? TODO document better :: stats: TODO document :: watches: incoming and outgoing subscription state @@ -54,8 +56,9 @@ :: +$ yoke $: control-duct=duct - nonce=@t - live=? ::TODO remove, replaced by -.agent + run-nonce=@t + sub-nonce=@ + live=? =stats =watches agent=(each agent vase) @@ -127,7 +130,7 @@ :: +$ egg $: control-duct=duct - nonce=@t + run-nonce=@t live=? =stats =watches @@ -357,7 +360,7 @@ control-duct hen beak bek agent &+agent - nonce (scot %uw (end 5 (shas %yoke-nonce eny))) + run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) == :: =/ old mo-core @@ -455,7 +458,7 @@ [%a %plea ship %g path ames-request-all] :: =. outstanding.state - =/ stand + =/ stan (~(gut by outstanding.state) [wire hen] *(qeu remote-request)) (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal)) (mo-pass wire note-arvo) @@ -738,7 +741,7 @@ ?~ yoke %- (slog leaf+"gall: {} dead, got {<+<.sign-arvo>}" ~) mo-core - ?. =(nonce.u.yoke i.t.wire) + ?. =(run-nonce.u.yoke i.t.wire) %- (slog leaf+"gall: got old {<+<.sign-arvo>} for {}" ~) mo-core ?. ?=([?(%gall %behn) %unto *] sign-arvo) @@ -1133,19 +1136,25 @@ tang.neet == =. wire + :^ %use agent-name run-nonce.current-agent ?- -.neet %agent [%out (scot %p ship.neet) name.neet wire] %huck [%out (scot %p ship.neet) name.neet wire] %arvo [(scot %p attributing.agent-routes) wire] == - =. wire [%use agent-name nonce.yoke wire] + :: increment nonce for new subscription + :: + =? run-nonce.current-agent + &(?=(%agent -.neet) ?=(?(%watch %watch-as) -.deal.neet)) + +(run-nonce.current-agent + :: =/ =note-arvo ?- -.neet %arvo note-arvo.neet %huck note-arvo.neet %agent [%g %deal [our ship.neet] [name deal]:neet] == - [duct %pass wire note-arvo]~ + [system-duct.state %pass wire note-arvo]~ == :: +ap-breach: ship breached, so forget about them :: @@ -1665,17 +1674,13 @@ $(moves t.moves, new-moves [move new-moves]) =/ =wire p.move.move ?> ?=([%use @ @ %out @ @ *] wire) - =/ short-wire t.t.t.t.t.t.wire - =/ =dock [q.p q]:q.move.move - =/ =path - ?- -.r.q.move.move - %watch path.r.q.move.move - %watch-as path.r.q.move.move - == - ?: (~(has by outbound.watches.yoke) short-wire dock) + =/ [sys-wire=^wire sub-wire=^wire] [(scag 6 wire) (slag 6 wire)] + =/ [=dock =deal] [[q.p q] r]:q.move.move + :: + ?: (~(has by outbound.watches.yoke) sub-wire dock) =. ap-core =/ =tang - ~[leaf+"subscribe wire not unique" >agent-name< >short-wire< >dock<] + ~[leaf+"subscribe wire not unique" >agent-name< >sub-wire< >dock<] =/ have (~(got by outbound.watches.yoke) short-wire dock) %- (slog >out=have< tang) From a4ae79e7944ba15db4ca3fef9ed3285a4d22b55b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 25 Jun 2021 18:11:18 -0400 Subject: [PATCH 02/16] gall: compiles with nonce in wire --- pkg/arvo/sys/lull.hoon | 2 +- pkg/arvo/sys/vane/gall.hoon | 221 ++++++++++++++++++++++++------------ 2 files changed, 150 insertions(+), 73 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index cef2295a1..f0689ad65 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1652,7 +1652,7 @@ +$ bitt (map duct (pair ship path)) :: incoming subs +$ boat :: outgoing subs %+ map [=wire =ship =term] :: - [acked=? =path] :: + [acked=? =path nonce=@] :: +$ bowl :: standard app state $: $: our=ship :: host src=ship :: guest diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 72ebeafa1..c4ebc59af 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -14,7 +14,7 @@ +$ move [=duct move=(wind note-arvo gift-arvo)] :: $state-8: overall gall state, versioned :: -+$ state-8 [%8 state] ++$ state-9 [%9 state] :: $state: overall gall state :: :: system-duct: TODO document @@ -57,7 +57,7 @@ +$ yoke $: control-duct=duct run-nonce=@t - sub-nonce=@ + sub-nonce=_1 live=? =stats =watches @@ -119,7 +119,7 @@ :: $spore: structures for update, produced by +stay :: +$ spore - $: %8 + $: %9 system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) @@ -131,6 +131,7 @@ +$ egg $: control-duct=duct run-nonce=@t + sub-nonce=@ live=? =stats =watches @@ -167,7 +168,7 @@ [^duct %pass /whiz/gall %$ %whiz ~]~ =/ adult adult-core =. state.adult - [%8 system-duct outstanding contacts yokes=~ blocked]:spore + [%9 system-duct outstanding contacts yokes=~ blocked]:spore =/ mo-core (mo-abed:mo:adult duct) =. mo-core =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore) @@ -226,9 +227,9 @@ :: ++ load |^ |= old=spore-any - =? old ?=(%7 -.old) - (spore-7-to-8 old) - ?> ?=(%8 -.old) + =? old ?=(%7 -.old) (spore-7-to-8 old) + =? old ?=(%8 -.old) (spore-8-to-9 old) + ?> ?=(%9 -.old) =. spore old ?. =(~ eggs.spore) pupal-gate @@ -237,32 +238,79 @@ state spore(eggs *(map term yoke)) == :: - +$ spore-any $%(^spore spore-7) + +$ spore-any $%(^spore spore-8 spore-7) +$ spore-7 $: %7 wipe-eyre-subs=_| ::NOTE band-aid for #3196 system-duct=duct outstanding=(map [wire duct] (qeu remote-request)) contacts=(set ship) - eggs=(map term egg) + eggs=(map term egg-7) blocked=(map term (qeu blocked-move)) == :: + +$ spore-8 + $: %8 + system-duct=duct + outstanding=(map [wire duct] (qeu remote-request)) + contacts=(set ship) + eggs=(map term egg-8) + blocked=(map term (qeu blocked-move)) + == + :: + +$ egg-7 egg-8 + +$ egg-8 + $: control-duct=duct + run-nonce=@t + live=? + =stats + watches=watches-8 + old-state=(each vase vase) + =beak + marks=(map duct mark) + == + :: + +$ watches-8 [inbound=bitt outbound=boat-8] + +$ boat-8 (map [wire ship term] [acked=? =path]) + :: ++ spore-7-to-8 |= old=spore-7 - ^- ^spore + ^- spore-8 :- %8 =. eggs.old %- ~(urn by eggs.old) - |= [a=term e=egg] + |= [a=term e=egg-7] ::NOTE kiln will kick off appropriate app revival e(old-state [%| p.old-state.e]) +>.old + :: + ++ spore-8-to-9 + |= old=spore-8 + ^- ^spore + =- old(- %9, eggs -) + %- ~(run by eggs.old) + |= =egg-8 + ^- egg + :* control-duct.egg-8 + run-nonce.egg-8 + sub-nonce=0 + live.egg-8 + stats.egg-8 + [inbound.watches.egg-8 (boat-8-to-9 outbound.watches.egg-8)] + [old-state beak marks]:egg-8 + == + :: + ++ boat-8-to-9 + |= =boat-8 + ^- boat + %- ~(run by boat-8) + |= [acked=? =path] + [acked path nonce=0] -- -- :: adult gall vane interface, for type compatibility with pupa :: -=| state=state-8 +=| state=state-9 |= [now=@da eny=@uvJ rof=roof] =* gall-payload . =< ~% %gall-wrap ..mo ~ @@ -458,7 +506,7 @@ [%a %plea ship %g path ames-request-all] :: =. outstanding.state - =/ stan + =/ stand (~(gut by outstanding.state) [wire hen] *(qeu remote-request)) (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal)) (mo-pass wire note-arvo) @@ -1039,7 +1087,7 @@ :: ++ ap-nuke ^+ ap-core - =/ out=(list [[=wire =ship =term] ? =path]) + =/ out=(list [[=wire =ship =term] ? =path nonce=@]) ~(tap by outbound.watches.yoke) =/ inbound-paths=(set path) %- silt @@ -1052,7 +1100,7 @@ ~ [%give %kick ~(tap in inbound-paths) ~]~ %+ turn ~(tap by outbound.watches.yoke) - |= [[=wire =ship =term] ? =path] + |= [[=wire =ship =term] ? =path nonce=@] [%pass wire %agent [ship term] %leave ~] =^ maybe-tang ap-core (ap-ingest ~ |.([will *agent])) ap-core @@ -1142,11 +1190,6 @@ %huck [%out (scot %p ship.neet) name.neet wire] %arvo [(scot %p attributing.agent-routes) wire] == - :: increment nonce for new subscription - :: - =? run-nonce.current-agent - &(?=(%agent -.neet) ?=(?(%watch %watch-as) -.deal.neet)) - +(run-nonce.current-agent :: =/ =note-arvo ?- -.neet @@ -1170,7 +1213,7 @@ core(agent-duct agent-duct) $(in t.in) :: - =/ out=(list [[=wire =^ship =term] ? =path]) + =/ out=(list [[=wire =^ship =term] ? =path nonce=@]) ~(tap by outbound.watches.yoke) |- ^+ ap-core ?~ out @@ -1178,7 +1221,8 @@ =? ap-core =(ship ship.i.out) =/ core =. agent-duct system-duct.state - =/ way [%out (scot %p ship) term.i.out wire.i.out] + =/ way + [%out (scot %p ship) term.i.out (scot %ud nonce.i.out) wire.i.out] (ap-specific-take way %kick ~) core(agent-duct agent-duct) $(out t.out) @@ -1293,15 +1337,6 @@ ?: ?=(%& -.res) ``want^p.res ((slog leaf+"peek failed tube from {(trip have)} to {(trip want)}" ~) ~) - :: +ap-update-subscription: update subscription. - :: - ++ ap-update-subscription - ~/ %ap-update-subscription - |= [is-ok=? =other=ship other-agent=term =wire] - ^+ ap-core - ?: is-ok - ap-core - (ap-kill-down wire [other-ship other-agent]) :: +ap-move: send move :: ++ ap-move @@ -1433,48 +1468,79 @@ %- ap-move :_ ~ :^ hen %pass /nowhere [%c %warp our q.beak.yoke ~ %sing %b case /[mark.unto]] + |^ ^+ ap-core + :: %poke-ack has no nonce :: - :: if subscription ack or close, handle before calling user code + ?: ?=(%poke-ack -.sign) + ingest-and-check-error + :: pop nonce off .agent-wire and match against stored subscription + =^ nonce=@ agent-wire [(slav %ud (head agent-wire)) (tail agent-wire)] + =/ sub-key [agent-wire dock] + =/ wat (~(get by outbound.watches.yoke) sub-key) + ?~ wat + :: we should be subscribed, but if not, no-op for integrity + :: + %. ap-core + %- slog :~ + leaf+"{}: got {<-.sign>} for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + == + :: make sure wire nonce matches stored nonce :: - =? outbound.watches.yoke ?=(%kick -.sign) - %- ~(del by outbound.watches.yoke) - [agent-wire dock] - ?: ?& ?=(%watch-ack -.sign) - !(~(has by outbound.watches.yoke) [agent-wire dock]) - == - %- %: slog - leaf+"{}: got ack for nonexistent subscription" - leaf+"{}: {}" - >wire=wire< - ~ - == - ap-core + ?. =(nonce.u.wat nonce) + %. ap-core + %- slog :~ + =/ nonces [expected=nonce.u.wat got=nonce] + =/ ok |(?=(?(%fact %kick) -.sign) =(~ p.sign)) + leaf+"{}: stale %watch-ack {} ok={}" + :: + leaf+"{}: {}" + >wire=wire< + == + ?- -.sign + %fact + =^ tan ap-core ingest + ?~ tan ap-core + =. ap-core (ap-kill-down sub-key) + (ap-error -.sign leaf/"take %fact failed, closing subscription" u.tan) :: - =? outbound.watches.yoke ?=(%watch-ack -.sign) - ?^ p.sign + %kick + :: if subscription ack or close, handle before calling user code + :: + =. outbound.watches.yoke %- ~(del by outbound.watches.yoke) [agent-wire dock] - %+ ~(jab by outbound.watches.yoke) [agent-wire dock] - |= [acked=? =path] - =. . - ?. acked - . - %- =/ =tape - "{}: received 2nd watch-ack on {}" - (slog leaf+tape ~) - . - [& path] + :: + ingest-and-check-error :: - =^ maybe-tang ap-core - %+ ap-ingest ~ |. - (on-agent:ap-agent-core agent-wire sign) - :: if failed %fact handling, kill subscription - :: - =? ap-core ?=(%fact -.sign) - (ap-update-subscription =(~ maybe-tang) p.dock q.dock agent-wire) - ?^ maybe-tang - (ap-error -.sign leaf/"closing subscription" u.maybe-tang) - ap-core + %watch-ack + ?. (~(has by outbound.watches.yoke) sub-key) + %- %: slog + leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + ~ + == + ap-core + =. outbound.watches.yoke + ?^ p.sign + (~(del by outbound.watches.yoke) sub-key) + :: + %+ ~(jab by outbound.watches.yoke) sub-key + |= val=[acked=? =path nonce=@] + =? . acked.val + %.(. (slog leaf+"{} 2nd watch-ack on {}" ~)) + val(acked &) + :: + ingest-and-check-error + == + ++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign))) + ++ ingest-and-check-error + ^+ ap-core + =^ tan ap-core ingest + ?~(tan ap-core (ap-error -.sign leaf/"take {<-.sign>} failed" u.tan)) + -- :: +ap-install: install wrapper. :: ++ ap-install @@ -1674,7 +1740,8 @@ $(moves t.moves, new-moves [move new-moves]) =/ =wire p.move.move ?> ?=([%use @ @ %out @ @ *] wire) - =/ [sys-wire=^wire sub-wire=^wire] [(scag 6 wire) (slag 6 wire)] + =/ sys-wire=^wire (scag 6 `^wire`wire) + =/ sub-wire=^wire (slag 6 `^wire`wire) =/ [=dock =deal] [[q.p q] r]:q.move.move :: ?: (~(has by outbound.watches.yoke) sub-wire dock) @@ -1682,13 +1749,23 @@ =/ =tang ~[leaf+"subscribe wire not unique" >agent-name< >sub-wire< >dock<] =/ have - (~(got by outbound.watches.yoke) short-wire dock) + (~(got by outbound.watches.yoke) sub-wire dock) %- (slog >out=have< tang) (ap-error %watch-not-unique tang) :: reentrant, maybe bad? $(moves t.moves) - =. outbound.watches.yoke - (~(put by outbound.watches.yoke) [short-wire dock] [| path]) - $(moves t.moves, new-moves [move new-moves]) + :: + =. p.move.move + (weld sys-wire [(scot %ud sub-nonce.yoke) sub-wire]) + %= $ + moves t.moves + new-moves [move new-moves] + sub-nonce.current-agent +(sub-nonce.current-agent) + outbound.watches.current-agent + %+ ~(put by outbound.watches.yoke) [sub-wire dock] + :+ acked=| + path=?+(-.deal !! %watch path.deal, %watch-as path.deal) + sub-nonce.yoke + == -- -- :: +call: request From c63732cd77db4c8795027d76fcc3935f08882b5e Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 25 Jun 2021 20:46:36 -0400 Subject: [PATCH 03/16] dbug,spider: fix type errors; ship boots --- pkg/arvo/app/spider.hoon | 2 +- pkg/base-dev/lib/dbug.hoon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 83e360d2d..821f2ac5e 100644 --- a/pkg/arvo/app/spider.hoon +++ b/pkg/arvo/app/spider.hoon @@ -607,7 +607,7 @@ == :_ state %+ murn ~(tap by wex.bowl) - |= [[=wire =ship =term] [acked=? =path]] + |= [[=wire =ship =term] [acked=? =path nonce=@]] ^- (unit card) ?. ?& ?=([%thread @ *] wire) =(tid i.t.wire) diff --git a/pkg/base-dev/lib/dbug.hoon b/pkg/base-dev/lib/dbug.hoon index ce98619e8..c61286669 100644 --- a/pkg/base-dev/lib/dbug.hoon +++ b/pkg/base-dev/lib/dbug.hoon @@ -84,7 +84,7 @@ %+ sort ~(tap by wex.bowl) |= [[[a=wire *] *] [[b=wire *] *]] (aor a b) - |= [[=wire =ship =term] [acked=? =path]] + |= [[=wire =ship =term] [acked=? =path nonce=@]] ^- (unit tank) =; relevant=? ?. relevant ~ From edf5ec91237c52f15ce6ae5401be60eaad0c425b Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Sun, 27 Jun 2021 19:47:24 -0400 Subject: [PATCH 04/16] gall: upgrades almost smoothly --- pkg/arvo/sys/vane/gall.hoon | 122 ++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 53 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index c4ebc59af..f8f2dede4 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1184,7 +1184,7 @@ tang.neet == =. wire - :^ %use agent-name run-nonce.current-agent + :^ %use agent-name run-nonce.yoke ?- -.neet %agent [%out (scot %p ship.neet) name.neet wire] %huck [%out (scot %p ship.neet) name.neet wire] @@ -1448,6 +1448,7 @@ =/ other-agent i.t.t.wire =/ =dock [other-ship other-agent] =/ agent-wire t.t.t.wire + =/ nonce=@ 0 :: =^ =sign:agent ap-core ?. ?=(%raw-fact -.unto) @@ -1469,73 +1470,88 @@ :^ hen %pass /nowhere [%c %warp our q.beak.yoke ~ %sing %b case /[mark.unto]] |^ ^+ ap-core - :: %poke-ack has no nonce + :: %poke-ack has no nonce; ingest directly + :: + ?: ?=(%poke-ack -.sign) + ingest-and-check-error + :: if .agent-wire matches, it's an old pre-nonce subscription + :: + ?: (~(has by outbound.watches.yoke) sub-key) + run-sign + :: if an app happened to use a null wire, no-op + :: + ?: =(~ agent-wire) + on-missing + :: pop nonce off .agent-wire and match against stored subscription + :: + =: nonce (slav %ud (head agent-wire)) + agent-wire (tail agent-wire) + == + =/ got (~(get by outbound.watches.yoke) sub-key) + ?~ got + on-missing + ?. =(nonce.u.got nonce) + (on-bad-nonce nonce.u.got) + run-sign :: - ?: ?=(%poke-ack -.sign) - ingest-and-check-error - :: pop nonce off .agent-wire and match against stored subscription - =^ nonce=@ agent-wire [(slav %ud (head agent-wire)) (tail agent-wire)] - =/ sub-key [agent-wire dock] - =/ wat (~(get by outbound.watches.yoke) sub-key) - ?~ wat - :: we should be subscribed, but if not, no-op for integrity + ++ run-sign + ?- -.sign + %poke-ack !! + %fact + =^ tan ap-core ingest + ?~ tan ap-core + =. ap-core (ap-kill-down sub-key) + (ap-error -.sign leaf/"take %fact failed, closing subscription" u.tan) :: + %kick + =. outbound.watches.yoke + (~(del by outbound.watches.yoke) sub-key) + :: + ingest-and-check-error + :: + %watch-ack + ?. (~(has by outbound.watches.yoke) sub-key) + %- %: slog + leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + ~ + == + ap-core + =. outbound.watches.yoke + ?^ p.sign + (~(del by outbound.watches.yoke) sub-key) + :: + %+ ~(jab by outbound.watches.yoke) sub-key + |= val=[acked=? =path nonce=@] + =? . acked.val + %.(. (slog leaf+"{} 2nd watch-ack on {}" ~)) + val(acked &) + :: + ingest-and-check-error + == + ++ on-missing %. ap-core %- slog :~ leaf+"{}: got {<-.sign>} for nonexistent subscription" - leaf+"{}: {}" + leaf+"{}: {<[nonce=nonce agent-wire]>}" >wire=wire< == - :: make sure wire nonce matches stored nonce - :: - ?. =(nonce.u.wat nonce) + ++ on-bad-nonce + |= stored-nonce=@ %. ap-core %- slog :~ - =/ nonces [expected=nonce.u.wat got=nonce] + =/ nonces [expected=stored-nonce got=nonce] =/ ok |(?=(?(%fact %kick) -.sign) =(~ p.sign)) leaf+"{}: stale %watch-ack {} ok={}" :: leaf+"{}: {}" >wire=wire< == - ?- -.sign - %fact - =^ tan ap-core ingest - ?~ tan ap-core - =. ap-core (ap-kill-down sub-key) - (ap-error -.sign leaf/"take %fact failed, closing subscription" u.tan) :: - %kick - :: if subscription ack or close, handle before calling user code - :: - =. outbound.watches.yoke - %- ~(del by outbound.watches.yoke) - [agent-wire dock] - :: - ingest-and-check-error + ++ sub-key [agent-wire dock] + ++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign))) :: - %watch-ack - ?. (~(has by outbound.watches.yoke) sub-key) - %- %: slog - leaf+"{}: got ack for nonexistent subscription" - leaf+"{}: {}" - >wire=wire< - ~ - == - ap-core - =. outbound.watches.yoke - ?^ p.sign - (~(del by outbound.watches.yoke) sub-key) - :: - %+ ~(jab by outbound.watches.yoke) sub-key - |= val=[acked=? =path nonce=@] - =? . acked.val - %.(. (slog leaf+"{} 2nd watch-ack on {}" ~)) - val(acked &) - :: - ingest-and-check-error - == - ++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign))) ++ ingest-and-check-error ^+ ap-core =^ tan ap-core ingest @@ -1759,8 +1775,8 @@ %= $ moves t.moves new-moves [move new-moves] - sub-nonce.current-agent +(sub-nonce.current-agent) - outbound.watches.current-agent + sub-nonce.yoke +(sub-nonce.yoke) + outbound.watches.yoke %+ ~(put by outbound.watches.yoke) [sub-wire dock] :+ acked=| path=?+(-.deal !! %watch path.deal, %watch-as path.deal) From 9582307713c58f6ae042c66ca2da235a489d9d16 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Mon, 28 Jun 2021 14:16:29 -0400 Subject: [PATCH 05/16] dbug: fix type error from nonce change --- pkg/arvo/app/dbug.hoon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index b5c4da98c..66f229062 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -206,13 +206,14 @@ 'ship'^(ship s) 'path'^(path p) == + :: TODO: display subscription nonce :: ++ outgoing |= =boat:gall ^- json :- %a %+ turn ~(tap by boat) - |= [[w=wire s=^ship t=term] [a=? p=^path]] + |= [[w=wire s=^ship t=term] [a=? p=^path nonce=@]] %- pairs :~ 'wire'^(path w) 'ship'^(ship s) From fdd2067e7540902cc021b2eb2370297d98ee0c66 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 7 Jul 2021 11:50:21 -0400 Subject: [PATCH 06/16] gall: review cleanups --- pkg/arvo/sys/vane/gall.hoon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index f8f2dede4..87cd96f8f 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -408,7 +408,7 @@ control-duct hen beak bek agent &+agent - run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) + run-nonce (scot %uw (end 5 (shas %yoke-nonce eny))) == :: =/ old mo-core @@ -1747,10 +1747,10 @@ ?: ?=([* %pass * %g %deal * * %leave *] move) =/ =wire p.move.move ?> ?=([%use @ @ %out @ @ *] wire) - =/ short-wire t.t.t.t.t.t.wire + =/ sub-wire t.t.t.t.t.t.wire =/ =dock [q.p q]:q.move.move =. outbound.watches.yoke - (~(del by outbound.watches.yoke) [short-wire dock]) + (~(del by outbound.watches.yoke) [sub-wire dock]) $(moves t.moves, new-moves [move new-moves]) ?. ?=([* %pass * %g %deal * * ?(%watch %watch-as) *] move) $(moves t.moves, new-moves [move new-moves]) @@ -1772,7 +1772,7 @@ :: =. p.move.move (weld sys-wire [(scot %ud sub-nonce.yoke) sub-wire]) - %= $ + %_ $ moves t.moves new-moves [move new-moves] sub-nonce.yoke +(sub-nonce.yoke) From 5583fc13205a5e413489f070b6c1ed9271d5589f Mon Sep 17 00:00:00 2001 From: h5gq3 Date: Sun, 29 Aug 2021 22:29:02 +0300 Subject: [PATCH 07/16] ames-flow-kill --- pkg/arvo/sys/lull.hoon | 3 + pkg/arvo/sys/vane/ames.hoon | 221 +++++++++++++++++++++++++++++++----- pkg/arvo/sys/vane/gall.hoon | 3 + 3 files changed, 197 insertions(+), 30 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index f0689ad65..643a376da 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -366,6 +366,7 @@ $% [%hear =lane =blob] [%heed =ship] [%jilt =ship] + [%cork =ship] $>(%plea vane-task) :: $>(%born vane-task) @@ -523,6 +524,8 @@ rcv=(map bone message-sink-state) nax=(set [=bone =message-num]) heeds=(set duct) + closing=(set bone) + corked=(set bone) == :: $qos: quality of service; how is our connection to a peer doing? :: diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 6a3f8e7e4..7eb9c0fad 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -560,7 +560,7 @@ :: was processed during a single Arvo event. At the moment, .lag is :: always zero. :: -+$ ack-meat (each fragment-num [ok=? lag=@dr]) ++$ ack-meat (each fragment-num [ok=? cork=? lag=@dr]) :: $naxplanation: nack trace; explains which message failed and why :: +$ naxplanation [=message-num =error] @@ -582,6 +582,53 @@ crypto-core=acru:ames =bug == ++$ ames-state-6 ames-state ++$ ames-state-4 ames-state-5 ++$ ames-state-5 + $: peers=(map ship ship-state-5) + =unix=duct + =life + crypto-core=acru:ames + =bug + == + +$ ship-state-6 + $% [%alien alien-agenda] + [%known peer-state-6] + == + +$ peer-state-6 + $: $: =symmetric-key + =life + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + closing=(set bone) + corked=(set bone) + == + +$ ship-state-5 + $% [%alien alien-agenda] + [%known peer-state-5] + == + +$ peer-state-5 + $: $: =symmetric-key + =life + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + == :: $bug: debug printing configuration :: :: veb: verbosity toggles @@ -665,12 +712,14 @@ :: $message-pump-gift: effect from |message-pump :: :: %done: report message acknowledgment +:: %cork: kill flow :: %send: emit message fragment :: %wait: set a new timer at .date :: %rest: cancel timer at .date :: +$ message-pump-gift $% [%done =message-num error=(unit error)] + [%cork ~] [%send =static-fragment] [%wait date=@da] [%rest date=@da] @@ -707,7 +756,7 @@ :: .ok: %.y unless previous failed attempt :: +$ message-sink-task - $% [%done ok=?] + $% [%done ok=? cork=?] [%drop =message-num] [%hear =lane =shut-packet ok=?] == @@ -719,6 +768,7 @@ +$ message-sink-gift $% [%memo =message-num message=*] [%send =message-num =ack-meat] + [%cork ~] == -- :: external vane interface @@ -829,24 +879,31 @@ :: lifecycle arms; mostly pass-throughs to the contained adult ames :: ++ scry scry:adult-core - ++ stay [%5 %larva queued-events ames-state.adult-gate] + ++ stay [%6 %larva queued-events ames-state.adult-gate] ++ load |= $= old $% $: %4 $% $: %larva events=(qeu queued-event) - state=_ames-state.adult-gate + state=ames-state-4 == - [%adult state=_ames-state.adult-gate] + [%adult state=ames-state-4] == == $: %5 $% $: %larva events=(qeu queued-event) - state=_ames-state.adult-gate + state=ames-state-5 == - [%adult state=_ames-state.adult-gate] + [%adult state=ames-state-5] == == - == + $: %6 + $% $: %larva + events=(qeu queued-event) + state=ames-state-6 + == + [%adult state=ames-state-6] + == == + == ?- old [%4 %adult *] (load:adult-core %4 state.old) :: @@ -863,7 +920,16 @@ =. queued-events events.old =. adult-gate (load:adult-core %5 state.old) larval-gate - == + :: + [%6 %adult *] (load:adult-core %6 state.old) + :: + [%6 %larva *] + ~> %slog.1^leaf/"ames: larva: load" + =. queued-events events.old + =. adult-gate (load:adult-core %6 state.old) + larval-gate + :: + == -- :: adult ames, after metamorphosis from larva :: @@ -904,6 +970,7 @@ %trim on-trim:event-core %vega on-vega:event-core %plea (on-plea:event-core [ship plea]:task) + %cork (on-cork:event-core ship.task) == :: [moves ames-gate] @@ -929,32 +996,35 @@ [%jael %turf *] (on-take-turf:event-core turfs.sign) [%jael %private-keys *] (on-priv:event-core [life vein]:sign) [%jael %public-keys *] (on-publ:event-core wire public-keys-result.sign) + :: == :: [moves ames-gate] :: +stay: extract state before reload :: -++ stay [%5 %adult ames-state] +++ stay [%6 %adult ames-state] :: +load: load in old state after reload :: ++ load |= $= old-state - $% [%4 ^ames-state] - [%5 ^ames-state] + $% [%4 ames-state-4] + [%5 ames-state-5] + [%6 ames-state-6] == |^ ^+ ames-gate =? old-state ?=(%4 -.old-state) %5^(state-4-to-5 +.old-state) + =? old-state ?=(%5 -.old-state) %6^(state-5-to-6 +.old-state) :: - ?> ?=(%5 -.old-state) + ?> ?=(%6 -.old-state) ames-gate(ames-state +.old-state) :: ++ state-4-to-5 - |= =^ames-state - ^- ^^ames-state + |= ames-state=ames-state-4 + ^- ames-state-5 =. peers.ames-state %- ~(run by peers.ames-state) - |= =ship-state + |= ship-state=ship-state-5 ?. ?=(%known -.ship-state) ship-state =. snd.ship-state @@ -965,6 +1035,32 @@ message-pump-state ship-state ames-state + :: + ++ state-5-to-6 + |= ames-state=ames-state-5 + ^- ames-state-6 + %= ames-state + peers + ^- (map ship ship-state) + %- ~(run by peers.ames-state) + |= ship-state=ship-state-5 + ^- ship-state-6 + ?. ?=(%known -.ship-state) + ship-state + :- %known + ^- peer-state-6 + :* [symmetric-key.ship-state life.ship-state public-key.ship-state sponsor.ship-state] + route.ship-state + qos.ship-state + ossuary.ship-state + snd.ship-state + rcv.ship-state + nax.ship-state + heeds.ship-state + closing=*(set bone) + corked=*(set bone) + == + == -- :: +scry: dereference namespace :: @@ -1113,10 +1209,12 @@ :: if processing succeded, send positive ack packet and exit :: ?~ error - abet:(run-message-sink:peer-core bone %done ok=%.y) + ?: (~(has in closing.peer-state) bone) + abet:(run-message-sink:peer-core bone %done ok=%.y cork=%.y) + abet:(run-message-sink:peer-core bone %done ok=%.y cork=%.n) :: failed; send message nack packet :: - =. event-core abet:(run-message-sink:peer-core bone %done ok=%.n) + =. event-core abet:(run-message-sink:peer-core bone %done ok=%.n cork=%.n) =/ =^peer-state (got-peer-state her) =/ =^channel [[our her] now channel-state -.peer-state] :: construct nack-trace message, referencing .failed $message-num @@ -1346,6 +1444,7 @@ (decode-shut-packet packet [symmetric-key her-life our-life]:channel) :: non-galaxy: update route with heard lane or forwarded lane :: + :: =? route.peer-state !=(%czar (clan:title her.channel)) :: if new packet is direct, use that. otherwise, if the new new :: and old lanes are indirect, use the new one. if the new lane @@ -1412,8 +1511,30 @@ =/ sndr [our our-life.channel] =/ rcvr [ship her-life.channel] "plea {}" + :: since flow kill goes like: + :: client vane cork task -> client ames pass cork as plea -> server ames sinks plea -> server ames +on-plea (we are here) + :: if it's %cork plea passed to ames from its sink, give %done and process flow closing after +on-take-done call :: + ?: &(=(vane.plea %a) =(path.plea `path`/flow) ?=([%cork *] payload.plea)) + (emit duct %give %done ~) abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea) + :: +on-cork: handle request to kill a flow + :: + ++ on-cork + |= =ship + ^+ event-core + =/ ship-state (~(get by peers.ames-state) ship) + :: + ?> ?=([~ %known *] ship-state) + =/ =peer-state +.u.ship-state + =/ =channel [[our ship] now channel-state -.peer-state] + :: + =/ =plea [%a /flow [%cork ~]] + :: + =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) + :: + =. closing.peer-state (~(put in closing.peer-state) bone) + abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea) :: +on-take-wake: receive wakeup or error notification from behn :: ++ on-take-wake @@ -1936,6 +2057,7 @@ =. peer-core (update-qos %live last-contact=now) :: =/ =bone bone.shut-packet + =/ message-pump-state (~(get by snd.peer-state) bone) :: ?: ?=(%& -.meat.shut-packet) =+ ?. &(?=(^ dud) msg.veb) ~ @@ -2119,6 +2241,7 @@ =. peer-core ?- -.gift %done (on-pump-done [message-num error]:gift) + %cork on-pump-cork %send (on-pump-send static-fragment.gift) %wait (on-pump-wait date.gift) %rest (on-pump-rest date.gift) @@ -2144,10 +2267,22 @@ :: not a nack-trace bone; relay ack to client vane :: (emit (got-duct bone) %give %done error) + :: +on-pump-cork: kill flow on cork sender side + :: + ++ on-pump-cork + ^+ peer-core + =. by-duct.ossuary.peer-state (~(del by by-duct.ossuary.peer-state) (got-duct bone)) + =. by-bone.ossuary.peer-state (~(del by by-bone.ossuary.peer-state) bone) + =. snd.peer-state (~(del by snd.peer-state) bone) + =. rcv.peer-state (~(del by rcv.peer-state) bone) + =. corked.peer-state (~(put in corked.peer-state) bone) + =. closing.peer-state (~(del in closing.peer-state) bone) + peer-core :: +on-pump-send: emit message fragment requested by |message-pump :: ++ on-pump-send - |=(f=static-fragment (send-shut-packet bone [message-num %& +]:f)) + |= f=static-fragment + (send-shut-packet bone [message-num %& +]:f) :: +on-pump-wait: relay |message-pump's set-timer request :: ++ on-pump-wait @@ -2172,6 +2307,7 @@ ++ run-message-sink |= [=bone task=message-sink-task] ^+ peer-core + ?: (~(has in corked.peer-state) bone) peer-core :: pass .task to the |message-sink and apply state mutations :: =/ =message-sink-state @@ -2189,8 +2325,25 @@ ?- -.gift %memo (on-sink-memo [message-num message]:gift) %send (on-sink-send [message-num ack-meat]:gift) + %cork on-sink-cork == $(sink-gifts t.sink-gifts) + :: +on-sink-cork: handle flow kill after server ames has taken %done + :: + ++ on-sink-cork + :: resetting timer for boons + =. peer-core + =/ =message-pump-state + (~(gut by snd.peer-state) bone *message-pump-state) + ?~ next-wake=next-wake.packet-pump-state.message-pump-state peer-core + =/ wire (make-pump-timer-wire her.channel bone) + =/ duct ~[/ames] + (emit duct %pass wire %b %rest u.next-wake) + =. rcv.peer-state (~(del by rcv.peer-state) bone) + =. snd.peer-state (~(del by snd.peer-state) bone) + =. corked.peer-state (~(put in corked.peer-state) bone) + =. closing.peer-state (~(del in closing.peer-state) bone) + peer-core :: +on-sink-send: emit ack packet as requested by |message-sink :: ++ on-sink-send @@ -2224,10 +2377,11 @@ ++ on-sink-boon |= [=message-num message=*] ^+ peer-core + ?: |((~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone)) peer-core :: send ack unconditionally :: =. peer-core (emit (got-duct bone) %give %boon message) - =. peer-core (run-message-sink bone %done ok=%.y) + =. peer-core (run-message-sink bone %done ok=%.y cork=%.n) :: ?. ?=([%hear * * ok=%.n] task) :: fresh boon; give message to client vane @@ -2265,7 +2419,7 @@ =+ ;; =naxplanation message :: ack nack-trace message (only applied if we don't later crash) :: - =. peer-core (run-message-sink bone %done ok=%.y) + =. peer-core (run-message-sink bone %done ok=%.y cork=%.n) :: flip .bone's second bit to find referenced flow :: =/ target-bone=^bone (mix 0b10 bone) @@ -2277,6 +2431,7 @@ ++ on-sink-plea |= [=message-num message=*] ^+ peer-core + ?: |((~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone)) peer-core %- %+ trace msg.veb =/ dat [her.channel bone=bone message-num=message-num] |.("sink plea {}") @@ -2286,6 +2441,9 @@ :: fresh plea; pass to client vane :: =+ ;; =plea message + :: if this plea is %cork, put to closing + :: + =? closing.peer-state ?=([%cork *] payload.plea) (~(put in closing.peer-state) bone) :: =/ =wire (make-bone-wire her.channel bone) :: @@ -2297,7 +2455,7 @@ == :: we previously crashed on this message; send nack :: - =. peer-core (run-message-sink bone %done ok=%.n) + =. peer-core (run-message-sink bone %done ok=%.n cork=%.n) :: also send nack-trace with blank .error for security :: =/ nack-trace-bone=^bone (mix 0b10 bone) @@ -2306,7 +2464,7 @@ :: (run-message-pump nack-trace-bone %memo message-blob) -- - -- + -- -- :: +make-message-pump: constructor for |message-pump :: @@ -2347,9 +2505,9 @@ %hear ?- -.ack-meat.task %& (on-hear [message-num fragment-num=p.ack-meat]:task) - %| (on-done [message-num ?:(ok.p.ack-meat [%ok ~] [%nack ~])]:task) + %| (on-done [[message-num ?:(ok.p.ack-meat [%ok ~] [%nack ~])] cork.p.ack-meat]:task) == - %near (on-done [message-num %naxplanation error]:naxplanation.task) + %near (on-done [[message-num %naxplanation error]:naxplanation.task %&]) == :: +on-memo: handle request to send a message :: @@ -2381,7 +2539,7 @@ :: flows. :: ++ on-done - |= [=message-num =ack] + |= [[=message-num =ack] cork=?] ^+ message-pump :: unsent messages from the future should never get acked :: @@ -2443,6 +2601,7 @@ ?- -.u.cur %ok =. message-pump (give %done current.state ~) + =? message-pump cork (give %cork ~) $(current.state +(current.state)) :: %nack @@ -2974,7 +3133,7 @@ =- [(flop gifts) state] :: ?- -.task - %done (on-done ok.task) + %done (on-done ok.task cork.task) %drop (on-drop message-num.task) %hear (on-hear [lane shut-packet ok]:task) == @@ -3011,7 +3170,7 @@ :: =/ ok=? !(~(has in nax.state) seq) %- (trace rcv.veb |.("send dupe message ack {} ok={}")) - (give %send seq %| ok lag=`@dr`0) + (give %send seq %| ok %| lag=`@dr`0) :: last-acked Date: Wed, 1 Sep 2021 18:16:00 +0300 Subject: [PATCH 08/16] style fixes --- pkg/arvo/sys/lull.hoon | 1 + pkg/arvo/sys/vane/ames.hoon | 152 +++++++++++++++++++----------------- pkg/arvo/sys/vane/gall.hoon | 6 +- 3 files changed, 86 insertions(+), 73 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 643a376da..e342ae4af 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -351,6 +351,7 @@ :: %hear: packet from unix :: %heed: track peer's responsiveness; gives %clog if slow :: %jilt: stop tracking peer's responsiveness + :: %cork: request to delete message flow :: %plea: request to send message :: :: System and Lifecycle Tasks diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 7eb9c0fad..0f9575656 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -585,50 +585,50 @@ +$ ames-state-6 ames-state +$ ames-state-4 ames-state-5 +$ ames-state-5 - $: peers=(map ship ship-state-5) - =unix=duct - =life - crypto-core=acru:ames - =bug - == - +$ ship-state-6 - $% [%alien alien-agenda] - [%known peer-state-6] - == - +$ peer-state-6 - $: $: =symmetric-key - =life - =public-key - sponsor=ship - == - route=(unit [direct=? =lane]) - =qos - =ossuary - snd=(map bone message-pump-state) - rcv=(map bone message-sink-state) - nax=(set [=bone =message-num]) - heeds=(set duct) - closing=(set bone) - corked=(set bone) - == - +$ ship-state-5 - $% [%alien alien-agenda] - [%known peer-state-5] - == - +$ peer-state-5 - $: $: =symmetric-key - =life - =public-key - sponsor=ship - == - route=(unit [direct=? =lane]) - =qos - =ossuary - snd=(map bone message-pump-state) - rcv=(map bone message-sink-state) - nax=(set [=bone =message-num]) - heeds=(set duct) - == + $: peers=(map ship ship-state-5) + =unix=duct + =life + crypto-core=acru:ames + =bug + == ++$ ship-state-6 + $% [%alien alien-agenda] + [%known peer-state-6] + == ++$ peer-state-6 + $: $: =symmetric-key + =life + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + closing=(set bone) + corked=(set bone) + == ++$ ship-state-5 + $% [%alien alien-agenda] + [%known peer-state-5] + == ++$ peer-state-5 + $: $: =symmetric-key + =life + =public-key + sponsor=ship + == + route=(unit [direct=? =lane]) + =qos + =ossuary + snd=(map bone message-pump-state) + rcv=(map bone message-sink-state) + nax=(set [=bone =message-num]) + heeds=(set duct) + == :: $bug: debug printing configuration :: :: veb: verbosity toggles @@ -929,7 +929,7 @@ =. adult-gate (load:adult-core %6 state.old) larval-gate :: - == + == -- :: adult ames, after metamorphosis from larva :: @@ -996,7 +996,6 @@ [%jael %turf *] (on-take-turf:event-core turfs.sign) [%jael %private-keys *] (on-priv:event-core [life vein]:sign) [%jael %public-keys *] (on-publ:event-core wire public-keys-result.sign) - :: == :: [moves ames-gate] @@ -1039,8 +1038,8 @@ ++ state-5-to-6 |= ames-state=ames-state-5 ^- ames-state-6 - %= ames-state - peers + %= ames-state + peers ^- (map ship ship-state) %- ~(run by peers.ames-state) |= ship-state=ship-state-5 @@ -1049,7 +1048,11 @@ ship-state :- %known ^- peer-state-6 - :* [symmetric-key.ship-state life.ship-state public-key.ship-state sponsor.ship-state] + :* :* symmetric-key.ship-state + life.ship-state + public-key.ship-state + sponsor.ship-state + == route.ship-state qos.ship-state ossuary.ship-state @@ -1444,7 +1447,6 @@ (decode-shut-packet packet [symmetric-key her-life our-life]:channel) :: non-galaxy: update route with heard lane or forwarded lane :: - :: =? route.peer-state !=(%czar (clan:title her.channel)) :: if new packet is direct, use that. otherwise, if the new new :: and old lanes are indirect, use the new one. if the new lane @@ -1512,8 +1514,10 @@ =/ rcvr [ship her-life.channel] "plea {}" :: since flow kill goes like: - :: client vane cork task -> client ames pass cork as plea -> server ames sinks plea -> server ames +on-plea (we are here) - :: if it's %cork plea passed to ames from its sink, give %done and process flow closing after +on-take-done call + :: client vane cork task -> client ames pass cork as plea -> + :: -> server ames sinks plea -> server ames +on-plea (we are here); + :: if it's %cork plea passed to ames from its sink, + :: give %done and process flow closing after +on-take-done call :: ?: &(=(vane.plea %a) =(path.plea `path`/flow) ?=([%cork *] payload.plea)) (emit duct %give %done ~) @@ -1534,7 +1538,7 @@ =^ =bone ossuary.peer-state (bind-duct ossuary.peer-state duct) :: =. closing.peer-state (~(put in closing.peer-state) bone) - abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea) + abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea) :: +on-take-wake: receive wakeup or error notification from behn :: ++ on-take-wake @@ -2057,7 +2061,6 @@ =. peer-core (update-qos %live last-contact=now) :: =/ =bone bone.shut-packet - =/ message-pump-state (~(get by snd.peer-state) bone) :: ?: ?=(%& -.meat.shut-packet) =+ ?. &(?=(^ dud) msg.veb) ~ @@ -2271,18 +2274,20 @@ :: ++ on-pump-cork ^+ peer-core - =. by-duct.ossuary.peer-state (~(del by by-duct.ossuary.peer-state) (got-duct bone)) - =. by-bone.ossuary.peer-state (~(del by by-bone.ossuary.peer-state) bone) + =. by-duct.ossuary.peer-state + (~(del by by-duct.ossuary.peer-state) (got-duct bone)) + =. by-bone.ossuary.peer-state + (~(del by by-bone.ossuary.peer-state) bone) =. snd.peer-state (~(del by snd.peer-state) bone) =. rcv.peer-state (~(del by rcv.peer-state) bone) =. corked.peer-state (~(put in corked.peer-state) bone) =. closing.peer-state (~(del in closing.peer-state) bone) - peer-core + peer-core :: +on-pump-send: emit message fragment requested by |message-pump :: ++ on-pump-send |= f=static-fragment - (send-shut-packet bone [message-num %& +]:f) + (send-shut-packet bone [message-num %& +]:f) :: +on-pump-wait: relay |message-pump's set-timer request :: ++ on-pump-wait @@ -2331,19 +2336,20 @@ :: +on-sink-cork: handle flow kill after server ames has taken %done :: ++ on-sink-cork - :: resetting timer for boons - =. peer-core - =/ =message-pump-state - (~(gut by snd.peer-state) bone *message-pump-state) - ?~ next-wake=next-wake.packet-pump-state.message-pump-state peer-core + :: resetting timer for boons + =. peer-core + =/ =message-pump-state + (~(gut by snd.peer-state) bone *message-pump-state) + ?~ next-wake=next-wake.packet-pump-state.message-pump-state peer-core =/ wire (make-pump-timer-wire her.channel bone) =/ duct ~[/ames] (emit duct %pass wire %b %rest u.next-wake) + :: =. rcv.peer-state (~(del by rcv.peer-state) bone) =. snd.peer-state (~(del by snd.peer-state) bone) =. corked.peer-state (~(put in corked.peer-state) bone) =. closing.peer-state (~(del in closing.peer-state) bone) - peer-core + peer-core :: +on-sink-send: emit ack packet as requested by |message-sink :: ++ on-sink-send @@ -2377,7 +2383,10 @@ ++ on-sink-boon |= [=message-num message=*] ^+ peer-core - ?: |((~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone)) peer-core + ?: ?| (~(has in closing.peer-state) bone) + (~(has in corked.peer-state) bone) + == + peer-core :: send ack unconditionally :: =. peer-core (emit (got-duct bone) %give %boon message) @@ -2431,7 +2440,10 @@ ++ on-sink-plea |= [=message-num message=*] ^+ peer-core - ?: |((~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone)) peer-core + ?: ?| (~(has in closing.peer-state) bone) + (~(has in corked.peer-state) bone) + == + peer-core %- %+ trace msg.veb =/ dat [her.channel bone=bone message-num=message-num] |.("sink plea {}") @@ -2443,7 +2455,8 @@ =+ ;; =plea message :: if this plea is %cork, put to closing :: - =? closing.peer-state ?=([%cork *] payload.plea) (~(put in closing.peer-state) bone) + =? closing.peer-state ?=([%cork *] payload.plea) + (~(put in closing.peer-state) bone) :: =/ =wire (make-bone-wire her.channel bone) :: @@ -2464,7 +2477,7 @@ :: (run-message-pump nack-trace-bone %memo message-blob) -- - -- + -- -- :: +make-message-pump: constructor for |message-pump :: @@ -3291,9 +3304,8 @@ =. last-acked.state +(last-acked.state) =? nax.state !ok (~(put in nax.state) message-num) :: - =? message-sink cork (give %send message-num %| ok %& lag=`@dr`0) + =. message-sink (give %send message-num %| ok cork lag=`@dr`0) =? message-sink cork (give %cork ~) - =? message-sink !cork (give %send message-num %| ok %| lag=`@dr`0) =/ next ~(top to pending-vane-ack.state) ?~ next message-sink diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 818b066da..bbfe7504f 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -509,10 +509,10 @@ =/ stand (~(gut by outstanding.state) [wire hen] *(qeu remote-request)) (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal)) - ?: ?=(%leave -.deal) + ?. ?=(%leave -.deal) + (mo-pass wire note-arvo) =. mo-core (mo-pass wire note-arvo) - (mo-pass wire [%a [%cork ship]]) - (mo-pass wire note-arvo) + (mo-pass wire [%a [%cork ship]]) :: +mo-track-ship: subscribe to ames and jael for notices about .ship :: ++ mo-track-ship From 52ef6ba08e4428853b21c1b428b4dd7077f7661b Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 22 Mar 2022 15:42:18 +0100 Subject: [PATCH 09/16] ames: handles decoding old-format shut-packets --- pkg/arvo/sys/vane/ames.hoon | 108 ++++++++++++++---------------------- 1 file changed, 43 insertions(+), 65 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0f9575656..34a02f3d3 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -435,8 +435,19 @@ =/ cyf (rsh [3 18] content.packet) ~| ames-decrypt+[[sndr rcvr origin]:packet len siv] =/ vec ~[sndr.packet rcvr.packet sndr-life rcvr-life] - ;; shut-packet %- cue %- need - (~(de sivc:aes:crypto (shaz symmetric-key) vec) siv len cyf) + =/ =noun + %- cue %- need + (~(de sivc:aes:crypto (shaz symmetric-key) vec) siv len cyf) + ;; shut-packet + ?: ?=(shut-packet noun) + noun + =* meat +>.noun + ?: ?=(%& -.meat) noun + ?: ?=(%& +<.meat) noun + =* ack +>.meat + =/ [ok=? lag=@dr] ?>(?=([? @dr] ack) ack) + =. ack [ok %.n lag] + noun :: +decode-ship-size: decode a 2-bit ship type specifier into a byte width :: :: Type 0: galaxy or star -- 2 bytes @@ -582,7 +593,7 @@ crypto-core=acru:ames =bug == -+$ ames-state-6 ames-state +:: +$ ames-state-4 ames-state-5 +$ ames-state-5 $: peers=(map ship ship-state-5) @@ -591,30 +602,12 @@ crypto-core=acru:ames =bug == -+$ ship-state-6 - $% [%alien alien-agenda] - [%known peer-state-6] - == -+$ peer-state-6 - $: $: =symmetric-key - =life - =public-key - sponsor=ship - == - route=(unit [direct=? =lane]) - =qos - =ossuary - snd=(map bone message-pump-state) - rcv=(map bone message-sink-state) - nax=(set [=bone =message-num]) - heeds=(set duct) - closing=(set bone) - corked=(set bone) - == +:: +$ ship-state-5 $% [%alien alien-agenda] [%known peer-state-5] == +:: +$ peer-state-5 $: $: =symmetric-key =life @@ -899,9 +892,9 @@ $: %6 $% $: %larva events=(qeu queued-event) - state=ames-state-6 + state=_ames-state.adult-gate == - [%adult state=ames-state-6] + [%adult state=_ames-state.adult-gate] == == == ?- old @@ -1008,7 +1001,7 @@ |= $= old-state $% [%4 ames-state-4] [%5 ames-state-5] - [%6 ames-state-6] + [%6 ^ames-state] == |^ ^+ ames-gate @@ -1037,33 +1030,17 @@ :: ++ state-5-to-6 |= ames-state=ames-state-5 - ^- ames-state-6 - %= ames-state - peers - ^- (map ship ship-state) - %- ~(run by peers.ames-state) - |= ship-state=ship-state-5 - ^- ship-state-6 - ?. ?=(%known -.ship-state) - ship-state - :- %known - ^- peer-state-6 - :* :* symmetric-key.ship-state - life.ship-state - public-key.ship-state - sponsor.ship-state - == - route.ship-state - qos.ship-state - ossuary.ship-state - snd.ship-state - rcv.ship-state - nax.ship-state - heeds.ship-state - closing=*(set bone) - corked=*(set bone) - == - == + ^- ^^ames-state + :_ +.ames-state + %- ~(run by peers.ames-state) + |= ship-state=ship-state-5 + ^- ^ship-state + ?. ?=(%known -.ship-state) + ship-state + :- %known + ^- peer-state + :- +<.ship-state + [route qos ossuary snd rcv nax heeds ~ ~]:ship-state -- :: +scry: dereference namespace :: @@ -1212,9 +1189,8 @@ :: if processing succeded, send positive ack packet and exit :: ?~ error - ?: (~(has in closing.peer-state) bone) - abet:(run-message-sink:peer-core bone %done ok=%.y cork=%.y) - abet:(run-message-sink:peer-core bone %done ok=%.y cork=%.n) + =/ cork=? (~(has in closing.peer-state) bone) + abet:(run-message-sink:peer-core bone %done ok=%.y cork) :: failed; send message nack packet :: =. event-core abet:(run-message-sink:peer-core bone %done ok=%.n cork=%.n) @@ -2274,14 +2250,16 @@ :: ++ on-pump-cork ^+ peer-core - =. by-duct.ossuary.peer-state - (~(del by by-duct.ossuary.peer-state) (got-duct bone)) - =. by-bone.ossuary.peer-state - (~(del by by-bone.ossuary.peer-state) bone) - =. snd.peer-state (~(del by snd.peer-state) bone) - =. rcv.peer-state (~(del by rcv.peer-state) bone) - =. corked.peer-state (~(put in corked.peer-state) bone) - =. closing.peer-state (~(del in closing.peer-state) bone) + =. peer-state + =, peer-state + %_ peer-state + snd (~(del by snd) bone) + rcv (~(del by rcv) bone) + corked (~(put in corked) bone) + closing (~(del in closing) bone) + by-duct.ossuary (~(del by by-duct.ossuary) (got-duct bone)) + by-bone.ossuary (~(del by by-bone.ossuary) bone) + == peer-core :: +on-pump-send: emit message fragment requested by |message-pump :: @@ -2443,7 +2421,7 @@ ?: ?| (~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone) == - peer-core + peer-core %- %+ trace msg.veb =/ dat [her.channel bone=bone message-num=message-num] |.("sink plea {}") From 8be9257164b2a49142cba42e7c3c6569c06c6e3c Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Thu, 31 Mar 2022 10:37:01 +0200 Subject: [PATCH 10/16] ames: style indentation --- pkg/arvo/sys/vane/ames.hoon | 39 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 34a02f3d3..8bcd307d9 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2314,19 +2314,23 @@ :: +on-sink-cork: handle flow kill after server ames has taken %done :: ++ on-sink-cork - :: resetting timer for boons - =. peer-core + ^+ peer-core =/ =message-pump-state (~(gut by snd.peer-state) bone *message-pump-state) - ?~ next-wake=next-wake.packet-pump-state.message-pump-state peer-core - =/ wire (make-pump-timer-wire her.channel bone) - =/ duct ~[/ames] - (emit duct %pass wire %b %rest u.next-wake) - :: - =. rcv.peer-state (~(del by rcv.peer-state) bone) - =. snd.peer-state (~(del by snd.peer-state) bone) - =. corked.peer-state (~(put in corked.peer-state) bone) - =. closing.peer-state (~(del in closing.peer-state) bone) + =? peer-core ?=(^ next-wake.packet-pump-state.message-pump-state) + =* next-wake u.next-wake.packet-pump-state.message-pump-state + =/ =wire (make-pump-timer-wire her.channel bone) + :: resetting timer for boons + :: + (emit [/ames]~ %pass wire %b %rest next-wake) + =. peer-state + =, peer-state + %_ peer-state + rcv (~(del by rcv) bone) + snd (~(del by snd) bone) + corked (~(put in corked) bone) + closing (~(del in closing) bone) + == peer-core :: +on-sink-send: emit ack packet as requested by |message-sink :: @@ -2364,7 +2368,7 @@ ?: ?| (~(has in closing.peer-state) bone) (~(has in corked.peer-state) bone) == - peer-core + peer-core :: send ack unconditionally :: =. peer-core (emit (got-duct bone) %give %boon message) @@ -2494,9 +2498,14 @@ %memo (on-memo message-blob.task) %wake (run-packet-pump %wake current.state) %hear - ?- -.ack-meat.task - %& (on-hear [message-num fragment-num=p.ack-meat]:task) - %| (on-done [[message-num ?:(ok.p.ack-meat [%ok ~] [%nack ~])] cork.p.ack-meat]:task) + ?- -.ack-meat.task + %& + (on-hear [message-num fragment-num=p.ack-meat]:task) + :: + %| + =* ack p.ack-meat.task + %- on-done + [[message-num:task ?:(ok.ack [%ok ~] [%nack ~])] cork.ack] == %near (on-done [[message-num %naxplanation error]:naxplanation.task %&]) == From 674c9e95a085a74fb8bb9618afa7a40408af0d28 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Thu, 31 Mar 2022 10:41:34 +0200 Subject: [PATCH 11/16] gall: style indentation --- pkg/arvo/sys/vane/gall.hoon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index bbfe7504f..845d08472 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1200,7 +1200,7 @@ %huck note-arvo.neet %agent [%g %deal [our ship.neet] [name deal]:neet] == - [system-duct.state %pass wire note-arvo]~ + [duct %pass wire note-arvo]~ == :: +ap-breach: ship breached, so forget about them :: @@ -1497,6 +1497,8 @@ (on-bad-nonce nonce.u.got) run-sign :: + ++ sub-key [agent-wire dock] + ++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign))) ++ run-sign ?- -.sign %poke-ack !! @@ -1533,6 +1535,7 @@ :: ingest-and-check-error == + :: ++ on-missing %. ap-core %- slog :~ @@ -1540,6 +1543,7 @@ leaf+"{}: {<[nonce=nonce agent-wire]>}" >wire=wire< == + :: ++ on-bad-nonce |= stored-nonce=@ %. ap-core @@ -1552,9 +1556,6 @@ >wire=wire< == :: - ++ sub-key [agent-wire dock] - ++ ingest (ap-ingest ~ |.((on-agent:ap-agent-core agent-wire sign))) - :: ++ ingest-and-check-error ^+ ap-core =^ tan ap-core ingest @@ -1776,9 +1777,10 @@ =. p.move.move (weld sys-wire [(scot %ud sub-nonce.yoke) sub-wire]) %_ $ - moves t.moves - new-moves [move new-moves] + moves t.moves + new-moves [move new-moves] sub-nonce.yoke +(sub-nonce.yoke) + :: outbound.watches.yoke %+ ~(put by outbound.watches.yoke) [sub-wire dock] :+ acked=| From 0a96d697852c8ce33d5caf01ef4232cebd6817ad Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 1 Apr 2022 09:37:45 +0200 Subject: [PATCH 12/16] gall: include sub-nonce in unsubscribe wire --- pkg/arvo/sys/vane/gall.hoon | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 845d08472..7f614da8c 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1751,8 +1751,22 @@ ?: ?=([* %pass * %g %deal * * %leave *] move) =/ =wire p.move.move ?> ?=([%use @ @ %out @ @ *] wire) - =/ sub-wire t.t.t.t.t.t.wire - =/ =dock [q.p q]:q.move.move + =/ =dock [q.p q]:q.move.move + =/ sys-wire=^wire (scag 6 `^wire`wire) + =/ sub-wire=^wire (slag 6 `^wire`wire) + :: + ?. (~(has by outbound.watches.yoke) sub-wire dock) + =. ap-core + =/ =tang + :~ leaf+"got %leave for missing subscription" + >agent-name< >sub-wire< >dock< + == + (ap-error %leave-missing-subscription tang) + $(moves t.moves) + =/ have=[acked=? =path nonce=@] + (~(got by outbound.watches.yoke) sub-wire dock) + =. p.move.move + (weld sys-wire [(scot %ud nonce.have) sub-wire]) =. outbound.watches.yoke (~(del by outbound.watches.yoke) [sub-wire dock]) $(moves t.moves, new-moves [move new-moves]) From c380cf3f42eaab39b7a280927e666667cc3b2495 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 5 Apr 2022 04:41:03 +0200 Subject: [PATCH 13/16] gall: add %cork to remote-request action --- pkg/arvo/sys/vane/gall.hoon | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 7f614da8c..4947c908e 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -111,6 +111,7 @@ %poke %leave %missing + %cork == :: |migrate: data structures for upgrades :: @@ -508,10 +509,11 @@ =. outstanding.state =/ stand (~(gut by outstanding.state) [wire hen] *(qeu remote-request)) - (~(put by outstanding.state) [wire hen] (~(put to stand) -.deal)) - ?. ?=(%leave -.deal) - (mo-pass wire note-arvo) + %+ ~(put by outstanding.state) [wire hen] + (~(gas to stand) ?.(?=(%leave -.deal) ~[-.deal] ~[%leave %cork])) =. mo-core (mo-pass wire note-arvo) + ?. ?=(%leave -.deal) + mo-core (mo-pass wire [%a [%cork ship]]) :: +mo-track-ship: subscribe to ames and jael for notices about .ship :: @@ -734,7 +736,12 @@ (~(put to *(qeu remote-request)) %missing) ~| [full-wire=full-wire hen=hen stand=stand] =^ rr stand ~(get to stand) - [rr (~(put by outstanding.state) [full-wire hen] stand)] + ~? &(=(rr %cork) ?=(^ stand)) + [%outstanding-queue-not-empty wire hen] + :- rr + ?: ?=(%cork rr) + (~(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 :: 2019/12 :: @@ -750,6 +757,7 @@ %watch (mo-give %unto %watch-ack err) %poke (mo-give %unto %poke-ack err) %leave mo-core + %cork mo-core %missing (mo-give:(mo-give %unto %watch-ack err) %unto %poke-ack err) == :: @@ -1756,13 +1764,10 @@ =/ sub-wire=^wire (slag 6 `^wire`wire) :: ?. (~(has by outbound.watches.yoke) sub-wire dock) - =. ap-core - =/ =tang - :~ leaf+"got %leave for missing subscription" - >agent-name< >sub-wire< >dock< - == - (ap-error %leave-missing-subscription tang) - $(moves t.moves) + =; =tang + %- (slog tang) + $(moves t.moves) + [leaf+"gall: {} missing subscription, got %leave"]~ =/ have=[acked=? =path nonce=@] (~(got by outbound.watches.yoke) sub-wire dock) =. p.move.move From a288d455c324fa6dd9d1373585b112e99f559586 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 5 Apr 2022 04:46:00 +0200 Subject: [PATCH 14/16] ames: remove %cork from |ack-meat --- pkg/arvo/sys/vane/ames.hoon | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 8bcd307d9..71a1b9ea1 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -571,7 +571,7 @@ :: was processed during a single Arvo event. At the moment, .lag is :: always zero. :: -+$ ack-meat (each fragment-num [ok=? cork=? lag=@dr]) ++$ ack-meat (each fragment-num [ok=? lag=@dr]) :: $naxplanation: nack trace; explains which message failed and why :: +$ naxplanation [=message-num =error] @@ -2209,7 +2209,8 @@ =/ =message-pump-state (~(gut by snd.peer-state) bone *message-pump-state) :: - =/ message-pump (make-message-pump message-pump-state channel) + =/ closing=? (~(has in closing.peer-state) bone) + =/ message-pump (make-message-pump message-pump-state channel closing) =^ pump-gifts message-pump-state (work:message-pump task) =. snd.peer-state (~(put by snd.peer-state) bone message-pump-state) :: process effects from |message-pump @@ -2464,7 +2465,7 @@ :: +make-message-pump: constructor for |message-pump :: ++ make-message-pump - |= [state=message-pump-state =channel] + |= [state=message-pump-state =channel closing=?] =* veb veb.bug.channel =| gifts=(list message-pump-gift) :: @@ -2503,9 +2504,21 @@ (on-hear [message-num fragment-num=p.ack-meat]:task) :: %| + ~& [current.state message+message-num:task] + =/ cork=? + =/ top-live + (pry:packet-queue:*make-packet-pump live.packet-pump-state.state) + :: If we send a %cork and get an ack, we can know by + :: sequence number that the ack is for the %cork message + :: + ?& closing + ?=(^ top-live) + =(1 ~(wyt by live.packet-pump-state.state)) + =(message-num:task message-num.key.u.top-live) + == =* ack p.ack-meat.task %- on-done - [[message-num:task ?:(ok.ack [%ok ~] [%nack ~])] cork.ack] + [[message-num:task ?:(ok.ack [%ok ~] [%nack ~])] cork] == %near (on-done [[message-num %naxplanation error]:naxplanation.task %&]) == @@ -3170,7 +3183,7 @@ :: =/ ok=? !(~(has in nax.state) seq) %- (trace rcv.veb |.("send dupe message ack {} ok={}")) - (give %send seq %| ok %| lag=`@dr`0) + (give %send seq %| ok lag=`@dr`0) :: last-acked Date: Fri, 15 Apr 2022 17:22:01 +0200 Subject: [PATCH 15/16] gall: handle %kicks for nonexistent subscriptions --- pkg/arvo/sys/vane/ames.hoon | 1 - pkg/arvo/sys/vane/gall.hoon | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 71a1b9ea1..8e170adb5 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2504,7 +2504,6 @@ (on-hear [message-num fragment-num=p.ack-meat]:task) :: %| - ~& [current.state message+message-num:task] =/ cork=? =/ top-live (pry:packet-queue:*make-packet-pump live.packet-pump-state.state) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 4947c908e..793b7bd00 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1493,9 +1493,13 @@ :: ?: =(~ agent-wire) on-missing + =/ has-nonce=(unit @ud) (slaw %ud (head agent-wire)) + ?: &(?=(~ has-nonce) ?=(%kick -.sign)) + on-weird-kick :: pop nonce off .agent-wire and match against stored subscription :: - =: nonce (slav %ud (head agent-wire)) + ?> ?=(^ has-nonce) + =: nonce u.has-nonce agent-wire (tail agent-wire) == =/ got (~(get by outbound.watches.yoke) sub-key) @@ -1552,6 +1556,14 @@ >wire=wire< == :: + ++ on-weird-kick + %. run-sign + %- slog :~ + leaf+"{}: got %kick for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + == + :: ++ on-bad-nonce |= stored-nonce=@ %. ap-core From ec60399cdf742efc1f7549b8fa0f53045663627e Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 19 Apr 2022 13:02:31 +0200 Subject: [PATCH 16/16] ames: restore previous +decode-shut-packet --- pkg/arvo/sys/vane/ames.hoon | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 8e170adb5..c1b8a6495 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -435,19 +435,8 @@ =/ cyf (rsh [3 18] content.packet) ~| ames-decrypt+[[sndr rcvr origin]:packet len siv] =/ vec ~[sndr.packet rcvr.packet sndr-life rcvr-life] - =/ =noun - %- cue %- need - (~(de sivc:aes:crypto (shaz symmetric-key) vec) siv len cyf) - ;; shut-packet - ?: ?=(shut-packet noun) - noun - =* meat +>.noun - ?: ?=(%& -.meat) noun - ?: ?=(%& +<.meat) noun - =* ack +>.meat - =/ [ok=? lag=@dr] ?>(?=([? @dr] ack) ack) - =. ack [ok %.n lag] - noun + ;; shut-packet %- cue %- need + (~(de sivc:aes:crypto (shaz symmetric-key) vec) siv len cyf) :: +decode-ship-size: decode a 2-bit ship type specifier into a byte width :: :: Type 0: galaxy or star -- 2 bytes