From 350636fe2a405cf7e47131faae92065a0ea1ef4f Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sat, 14 May 2022 10:52:45 +0200 Subject: [PATCH 1/8] ames: don't relay acks for naxplanations of %corks This avoids closing a subscription prematurely, before the server ames has had time to process the innitial %cork. --- pkg/arvo/sys/vane/ames.hoon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0d3043bbc..d8f63fa91 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2410,6 +2410,11 @@ =/ target-bone=^bone (mix 0b10 bone) :: (run-message-sink target-bone %drop message-num) + ?: &(closing ?=(%near -.task)) + :: if the bone belongs to a closing flow and we got a naxplanation, + :: don't relay the ack to the client vane, and wait for the next try + :: + peer-core :: not a nack-trace bone; relay ack to client vane :: (emit (got-duct bone) %give %done error) @@ -2602,6 +2607,8 @@ :: if we get a naxplanation for a %cork, the publisher is behind :: receiving the OTA, so we set up a timer to retry in one hour. :: + %- %+ trace msg.veb + |.("resend %cork on bone={} in ~h1") =/ =wire (make-pump-timer-wire her.channel target-bone) (emit [/ames]~ %pass wire %b %wait `@da`(add now ~h1)) :: +on-sink-plea: handle request message received by |message-sink From a1dcc5a8cd083e8c3b0626db17205582ae767a71 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sun, 15 May 2022 17:16:18 +0200 Subject: [PATCH 2/8] gall: print trace logs by agent This uses the same patterns found in %ames. We add an %odd flag for logs related to the gall-rq PR, and leave it open for other flags --- pkg/arvo/gen/hood/gall-sift.hoon | 8 +++ pkg/arvo/gen/hood/gall-verb.hoon | 11 ++++ pkg/arvo/lib/hood/helm.hoon | 10 +++ pkg/arvo/sys/lull.hoon | 5 ++ pkg/arvo/sys/vane/gall.hoon | 105 +++++++++++++++++++++++++------ 5 files changed, 120 insertions(+), 19 deletions(-) create mode 100644 pkg/arvo/gen/hood/gall-sift.hoon create mode 100644 pkg/arvo/gen/hood/gall-verb.hoon diff --git a/pkg/arvo/gen/hood/gall-sift.hoon b/pkg/arvo/gen/hood/gall-sift.hoon new file mode 100644 index 000000000..9f02165ee --- /dev/null +++ b/pkg/arvo/gen/hood/gall-sift.hoon @@ -0,0 +1,8 @@ +:: Helm: Set Gall Verbosity by Agent +:: +/? 310 +:: +:- %say +|= [^ dudes=(list dude:gall) ~] +:- %helm-gall-sift +dudes diff --git a/pkg/arvo/gen/hood/gall-verb.hoon b/pkg/arvo/gen/hood/gall-verb.hoon new file mode 100644 index 000000000..32b445701 --- /dev/null +++ b/pkg/arvo/gen/hood/gall-verb.hoon @@ -0,0 +1,11 @@ +:: Helm: Adjust Gall verbosity +:: +:: List of diagnostic flags is in verb:gall in zuse.hoon, documented in +:: gall.hoon +:: +/? 310 +:: +:- %say +|= [^ veb=(list verb:gall) ~] +:- %helm-gall-verb +veb diff --git a/pkg/arvo/lib/hood/helm.hoon b/pkg/arvo/lib/hood/helm.hoon index 055cec9f3..d2240f3ac 100644 --- a/pkg/arvo/lib/hood/helm.hoon +++ b/pkg/arvo/lib/hood/helm.hoon @@ -200,6 +200,14 @@ |= veb=(list verb:ames) =< abet (emit %pass /helm %arvo %a %spew veb) :: +++ poke-gall-sift + |= dudes=(list dude:gall) =< abet + (emit %pass /helm %arvo %g %sift dudes) +:: +++ poke-gall-verb + |= veb=(list verb:gall) =< abet + (emit %pass /helm %arvo %g %spew veb) +:: ++ poke-ames-wake |= ~ =< abet (emit %pass /helm %arvo %a %stir '') @@ -237,6 +245,8 @@ %helm-code =;(f (f !<(_+<.f vase)) poke-code) %helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve) %helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject) + %helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift) + %helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb) %helm-hi =;(f (f !<(_+<.f vase)) poke-hi) %helm-knob =;(f (f !<(_+<.f vase)) poke-knob) %helm-mass =;(f (f !<(_+<.f vase)) poke-mass) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index fba3c4d69..f6aa94fd2 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1653,6 +1653,8 @@ $>(%trim vane-task) :: trim state $>(%vega vane-task) :: report upgrade $>(%plea vane-task) :: network request + [%spew veb=(list verb)] :: set verbosity + [%sift dudes=(list dude)] :: per agent == :: +$ bitt (map duct (pair ship path)) :: incoming subs +$ boat :: outgoing subs @@ -1693,6 +1695,9 @@ $% [%raw-fact =mark =noun] sign:agent == + :: TODO: add more flags? + :: + +$ verb ?(%odd) :: :: +agent: app core :: diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 793b7bd00..631662ed8 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -4,15 +4,45 @@ :: :::: |= our=ship +:: veb: verbosity flags +:: +=/ veb-all-off + :: TODO: add more flags? + :: + :* odd=`?`%.n :: unusual events + == =, gall => |% ++| %helpers +:: +trace: print if .verb is set and we're tracking .dude +:: +++ trace + |= [verb=? =dude dudes=(set dude) print=tang] + ^+ same + ?. verb + same + ?. => [dude=dude dudes=dudes in=in] + ~+ |(=(~ dudes) (~(has in dudes) dude)) + same + (slog print) +:: +:: $bug: debug printing configuration +:: +:: veb: verbosity toggles +:: dudes: app filter; if ~, print for all +:: ++$ bug + $: veb=_veb-all-off + dudes=(set dude) + == +:: +| %main :: :: $move: Arvo-level move :: +$ move [=duct move=(wind note-arvo gift-arvo)] -:: $state-8: overall gall state, versioned +:: $state-9: overall gall state, versioned :: +$ state-9 [%9 state] :: $state: overall gall state @@ -22,6 +52,7 @@ :: contacts: other ships we're in communication with :: yokes: running agents :: blocked: moves to agents that haven't been started yet +:: bug: debug printing configuration :: +$ state $: system-duct=duct @@ -29,6 +60,7 @@ contacts=(set ship) yokes=(map term yoke) blocked=(map term (qeu blocked-move)) + =bug == :: $watches: subscribers and publications :: @@ -126,6 +158,7 @@ contacts=(set ship) eggs=(map term egg) blocked=(map term (qeu blocked-move)) + =bug == :: $egg: migratory agent state; $yoke with .old-state instead of .agent :: @@ -169,7 +202,7 @@ [^duct %pass /whiz/gall %$ %whiz ~]~ =/ adult adult-core =. state.adult - [%9 system-duct outstanding contacts yokes=~ blocked]:spore + [%9 system-duct outstanding contacts yokes=~ blocked bug]:spore =/ mo-core (mo-abed:mo:adult duct) =. mo-core =/ apps=(list [dap=term =egg]) ~(tap by eggs.spore) @@ -288,7 +321,7 @@ ++ spore-8-to-9 |= old=spore-8 ^- ^spore - =- old(- %9, eggs -) + =- old(- %9, eggs -, blocked [blocked.old *bug]) %- ~(run by eggs.old) |= =egg-8 ^- egg @@ -332,6 +365,12 @@ ++ mo ~% %gall-mo +> ~ |_ [hen=duct moves=(list move)] + :: + ++ trace + |= [verb=? =dude print=tang] + ^+ same + (^trace verb dude dudes.bug.state print) + :: :: +mo-abed: initialise state with the provided duct :: +mo-abet: finalize, reversing moves :: +mo-pass: prepend a standard %pass to the current list of moves @@ -1024,6 +1063,28 @@ %d (mo-give %unto %raw-fact mark.ames-response noun.ames-response) %x (mo-give %unto %kick ~) == + :: +mo-spew: handle request to set verbosity toggles on debug output + :: + ++ mo-spew + |= verbs=(list verb) + ^+ mo-core + :: start from all %.n's, then flip requested toggles + :: + =. veb.bug.state + %+ roll verbs + |= [=verb acc=_veb-all-off] + ^+ veb.bug.state + ?- verb + %odd acc(odd %.y) + == + mo-core + :: +mo-sift: handle request to filter debug output by agent + :: + ++ mo-sift + |= dudes=(list dude) + ^+ mo-core + =. dudes.bug.state (sy dudes) + mo-core :: +ap: agent engine :: :: An inner, agent-level core. The sample refers to the agent we're @@ -1038,6 +1099,12 @@ agent-config=(list (each suss tang)) =yoke == + :: + ++ trace + |= [verb=? print=tang] + ^+ same + (^trace verb agent-name print) + :: ++ ap-core . :: +ap-abed: initialise state for an agent, with the supplied routes. :: @@ -1528,29 +1595,28 @@ :: %watch-ack ?. (~(has by outbound.watches.yoke) sub-key) - %- %: slog - leaf+"{}: got ack for nonexistent subscription" - leaf+"{}: {}" - >wire=wire< - ~ - == - ap-core + %. ap-core + %+ trace odd.veb.bug.state :~ + leaf+"{}: got ack for nonexistent subscription" + leaf+"{}: {}" + >wire=wire< + == =. 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 &) + %. val(acked &) + %^ trace &(odd.veb.bug.state acked.val) + leaf/"{} 2nd watch-ack on {}" ~ :: ingest-and-check-error == :: ++ on-missing %. ap-core - %- slog :~ + %+ trace odd.veb.bug.state :~ leaf+"{}: got {<-.sign>} for nonexistent subscription" leaf+"{}: {<[nonce=nonce agent-wire]>}" >wire=wire< @@ -1558,7 +1624,7 @@ :: ++ on-weird-kick %. run-sign - %- slog :~ + %+ trace odd.veb.bug.state :~ leaf+"{}: got %kick for nonexistent subscription" leaf+"{}: {}" >wire=wire< @@ -1776,10 +1842,9 @@ =/ sub-wire=^wire (slag 6 `^wire`wire) :: ?. (~(has by outbound.watches.yoke) sub-wire dock) - =; =tang - %- (slog tang) - $(moves t.moves) - [leaf+"gall: {} missing subscription, got %leave"]~ + %. $(moves t.moves) + %^ trace odd.veb.bug.state + leaf/"gall: {} missing subscription, got %leave" ~ =/ have=[acked=? =path nonce=@] (~(got by outbound.watches.yoke) sub-wire dock) =. p.move.move @@ -1860,6 +1925,8 @@ %jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task) %idle mo-abet:(mo-idle:mo-core dude.task) %nuke mo-abet:(mo-nuke:mo-core dude.task) + %spew mo-abet:(mo-spew:mo-core veb.task) + %sift mo-abet:(mo-sift:mo-core dudes.task) %trim [~ gall-payload] %vega [~ gall-payload] == From 83356f02ca49eb8ce2c96d7b0a909623e42e562a Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 16 May 2022 09:13:40 +0200 Subject: [PATCH 3/8] gall: add $beat map for subscription nonces Previously we stored the nonce in $boat, which changed the $bowl of each agent. This compiles and all agents reload, but more testing is needed. It also renames inbound/outbound watches to $bitt/$boat. --- pkg/arvo/sys/lull.hoon | 5 +- pkg/arvo/sys/vane/gall.hoon | 116 +++++++++++++++++++----------------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index f6aa94fd2..5a3e94750 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1657,9 +1657,8 @@ [%sift dudes=(list dude)] :: per agent == :: +$ bitt (map duct (pair ship path)) :: incoming subs - +$ boat :: outgoing subs - %+ map [=wire =ship =term] :: - [acked=? =path nonce=@] :: + +$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs + +$ beat (map [=wire =ship =term] 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 631662ed8..b09d2b9ae 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -65,9 +65,9 @@ :: $watches: subscribers and publications :: :: TODO: rename this, to $ties? -:: TODO: rename $boat and $bitt and document +:: TODO: document :: -+$ watches [inbound=bitt outbound=boat] ++$ watches [=bitt =boat =beat] :: $routes: new cuff; TODO: document :: +$ routes @@ -330,16 +330,14 @@ sub-nonce=0 live.egg-8 stats.egg-8 - [inbound.watches.egg-8 (boat-8-to-9 outbound.watches.egg-8)] + (watches-8-to-9 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] + ++ watches-8-to-9 + |= watches-8 + ^- watches + [inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))] -- -- :: adult gall vane interface, for type compatibility with pupa @@ -1165,11 +1163,11 @@ :: ++ ap-nuke ^+ ap-core - =/ out=(list [[=wire =ship =term] ? =path nonce=@]) - ~(tap by outbound.watches.yoke) + =/ out=(list [[=wire =ship =term] ? =path]) + ~(tap by boat.watches.yoke) =/ inbound-paths=(set path) %- silt - %+ turn ~(tap by inbound.watches.yoke) + %+ turn ~(tap by bitt.watches.yoke) |= [=duct =ship =path] path =/ will=(list card:agent:gall) @@ -1177,8 +1175,8 @@ ?: =(~ inbound-paths) ~ [%give %kick ~(tap in inbound-paths) ~]~ - %+ turn ~(tap by outbound.watches.yoke) - |= [[=wire =ship =term] ? =path nonce=@] + %+ turn ~(tap by boat.watches.yoke) + |= [[=wire =ship =term] ? =path] [%pass wire %agent [ship term] %leave ~] =^ maybe-tang ap-core (ap-ingest ~ |.([will *agent])) ap-core @@ -1283,7 +1281,7 @@ |= =ship ^+ ap-core =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.yoke) + ~(tap by bitt.watches.yoke) |- ^+ ap-core ?^ in =? ap-core =(ship ship.i.in) @@ -1292,7 +1290,10 @@ $(in t.in) :: =/ out=(list [[=wire =^ship =term] ? =path nonce=@]) - ~(tap by outbound.watches.yoke) + %+ turn ~(tap by boat.watches.yoke) + |= [key=[wire ^ship term] val=[? path]] + :- key + val(+ [+.val (~(got by beat.watches.yoke) key)]) |- ^+ ap-core ?~ out ap-core @@ -1316,7 +1317,7 @@ ^+ ap-core :: =/ in=(list [=duct =^ship =path]) - ~(tap by inbound.watches.yoke) + ~(tap by bitt.watches.yoke) |- ^+ ap-core ?~ in ap-core :: @@ -1337,7 +1338,7 @@ ?~ target-paths ?~ target-ship ~[agent-duct] - %+ murn ~(tap by inbound.watches.yoke) + %+ murn ~(tap by bitt.watches.yoke) |= [=duct =ship =path] ^- (unit ^duct) ?: =(target-ship `ship) @@ -1352,7 +1353,7 @@ ++ ap-ducts-from-path |= [target-path=path target-ship=(unit ship)] ^- (list duct) - %+ murn ~(tap by inbound.watches.yoke) + %+ murn ~(tap by bitt.watches.yoke) |= [=duct =ship =path] ^- (unit ^duct) ?: ?& =(target-path path) @@ -1438,8 +1439,8 @@ attributing.agent-routes :: guest agent-name :: agent == :: - :* wex=outbound.watches.yoke :: outgoing - sup=inbound.watches.yoke :: incoming + :* wex=boat.watches.yoke :: outgoing + sup=bitt.watches.yoke :: incoming == :: :* act=change.stats.yoke :: tick eny=eny.stats.yoke :: nonce @@ -1475,8 +1476,8 @@ |= pax=path ^+ ap-core =/ incoming [attributing.agent-routes pax] - =. inbound.watches.yoke - (~(put by inbound.watches.yoke) agent-duct incoming) + =. bitt.watches.yoke + (~(put by bitt.watches.yoke) agent-duct incoming) =^ maybe-tang ap-core %+ ap-ingest %watch-ack |. (on-watch:ap-agent-core pax) @@ -1554,7 +1555,7 @@ ingest-and-check-error :: if .agent-wire matches, it's an old pre-nonce subscription :: - ?: (~(has by outbound.watches.yoke) sub-key) + ?: (~(has by boat.watches.yoke) sub-key) run-sign :: if an app happened to use a null wire, no-op :: @@ -1569,7 +1570,7 @@ =: nonce u.has-nonce agent-wire (tail agent-wire) == - =/ got (~(get by outbound.watches.yoke) sub-key) + =/ got (~(get by beat.watches.yoke) sub-key) ?~ got on-missing ?. =(nonce.u.got nonce) @@ -1588,25 +1589,29 @@ (ap-error -.sign leaf/"take %fact failed, closing subscription" u.tan) :: %kick - =. outbound.watches.yoke - (~(del by outbound.watches.yoke) sub-key) + =: beat.watches.yoke (~(del by beat.watches.yoke) sub-key) + boat.watches.yoke (~(del by boat.watches.yoke) sub-key) + == :: ingest-and-check-error :: %watch-ack - ?. (~(has by outbound.watches.yoke) sub-key) + ?. (~(has by boat.watches.yoke) sub-key) %. ap-core %+ trace odd.veb.bug.state :~ leaf+"{}: got ack for nonexistent subscription" leaf+"{}: {}" >wire=wire< == - =. outbound.watches.yoke + =? beat.watches.yoke ?=(^ p.sign) + (~(del by beat.watches.yoke) sub-key) + :: + =. boat.watches.yoke ?^ p.sign - (~(del by outbound.watches.yoke) sub-key) + (~(del by boat.watches.yoke) sub-key) :: - %+ ~(jab by outbound.watches.yoke) sub-key - |= val=[acked=? =path nonce=@] + %+ ~(jab by boat.watches.yoke) sub-key + |= val=[acked=? =path] %. val(acked &) %^ trace &(odd.veb.bug.state acked.val) leaf/"{} 2nd watch-ack on {}" ~ @@ -1682,8 +1687,8 @@ ^+ ap-core :: %= ap-core - inbound.watches.yoke - (~(del by inbound.watches.yoke) agent-duct) + bitt.watches.yoke + (~(del by bitt.watches.yoke) agent-duct) == :: +ap-load-delete: load delete. :: @@ -1691,13 +1696,13 @@ ^+ ap-core :: =/ maybe-incoming - (~(get by inbound.watches.yoke) agent-duct) + (~(get by bitt.watches.yoke) agent-duct) ?~ maybe-incoming ap-core :: =/ incoming u.maybe-incoming - =. inbound.watches.yoke - (~(del by inbound.watches.yoke) agent-duct) + =. bitt.watches.yoke + (~(del by bitt.watches.yoke) agent-duct) :: =^ maybe-tang ap-core %+ ap-ingest ~ |. @@ -1803,10 +1808,10 @@ :: =. agent.yoke &++.p.result =/ moves (zing (turn -.p.result ap-from-internal)) - =. inbound.watches.yoke + =. bitt.watches.yoke (ap-handle-kicks moves) (ap-handle-peers moves) - :: +ap-handle-kicks: handle cancels of inbound.watches + :: +ap-handle-kicks: handle cancels of bitt.watches :: ++ ap-handle-kicks ~/ %ap-handle-kicks @@ -1822,8 +1827,8 @@ :: =/ quit-map=bitt (malt (turn quits |=(=duct [duct *[ship path]]))) - (~(dif by inbound.watches.yoke) quit-map) - :: +ap-handle-peers: handle new outbound.watches + (~(dif by bitt.watches.yoke) quit-map) + :: +ap-handle-peers: handle new boat.watches :: ++ ap-handle-peers ~/ %ap-handle-peers @@ -1841,16 +1846,18 @@ =/ sys-wire=^wire (scag 6 `^wire`wire) =/ sub-wire=^wire (slag 6 `^wire`wire) :: - ?. (~(has by outbound.watches.yoke) sub-wire dock) + ?. (~(has by boat.watches.yoke) sub-wire dock) %. $(moves t.moves) %^ trace odd.veb.bug.state leaf/"gall: {} missing subscription, got %leave" ~ - =/ have=[acked=? =path nonce=@] - (~(got by outbound.watches.yoke) sub-wire dock) + =/ have=[nonce=@ acked=? =path] + :- (~(got by beat.watches.yoke) sub-wire dock) + (~(got by boat.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]) + =: boat.watches.yoke (~(del by boat.watches.yoke) [sub-wire dock]) + beat.watches.yoke (~(del by beat.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]) @@ -1860,12 +1867,11 @@ =/ sub-wire=^wire (slag 6 `^wire`wire) =/ [=dock =deal] [[q.p q] r]:q.move.move :: - ?: (~(has by outbound.watches.yoke) sub-wire dock) + ?: (~(has by boat.watches.yoke) sub-wire dock) =. ap-core =/ =tang ~[leaf+"subscribe wire not unique" >agent-name< >sub-wire< >dock<] - =/ have - (~(got by outbound.watches.yoke) sub-wire dock) + =/ have (~(got by boat.watches.yoke) sub-wire dock) %- (slog >out=have< tang) (ap-error %watch-not-unique tang) :: reentrant, maybe bad? $(moves t.moves) @@ -1877,11 +1883,13 @@ new-moves [move new-moves] 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) - sub-nonce.yoke + boat.watches.yoke + %+ ~(put by boat.watches.yoke) [sub-wire dock] + :- acked=| + path=?+(-.deal !! %watch path.deal, %watch-as path.deal) + :: + beat.watches.yoke + (~(put by beat.watches.yoke) [sub-wire dock] sub-nonce.yoke) == -- -- From 20a5f0701c827afaf7bb87b6e9aea37b436458dc Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 16 May 2022 10:27:27 +0200 Subject: [PATCH 4/8] app: remove nonce from dbug and spider --- pkg/arvo/app/dbug.hoon | 3 +-- pkg/arvo/app/spider.hoon | 2 +- pkg/base-dev/lib/dbug.hoon | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/dbug.hoon b/pkg/arvo/app/dbug.hoon index 6867e83bb..f0dc3c810 100644 --- a/pkg/arvo/app/dbug.hoon +++ b/pkg/arvo/app/dbug.hoon @@ -206,14 +206,13 @@ '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 nonce=@]] + |= [[w=wire s=^ship t=term] [a=? p=^path]] %- pairs :~ 'wire'^(path w) 'ship'^(ship s) diff --git a/pkg/arvo/app/spider.hoon b/pkg/arvo/app/spider.hoon index 821f2ac5e..83e360d2d 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 nonce=@]] + |= [[=wire =ship =term] [acked=? =path]] ^- (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 c61286669..ce98619e8 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 nonce=@]] + |= [[=wire =ship =term] [acked=? =path]] ^- (unit tank) =; relevant=? ?. relevant ~ From 586fecef10cb2e0e55d8ceceebbc0c5687c2fe15 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Mon, 16 May 2022 10:27:36 +0200 Subject: [PATCH 5/8] gall: add %gn to scry the nonce of a subscription --- pkg/arvo/sys/vane/gall.hoon | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index b09d2b9ae..ebf8cf25c 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -2006,6 +2006,19 @@ acc (~(put in acc) [dude -.agent.yoke]) :: + ?: ?& =(%n care) + ?=([@ @ ^] path) + =([%$ %da now] coin) + =(our ship) + == + ?~ yok=(~(get by yokes.state) dap) + [~ ~] + =/ [=^ship =term =wire] + [(slav %p i.path) i.t.path t.t.path] + ?~ nonce=(~(get by beat.watches.u.yok) [wire ship term]) + [~ ~] + [~ ~ atom+!>(u.nonce)] + :: ?. =(our ship) ~ ?. =([%$ %da now] coin) From 2553573be0de8a189d133898ae58cac6a61aff86 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 17 May 2022 07:11:09 +0200 Subject: [PATCH 6/8] ames: start drainage timer if regressed from adult This accounts for a possible race condition where ames expects a response, but regresses into the larval state. Upon receiving the $sign on +take, we would remain stuck as a larva. Now we check that we have enough information to re-evolve and then start a /larval timer to begin draining the queue. --- bin/solid.pill | 4 +-- pkg/arvo/sys/vane/ames.hoon | 55 ++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index 500e2243f..8ab816f79 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:655bac06453b7d26ed0549576577dae1adc0fff3fefe202065cca752ff74e4e2 -size 9640752 +oid sha256:afe650a1583104e57bc83d7a0804405661b2e7a53e0673694ad53522b8894d79 +size 9526886 diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 8e7145ff9..0d6cb5552 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -784,6 +784,13 @@ |= [now=@da eny=@ rof=roof] =* larval-gate . =* adult-core (adult-gate +<) +=< |% + ++ call ^call + ++ load ^load + ++ scry ^scry + ++ stay ^stay + ++ take ^take + -- |% :: +call: handle request $task :: @@ -796,17 +803,8 @@ ?^ dud ~|(%ames-larval-call-dud (mean tang.u.dud)) :: - =/ update-ready=? - ?& ?=(^ cached-state) - ?=(~ queued-events) - == - ?: update-ready - =. ames-state.adult-gate - ?> ?=(^ cached-state) - (state-5-to-6:load:adult-core +.u.cached-state) - =. cached-state ~ - ~> %slog.1^leaf/"ames: metamorphosis reload" - [~ adult-gate] + ?: &(?=(^ cached-state) ?=(~ queued-events)) + (molt ~) :: %born: set .unix-duct and start draining .queued-events :: ?: ?=(%born -.task) @@ -836,11 +834,17 @@ ~|(%ames-larval-take-dud (mean tang.u.dud)) :: enqueue event if not a larval drainage timer :: + =? queued-events !=(/larva wire) + (~(put to queued-events) %take wire duct sign) + :: start drainage timer if have regressed from adult ames + :: + ?: ?& !=(/larva wire) + ?=(^ cached-state) + == + [[duct %pass /larva %b %wait now]~ larval-gate] :: XX what to do with errors? :: - ?. =(/larva wire) - =. queued-events (~(put to queued-events) %take wire duct sign) - [~ larval-gate] + ?. =(/larva wire) [~ larval-gate] :: larval event drainage timer; pop and process a queued event :: ?. ?=([%behn %wake *] sign) @@ -879,20 +883,10 @@ %call (call:adult-core [duct ~ wrapped-task]:+.first-event) %take (take:adult-core [wire duct ~ sign]:+.first-event) == - =/ update-ready=? - ?& ?=(^ cached-state) - ?=(~ queued-events) - == - ?: update-ready - =. ames-state.adult-gate - ?> ?=(^ cached-state) - (state-5-to-6:load:adult-core +.u.cached-state) - =. cached-state ~ - ~> %slog.1^leaf/"ames: metamorphosis reload" - [moves adult-gate] :: .queued-events has been cleared; metamorphose :: ?~ queued-events + ?: ?=(^ cached-state) (molt moves) ~> %slog.0^leaf/"ames: metamorphosis" [moves adult-gate] :: set timer to drain next event @@ -952,6 +946,17 @@ =. adult-gate (load:adult-core %6 state.old) larval-gate == + :: +molt: re-evolve to adult-ames + :: + ++ molt + |= moves=(list move) + ^- (quip move _adult-gate) + =. ames-state.adult-gate + ?> ?=(^ cached-state) + (state-5-to-6:load:adult-core +.u.cached-state) + =. cached-state ~ + ~> %slog.1^leaf/"ames: metamorphosis reload" + [~ adult-gate] -- :: adult ames, after metamorphosis from larva :: From 4dae3ae3e2734b5972aa127cc3a8cdc406fa6fa6 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 17 May 2022 07:49:15 +0200 Subject: [PATCH 7/8] ames: indent --- pkg/arvo/sys/vane/ames.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 0d6cb5552..90cd58a13 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -784,7 +784,7 @@ |= [now=@da eny=@ rof=roof] =* larval-gate . =* adult-core (adult-gate +<) -=< |% + =< |% ++ call ^call ++ load ^load ++ scry ^scry From 7166e4c7cf7042a9d2699f6e584c32649c980bfe Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Tue, 17 May 2022 14:29:13 +0200 Subject: [PATCH 8/8] gall: skip nonce in pre-nonce subs wires --- pkg/arvo/sys/vane/gall.hoon | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index ebf8cf25c..9085e459b 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -1850,11 +1850,14 @@ %. $(moves t.moves) %^ trace odd.veb.bug.state leaf/"gall: {} missing subscription, got %leave" ~ - =/ have=[nonce=@ acked=? =path] - :- (~(got by beat.watches.yoke) sub-wire dock) - (~(got by boat.watches.yoke) sub-wire dock) + =/ nonce=@ (~(got by beat.watches.yoke) sub-wire dock) =. p.move.move - (weld sys-wire [(scot %ud nonce.have) sub-wire]) + %+ weld sys-wire + ?: =(nonce 0) + :: skip adding nonce to pre-nonce subscription wires + :: + sub-wire + [(scot %ud nonce) sub-wire] =: boat.watches.yoke (~(del by boat.watches.yoke) [sub-wire dock]) beat.watches.yoke (~(del by beat.watches.yoke) [sub-wire dock]) ==