mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-20 05:11:46 +03:00
naive: spawn and xfer proxy tests
This commit is contained in:
parent
3bba3e5ac0
commit
4c7cdc253a
@ -242,8 +242,9 @@
|
|||||||
%manage %.n
|
%manage %.n
|
||||||
%transfer %.y
|
%transfer %.y
|
||||||
==
|
==
|
||||||
:: TODO: how do i make the following two lines?
|
$? %configure-keys %escape %cancel-escape %adopt
|
||||||
?(%configure-keys %escape %cancel-escape %adopt %reject %detach %set-management-proxy)
|
%reject %detach %set-management-proxy
|
||||||
|
==
|
||||||
?. =(dominion %l2)
|
?. =(dominion %l2)
|
||||||
%.n
|
%.n
|
||||||
?+ proxy %.n
|
?+ proxy %.n
|
||||||
@ -256,14 +257,20 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-tx-type
|
++ filter-tx-type
|
||||||
|= [=tx-type =event-list]
|
|= [typs=(list =tx-type) =event-list]
|
||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|
:: I think I can shorten this a bit with a fold or something
|
||||||
|= =event ^- ?
|
|= =event ^- ?
|
||||||
?: =(tx-type.event tx-type)
|
=/ match=? %.n
|
||||||
%.y
|
|-
|
||||||
%.n
|
?~ typs match
|
||||||
|
=/ cur-typ i.typs
|
||||||
|
%= $
|
||||||
|
match |(match =(cur-typ tx-type.event))
|
||||||
|
typs t.typs
|
||||||
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-proxy
|
++ filter-proxy
|
||||||
@ -271,10 +278,8 @@
|
|||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|= =event ^- ?
|
|= =event
|
||||||
?: =(proxy.event proxy)
|
=(proxy.event proxy)
|
||||||
%.y
|
|
||||||
%.n
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-rank
|
++ filter-rank
|
||||||
@ -282,10 +287,8 @@
|
|||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|= =event ^- ?
|
|= =event
|
||||||
?: =(rank.event rank)
|
=(rank.event rank)
|
||||||
%.y
|
|
||||||
%.n
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-owner
|
++ filter-owner
|
||||||
@ -293,10 +296,8 @@
|
|||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|= =event ^- ?
|
|= =event
|
||||||
?: =(owner.event owner)
|
=(owner.event owner)
|
||||||
%.y
|
|
||||||
%.n
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-nonce
|
++ filter-nonce
|
||||||
@ -304,10 +305,8 @@
|
|||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|= =event ^- ?
|
|= =event
|
||||||
?: =(nonce.event nonce)
|
=(nonce.event nonce)
|
||||||
%.y
|
|
||||||
%.n
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ filter-dominion
|
++ filter-dominion
|
||||||
@ -315,10 +314,8 @@
|
|||||||
|^
|
|^
|
||||||
(skim event-list filter)
|
(skim event-list filter)
|
||||||
++ filter
|
++ filter
|
||||||
|= =event ^- ?
|
|= =event
|
||||||
?: =(dominion.event dominion)
|
=(dominion.event dominion)
|
||||||
%.y
|
|
||||||
%.n
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ make-event-list ^- event-list
|
++ make-event-list ^- event-list
|
||||||
@ -431,13 +428,19 @@
|
|||||||
:: it ought to test, and +success-map says whether or not that
|
:: it ought to test, and +success-map says whether or not that
|
||||||
:: event should succed or fail
|
:: event should succed or fail
|
||||||
::
|
::
|
||||||
++ gen-rut-mgmt-jar
|
++ gen-rut-proxy-jar
|
||||||
^- (jar @p event)
|
^- (jar @p event)
|
||||||
=/ filter ;: cork
|
=/ filter ;: cork
|
||||||
(cury filter-owner %.y)
|
(cury filter-owner %.y)
|
||||||
(cury filter-tx-type %set-management-proxy)
|
|
||||||
(cury filter-proxy %own)
|
(cury filter-proxy %own)
|
||||||
(cury filter-nonce %.y)
|
(cury filter-nonce %.y)
|
||||||
|
%- cury
|
||||||
|
:- filter-tx-type
|
||||||
|
:* %set-management-proxy
|
||||||
|
%set-spawn-proxy
|
||||||
|
%set-transfer-proxy
|
||||||
|
~
|
||||||
|
==
|
||||||
==
|
==
|
||||||
=/ filtered-events (filter make-event-list)
|
=/ filtered-events (filter make-event-list)
|
||||||
=| mgmt-jar=(jar @p event)
|
=| mgmt-jar=(jar @p event)
|
||||||
@ -454,8 +457,22 @@
|
|||||||
==
|
==
|
||||||
?: =(rank.current-event %planet)
|
?: =(rank.current-event %planet)
|
||||||
?+ dominion.current-event !!
|
?+ dominion.current-event !!
|
||||||
%l1 (list-in-jar (ly ~[~rabsum-ravtyd ~radres-tinnyl]) current-event)
|
%l1 %- list-in-jar
|
||||||
%l2 (list-in-jar (ly ~[~dovmul-mogryt ~pidted-dacnum ~pinpun-pilsun ~habtyc-nibpyx ~disryt-nolpet]) current-event)
|
:- %- ly
|
||||||
|
:+ ~rabsum-ravtyd
|
||||||
|
~radres-tinnyl
|
||||||
|
~
|
||||||
|
current-event
|
||||||
|
%l2 %- list-in-jar
|
||||||
|
:- %- ly
|
||||||
|
:* ~dovmul-mogryt
|
||||||
|
~pidted-dacnum
|
||||||
|
~pinpun-pilsun
|
||||||
|
~habtyc-nibpyx
|
||||||
|
~disryt-nolpet
|
||||||
|
~
|
||||||
|
==
|
||||||
|
current-event
|
||||||
==
|
==
|
||||||
$(filtered-events t.filtered-events)
|
$(filtered-events t.filtered-events)
|
||||||
::
|
::
|
||||||
@ -473,6 +490,37 @@
|
|||||||
::
|
::
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
|
++ rut-default-args
|
||||||
|
|= [=ship =event] ^- skim-tx:naive
|
||||||
|
|^ ^- skim-tx:naive
|
||||||
|
?+ tx-type.event !!
|
||||||
|
:: %spawn
|
||||||
|
:: %transfer-point
|
||||||
|
:: %configure-keys
|
||||||
|
:: %escape
|
||||||
|
:: %cancel-escape
|
||||||
|
:: %adopt
|
||||||
|
:: %reject
|
||||||
|
:: %detach
|
||||||
|
%set-management-proxy [%set-management-proxy (addr %proxy-test)]
|
||||||
|
%set-spawn-proxy [%set-spawn-proxy (addr %proxy-test)]
|
||||||
|
%set-transfer-proxy [%set-transfer-proxy (addr %proxy-test)]
|
||||||
|
==
|
||||||
|
::
|
||||||
|
:: ++ which-ship
|
||||||
|
:: :: should only matter for spawn and sponsorship actions
|
||||||
|
:: ?+ ship !!
|
||||||
|
:: ~rut
|
||||||
|
:: ~rigrut
|
||||||
|
:: ==
|
||||||
|
:: ::
|
||||||
|
:: ++ set-proxy ^- skim-tx:naive [tx-type.event (addr %proxy-test)]
|
||||||
|
:: ++ transfer
|
||||||
|
:: ++ configure-keys
|
||||||
|
:: ++ sponsor ~
|
||||||
|
::
|
||||||
|
--
|
||||||
|
::
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ l1
|
++ l1
|
||||||
@ -614,10 +662,10 @@
|
|||||||
|%
|
|%
|
||||||
:: new tests
|
:: new tests
|
||||||
::
|
::
|
||||||
++ test-rut-mgmt-proxies ^- tang
|
++ test-rut-proxies ^- tang
|
||||||
=, l2-event-gen
|
=, l2-event-gen
|
||||||
::
|
::
|
||||||
=/ event-jar gen-rut-mgmt-jar
|
=/ event-jar gen-rut-proxy-jar
|
||||||
=| =^state:naive
|
=| =^state:naive
|
||||||
=^ f state (init-rut-full state)
|
=^ f state (init-rut-full state)
|
||||||
=/ initial-state state
|
=/ initial-state state
|
||||||
@ -645,6 +693,7 @@
|
|||||||
!> (~(got by suc-map) cur-event)
|
!> (~(got by suc-map) cur-event)
|
||||||
::
|
::
|
||||||
!>
|
!>
|
||||||
|
|^
|
||||||
=^ f
|
=^ f
|
||||||
state
|
state
|
||||||
%- n
|
%- n
|
||||||
@ -653,15 +702,31 @@
|
|||||||
=< q
|
=< q
|
||||||
%- gen-tx
|
%- gen-tx
|
||||||
:+ nonce.owner.own:(~(got by points.state) cur-ship)
|
:+ nonce.owner.own:(~(got by points.state) cur-ship)
|
||||||
:+ [cur-ship proxy.cur-event]
|
:- [cur-ship proxy.cur-event]
|
||||||
%set-management-proxy ::tx-type.cur-event why does the tx-type not work?
|
(rut-default-args cur-ship cur-event)
|
||||||
(addr common-mgmt)
|
|
||||||
(~(got by default-own-keys) cur-ship)
|
(~(got by default-own-keys) cur-ship)
|
||||||
?: .= =< address.management-proxy.own
|
?+ tx-type.cur-event !!
|
||||||
(~(got by points.state) cur-ship)
|
%set-management-proxy check-mgmt-proxy
|
||||||
(addr common-mgmt)
|
%set-spawn-proxy check-spwn-proxy
|
||||||
%.y
|
%set-transfer-proxy check-xfer-proxy
|
||||||
%.n
|
==
|
||||||
|
::
|
||||||
|
++ check-mgmt-proxy
|
||||||
|
.= =< address.management-proxy.own
|
||||||
|
(~(got by points.state) cur-ship)
|
||||||
|
(addr %proxy-test)
|
||||||
|
::
|
||||||
|
++ check-spwn-proxy
|
||||||
|
.= =< address.spawn-proxy.own
|
||||||
|
(~(got by points.state) cur-ship)
|
||||||
|
(addr %proxy-test)
|
||||||
|
::
|
||||||
|
++ check-xfer-proxy
|
||||||
|
.= =< address.transfer-proxy.own
|
||||||
|
(~(got by points.state) cur-ship)
|
||||||
|
(addr %proxy-test)
|
||||||
|
::
|
||||||
|
--
|
||||||
::
|
::
|
||||||
++ test-marbud-l2-change-keys-new ^- tang
|
++ test-marbud-l2-change-keys-new ^- tang
|
||||||
=/ new-keys [%configure-keys suit encr auth |]
|
=/ new-keys [%configure-keys suit encr auth |]
|
||||||
|
Loading…
Reference in New Issue
Block a user