2021-03-18 03:27:30 +03:00
|
|
|
/+ *test, naive, ethereum
|
|
|
|
|%
|
2021-03-18 04:07:21 +03:00
|
|
|
++ address @ux
|
2021-04-15 03:49:30 +03:00
|
|
|
++ n |=([=^state:naive =^input:naive] (%*(. naive lac |) verifier +<))
|
2021-03-18 23:32:32 +03:00
|
|
|
:: TODO: does this uniquely produce the pubkey?
|
|
|
|
::
|
2021-03-28 05:08:17 +03:00
|
|
|
++ verifier
|
2021-03-18 03:27:30 +03:00
|
|
|
^- ^verifier:naive
|
|
|
|
|= [dat=@ v=@ r=@ s=@]
|
2021-03-28 05:08:17 +03:00
|
|
|
=/ result
|
|
|
|
%- mule
|
|
|
|
|.
|
|
|
|
=, secp256k1:secp:crypto
|
|
|
|
%- address-from-pub:key:ethereum
|
|
|
|
%- serialize-point
|
|
|
|
(ecdsa-raw-recover dat v r s)
|
|
|
|
?- -.result
|
|
|
|
%| ~
|
|
|
|
%& `p.result
|
|
|
|
==
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-23 21:54:36 +03:00
|
|
|
++ addr address-from-pk:key:ethereum
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
2021-03-18 04:07:21 +03:00
|
|
|
++ log
|
2021-04-15 02:58:27 +03:00
|
|
|
|= [log-name=@ux data=@ux topics=(lest @)]
|
2021-03-18 04:07:21 +03:00
|
|
|
^- ^input:naive
|
2021-04-02 05:24:31 +03:00
|
|
|
[%log *@ux data log-name topics]
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
:: ~bud is so that we aren't testing something impossible in Azimuth, like a star spawned before its sponsor galaxy
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
|
|
|
++ init-bud
|
|
|
|
|= =^state:naive
|
2021-04-15 01:54:40 +03:00
|
|
|
^- [effects:naive ^state:naive]
|
2021-04-22 22:18:23 +03:00
|
|
|
(n state (owner-changed:l1 ~bud (addr ~bud)))
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
:: ~dopbud is for testing L1 ownership with L2 spawn proxy
|
|
|
|
::
|
|
|
|
++ init-dopbud
|
|
|
|
|= =^state:naive
|
2021-04-15 01:54:40 +03:00
|
|
|
^- [effects:naive ^state:naive]
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f1 state (init-bud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f2 state (n state (owner-changed:l1 ~dopbud (addr %dopbud-key-0)))
|
2021-04-14 21:33:31 +03:00
|
|
|
=^ f3 state (n state (changed-spawn-proxy:l1 ~dopbud deposit-address:naive))
|
2021-04-14 21:30:00 +03:00
|
|
|
[:(welp f1 f2 f3) state]
|
|
|
|
::
|
|
|
|
:: ~marbud is for testing L2 ownership
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
++ init-marbud
|
2021-03-18 04:07:21 +03:00
|
|
|
|= =^state:naive
|
2021-04-15 01:54:40 +03:00
|
|
|
^- [effects:naive ^state:naive]
|
2021-03-18 04:07:21 +03:00
|
|
|
=^ f1 state (init-bud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f2 state (n state (owner-changed:l1 ~marbud (addr %marbud-key-0)))
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f3 state (n state (owner-changed:l1 ~marbud deposit-address:naive))
|
2021-03-18 04:07:21 +03:00
|
|
|
[:(welp f1 f2 f3) state]
|
|
|
|
::
|
2021-04-23 21:52:48 +03:00
|
|
|
:: ~sambud is for testing L1 stars attempting L2 actions
|
2021-04-22 22:18:23 +03:00
|
|
|
::
|
2021-04-23 21:52:48 +03:00
|
|
|
++ init-sambud
|
2021-04-22 22:18:23 +03:00
|
|
|
|= =^state:naive
|
|
|
|
^- [effects:naive ^state:naive]
|
|
|
|
=^ f1 state (init-bud state)
|
2021-04-23 21:52:48 +03:00
|
|
|
=^ f2 state (n state (owner-changed:l1 ~sambud (addr %sambud-key-0)))
|
2021-04-22 22:18:23 +03:00
|
|
|
[:(welp f1 f2) state]
|
|
|
|
::
|
2021-03-18 04:07:21 +03:00
|
|
|
++ sign-tx
|
2021-04-15 01:54:40 +03:00
|
|
|
|= [pk=@ nonce=@ud tx=@] ^- @
|
2021-04-01 10:05:12 +03:00
|
|
|
=+ (ecdsa-raw-sign:secp256k1:secp:crypto (dad:naive 5 nonce tx) pk)
|
2021-03-18 04:07:21 +03:00
|
|
|
(cat 3 (can 3 1^v 32^r 32^s ~) tx)
|
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
++ l1
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: Azimuth.sol events
|
|
|
|
::
|
|
|
|
++ owner-changed
|
|
|
|
|= [=ship =address]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log owner-changed:log-names:naive *@ux ship address ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
:: TODO: Activated (not in lib/naive.hoon)
|
|
|
|
:: TODO: Spawned (not in lib/naive.hoon)
|
|
|
|
::
|
|
|
|
++ escape-requested
|
|
|
|
|= [escapee=ship parent=ship]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log escape-requested:log-names:naive *@ux escapee parent ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ escape-canceled
|
|
|
|
:: The parent is pinned but not used in lib/naive.hoon for some reason
|
|
|
|
|= [escapee=ship parent=ship]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log escape-canceled:log-names:naive *@ux escapee parent ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ escape-accepted
|
|
|
|
|= [escapee=ship parent=ship]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log escape-accepted:log-names:naive *@ux escapee parent ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ lost-sponsor
|
|
|
|
|= [lost=ship parent=ship]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log lost-sponsor:log-names:naive *@ux lost parent ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
2021-04-22 20:40:32 +03:00
|
|
|
++ changed-keys
|
|
|
|
|= [=ship encr=@ auth=@ suite=@ life=@]
|
|
|
|
=/ keys=@ux
|
|
|
|
%: can 8
|
|
|
|
1^life
|
|
|
|
1^suite
|
|
|
|
1^auth
|
|
|
|
1^encr
|
|
|
|
~
|
|
|
|
==
|
|
|
|
(log changed-keys:log-names:naive keys ship ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ broke-continuity
|
|
|
|
|= [=ship rift=@]
|
|
|
|
(log broke-continuity:log-names:naive rift ship ~)
|
|
|
|
::
|
|
|
|
++ changed-spawn-proxy
|
2021-04-14 21:33:31 +03:00
|
|
|
|= [=ship =address]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log changed-spawn-proxy:log-names:naive *@ux ship address ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ changed-transfer-proxy
|
|
|
|
|= [=ship =address]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log changed-transfer-proxy:log-names:naive *@ux ship address ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ changed-management-proxy
|
2021-04-14 21:31:47 +03:00
|
|
|
|= [=ship =address]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log changed-management-proxy:log-names:naive *@ux ship address ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
++ changed-voting-proxy
|
2021-04-14 21:31:47 +03:00
|
|
|
|= [=ship =address]
|
2021-04-15 03:24:33 +03:00
|
|
|
(log changed-voting-proxy:log-names:naive *@ux ship address ~)
|
2021-04-14 21:30:00 +03:00
|
|
|
::
|
|
|
|
:: TODO: ChangedDns (lib/naive still has TODOs)
|
|
|
|
::
|
|
|
|
:: Ecliptic.sol events
|
|
|
|
::
|
|
|
|
++ approval-for-all
|
2021-04-15 03:24:33 +03:00
|
|
|
|= [owner=address operator=address approved=@]
|
2021-04-14 21:30:00 +03:00
|
|
|
(log approval-for-all:log-names:naive approved owner operator ~)
|
|
|
|
::
|
|
|
|
--
|
2021-04-09 17:53:15 +03:00
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
++ l2
|
2021-04-09 17:53:15 +03:00
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
|%
|
|
|
|
::
|
2021-04-14 22:36:56 +03:00
|
|
|
++ spawn
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud parent=ship pk=@ proxy=@tas child=ship =address] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-ship-address:bits %spawn parent proxy child address)
|
|
|
|
::
|
|
|
|
++ transfer-point
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud =ship pk=@ =address proxy=@tas reset=?] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 21:30:00 +03:00
|
|
|
%: can 3
|
2021-04-14 22:36:56 +03:00
|
|
|
(from-proxy:bits proxy)
|
|
|
|
4^ship
|
|
|
|
1^(can 0 7^%0 1^reset ~) :: %transfer-point
|
|
|
|
4^ship
|
2021-04-14 21:30:00 +03:00
|
|
|
20^address
|
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
2021-04-14 22:36:56 +03:00
|
|
|
++ configure-keys
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud =ship pk=@ proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 21:30:00 +03:00
|
|
|
%: can 3
|
2021-04-14 22:36:56 +03:00
|
|
|
(from-proxy:bits proxy)
|
2021-04-14 21:30:00 +03:00
|
|
|
4^ship
|
2021-04-14 22:36:56 +03:00
|
|
|
1^(can 0 7^%2 1^breach ~) :: %configure-keys
|
2021-04-14 21:30:00 +03:00
|
|
|
4^ship
|
2021-04-14 22:36:56 +03:00
|
|
|
32^encrypt
|
|
|
|
32^auth
|
|
|
|
4^crypto-suite
|
2021-04-14 21:30:00 +03:00
|
|
|
~
|
|
|
|
==
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ escape
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-escape:bits %escape child proxy parent)
|
|
|
|
::
|
|
|
|
++ cancel-escape
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-escape:bits %cancel-escape child proxy parent)
|
|
|
|
::
|
|
|
|
++ adopt
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-escape:bits %adopt child proxy parent)
|
|
|
|
::
|
|
|
|
++ reject
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-escape:bits %reject child proxy parent)
|
|
|
|
::
|
|
|
|
++ detach
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-escape:bits %detach child proxy parent)
|
|
|
|
::
|
|
|
|
++ set-management-proxy
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-ship-address:bits %set-management-proxy ship proxy ship address)
|
|
|
|
::
|
|
|
|
++ set-spawn-proxy
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-ship-address:bits %set-spawn-proxy ship proxy ship address)
|
|
|
|
::
|
|
|
|
++ set-transfer-proxy
|
2021-04-23 21:54:36 +03:00
|
|
|
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
|
|
|
%^ sign-tx pk nonce
|
2021-04-14 22:36:56 +03:00
|
|
|
(take-ship-address:bits %set-transfer-proxy ship proxy ship address)
|
|
|
|
::
|
|
|
|
++ bits
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
|
|
|
|
::
|
|
|
|
++ take-escape
|
2021-04-15 01:54:40 +03:00
|
|
|
|= [action=@tas child=ship proxy=@tas parent=ship] ^- @
|
2021-04-14 22:36:56 +03:00
|
|
|
=/ op
|
|
|
|
?+ action !!
|
|
|
|
%escape %3
|
|
|
|
%cancel-escape %4
|
|
|
|
%adopt %5
|
|
|
|
%reject %6
|
|
|
|
%detach %7
|
|
|
|
==
|
|
|
|
%: can 3
|
|
|
|
(from-proxy proxy)
|
|
|
|
4^child
|
|
|
|
1^(can 0 7^op 1^0 ~)
|
|
|
|
4^child
|
|
|
|
4^parent
|
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ take-ship-address
|
2021-04-15 01:54:40 +03:00
|
|
|
|= [action=@tas from=ship proxy=@tas target=ship =address] ^- @
|
2021-04-14 22:36:56 +03:00
|
|
|
=/ op
|
|
|
|
?+ action !!
|
|
|
|
%spawn %1
|
|
|
|
%set-management-proxy %8
|
|
|
|
%set-spawn-proxy %9
|
2021-04-15 04:03:52 +03:00
|
|
|
%set-transfer-proxy %10
|
2021-04-14 22:36:56 +03:00
|
|
|
==
|
|
|
|
%: can 3
|
|
|
|
(from-proxy proxy)
|
|
|
|
4^from
|
|
|
|
1^(can 0 7^op 1^0 ~)
|
|
|
|
4^target
|
|
|
|
20^address
|
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ from-proxy
|
|
|
|
|= prx=@tas
|
2021-04-15 01:54:40 +03:00
|
|
|
^- [@ @]
|
2021-04-14 22:36:56 +03:00
|
|
|
=/ proxy
|
|
|
|
?+ prx !!
|
|
|
|
%own %0
|
|
|
|
%spawn %1
|
|
|
|
%manage %2
|
|
|
|
%vote %3
|
|
|
|
%transfer %4
|
|
|
|
==
|
2021-04-21 09:51:32 +03:00
|
|
|
1^(can 0 3^proxy 5^0 ~)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
--
|
|
|
|
::
|
2021-04-14 21:30:00 +03:00
|
|
|
--
|
2021-04-09 23:22:52 +03:00
|
|
|
::
|
2021-03-18 03:27:30 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
|%
|
2021-04-15 01:54:40 +03:00
|
|
|
++ test-log ^- tang
|
2021-03-18 03:27:30 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!>
|
2021-04-03 02:06:24 +03:00
|
|
|
:- [%point ~bud %owner 0x123]~
|
2021-04-15 03:24:33 +03:00
|
|
|
:_ [~ ~] :_ [~ ~]
|
2021-04-15 03:17:01 +03:00
|
|
|
:- ~bud
|
|
|
|
%*(. *point:naive dominion %l1, owner.own 0x123^0, who.sponsor.net ~bud)
|
2021-03-18 03:27:30 +03:00
|
|
|
::
|
|
|
|
!>
|
2021-03-28 05:08:17 +03:00
|
|
|
%^ naive verifier *^state:naive
|
2021-04-15 02:58:27 +03:00
|
|
|
:* %log *@ux *@ux
|
2021-04-02 05:24:31 +03:00
|
|
|
owner-changed:log-names:naive (@ux ~bud) 0x123 ~
|
2021-03-18 03:27:30 +03:00
|
|
|
==
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-15 01:54:40 +03:00
|
|
|
++ test-deposit ^- tang
|
2021-03-18 04:07:21 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> %l2
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f state (init-marbud state)
|
2021-03-18 04:07:21 +03:00
|
|
|
dominion:(~(got by points.state) ~marbud)
|
|
|
|
::
|
2021-04-15 01:54:40 +03:00
|
|
|
++ test-batch ^- tang
|
2021-03-18 04:07:21 +03:00
|
|
|
%+ expect-eq
|
2021-04-01 10:05:12 +03:00
|
|
|
!> [0x234 2]
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (transfer-point:l2 0 ~marbud %marbud-key-0 (addr %marbud-key-0) %own |))
|
2021-04-22 21:35:50 +03:00
|
|
|
=^ f state (n state %bat (transfer-point:l2 1 ~marbud %marbud-key-0 0x234 %own |))
|
2021-03-18 04:07:21 +03:00
|
|
|
owner.own:(~(got by points.state) ~marbud)
|
2021-04-09 17:53:15 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-l1-changed-spawn-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
|
|
|
=^ f state (n state (changed-spawn-proxy:l1 ~bud 0x123))
|
|
|
|
spawn-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-transfer-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
|
|
|
=^ f state (n state (changed-transfer-proxy:l1 ~bud 0x123))
|
|
|
|
transfer-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-management-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
|
|
|
=^ f state (n state (changed-management-proxy:l1 ~bud 0x123))
|
|
|
|
management-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-voting-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
|
|
|
=^ f state (n state (changed-voting-proxy:l1 ~bud 0x123))
|
|
|
|
voting-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l2-set-spawn-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 21:35:50 +03:00
|
|
|
=^ f state (n state %bat (set-spawn-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
2021-04-15 01:53:38 +03:00
|
|
|
spawn-proxy.own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
++ test-l2-set-transfer-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 21:35:50 +03:00
|
|
|
=^ f state (n state %bat (set-transfer-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
2021-04-15 01:53:38 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
++ test-l2-set-management-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [0x123 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 21:35:50 +03:00
|
|
|
=^ f state (n state %bat (set-management-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
2021-04-15 01:53:38 +03:00
|
|
|
management-proxy.own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
++ test-l2-spawn-proxy-deposit ^- tang
|
2021-04-09 17:53:15 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> %spawn
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f state (init-dopbud state)
|
2021-04-09 17:53:15 +03:00
|
|
|
dominion:(~(got by points.state) ~dopbud)
|
2021-04-09 23:22:52 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-marbud-l2-spawn ^- tang
|
2021-04-09 23:22:52 +03:00
|
|
|
%+ expect-eq
|
2021-04-22 22:18:23 +03:00
|
|
|
!> [`@ux`(addr %ll-key-0) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
2021-04-09 23:22:52 +03:00
|
|
|
!>
|
|
|
|
=| =^state:naive
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (addr %ll-key-0)))
|
2021-04-09 23:22:52 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
2021-04-22 22:18:23 +03:00
|
|
|
::
|
|
|
|
++ test-marbud-l2-spawn-w-proxy ^- tang
|
|
|
|
%+ expect-eq
|
|
|
|
!> [`@ux`(addr %ll-key-0) 0]
|
2021-04-22 21:35:50 +03:00
|
|
|
::
|
2021-04-22 22:18:23 +03:00
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat (set-spawn-proxy:l2 0 ~marbud %marbud-key-0 %own (addr %marbud-spawn-0)))
|
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-spawn-0 %spawn ~linnup-torsyx (addr %ll-key-0)))
|
|
|
|
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-dopbud-l2-spawn ^- tang
|
2021-04-09 23:22:52 +03:00
|
|
|
%+ expect-eq
|
2021-04-22 22:18:23 +03:00
|
|
|
!> [`@ux`(addr %pp-key-0) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
2021-04-09 23:22:52 +03:00
|
|
|
!>
|
|
|
|
=| =^state:naive
|
2021-04-14 21:30:00 +03:00
|
|
|
=^ f state (init-dopbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
2021-04-09 23:22:52 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~palsep-picdun)
|
2021-04-10 00:06:50 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-dopbud-l2-spawn-after-transfer ^- tang
|
|
|
|
%+ expect-eq
|
2021-04-22 22:18:23 +03:00
|
|
|
!> [`@ux`(addr %lr-key-0) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-dopbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
|
|
|
=^ f state (n state (owner-changed:l1 ~dopbud (addr %dopbud-key-1)))
|
|
|
|
=^ f state (n state %bat (spawn:l2 1 ~dopbud %dopbud-key-1 %own ~laclur-rachul (addr %lr-key-0)))
|
2021-04-15 01:53:38 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~laclur-rachul)
|
|
|
|
::
|
2021-04-23 21:52:48 +03:00
|
|
|
:: ++ test-sambud-double-spawn ^- tang
|
|
|
|
:: ::
|
|
|
|
:: :: TODO: Not sure of the right way to write this test yet. Current iteration
|
|
|
|
:: :: doesn't even compile
|
|
|
|
:: ::
|
|
|
|
:: %- expect-fail
|
|
|
|
:: |.
|
|
|
|
:: ?<
|
|
|
|
:: ?= [`@ux`(addr %ld-key-1) 0]
|
|
|
|
:: =| =^state:naive
|
|
|
|
:: =^ f state (init-sambud state)
|
|
|
|
:: =^ f state (n state (owner-changed:l1 ~lisdur-fodrys (addr %ld-key-0)))
|
|
|
|
:: =^ f state (n state (changed-spawn-proxy:l1 ~sambud deposit-address:naive))
|
|
|
|
:: =^ f state (n state %bat (spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
|
|
|
:: transfer-proxy.own:(~(got by points.state) ~lisdur-fodrys)
|
|
|
|
:: %.n
|
|
|
|
::
|
|
|
|
:: ++ test-sambud-double-spawn-w-proxy ^- tang
|
|
|
|
:: ::
|
|
|
|
:: :: Same confusion as above
|
|
|
|
:: ::
|
|
|
|
:: %- expect-fail
|
|
|
|
:: |.
|
|
|
|
:: =| =^state:naive
|
|
|
|
:: =^ f state (init-sambud state)
|
|
|
|
:: =^ f state (n state (owner-changed:l1 ~lisdur-fodrys (addr %ld-key-0)))
|
|
|
|
:: =^ f state (n state (owner-changed:l1 ~sambud deposit-address:naive))
|
|
|
|
:: =^ f state (n state %bat (spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
|
|
|
:: state
|
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-linnup-torsyx-l2-transfer-ownership ^- tang
|
|
|
|
%+ expect-eq
|
2021-04-22 22:18:23 +03:00
|
|
|
!> [`@ux`(addr %lt-key-0) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (addr %lt-key-0)))
|
|
|
|
=^ f state (n state %bat (transfer-point:l2 0 ~linnup-torsyx %lt-key-0 (addr %lt-key-0) %transfer &))
|
2021-04-15 01:53:38 +03:00
|
|
|
owner.own:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
|
|
|
++ test-palsep-picdun-l2-transfer-ownership ^- tang
|
|
|
|
%+ expect-eq
|
2021-04-22 22:18:23 +03:00
|
|
|
!> [`@ux`(addr %pp-key-0) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-dopbud state)
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
|
|
|
=^ f state (n state %bat (transfer-point:l2 0 ~palsep-picdun %pp-key-0 (addr %pp-key-0) %transfer &))
|
2021-04-15 01:53:38 +03:00
|
|
|
owner.own:(~(got by points.state) ~palsep-picdun)
|
|
|
|
::
|
2021-03-18 03:27:30 +03:00
|
|
|
--
|