From bc521fa8300ac628b447d5c39dfaf5fa0ca4704a Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 28 Feb 2023 11:25:06 -0600 Subject: [PATCH 01/20] Revert "Merge pull request #5973 from urbit/m/http-auth-tokens" This reverts commit 61d32b559865dea832de65bf7a6085f75ef95748, reversing changes made to b271d5e3c33e19271e4b31e96bda8c7765e22606. --- pkg/arvo/sys/lull.hoon | 3 - pkg/arvo/sys/vane/eyre.hoon | 25 ++---- tests/sys/vane/eyre.hoon | 171 +++++++++++++++++++++++------------- 3 files changed, 118 insertions(+), 81 deletions(-) diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index e99578baa..9856f9311 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -1315,9 +1315,6 @@ :: so we can apply configurations on a per-site basis :: [%set-config =http-config] - :: sessions: valid authentication cookie strings - :: - [%sessions ses=(set @t)] :: response: response to an event from earth :: [%response =http-event:http] diff --git a/pkg/arvo/sys/vane/eyre.hoon b/pkg/arvo/sys/vane/eyre.hoon index e587bea66..e1716c624 100644 --- a/pkg/arvo/sys/vane/eyre.hoon +++ b/pkg/arvo/sys/vane/eyre.hoon @@ -984,7 +984,6 @@ (session-cookie-string session &) :: =; out=[moves=(list move) server-state] - =. moves.out [give-session-tokens moves.out] :: if we didn't have any cookies previously, start the expiry timer :: ?. first-session out @@ -1059,7 +1058,7 @@ ?~ channels =^ moz state (handle-response response) - [[give-session-tokens (weld moves moz)] state] + [(weld moves moz) state] =^ moz state (discard-channel:by-channel i.channels |) $(moves (weld moves moz), channels t.channels) @@ -2143,13 +2142,6 @@ (cury cat 3) ?~ ext.request-line '' (cat 3 '.' u.ext.request-line) - :: +give-session-tokens: send valid session tokens to unix - :: - ++ give-session-tokens - ^- move - :- outgoing-duct.state - =* ses sessions.authentication-state.state - [%give %sessions (~(run in ~(key by ses)) (cury scot %uv))] -- :: ++ forwarded-params @@ -2329,15 +2321,12 @@ =. outgoing-duct.server-state.ax duct :: :_ http-server-gate - :* :: hand back default configuration for now - :: - [duct %give %set-config http-config.server-state.ax] - :: provide a list of valid auth tokens - :: - =< give-session-tokens - (per-server-event [eny duct now rof] server-state.ax) + ;: weld + :: hand back default configuration for now :: - closed-connections + [duct %give %set-config http-config.server-state.ax]~ + :: + closed-connections == :: ?: ?=(%code-changed -.task) @@ -2611,8 +2600,6 @@ :: ^- [(list move) _http-server-gate] :_ http-server-gate - :- =< give-session-tokens - (per-server-event [eny duct now rof] server-state.ax) ?: =(~ sessions) ~ =; next-expiry=@da [duct %pass /sessions/expire %b %wait next-expiry]~ diff --git a/tests/sys/vane/eyre.hoon b/tests/sys/vane/eyre.hoon index 10802f190..f8fd9ba0f 100644 --- a/tests/sys/vane/eyre.hoon +++ b/tests/sys/vane/eyre.hoon @@ -7,14 +7,27 @@ :: |% ++ test-init - -:perform-init -:: -++ test-born - -:(perform-born eyre-gate) + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == + :: + results1 :: ++ test-overwrite-bindings :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -44,7 +57,14 @@ :: ++ test-remove-binding :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -110,7 +130,14 @@ :: ++ test-builtin-four-oh-four :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: when there's no configuration and nothing matches, expect 404 :: =^ results2 eyre-gate @@ -146,7 +173,14 @@ :: ++ test-basic-app-request :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -232,7 +266,14 @@ :: ++ test-app-error :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -328,7 +369,14 @@ :: ++ test-multipart-app-request :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -436,11 +484,17 @@ :: ++ test-login-handler-full-path :: - =^ results1 eyre-gate perform-init - =^ results2 eyre-gate (perform-born eyre-gate) + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: - =^ results3 eyre-gate + =^ results2 eyre-gate %- eyre-call :* eyre-gate now=~1111.1.2 @@ -450,7 +504,7 @@ == :: outside requests a path that app1 has bound to :: - =^ results4 eyre-gate + =^ results3 eyre-gate %- eyre-call-with-comparator :* eyre-gate now=~1111.1.3 @@ -496,7 +550,7 @@ == :: app then gives a redirect to Eyre :: - =^ results5 eyre-gate + =^ results4 eyre-gate %- eyre-take :* eyre-gate now=~1111.1.4 @@ -515,7 +569,7 @@ == == == :: the browser then fetches the login page :: - =^ results6 eyre-gate + =^ results5 eyre-gate %- perform-authentication :* eyre-gate now=~1111.1.5 @@ -523,7 +577,7 @@ == :: going back to the original url will acknowledge the authentication cookie :: - =^ results7 eyre-gate + =^ results6 eyre-gate %- eyre-call-with-comparator :* eyre-gate now=~1111.1.5..1.0.0 @@ -590,12 +644,18 @@ results4 results5 results6 - results7 == :: ++ test-generator :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: gen1 binds successfully :: =^ results2 eyre-gate @@ -723,7 +783,14 @@ :: ++ test-channel-reject-unauthenticated :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: =^ results2 eyre-gate %- eyre-call :* @@ -1806,7 +1873,14 @@ :: ++ test-born-sends-pending-cancels :: - =^ results1 eyre-gate perform-init + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: app1 binds successfully :: =^ results2 eyre-gate @@ -1877,15 +1951,15 @@ |= moves=(list move:eyre-gate) ^- tang :: - ?. ?=([^ ^ ^ ~] moves) + ?. ?=([^ ^ ~] moves) [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: - :: we don't care about the first two, which are just - :: configuration moves. + :: we don't care about the first one, which is just a static + :: configuration move. :: - =/ =move:eyre-gate i.t.t.moves - =/ =duct duct.move - =/ card card.move + =/ move=move:eyre-gate i.t.moves + =/ =duct duct.move + =/ card=(wind note:eyre-gate gift:eyre-gate) card.move :: %+ weld (expect-eq !>(~[/http-blah]) !>(duct)) @@ -2052,30 +2126,6 @@ :: todo: handle other deals :: [%leaf "unexpected %deal type"]~ -:: +perfom-init: %init a new eyre-gate -:: -++ perform-init - %- eyre-call :* - eyre-gate - now=~1111.1.1 - scry=scry-provides-code - call-args=[duct=~[/init] ~ [%init ~]] - expected-moves=~ - == -:: +perform-born: %born an eyre-gate -:: -++ perform-born - |= =_eyre-gate - %- eyre-call :* - eyre-gate - new=~1111.1.1 - scry=scry-provides-code - call-args=[duct=~[/unix] ~ [%born ~]] - ^= expected-moves - :~ [duct=~[/unix] %give %set-config *http-config:eyre] - [duct=~[/unix] %give %sessions ~] - == - == :: +perform-authentication: goes through the authentication flow :: ++ perform-authentication @@ -2135,9 +2185,6 @@ :~ ::NOTE this ~d7 is tied to the eyre-internal +session-timeout... :- duct=~[/http-blah] [%pass p=/sessions/expire q=[%b [%wait p=(add start-now ~d7.m1)]]] - :: - =+ token='0v3.q0p7t.mlkkq.cqtto.p0nvi.2ieea' - [duct=~[/unix] %give %sessions [token ~ ~]] :: :* duct=~[/http-blah] %give @@ -2162,11 +2209,17 @@ == ^- [tang _eyre-gate] :: - =^ results1 eyre-gate perform-init - =^ results2 eyre-gate (perform-born eyre-gate) + =^ results1 eyre-gate + %- eyre-call :* + eyre-gate + now=~1111.1.1 + scry=scry-provides-code + call-args=[duct=~[/init] ~ [%init ~]] + expected-moves=~ + == :: ensure there's an authenticated session :: - =^ results3 eyre-gate + =^ results2 eyre-gate %- perform-authentication :* eyre-gate now=~1111.1.2 @@ -2174,7 +2227,7 @@ == :: send the channel a poke and a subscription request :: - =^ results4 eyre-gate + =^ results3 eyre-gate %- eyre-call-with-comparator :* eyre-gate now=~1111.1.2 @@ -2240,7 +2293,7 @@ == == :: :_ eyre-gate - :(weld results1 results2 results3 results4) + :(weld results1 results2 results3) :: ++ scry-provides-code ^- roof |= [gang =view =beam] From f5eeffef587b06bc93540536cf88a10e49dc77fd Mon Sep 17 00:00:00 2001 From: J Lynn Date: Wed, 8 Mar 2023 09:23:37 +1100 Subject: [PATCH 02/20] %eth-watcher: ensure get-block-by-number RPC call doesn't pad block number. Resolves #6377 - stuck %eth-watcher due to get-block-by-number zero-padded number RPC failure --- pkg/base-dev/lib/ethereum.hoon | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/base-dev/lib/ethereum.hoon b/pkg/base-dev/lib/ethereum.hoon index 9f63062f9..fd30a7829 100644 --- a/pkg/base-dev/lib/ethereum.hoon +++ b/pkg/base-dev/lib/ethereum.hoon @@ -733,7 +733,7 @@ :: %eth-get-block-by-number :- 'eth_getBlockByNumber' - :~ (tape (num-to-hex bon.req)) + :~ (tape (num-to-hex-minimal bon.req)) b+txs.req == :: @@ -942,6 +942,15 @@ %- render-hex-bytes (as-octs:mimes:html n) :: +++ num-to-hex-minimal + |= n=@ + ^- tape + %- prefix-hex + ?: =(0 n) + "0" + %- render-hex-bytes-minimal + (as-octs:mimes:html n) +:: ++ address-to-hex |= a=address ^- tape @@ -980,6 +989,12 @@ ^- tape ((x-co:co (mul 2 p.a)) q.a) :: +++ render-hex-bytes-minimal + :: atom to string of hex bytes without 0x prefix and dots, minimal representation (no padding). + |= a=octs + ^- tape + ((x-co:co 1) q.a) +:: ++ pad-to-multiple |= [wat=tape mof=@ud wer=?(%left %right)] ^- tape From 0a1e39cb47d7366f8def156736e49898172e9ed5 Mon Sep 17 00:00:00 2001 From: J Lynn Date: Wed, 8 Mar 2023 09:59:47 +1100 Subject: [PATCH 03/20] %eth-watcher: clean up extraneous render-hex-bytes-minimal formatter Per suggestion at https://github.com/urbit/urbit/pull/6377/files/f5eeffef587b06bc93540536cf88a10e49dc77fd#r1128704330 Moves x-co:co into num-to-hex-minimal. --- pkg/base-dev/lib/ethereum.hoon | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkg/base-dev/lib/ethereum.hoon b/pkg/base-dev/lib/ethereum.hoon index fd30a7829..23b69e9a3 100644 --- a/pkg/base-dev/lib/ethereum.hoon +++ b/pkg/base-dev/lib/ethereum.hoon @@ -948,8 +948,7 @@ %- prefix-hex ?: =(0 n) "0" - %- render-hex-bytes-minimal - (as-octs:mimes:html n) + ((x-co:co 1) n) :: ++ address-to-hex |= a=address @@ -989,12 +988,6 @@ ^- tape ((x-co:co (mul 2 p.a)) q.a) :: -++ render-hex-bytes-minimal - :: atom to string of hex bytes without 0x prefix and dots, minimal representation (no padding). - |= a=octs - ^- tape - ((x-co:co 1) q.a) -:: ++ pad-to-multiple |= [wat=tape mof=@ud wer=?(%left %right)] ^- tape From 307dce7f56015b6c2a81d6ba0f965915ca076baf Mon Sep 17 00:00:00 2001 From: Pyry Kovanen Date: Tue, 7 Mar 2023 17:16:47 -0600 Subject: [PATCH 04/20] lib/ethereum: remove unnecessary conditional --- pkg/base-dev/lib/ethereum.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/base-dev/lib/ethereum.hoon b/pkg/base-dev/lib/ethereum.hoon index 23b69e9a3..4f53df668 100644 --- a/pkg/base-dev/lib/ethereum.hoon +++ b/pkg/base-dev/lib/ethereum.hoon @@ -946,8 +946,6 @@ |= n=@ ^- tape %- prefix-hex - ?: =(0 n) - "0" ((x-co:co 1) n) :: ++ address-to-hex From d2e6c7e8a17b0e35d6e84c0ddbbc77bbb3e42663 Mon Sep 17 00:00:00 2001 From: ~wicrum-wicrun <99811688+wicrum-wicrun@users.noreply.github.com> Date: Mon, 27 Mar 2023 19:21:19 +0200 Subject: [PATCH 05/20] Unsubscribing and permissions --- pkg/base-dev/lib/sss.hoon | 301 +++++++++++++++++++++++++++----------- pkg/base-dev/sur/sss.hoon | 11 +- 2 files changed, 224 insertions(+), 88 deletions(-) diff --git a/pkg/base-dev/lib/sss.hoon b/pkg/base-dev/lib/sss.hoon index 5f02e3db0..896401085 100644 --- a/pkg/base-dev/lib/sss.hoon +++ b/pkg/base-dev/lib/sss.hoon @@ -40,75 +40,119 @@ |* [=(lake) paths=mold] => |% - +$ flow [=aeon fail=_| =rock:lake] + +$ from (on-rock:poke lake paths) + +$ into (response:poke lake paths) + +$ result (request:poke paths) + +$ fail [paths ship dude] + +$ flow [=aeon stale=_| fail=_| =rock:lake] + +$ subs [%0 (map [ship dude paths] (unit flow))] -- - |_ [sub=(map [ship dude paths] flow) =bowl:gall result-type=type on-rock-type=type] - ++ surf pine :: Subscribe to [ship dude path]. + |= $: sub=subs + =bowl:gall + result-type=type + on-rock-type=type + fail-type=type + == + => .(sub +.sub) + |% + ++ surf :: Subscribe to [ship dude path]. + |= which=[ship dude paths] + ^- (quip card:agent:gall subs) + ?+ flow=(~(get by sub) which) `0/sub + ~ [~[(pine which)] 0/(~(put by sub) which ~)] + [~ ~] [~[(pine which)] 0/sub] + [~ ~ [* %& * *]] [~[(scry `+(aeon.u.u.flow) which)] 0/sub] + == + ++ quit (corl (lead %0) ~(del by sub)) :: Unsub from [ship dude path]. ++ read :: See current subscribed states. - ^- (map [ship dude paths] [fail=? rock:lake]) - %- ~(run by sub) - |= =flow - [fail rock]:flow - :: :: Check poke-acks for errors. + ^- (map [ship dude paths] [stale=? fail=? =rock:lake]) + %- malt %+ murn ~(tap by sub) + |= [key=[ship dude paths] val=(unit flow)] + ?~ val ~ + `[key +.u.val] + :: :: Check poke-ack for errors. :: :: If an %sss-on-rock poke nacks, ++ chit :: that state is flagged as failed. |= [[aeon=term ship=term dude=term path=paths] =sign:agent:gall] - ^+ sub + ^- subs + :- %0 ?> ?=(%poke-ack -.sign) ?~ p.sign sub %+ ~(jab by sub) [(slav %p ship) dude path] - |= =flow + |= (unit flow) + =/ =flow (need +<) ?> =(aeon.flow (slav %ud aeon)) - flow(fail &) + `flow(fail &) + :: :: Check poke-ack for errors. + :: :: If a scry request nacks, + ++ tell :: that state is flagged as stale. + |= [[ship=term =dude aeon=term path=paths] =sign:agent:gall] + ^- (quip card:agent:gall subs) + ?> ?=(%poke-ack -.sign) + ?~ p.sign `0/sub + =/ current [ship=(slav %p ship) dude=dude path=path] + ?+ flow=(~(get by sub) current) `0/sub + [~ ~ *] + =. stale.u.u.flow & + :_ 0/(~(put by sub) current u.flow) + ~[(on-rock-poke current u.u.flow ~)] + :: + [~ ~] + :_ 0/(~(del by sub) current) :_ ~ + :* %pass (zoom surf-fail/aeon/ship/dude/path) + %agent [our dap]:bowl + %poke %sss-surf-fail fail-type ^- fail + [path ship dude]:current + == + == :: :: Check if we're still interested :: :: in a wave. If no, no-op. :: :: If yes, scry. ++ behn :: (See https://gist.github.com/belisarius222/7f8452bfea9b199c0ed717ab1778f35b) |= [ship=term =dude aeon=term path=paths] ^- (list card:agent:gall) + %- fall :_ ~ %- mole |. =/ ship (slav %p ship) =/ aeon (slav %ud aeon) - ?: (lte aeon aeon:(~(got by sub) ship dude path)) ~ + ?: (lte aeon aeon:(fall (~(got by sub) ship dude path) *flow)) ~ ~[(scry `aeon ship dude path)] :: ++ apply :: Handle response from publisher. |= res=(response:poke lake paths) - ^- (quip card:agent:gall _sub) + ^- (quip card:agent:gall subs) + %- fall :_ `0/sub %- mole |. + =* current [src.bowl dude.res path.res] + =/ old=flow (fall (~(got by sub) current) *flow) ?- type.res + %tomb + =/ =flow old(stale &) + :_ 0/(~(put by sub) current `flow) :_ ~ + (on-rock-poke current flow ~) + :: %yore - :_ sub :_ ~ + :_ 0/sub :_ ~ (pine src.bowl dude.res path.res) :: %nigh - :_ sub :_ ~ + :_ 0/sub :_ ~ (behn-s25 [dude aeon path]:res) :: %scry - =* current [src.bowl dude.res path.res] =/ [wave=(unit wave:lake) =flow] - =/ old=flow (~(gut by sub) current *flow) ?- what.res %rock ?> (gte aeon.res aeon.old) - `[aeon.res | rock.res] - %wave ~| [%weird-wave res=res old=old] - ?> =(aeon.res +(aeon.old)) - [`wave.res [aeon.res | (wash:lake rock.old wave.res)]] + [~ [aeon.res | | rock.res]] + %wave ?> =(aeon.res +(aeon.old)) + [`wave.res [aeon.res | | (wash:lake rock.old wave.res)]] == - :_ (~(put by sub) current flow) - %- flop - :~ (scry `+(aeon.res) src.bowl dude.res path.res) - :* %pass (zoom on-rock/(scot %ud aeon.flow)^(scot %p src.bowl)^dude.res^path.res) - %agent [our dap]:bowl - %poke %sss-on-rock on-rock-type ^- from - [path.res src.bowl dude.res rock.flow wave] - == == + :_ 0/(~(put by sub) current `flow) + :~ (on-rock-poke current flow wave) + (scry `+(aeon.res) src.bowl dude.res path.res) + == == :: :: Non-public facing arms below :: - +$ from (on-rock:poke lake paths) - +$ into (response:poke lake paths) - +$ result (request:poke paths) ++ behn-s25 |= [=dude =aeon path=noun] ^- card:agent:gall @@ -119,71 +163,137 @@ ++ scry |= [when=(unit aeon) who=ship which=dude where=paths] ^- card:agent:gall - =/ when ?~ when %~ (scot %ud u.when) - :* %pass (zoom request/scry/(scot %p who)^which^when^where) + =/ when ?~ when ~ (scot %ud u.when) + :* %pass (zoom scry-request/(scot %p who)^which^when^where) %agent [who which] %poke %sss-to-pub :- result-type ^- result - [where which ^when] + [where dap.bowl ^when] + == + ++ on-rock-poke + |= [[=ship =dude path=paths] flow wave=(unit wave:lake)] + ^- card:agent:gall + :* %pass (zoom on-rock/(scot %ud aeon)^(scot %p ship)^dude^path) + %agent [our dap]:bowl + %poke %sss-on-rock on-rock-type ^- from + [path ship dude stale fail rock wave] == -- ++ du :: Manage publications. |* [=(lake) paths=mold] => |% - +$ rule [rocks=_1 waves=_5] :: Retention policy + +$ into (request:poke paths) + +$ result (response:poke lake paths) + +$ rule [rocks=_1 waves=_5] :: Retention policy +$ tide $: rok=((mop aeon rock:lake) gte) wav=((mop aeon wave:lake) lte) rul=rule - mem=(mip aeon [ship dude] @da) + mem=(mip ship dude @da) == + +$ buoy + $: tid=$~(*tide $@(aeon tide)) + alo=(unit (set ship)) + == + +$ pubs [%0 (map paths buoy)] -- - |_ [pub=(map paths tide) =bowl:gall result-type=type] - +* rok ((on aeon rock:lake) gte) - wav ((on aeon wave:lake) lte) - :: + |= [pub=pubs =bowl:gall result-type=type] + => .(pub +.pub) + =* rok ((on aeon rock:lake) gte) + =* wav ((on aeon wave:lake) lte) + |% ++ rule :: Set new retention policy. |= [path=paths =^rule] - ^+ pub + ^- pubs + :- %0 %+ ~(jab by pub) path - |= =tide - (form tide(rul rule)) + |= =buoy + ?@ tid.buoy buoy + buoy(tid (form tid.buoy(rul rule))) :: ++ wipe :: Create new rock and wipe rest. |= path=paths - ^+ pub + ^- pubs + :- %0 %+ ~(jab by pub) path - |= =tide - %* . (form tide(rul [0 1])) - rul rul.tide - wav ~ + |= =buoy + ?@ tid.buoy buoy + %* . buoy(tid (form tid.buoy(rul [0 1]))) + rul.tid rul.tid.buoy + wav.tid ~ == ++ give :: Give a wave on a path. |= [path=paths =wave:lake] - ^- (quip card:agent:gall _pub) - ?~ ;;((soft ^path) path) ~| %need-path !! - =/ =tide (~(gut by pub) path *tide) - =/ next=aeon - .+ %+ max - (fall (bind (pry:rok rok.tide) head) 0) - (fall (bind (ram:wav wav.tide) head) 0) - :: - :_ %+ ~(put by pub) path - =/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok) - =. wav.tide (put:wav wav.tide next wave) - =. mem.tide (~(del by mem.tide) next) - ?. =(next (add aeon.last waves.rul.tide)) tide - (form tide) - :: - %+ murn ~(tap by (~(gut by mem.tide) next ~)) - |= [[=ship =dude] =@da] - ?: (lth da now.bowl) ~ - `(send scry/wave/wave ship dude next path) + ^- (quip card:agent:gall pubs) + ?~ ((soft ^path) path) ~| %need-path !! + =/ buoy (~(gut by pub) path *buoy) + ?@ tide=tid.buoy ~| %dead-path !! ::TODO is this good behavior? + =/ next=aeon +((latest tide)) + :- %+ murn ~(tap bi mem.tide) + |= [=ship =dude =@da] + ?: (lth da now.bowl) ~ + `(send scry/wave/wave ship dude next path) + :- %0 + %+ ~(put by pub) path + =/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok) + =. wav.tide (put:wav wav.tide next wave) + =. mem.tide (~(del by mem.tide) next) + ?. =(next (add aeon.last waves.rul.tide)) buoy + buoy(tid (form tide)) + :: + ++ perm :: Change permissions with gate. + |= [where=(list paths) diff=$-((unit (set ship)) (unit (set ship)))] + ^- pubs + %+ edit where + |= =buoy + =/ new=_alo.buoy (diff alo.buoy) + ?@ tid.buoy buoy(alo new) + %= buoy + alo new + mem.tid ?~ new mem.tid.buoy + %. mem.tid.buoy + ~(int by (malt (turn ~(tap in u.new) (late *(map @ @))))) + == + ++ public (curr perm _~) :: Make list of paths public. + ++ secret (curr perm _`~) :: Make list of paths secret. + :: :: Block ships from paths. + ++ block :: No-ops on public paths. + |= [who=(list ship) whence=(list paths)] + ^- pubs + %+ edit whence + |= =buoy + ?@ tid.buoy buoy + ?~ alo.buoy buoy + %= buoy + alo `(~(dif in u.alo.buoy) (sy who)) + mem.tid (~(dif by mem.tid.buoy) (malt (turn who (late ~)))) + == + :: :: Allow ships to paths. + ++ allow :: Any public paths will no-op. + |= [who=(list ship) where=(list paths)] + ^- pubs + %+ edit where + |= =buoy + ?@ tid.buoy buoy + ?~ alo.buoy buoy + buoy(alo `(~(gas in u.alo.buoy) who)) + :: :: Kill a list of paths, i.e. tell + ++ kill :: subs to not expect updates. + (curr edit |=(=buoy buoy(tid (latest tid.buoy)))) + :: :: Reopen list of killed paths. + ++ live :: No-ops on live paths. + %+ curr edit + |= =buoy + ?^ tid.buoy buoy + %*(. buoy(tid *tide) rok.tid (put:rok ~ +(tid.buoy) *rock:lake)) + :: ++ read :: See current published states. - ^- (map paths rock:lake) - %- ~(run by pub) - |= =tide - =< rock + ^- (map paths [allowed=(unit (set ship)) =rock:lake]) + %- malt %+ murn ~(tap by pub) + |= [path=paths =buoy] + ^- (unit [paths (unit (set ship)) rock:lake]) + ?@ tide=tid.buoy ~ + :^ ~ path alo.buoy =< rock =/ snap=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok) %+ roll (tap:wav (lot:wav wav.tide `aeon.snap ~)) |= [[=aeon =wave:lake] =_snap] @@ -192,39 +302,58 @@ :: ++ apply :: Handle request from subscriber. |= req=(request:poke paths) - ^- (quip card:agent:gall _pub) - =/ =tide (~(gut by pub) path.req *tide) + ^- (quip card:agent:gall pubs) + =/ =buoy (~(gut by pub) path.req *buoy) + ?< &(?=(^ alo.buoy) !(~(has in u.alo.buoy) src.bowl)) + ?@ tid.buoy + :_ 0/pub :_ ~ + (send tomb/~ src.bowl dude.req tid.buoy path.req) ?~ when.req - =/ last (fall (pry:rok rok.tide) *[=key =val]:rok) - :_ pub :_ ~ + =/ last (fall (pry:rok rok.tid.buoy) *[=key =val]:rok) + :_ 0/pub :_ ~ (send scry/rock/val.last src.bowl dude.req key.last path.req) - ?^ dat=(get:wav wav.tide u.when.req) - :_ pub :_ ~ + ?^ dat=(get:wav wav.tid.buoy u.when.req) + :_ 0/pub :_ ~ (send scry/wave/u.dat src.bowl [dude u.when path]:req) ?: %+ lte u.when.req - key::(fall (ram:wav wav.tide) (pry:rok rok.tide) [=key val]:wav) - :_ pub :_ ~ + key::(fall (ram:wav wav.tid.buoy) (pry:rok rok.tid.buoy) [=key val]:wav) + :_ 0/pub :_ ~ (send yore/~ src.bowl [dude u.when path]:req) + ?> =(u.when.req +((latest tid.buoy))) :- ~[(send nigh/~ src.bowl [dude u.when path]:req)] + :- %0 %+ ~(put by pub) path.req - %= tide mem - %^ ~(put bi mem.tide) u.when.req [src.bowl dude.req] - (add ~s25 now.bowl) + %= buoy + mem.tid (~(put bi mem.tid.buoy) src.bowl dude.req (add ~s25 now.bowl)) == :: :: Non-public facing arms below :: - +$ into (request:poke paths) - +$ result (response:poke lake paths) ++ send |= [payload=_|3:*(response:poke lake paths) =ship =dude =aeon path=paths] ^- card:agent:gall =* mark (cat 3 %sss- name:lake) - :* %pass (zoom response/scry/(scot %p ship)^dude^(scot %ud aeon)^path) + :* %pass (zoom scry-response/(scot %p ship)^dude^(scot %ud aeon)^path) %agent [ship dude] %poke mark result-type ^- (response:poke lake paths) [path dap.bowl aeon payload] == + ++ latest + |= =$@(aeon tide) + ^- aeon + ?@ tide tide + %+ max (fall (bind (pry:rok rok.tide) head) 0) + (fall (bind (ram:wav wav.tide) head) 0) + :: + ++ edit + |= [ps=(list paths) edit=$-(buoy buoy)] + ^- pubs + :- %0 + %- ~(rep in (sy ps)) + |= [path=paths =_pub] + %- fall :_ pub %- mole |. + (~(jab by pub) path edit) + :: ++ form |= =tide ^+ tide diff --git a/pkg/base-dev/sur/sss.hoon b/pkg/base-dev/sur/sss.hoon index 9533719d7..7f2ac2262 100644 --- a/pkg/base-dev/sur/sss.hoon +++ b/pkg/base-dev/sur/sss.hoon @@ -24,13 +24,20 @@ $: path=paths =dude =aeon - $% [type=?(%nigh %yore) ~] + $% [type=?(%nigh %yore %tomb) ~] $: type=%scry $% [what=%rock =rock:lake] [what=%wave =wave:lake] == == == == ++ on-rock |* [=(lake) paths=mold] - ,[path=paths src=ship from=dude =rock:lake wave=(unit wave:lake)] + $: path=paths + src=ship + from=dude + stale=? + fail=? + =rock:lake + wave=(unit wave:lake) + == -- -- From 4516ecfaa36710aa3f7bdce5fbd6404a3e8bf385 Mon Sep 17 00:00:00 2001 From: ~wicrum-wicrun <99811688+wicrum-wicrun@users.noreply.github.com> Date: Mon, 27 Mar 2023 22:03:24 +0200 Subject: [PATCH 06/20] sss: Simplify `+block:du` and `+allow:du` --- pkg/base-dev/lib/sss.hoon | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/pkg/base-dev/lib/sss.hoon b/pkg/base-dev/lib/sss.hoon index 896401085..3a6d9114c 100644 --- a/pkg/base-dev/lib/sss.hoon +++ b/pkg/base-dev/lib/sss.hoon @@ -260,23 +260,16 @@ ++ block :: No-ops on public paths. |= [who=(list ship) whence=(list paths)] ^- pubs - %+ edit whence - |= =buoy - ?@ tid.buoy buoy - ?~ alo.buoy buoy - %= buoy - alo `(~(dif in u.alo.buoy) (sy who)) - mem.tid (~(dif by mem.tid.buoy) (malt (turn who (late ~)))) - == + %+ perm whence + |= old=(unit (set ship)) + ?~ old ~ `(~(dif in u.old) (sy who)) :: :: Allow ships to paths. ++ allow :: Any public paths will no-op. |= [who=(list ship) where=(list paths)] ^- pubs - %+ edit where - |= =buoy - ?@ tid.buoy buoy - ?~ alo.buoy buoy - buoy(alo `(~(gas in u.alo.buoy) who)) + %+ perm where + |= old=(unit (set ship)) + ?~ old ~ `(~(gas in u.old) who) :: :: Kill a list of paths, i.e. tell ++ kill :: subs to not expect updates. (curr edit |=(=buoy buoy(tid (latest tid.buoy)))) From 00b7ace08d12d187d636f7f1795c2a65a0c90b97 Mon Sep 17 00:00:00 2001 From: Alessio Date: Mon, 27 Mar 2023 23:58:19 -0300 Subject: [PATCH 07/20] arvo: add more files to |new-desk generator --- pkg/arvo/gen/hood/new-desk.hoon | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon index 54995a597..f7d8dcd6c 100644 --- a/pkg/arvo/gen/hood/new-desk.hoon +++ b/pkg/arvo/gen/hood/new-desk.hoon @@ -5,7 +5,7 @@ :- %ask |= $: [now=@da eny=@uvJ bek=beak] [=desk ~] - [from=$~(%base desk) hard=_|] + [from=$~(%base desk) hard=_| minimal=_|] == :: =; make-new-desk @@ -27,12 +27,23 @@ %- ~(gas by *(map path page:clay)) |^ =- (turn - mage) ^- (list path) - :~ /mar/noun/hoon + =/ common-files=(list path) :~ + /mar/noun/hoon /mar/hoon/hoon /mar/txt/hoon /mar/kelvin/hoon /sys/kelvin - == + == + =/ extra-files=(list path) ?: minimal [~] + :~ + /mar/bill/hoon + /mar/mime/hoon + /mar/json/hoon + /lib/skeleton/hoon + /lib/default-agent/hoon + /lib/dbug/hoon + == + (weld common-files extra-files) :: ++ mage |= =path From 821f99a351e011a70d14ad87ce70273931237957 Mon Sep 17 00:00:00 2001 From: "James D. Amberger" Date: Mon, 20 Mar 2023 17:59:27 -0400 Subject: [PATCH 08/20] hood: options for +vats generator This commit refactors `sur/hood.hoon` and changes the signature of the `+vats` generator thus: ```hoon |= $: [now=@da eny=@uvJ bec=beak] $@(~ [?(%suspended %running %blocking %nonexistent) ~]) $: verb=? show-suspended=? show-running=? show-blocking=? show-nonexistent=? == == ``` Called with a single positional argument, `+vats` will show only those desks fitting the description given, while keyword parameters allow finer-grained control over which desks are described. The `verb` parameter determines whether the full load of desk information be shown, or a subset thereof. Resolves #6297. --- pkg/arvo/gen/vat.hoon | 9 +- pkg/arvo/gen/vats.hoon | 18 ++- pkg/base-dev/sur/hood.hoon | 236 +++++++++++++++++++++---------------- 3 files changed, 158 insertions(+), 105 deletions(-) diff --git a/pkg/arvo/gen/vat.hoon b/pkg/arvo/gen/vat.hoon index 6534d5e24..0a154b7fa 100644 --- a/pkg/arvo/gen/vat.hoon +++ b/pkg/arvo/gen/vat.hoon @@ -1,6 +1,11 @@ /- *hood :- %say |= $: [now=@da eny=@uvJ bec=beak] - [[=desk ~] ~] + [syd=desk ~] + verb=? == -[%tang ~[(report-vat (report-prep p.bec now) p.bec now desk)]] +=+ ~(abed report-vats p.bec now) +=+ %+ report-vat + verb + %- vat-info syd +[%tang -] diff --git a/pkg/arvo/gen/vats.hoon b/pkg/arvo/gen/vats.hoon index 67046c460..ebc152e1f 100644 --- a/pkg/arvo/gen/vats.hoon +++ b/pkg/arvo/gen/vats.hoon @@ -1,6 +1,20 @@ /- *hood :- %say |= $: [now=@da eny=@uvJ bec=beak] - [arg=~ ~] + $@(~ [?(%suspended %running %blocking %nonexistent) ~]) + $: verb=? + show-suspended=? + show-running=? + show-blocking=? + show-nonexistent=? + == == -[%tang (report-vats p.bec now)] +=+ :- verb + ?~ +<+< +<+>+ + ?- -.+<+< + %suspended [& | | |] + %running [| & | |] + %blocking [| | & |] + %nonexistent [| | | &] + == +tang+((report-vats p.bec now) -) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index 06ce86e5f..ece12a30e 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -16,110 +16,144 @@ :: +$ sync-state [nun=@ta kid=(unit desk) let=@ud] +$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud]) -:: +report-prep: get data required for reports -:: -++ report-prep - |= [our=@p now=@da] - =/ ego (scot %p our) - =/ wen (scot %da now) - :* .^(rock:tire %cx /(scot %p our)//(scot %da now)/tire) - .^(=cone %cx /(scot %p our)//(scot %da now)/domes) - .^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun) - .^ (map [desk ship desk] sync-state) %gx - /[ego]/hood/[wen]/kiln/syncs/noun - == - == -:: +report-vats: report on all desk installations -:: ++ report-vats - |= [our=@p now=@da] - ^- tang - =/ desks .^((set desk) %cd /(scot %p our)/base/(scot %da now)) - =/ prep (report-prep our now) - %+ turn ~(tap in desks) - |=(syd=desk (report-vat prep our now syd)) -:: +report-vat: report on a single desk installation -:: -++ report-vat - |= $: $: tyr=rock:tire =cone sor=(map desk [ship desk]) - zyn=(map [desk ship desk] sync-state) - == - our=ship now=@da syd=desk + =| $: =cone + sor=(map desk [ship desk]) + zyn=(map [desk ship desk] sync-state) + desks=(set desk) + =pikes + =rock:tire:clay + kel=weft == - ^- tank - =/ ego (scot %p our) - =/ wen (scot %da now) - =+ .^(=cass %cw /[ego]/[syd]/[wen]) - ?: =(ud.cass 0) - leaf+"desk does not yet exist: {}" - ?: =(%kids syd) - =+ .^(hash=@uv %cz /[ego]/[syd]/[wen]) - leaf+"%kids %cz hash: {}" - =/ kel-path - /[ego]/[syd]/[wen]/sys/kelvin - ?. .^(? %cu kel-path) - leaf+"bad desk: {}" - =+ .^(=waft %cx kel-path) - :+ %rose ["" "{}" "::"] - ^- tang - =/ hash .^(@uv %cz /[ego]/[syd]/[wen]) - =/ =sink - ?~ s=(~(get by sor) syd) - ~ - ?~ z=(~(get by zyn) syd u.s) - ~ - `[-.u.s +.u.s +.u.z] - =/ meb=(list @uv) - ?~ sink [hash]~ - (mergebase-hashes our syd now her.u.sink sud.u.sink) - =/ dek (~(got by tyr) syd) - =/ =dome (~(got by cone) our syd) - =/ [on=(list [@tas ?]) of=(list [@tas ?])] - (skid ~(tap by ren.dome) |=([* ?] +<+)) - =/ sat - ?- zest.dek - %live "running" - %dead "suspended" - %held "suspended until next update" + |_ [our=@p now=@da] + +* ego (scot %p our) + wen (scot %da now) + ++ $ + |= [? ? ? ? ?] + (report-vats:abed +<) + ++ abed + %= ..abed + cone .^(^cone %cx /[ego]//[wen]/domes) + sor .^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun) + zyn .^ (map [desk ship desk] sync-state) %gx + /[ego]/hood/[wen]/kiln/syncs/noun + == + desks .^((set desk) %cd /[ego]/base/[wen]) + pikes .^(^pikes %gx /[ego]/hood/[wen]/kiln/pikes/kiln-pikes) + rock .^(rock:tire:clay %cx /[ego]//[wen]/tire) + kel (weft .^(* cx/(en-beam [our %base da+now] /sys/kelvin))) == - =/ kul=tape - %+ roll - %+ sort - ~(tap in (waft-to-wefts:clay waft)) - |= [a=weft b=weft] - ?: =(lal.a lal.b) - (lte num.a num.b) - (lte lal.a lal.b) - |= [=weft =tape] - (welp " {<[lal num]:weft>}" tape) - :~ leaf/"/sys/kelvin: {kul}" - leaf/"base hash: {?.(=(1 (lent meb)) <(head meb)>)}" - leaf/"%cz hash: {}" - :: - leaf/"app status: {sat}" - leaf/"force on: {?:(=(~ on) "~" )}" - leaf/"force off: {?:(=(~ of) "~" )}" - :: - leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}" - leaf/"updates: {?~(sink "local" "remote")}" - leaf/"source ship: {?~(sink <~> )}" - leaf/"source desk: {?~(sink <~> )}" - leaf/"source aeon: {?~(sink <~> )}" - leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> ))}" - leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" - == -:: +report-kids: non-vat cz hash report for kids desk -:: -++ report-kids - |= [our=ship now=@da] - ^- tank - =/ syd %kids - =/ ego (scot %p our) - =/ wen (scot %da now) - ?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd) - leaf/"no %kids desk" - =+ .^(hash=@uv %cz /[ego]/[syd]/[wen]) - leaf/"%kids %cz hash: {}" + ++ vat-info + |= desk=_`desk`%base + =/ pike (~(got by pikes) desk) + =/ zest -:(~(got by rock) desk) + =/ kel-path /[ego]/[desk]/[wen]/sys/kelvin + =/ sink=sink + ?~ s=(~(get by sor) desk) + ~ + ?~ z=(~(get by zyn) desk u.s) + ~ + `[-.u.s +.u.s +.u.z] + =/ hash .^(@uv %cz /[ego]/[desk]/[wen]) + =/ dek (~(got by rock) desk) + =/ =dome (~(got by cone) our desk) + =+ .^(=waft %cx kel-path) + :* &1 &2 &3 &4 &5 &6 &7 &8 + desk=desk + ^= running =(%live zest) + ^= suspended =(%dead zest) + ^= exists !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen]) + ^= bad-desk ?!(.^(? %cu kel-path)) + ^= meb :: =(list @uv) + ?~ sink [hash]~ + (mergebase-hashes our desk now her.u.sink sud.u.sink) + ^- [on=(list [@tas ?]) of=(list [@tas ?])] + (skid ~(tap by ren.dome) |=([* ?] +<+)) + ^= sat + ?- zest.dek + %live "running" + %dead "suspended" + %held "suspended until next update" + == + ^- kul=tape + %+ roll + %+ sort + ~(tap in (waft-to-wefts:clay waft)) + |= [a=weft b=weft] + ?: =(lal.a lal.b) + (lte num.a num.b) + (lte lal.a lal.b) + |= [=weft =tape] + (welp " {<[lal num]:weft>}" tape) + ^= blocking + ?& !=(%base desk) + !=(%live zest.pike) + !(~(has in wic.pike) kel) + == == + ++ report-vats + |= $: verb=? + show-suspended=? + show-running=? + show-blocking=? + show-nonexistent=? + == + %+ turn + %+ skim + %+ turn ~(tap in desks) + |= =desk (vat-info desk) + |= vat-info + :: just unconditionally show "bad" desks, whatever that means + ?| bad-desk + &(suspended show-suspended) + &(running show-running) + &(blocking show-blocking) + &(!exists show-nonexistent) + == + |= =vat-info + :+ %rose [" " " " "::"] + :- leaf+"{}" + %- flop + %- report-vat + [verb vat-info] + ++ report-vat + |= [verb=? vat-info] + ^- tang + ?: !exists + ~[leaf+"desk does not yet exist: {}"] + ?: =(%kids desk) + ~[leaf+"%kids %cz hash: {}"] + ?: bad-desk + ~[leaf+"bad desk: {}"] + %- flop + ?. verb + :~ leaf/"/sys/kelvin: {kul}" + leaf/"app status: {sat}" + leaf/"publishing ship: {?~(sink <~> <(get-publisher our desk now)>)}" + leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" + == + :~ leaf/"/sys/kelvin: {kul}" + leaf/"base hash: {?.(=(1 (lent meb)) <(head meb)>)}" + leaf/"%cz hash: {}" + :: + leaf/"app status: {sat}" + leaf/"force on: {?:(=(~ on) "~" )}" + leaf/"force off: {?:(=(~ of) "~" )}" + :: + leaf/"publishing ship: {?~(sink <~> <(get-publisher our desk now)>)}" + leaf/"updates: {?~(sink "local" "remote")}" + leaf/"source ship: {?~(sink <~> )}" + leaf/"source desk: {?~(sink <~> )}" + leaf/"source aeon: {?~(sink <~> )}" + leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> ))}" + leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}" + == + ++ report-kids + ^- tank + ?. (~(has in .^((set desk) %cd /[ego]//[wen])) %kids) + leaf/"no %kids desk" + =+ .^(hash=@uv %cz /[ego]/kids/[wen]) + leaf/"%kids %cz hash: {}" + -- :: +read-bill-foreign: read /desk/bill from a foreign desk :: ++ read-bill-foreign From 2c262e1fd0bd9c0597990b370e2fad0ca32667f2 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 23 Mar 2023 15:46:33 -0700 Subject: [PATCH 09/20] clay: stop failed kelvin upgrades from retrying immediately We were retrying failed kelvin upgrades as many times as we had apps that needed to be suspended, because suspending an app triggers an attempt to run the next kelvin upgrade. This suspends all those apps in one batch move, and then tries the next kelvin upgrade only once at the end. Fixes #6407 Partially addresses #6285 --- pkg/arvo/lib/hood/kiln.hoon | 8 +++----- pkg/arvo/sys/lull.hoon | 1 + pkg/arvo/sys/vane/clay.hoon | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pkg/arvo/lib/hood/kiln.hoon b/pkg/arvo/lib/hood/kiln.hoon index b1be5cf62..8c76cea0c 100644 --- a/pkg/arvo/lib/hood/kiln.hoon +++ b/pkg/arvo/lib/hood/kiln.hoon @@ -583,15 +583,13 @@ ..abet =/ kel i.wic %- emil - =/ cards + =/ desks=(list [=desk =zest]) %+ murn ~(tap by rock) |= [=desk =zest wic=(set weft)] ?: |(=(%base desk) !?=(%live zest) (~(has in wic) kel)) ~ - `u=[%pass /kiln/bump/[desk] %arvo %c %zest desk %held] - ?~ cards - [%pass /kiln/bump/wick %arvo %c %wick ~]~ - cards + `u=[desk %held] + [%pass /kiln/bump/zeal %arvo %c %zeal desks]~ :: ++ poke-cancel |= a=@tas diff --git a/pkg/arvo/sys/lull.hoon b/pkg/arvo/sys/lull.hoon index 9856f9311..a82a5fdea 100644 --- a/pkg/arvo/sys/lull.hoon +++ b/pkg/arvo/sys/lull.hoon @@ -801,6 +801,7 @@ [%warp wer=ship rif=riff] :: internal file req [%werp who=ship wer=ship rif=riff-any] :: external file req [%wick ~] :: try upgrade + [%zeal lit=(list [=desk =zest])] :: batch zest [%zest des=desk liv=zest] :: live $>(%plea vane-task) :: ames request == :: diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index bb2c2bd57..32f9b96d8 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -5018,9 +5018,22 @@ :: %wick =^ mos ruf - =/ den ((de now rof hen ruf) our %base) - abet:wick:den :: [wick] + abet:wick:((de now rof hen ruf) our %base) :: [wick] [mos ..^$] + :: + %zeal + =^ m1 ruf + =| mos=(list move) + |- ^+ [mos ruf] + ?~ lit.req + [mos ruf] + =/ den ((de now rof hen ruf) our desk.i.lit.req) + =^ mos-new ruf abet:(set-zest:den zest.i.lit.req) + $(mos (weld mos mos-new), lit.req t.lit.req) + =^ m2 ruf + abet:wick:((de now rof hen ruf) our %base) + =^ m3 ruf abet:goad:(lu now rof hen ruf) + [:(weld m1 m2 m3) ..^$] :: %zest =^ m1 ruf From 38ace43ca00fafbf2f3101c42c58afe8ffa9849f Mon Sep 17 00:00:00 2001 From: Alessio Date: Wed, 29 Mar 2023 14:20:23 -0300 Subject: [PATCH 10/20] arvo: change |new-desk to be minimal by default --- pkg/arvo/gen/hood/new-desk.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/gen/hood/new-desk.hoon b/pkg/arvo/gen/hood/new-desk.hoon index f7d8dcd6c..1078db17d 100644 --- a/pkg/arvo/gen/hood/new-desk.hoon +++ b/pkg/arvo/gen/hood/new-desk.hoon @@ -5,7 +5,7 @@ :- %ask |= $: [now=@da eny=@uvJ bek=beak] [=desk ~] - [from=$~(%base desk) hard=_| minimal=_|] + [from=$~(%base desk) hard=_| gall=_|] == :: =; make-new-desk @@ -34,7 +34,7 @@ /mar/kelvin/hoon /sys/kelvin == - =/ extra-files=(list path) ?: minimal [~] + =/ extra-files=(list path) ?. gall [~] :~ /mar/bill/hoon /mar/mime/hoon From bacbfd71ac0a1b277c250d620c68cb408d2d0cf8 Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Tue, 4 Apr 2023 02:50:09 -0400 Subject: [PATCH 11/20] add last-contact scry endpoint --- 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 5f09500fd..b00d2e845 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3987,6 +3987,13 @@ ?~ peer [~ ~] ``noun+!>(u.peer) + :: + [%last-contact ~] + :^ ~ ~ %noun + !> ^- (unit @da) + ?. ?=([~ %known *] peer) + ~ + `last-contact.qos.u.peer :: [%forward-lane ~] :: From d8ad34f0fc0a1d33494f201f66aee9f822ecb511 Mon Sep 17 00:00:00 2001 From: midden-fabler Date: Tue, 4 Apr 2023 03:06:22 -0400 Subject: [PATCH 12/20] update scry path listing --- pkg/arvo/sys/vane/ames.hoon | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index b00d2e845..e6b1c7e08 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3963,6 +3963,7 @@ :: /ax/protocol/version @ :: /ax/peers (map ship ?(%alien %known)) :: /ax/peers/[ship] ship-state + :: /ax/peers/[ship]/last-contact (unit @da) :: /ax/peers/[ship]/forward-lane (list lane) :: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)] :: /ax/snd-bones/[ship]/[bone] vase From 9ae28a985cbcafc4c9c9aec44f0e1eb41cde6856 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 4 Apr 2023 15:06:51 -0400 Subject: [PATCH 13/20] clay: %pass %drip with context, expect and handle errors in +take --- pkg/arvo/sys/vane/clay.hoon | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 27491080c..b443b5903 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -1384,7 +1384,7 @@ `[[care.mood case.mood syd] path.mood cage]:[u.res syd=syd] ?~ ref [%give %writ riot] - [%slip %b %drip !>([%writ riot])] + [%pass /drip %b %drip !>([%writ riot])] :: ++ case-to-date |= =case @@ -3781,7 +3781,7 @@ (~(run in moods) |=(m=mood [care.m path.m])) =/ gift [%wris cas res] ?: ?=(^ ref) - [%slip %b %drip !>(gift)] + [%pass /drip %b %drip !>(gift)] :: XX s/b [%behn %wris ...] in $sign? [%give gift] ?> ?=([* ~ ~] res) :_ ~ @@ -5753,7 +5753,25 @@ |= [tea=wire hen=duct dud=(unit goof) hin=sign] ^+ [*(list move) ..^$] ?^ dud - ~|(%clay-take-dud (mean tang.u.dud)) + ?+ tea + ~|(%clay-take-dud (mean tang.u.dud)) + :: + [%drip ~] + %. [~ ..^$] + %- slog + ^- tang + :* 'clay: drip fail' + [%rose [": " "" ""] 'bail' mote.u.dud ~] + tang.u.dud + == + == + :: + :: pseudo %slip on %drip + :: + ?: ?=([%drip ~] tea) + ?> ?=([?(%behn %clay) ?(%writ %wris) *] hin) + [[`move`[hen %give +.hin] ~] ..^$] + :: ?: ?=([%lu %load *] tea) ?> ?=(%unto +<.hin) ?> ?=(%poke-ack -.p.hin) @@ -5909,7 +5927,7 @@ ~(tap in ducts) =/ cancel-moves=(list move) %+ turn cancel-ducts - |=(=duct [duct %slip %b %drip !>([%writ ~])]) + |=(=duct [duct %pass /drip %b %drip !>([%writ ~])]) :: delete local state of foreign desk :: =. hoy.ruf (~(del by hoy.ruf) who) From b6194711c34af41977771d1b49fb3389a110c6eb Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Tue, 4 Apr 2023 15:07:27 -0400 Subject: [PATCH 14/20] behn: hurl errors on %drip %crud --- pkg/arvo/sys/vane/behn.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/sys/vane/behn.hoon b/pkg/arvo/sys/vane/behn.hoon index 78f13c81a..d5eb8f5df 100644 --- a/pkg/arvo/sys/vane/behn.hoon +++ b/pkg/arvo/sys/vane/behn.hoon @@ -108,10 +108,9 @@ [duct card] =/ =tang (weld u.error `tang`[leaf/"drip failed" ~]) - :: XX should be - :: [duct %hurl fail/tang card] + :: XX we don't know the mote due to the %wake pattern :: - [duct %pass /drip-slog %d %flog %crud %drip-fail tang] + [duct %hurl fail/tang card] :: +| %tasks :: From 66678acd3e241d890661f51dfdd364bfc4eb5582 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 5 Apr 2023 11:59:06 -0400 Subject: [PATCH 15/20] ames: ping faster to sponsors --- pkg/arvo/sys/vane/ames.hoon | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index e6b1c7e08..5fc7e0e56 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3310,13 +3310,19 @@ ++ num-slots ^- @ud (sub-safe cwnd live-packets) - :: :: +clamp-rto: apply min and max to an .rto value :: ++ clamp-rto |= rto=@dr ^+ rto - (min ~m2 (max ^~((div ~s1 5)) rto)) + (min max-backoff (max ^~((div ~s1 5) rto))) + :: +max-backoff: calculate highest re-send interval + :: + :: Keeps pinhole to sponsors open by inspecting the duct (hack). + :: + ++ max-backoff + ^- @dr + ?:(?=([[%gall %use %ping *] *] duct) ~s25 ~m2) :: +in-slow-start: %.y iff we're in "slow-start" mode :: ++ in-slow-start From 056ff35b89aed0899f06fac69088947bc4b64246 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Wed, 5 Apr 2023 12:04:14 -0400 Subject: [PATCH 16/20] app/ping: lower timeout to ~s25 --- pkg/arvo/app/ping.hoon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index 9b1400a54..304e9c003 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -42,10 +42,9 @@ %- (slog leaf+"ping: strange state {}" ~) `state :: NAT timeouts are often pretty short for UDP entries. 5 - :: minutes is a common value. We use 30 seconds, which is fairly - :: aggressive, but should be safe. + :: minutes is a common value. We use 25 seconds, same as Wireguard. :: - =/ until (add ~s30 now) + =/ until (add ~s25 now) =. ships.state (~(put by ships.state) ship u.s(ship-state [%waiting until])) :_ state From e300fa2d6b4e8ecb630b70b2a30717061b97ef40 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 6 Apr 2023 15:58:12 +0200 Subject: [PATCH 17/20] dill: exclude wrapped-task from most +call traces Instead of including wrapped-task as-is in most call traces, we now only include it in traces for crashing (harden task) calls. For everything else, we include only the tag of the resulting $task. Closes #6444. --- pkg/arvo/sys/vane/dill.hoon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/sys/vane/dill.hoon b/pkg/arvo/sys/vane/dill.hoon index 8973a4ac6..20673cb53 100644 --- a/pkg/arvo/sys/vane/dill.hoon +++ b/pkg/arvo/sys/vane/dill.hoon @@ -250,8 +250,10 @@ wrapped-task=(hobo task) == ^+ [*(list move) ..^$] - ~| wrapped-task - =/ task=task ((harden task) wrapped-task) + =/ task=task + ~| wrapped-task + ((harden task) wrapped-task) + ~| -.task :: unwrap session tasks, default to session %$ :: =^ ses=@tas task From eddbe86d69fc94b53f42663dfcc63ac98b47cd17 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 6 Apr 2023 11:58:34 -0400 Subject: [PATCH 18/20] ames: fix syntax error --- 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 5fc7e0e56..4f989eb20 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -3315,7 +3315,7 @@ ++ clamp-rto |= rto=@dr ^+ rto - (min max-backoff (max ^~((div ~s1 5) rto))) + (min max-backoff (max ^~((div ~s1 5)) rto)) :: +max-backoff: calculate highest re-send interval :: :: Keeps pinhole to sponsors open by inspecting the duct (hack). From b273f3091bee18a36a300646e141f7bc17b5c95f Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Thu, 6 Apr 2023 23:52:53 -0400 Subject: [PATCH 19/20] arvo: print module compilation times --- pkg/arvo/sys/arvo.hoon | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/arvo.hoon b/pkg/arvo/sys/arvo.hoon index 9d97a1d9c..bce8520ba 100644 --- a/pkg/arvo/sys/arvo.hoon +++ b/pkg/arvo/sys/arvo.hoon @@ -773,6 +773,7 @@ :: ~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"] =/ compiler-tool + ~> %bout .*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2]) :: :: switch to the second-generation compiler. we want to be @@ -781,7 +782,7 @@ :: generate last-generation spans for `!>`, etc. :: ~> %slog.[0 leaf+"1-d"] - =. compiler-gate .*(0 +.compiler-tool) + =. compiler-gate ~>(%bout .*(0 +.compiler-tool)) :: :: get the span (type) of the kernel core, which is the context :: of the compiler gate. we just compiled the compiler, @@ -791,17 +792,20 @@ :: ~> %slog.[0 leaf+"1-e"] =/ kernel-span + ~> %bout -:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2]) :: :: compile the arvo source against the kernel core. :: ~> %slog.[0 leaf+"1-f"] =/ kernel-tool + ~> %bout .*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2]) :: :: create the arvo kernel, whose subject is the kernel core. :: ~> %slog.[0 leaf+"1-g"] + ~> %bout [.*(+>.compiler-gate +.kernel-tool) epic.log] -- :: @@ -1046,6 +1050,7 @@ |= [cap=tape sub=vase pax=path txt=@t] ^- vase ~> %slog.[0 leaf/"{cap}: {(scow p+(mug txt))}"] + ~> %bout %- road |. ~_ leaf/"{cap}: build failed" (slap sub (rain pax txt)) @@ -1623,6 +1628,7 @@ ?~ hun =/ gat ~> %slog.[0 'arvo: compiling next arvo'] + ~> %bout %- road |. (slap !>(..ride) (rain /sys/arvo/hoon van)) =/ lod @@ -1640,6 +1646,7 @@ :: =/ raw ~> %slog.[0 'arvo: compiling hoon'] + ~> %bout (road |.((ride %noun u.hun))) :: activate the new compiler gate, producing +ride :: @@ -1665,6 +1672,7 @@ [raw cop] =/ hot ~> %slog.[0 leaf/"arvo: recompiling hoon %{(scow %ud nex)}"] + ~> %bout (road |.((slum cop [%noun u.hun]))) [hot .*(0 +.hot)] :: extract the hoon core from the outer gate (+ride) @@ -1680,6 +1688,7 @@ :: =/ rav ~> %slog.[0 'arvo: compiling next arvo'] + ~> %bout (road |.((slum cop [hyp van]))) :: activate arvo and extract the arvo core from the outer gate :: From cd161a54929516ecc286767148fb81ef5d59a3b0 Mon Sep 17 00:00:00 2001 From: Ted Blackman Date: Fri, 7 Apr 2023 15:19:24 -0400 Subject: [PATCH 20/20] +vats: fix crash on nonexistent desks --- pkg/base-dev/sur/hood.hoon | 39 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/pkg/base-dev/sur/hood.hoon b/pkg/base-dev/sur/hood.hoon index ece12a30e..f0ec60624 100644 --- a/pkg/base-dev/sur/hood.hoon +++ b/pkg/base-dev/sur/hood.hoon @@ -31,6 +31,18 @@ ++ $ |= [? ? ? ? ?] (report-vats:abed +<) + :: + ++ kel-path + |= =desk + ^- path + /[ego]/[desk]/[wen]/sys/kelvin + :: + ++ desk-exists + |= =desk + ?& !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen]) + .^(? %cu (kel-path desk)) + == + :: ++ abed %= ..abed cone .^(^cone %cx /[ego]//[wen]/domes) @@ -47,7 +59,7 @@ |= desk=_`desk`%base =/ pike (~(got by pikes) desk) =/ zest -:(~(got by rock) desk) - =/ kel-path /[ego]/[desk]/[wen]/sys/kelvin + =/ kel-path (kel-path desk) =/ sink=sink ?~ s=(~(get by sor) desk) ~ @@ -62,8 +74,6 @@ desk=desk ^= running =(%live zest) ^= suspended =(%dead zest) - ^= exists !=(ud.cass 0):.^(=cass %cw /[ego]/[desk]/[wen]) - ^= bad-desk ?!(.^(? %cu kel-path)) ^= meb :: =(list @uv) ?~ sink [hash]~ (mergebase-hashes our desk now her.u.sink sud.u.sink) @@ -90,6 +100,7 @@ !=(%live zest.pike) !(~(has in wic.pike) kel) == == + :: ++ report-vats |= $: verb=? show-suspended=? @@ -97,33 +108,33 @@ show-blocking=? show-nonexistent=? == + =/ [real=(list desk) fake=(list desk)] + (skid ~(tap in desks) desk-exists) + =; reals=tang + ?. show-nonexistent + reals + %+ weld reals + `tang`(turn fake |=(=desk leaf+"nonexistent desk: {}")) %+ turn - %+ skim - %+ turn ~(tap in desks) - |= =desk (vat-info desk) + %+ skim (turn real vat-info) |= vat-info - :: just unconditionally show "bad" desks, whatever that means - ?| bad-desk - &(suspended show-suspended) + ?| &(suspended show-suspended) &(running show-running) &(blocking show-blocking) - &(!exists show-nonexistent) == |= =vat-info + ^- tank :+ %rose [" " " " "::"] :- leaf+"{}" %- flop %- report-vat [verb vat-info] + :: ++ report-vat |= [verb=? vat-info] ^- tang - ?: !exists - ~[leaf+"desk does not yet exist: {}"] ?: =(%kids desk) ~[leaf+"%kids %cz hash: {}"] - ?: bad-desk - ~[leaf+"bad desk: {}"] %- flop ?. verb :~ leaf/"/sys/kelvin: {kul}"