naive: allow l2 spawn proxy to reset itself

This commit is contained in:
Philip Monk 2021-07-15 21:11:40 -04:00
parent 24e16ed457
commit ede732a58f
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
2 changed files with 21 additions and 10 deletions

View File

@ -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

View File

@ -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