From dd57a72a4d8d189b163b020b0206e0c469b9cc03 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 15 Jul 2021 20:02:05 -0400 Subject: [PATCH 1/2] naive: sponsorship fixes --- pkg/arvo/lib/naive.hoon | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/arvo/lib/naive.hoon b/pkg/arvo/lib/naive.hoon index cbdef687e..e991ee585 100644 --- a/pkg/arvo/lib/naive.hoon +++ b/pkg/arvo/lib/naive.hoon @@ -572,7 +572,7 @@ =* parent=@ i.t.t.topics.log =/ parent-point (get-point state parent) ?> ?=(^ parent-point) - ?: |(?=(%l2 -.point) ?=(%l2 -.u.parent-point)) `point + ?: ?=(%l2 -.u.parent-point) `point :- [%point ship %sponsor `parent]~ point(escape.net ~, sponsor.net [%& parent]) :: @@ -594,12 +594,16 @@ :- [%point ship %sponsor ~]~ point(has.sponsor.net %|) :: + :: The rest can be done by any ship on L1, even if their spawn proxy + :: is set to L2 + :: + ?: ?=(%l2 -.point) `point + :: ?: =(log-name escape-requested:log-names) ?> ?=([@ ~] t.t.topics.log) =* parent=@ i.t.t.topics.log =/ parent-point (get-point state parent) ?> ?=(^ parent-point) - ?: |(?=(%l2 -.point) ?=(%l2 -.u.parent-point)) `point :- [%point ship %escape `parent]~ point(escape.net `parent) :: @@ -608,15 +612,9 @@ =* parent=@ i.t.t.topics.log =/ parent-point (get-point state parent) ?> ?=(^ parent-point) - ?: |(?=(%l2 -.point) ?=(%l2 -.u.parent-point)) `point :- [%point ship %escape ~]~ point(escape.net ~) :: - :: The rest can be done by any ship on L1, even if their spawn proxy - :: is set to L2 - :: - ?: ?=(%l2 -.point) `point - :: ?: =(log-name broke-continuity:log-names) ?> ?=(~ t.t.topics.log) =* rift=@ data.log @@ -756,6 +754,7 @@ ^- (unit [effects ^state]) =/ point (get-point state ship) ?~ point (debug %strange-ship ~) + ?. ?=(%l2 -.u.point) (debug %ship-not-on-l2 ~) =/ res=(unit [=effects new-point=^point]) (fun u.point rest) ?~ res ~ From ede732a58f6fc1a482f6b56e1825f7e73a6c25fe Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Thu, 15 Jul 2021 21:11:40 -0400 Subject: [PATCH 2/2] naive: allow l2 spawn proxy to reset itself --- pkg/arvo/lib/naive.hoon | 17 ++++++++++++++--- pkg/arvo/tests/lib/naive.hoon | 14 +++++++------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/lib/naive.hoon b/pkg/arvo/lib/naive.hoon index e991ee585..b34f6a88e 100644 --- a/pkg/arvo/lib/naive.hoon +++ b/pkg/arvo/lib/naive.hoon @@ -59,8 +59,6 @@ :: TODO: make sure you can spawn with the spawn proxy after on domain :: %spawn :: -:: TODO: planet shouldn't be able to set spawn proxy -:: :: TODO: make sure that if we've already been deposited to L2, no :: further L1 logs count except detach. :: @@ -741,7 +739,9 @@ %adopt (w-point-esc process-adopt ship.tx +>.tx) %reject (w-point-esc process-reject ship.tx +>.tx) %detach (w-point-esc process-detach ship.tx +>.tx) - %set-spawn-proxy (w-point process-set-spawn-proxy ship.from.tx +>.tx) + %set-spawn-proxy + (w-point-spawn process-set-spawn-proxy ship.from.tx +>.tx) + :: %set-transfer-proxy (w-point process-set-transfer-proxy ship.from.tx +>.tx) :: @@ -770,6 +770,17 @@ ~ `[effects.u.res state(points (~(put by points.state) ship new-point.u.res))] :: + ++ w-point-spawn + |* [fun=$-([ship point *] (unit [effects point])) =ship rest=*] + ^- (unit [effects ^state]) + =/ point (get-point state ship) + ?~ point (debug %strange-ship ~) + ?: ?=(%l1 -.u.point) (debug %ship-on-l2 ~) + =/ res=(unit [=effects new-point=^point]) (fun u.point rest) + ?~ res + ~ + `[effects.u.res state(points (~(put by points.state) ship new-point.u.res))] + :: ++ process-transfer-point |= [=point to=address reset=?] =* ship ship.from.tx diff --git a/pkg/arvo/tests/lib/naive.hoon b/pkg/arvo/tests/lib/naive.hoon index df3bde048..6309eff20 100644 --- a/pkg/arvo/tests/lib/naive.hoon +++ b/pkg/arvo/tests/lib/naive.hoon @@ -618,12 +618,12 @@ ::(cury filter-dominion %l1) %- cury :- filter-tx-type - :* ::%spawn - ::%transfer-point - ::%configure-keys - ::%set-management-proxy - ::%set-spawn-proxy :: planets can set spawn proxy atm - ::%set-transfer-proxy + :* %spawn + %transfer-point + %configure-keys + %set-management-proxy + %set-spawn-proxy :: planets can set spawn proxy atm + %set-transfer-proxy %escape ~ == @@ -1712,7 +1712,7 @@ ++ test-l2-sambud-spawn-spawn-proxy-postdeposit ^- tang =/ sambud-sproxy [[~sambud %spawn] %set-spawn-proxy (addr %sambud-skey-1)] %+ expect-eq - !> [(addr %sambud-skey-1) 0] + !> [(addr %sambud-skey-1) 1] :: !> =| =^state:naive