2021-04-29 23:31:45 +03:00
|
|
|
/+ *test, naive, ethereum, azimuth
|
2021-05-11 21:28:43 +03:00
|
|
|
::
|
|
|
|
:: Types
|
|
|
|
|%
|
|
|
|
+$ address @ux
|
|
|
|
+$ nonce @ud
|
|
|
|
+$ skp [=ship pk=@ proxy=@tas]
|
|
|
|
--
|
|
|
|
::
|
2021-03-18 03:27:30 +03:00
|
|
|
|%
|
2021-04-29 04:13:00 +03:00
|
|
|
++ n |=([=^state:naive =^input:naive] (%*(. naive lac |) verifier 1.337 +<))
|
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
|
2021-04-29 01:38:28 +03:00
|
|
|
|= [dat=octs v=@ r=@ s=@]
|
|
|
|
?: (gth v 3) ~ :: TODO: move to jet
|
2021-03-28 05:08:17 +03:00
|
|
|
=/ result
|
|
|
|
%- mule
|
|
|
|
|.
|
|
|
|
=, secp256k1:secp:crypto
|
|
|
|
%- address-from-pub:key:ethereum
|
|
|
|
%- serialize-point
|
2021-04-29 01:38:28 +03:00
|
|
|
(ecdsa-raw-recover (keccak-256:keccak:crypto dat) v r s)
|
2021-03-28 05:08:17 +03:00
|
|
|
?- -.result
|
|
|
|
%| ~
|
|
|
|
%& `p.result
|
|
|
|
==
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-28 03:31:38 +03:00
|
|
|
++ addr address-from-prv: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-05-06 06:25:34 +03:00
|
|
|
(n state (owner-changed:l1 ~bud (addr %bud-key-0)))
|
|
|
|
::
|
|
|
|
:: ~wes is for testing sponsors of stars
|
|
|
|
::
|
|
|
|
++ init-wes
|
|
|
|
|= =^state:naive
|
|
|
|
^- [effects:naive ^state:naive]
|
|
|
|
(n state (owner-changed:l1 ~wes (addr %wes-key-0)))
|
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-05-04 21:10:25 +03:00
|
|
|
:: ~litbud is for testing L2 sponsorship
|
|
|
|
::
|
|
|
|
++ init-litbud
|
|
|
|
|= =^state:naive
|
|
|
|
^- [effects:naive ^state:naive]
|
|
|
|
:: ~bud should already be spawned, though trying to init ~bud again shouldn't matter i think?
|
|
|
|
:: =^ f1 state (init-bud state)
|
|
|
|
=^ f2 state (n state (owner-changed:l1 ~litbud (addr %litbud-key-0)))
|
|
|
|
=^ f3 state (n state (owner-changed:l1 ~litbud deposit-address:naive))
|
|
|
|
[:(welp f2 f3) state]
|
|
|
|
::
|
2021-05-06 06:25:34 +03:00
|
|
|
:: ~sambud is for testing L1 stars
|
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-05-11 21:28:43 +03:00
|
|
|
|= [pk=@ =nonce tx=octs] ^- octs
|
2021-04-29 08:04:11 +03:00
|
|
|
=/ prepared-data (prepare-for-sig 1.337 nonce tx)
|
2021-04-28 03:23:01 +03:00
|
|
|
=/ sign-data
|
2021-04-28 08:58:19 +03:00
|
|
|
=/ len (rsh [3 2] (scot %ui p.prepared-data))
|
2021-04-28 03:23:01 +03:00
|
|
|
%- keccak-256:keccak:crypto
|
2021-04-29 05:19:50 +03:00
|
|
|
%: cad:naive 3
|
2021-04-28 08:58:19 +03:00
|
|
|
26^'\19Ethereum Signed Message:\0a'
|
|
|
|
(met 3 len)^len
|
|
|
|
prepared-data
|
|
|
|
~
|
|
|
|
==
|
2021-04-28 03:23:01 +03:00
|
|
|
=+ (ecdsa-raw-sign:secp256k1:secp:crypto sign-data pk)
|
2021-04-29 05:19:50 +03:00
|
|
|
(cad:naive 3 1^v 32^s 32^r tx ~)
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
2021-04-29 08:04:11 +03:00
|
|
|
++ prepare-for-sig
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [chain-id=@ud =nonce tx=octs]
|
2021-04-29 08:04:11 +03:00
|
|
|
^- octs
|
|
|
|
=/ chain-t (rsh [3 2] (scot %ui chain-id))
|
|
|
|
%: cad:naive 3
|
|
|
|
14^'UrbitIDV1Chain'
|
|
|
|
(met 3 chain-t)^chain-t
|
|
|
|
1^':'
|
|
|
|
4^nonce
|
|
|
|
tx
|
|
|
|
~
|
|
|
|
==
|
2021-03-18 04:07:21 +03:00
|
|
|
::
|
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-05-11 21:28:43 +03:00
|
|
|
:: |= [=nonce parent=ship pk=@ proxy=@tas child=ship =address] ^- octs
|
|
|
|
|= [=nonce =skp child=ship =address] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
2021-04-29 05:55:57 +03:00
|
|
|
%: cad:naive 3
|
2021-05-11 21:28:43 +03:00
|
|
|
(from-proxy:bits proxy.skp)
|
|
|
|
4^ship.skp
|
2021-04-29 05:55:57 +03:00
|
|
|
1^%1 :: %spawn
|
|
|
|
4^child
|
|
|
|
20^address
|
|
|
|
~
|
|
|
|
==
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ transfer-point
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp =address reset=?] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
2021-04-29 05:19:50 +03:00
|
|
|
%: cad:naive 3
|
2021-05-11 21:28:43 +03:00
|
|
|
(from-proxy:bits proxy.skp)
|
|
|
|
4^ship.skp
|
2021-04-14 22:36:56 +03:00
|
|
|
1^(can 0 7^%0 1^reset ~) :: %transfer-point
|
2021-04-14 21:30:00 +03:00
|
|
|
20^address
|
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
2021-04-14 22:36:56 +03:00
|
|
|
++ configure-keys
|
2021-05-11 21:28:43 +03:00
|
|
|
|= $: =nonce =skp
|
2021-05-06 07:54:13 +03:00
|
|
|
encrypt=@ auth=@ crypto-suite=@ breach=?
|
2021-04-28 08:58:19 +03:00
|
|
|
==
|
|
|
|
^- octs
|
2021-05-11 21:28:43 +03:00
|
|
|
%^ sign-tx pk.skp nonce
|
2021-04-29 05:19:50 +03:00
|
|
|
%: cad:naive 3
|
2021-05-11 21:28:43 +03:00
|
|
|
(from-proxy:bits proxy.skp)
|
|
|
|
4^ship.skp
|
2021-04-14 22:36:56 +03:00
|
|
|
1^(can 0 7^%2 1^breach ~) :: %configure-keys
|
|
|
|
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-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp parent=ship] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-escape:bits %escape ship.skp proxy.skp parent)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ cancel-escape
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp parent=ship] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-escape:bits %cancel-escape ship.skp proxy.skp parent)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ adopt
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp child=ship] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-escape:bits %adopt ship.skp proxy.skp child)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ reject
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp child=ship] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-escape:bits %reject ship.skp proxy.skp child)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ detach
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp child=ship] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-escape:bits %detach ship.skp proxy.skp child)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ set-management-proxy
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp =address] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
2021-04-28 08:58:19 +03:00
|
|
|
^- octs
|
2021-05-11 21:28:43 +03:00
|
|
|
(take-ship-address:bits %set-management-proxy ship.skp proxy.skp address)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ set-spawn-proxy
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp =address] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-ship-address:bits %set-spawn-proxy ship.skp proxy.skp address)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ set-transfer-proxy
|
2021-05-11 21:28:43 +03:00
|
|
|
|= [=nonce =skp =address] ^- octs
|
|
|
|
%^ sign-tx pk.skp nonce
|
|
|
|
(take-ship-address:bits %set-transfer-proxy ship.skp proxy.skp address)
|
2021-04-14 22:36:56 +03:00
|
|
|
::
|
|
|
|
++ bits
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
|
|
|
|
::
|
|
|
|
++ take-escape
|
2021-04-29 05:55:57 +03:00
|
|
|
|= [action=@tas from=ship proxy=@tas other=ship] ^- octs
|
2021-04-14 22:36:56 +03:00
|
|
|
=/ op
|
|
|
|
?+ action !!
|
|
|
|
%escape %3
|
|
|
|
%cancel-escape %4
|
|
|
|
%adopt %5
|
|
|
|
%reject %6
|
|
|
|
%detach %7
|
|
|
|
==
|
2021-04-29 05:19:50 +03:00
|
|
|
%: cad:naive 3
|
2021-04-14 22:36:56 +03:00
|
|
|
(from-proxy proxy)
|
2021-04-29 05:55:57 +03:00
|
|
|
4^from
|
2021-04-14 22:36:56 +03:00
|
|
|
1^(can 0 7^op 1^0 ~)
|
2021-04-29 05:55:57 +03:00
|
|
|
4^other
|
2021-04-14 22:36:56 +03:00
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ take-ship-address
|
2021-04-29 05:55:57 +03:00
|
|
|
|= [action=@tas from=ship proxy=@tas =address] ^- octs
|
2021-04-14 22:36:56 +03:00
|
|
|
=/ op
|
|
|
|
?+ action !!
|
|
|
|
%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
|
|
|
==
|
2021-04-29 05:19:50 +03:00
|
|
|
%: cad:naive 3
|
2021-04-14 22:36:56 +03:00
|
|
|
(from-proxy proxy)
|
|
|
|
4^from
|
|
|
|
1^(can 0 7^op 1^0 ~)
|
|
|
|
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-05-04 20:27:43 +03:00
|
|
|
:: Keys
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ encr (shax 'You will forget that you ever read this sentence.')
|
|
|
|
++ auth (shax 'You cant know that this sentence is true.')
|
|
|
|
++ suit 1
|
|
|
|
::
|
2021-05-11 21:28:43 +03:00
|
|
|
++ marbud-own [~marbud %marbud-key-0 %own]
|
|
|
|
++ marbud-spn [~marbud %marbud-skey %spawn]
|
|
|
|
++ marbud-mgt [~marbud %marbud-mkey %manage]
|
|
|
|
::
|
|
|
|
++ dopbud-own [~dopbud %dopbud-key-0 %own]
|
|
|
|
::
|
|
|
|
++ litbud-own [~litbud %litbud-key-0 %own]
|
|
|
|
::
|
|
|
|
++ lt-own [~linnup-torsyx %lt-key-0 %own]
|
|
|
|
++ lt-xfr [~linnup-torsyx %lt-key-0 %transfer]
|
2021-05-04 20:27:43 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
:: Tests
|
|
|
|
::
|
2021-03-18 03:27:30 +03:00
|
|
|
|%
|
2021-05-01 00:16:53 +03:00
|
|
|
::
|
|
|
|
:: TODO: Factor out commonly used things like keys and addresses
|
|
|
|
::
|
2021-04-15 01:54:40 +03:00
|
|
|
++ test-log ^- tang
|
2021-03-18 03:27:30 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!>
|
2021-05-06 07:54:13 +03:00
|
|
|
:- [%point ~bud %owner (addr %bud-key-0)]~
|
2021-04-15 03:24:33 +03:00
|
|
|
:_ [~ ~] :_ [~ ~]
|
2021-04-15 03:17:01 +03:00
|
|
|
:- ~bud
|
2021-05-06 07:54:13 +03:00
|
|
|
%*(. *point:naive dominion %l1, owner.own (addr %bud-key-0)^0, who.sponsor.net ~bud)
|
2021-03-18 03:27:30 +03:00
|
|
|
::
|
|
|
|
!>
|
2021-04-29 04:13:00 +03:00
|
|
|
%^ naive verifier 1.337 :- *^state:naive
|
2021-04-15 02:58:27 +03:00
|
|
|
:* %log *@ux *@ux
|
2021-05-06 07:54:13 +03:00
|
|
|
owner-changed:log-names:naive (@ux ~bud) (addr %bud-key-0) ~
|
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-05-11 21:28:43 +03:00
|
|
|
=/ marbud-transfer [marbud-own (addr %marbud-key-0) |]
|
|
|
|
=/ marbud-transfer-2 [marbud-own (addr %marbud-key-1) |]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-03-18 04:07:21 +03:00
|
|
|
%+ expect-eq
|
2021-05-06 06:25:34 +03:00
|
|
|
!> [(addr %marbud-key-1) 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-05-06 07:54:13 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 marbud-transfer))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 1 marbud-transfer-2))
|
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
|
2021-05-06 06:25:34 +03:00
|
|
|
!> [(addr %bud-skey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
2021-05-06 06:25:34 +03:00
|
|
|
=^ f state (n state (changed-spawn-proxy:l1 ~bud (addr %bud-skey)))
|
2021-04-15 01:53:38 +03:00
|
|
|
spawn-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-transfer-proxy ^- tang
|
|
|
|
%+ expect-eq
|
2021-05-06 07:54:13 +03:00
|
|
|
!> [(addr %bud-key-1) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
2021-05-06 07:54:13 +03:00
|
|
|
=^ f state (n state (changed-transfer-proxy:l1 ~bud (addr %bud-key-1)))
|
2021-04-15 01:53:38 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-management-proxy ^- tang
|
|
|
|
%+ expect-eq
|
2021-05-06 06:25:34 +03:00
|
|
|
!> [(addr %bud-mkey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
2021-05-06 06:25:34 +03:00
|
|
|
=^ f state (n state (changed-management-proxy:l1 ~bud (addr %bud-mkey)))
|
2021-04-15 01:53:38 +03:00
|
|
|
management-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
|
|
|
++ test-l1-changed-voting-proxy ^- tang
|
|
|
|
%+ expect-eq
|
2021-05-06 06:25:34 +03:00
|
|
|
!> [(addr %bud-vkey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
2021-05-06 06:25:34 +03:00
|
|
|
=^ f state (n state (changed-voting-proxy:l1 ~bud (addr %bud-vkey)))
|
2021-04-15 01:53:38 +03:00
|
|
|
voting-proxy.own:(~(got by points.state) ~bud)
|
|
|
|
::
|
2021-04-28 22:29:20 +03:00
|
|
|
++ test-l1-changed-keys ^- tang
|
2021-04-29 23:31:45 +03:00
|
|
|
=/ life 1
|
2021-05-04 20:27:43 +03:00
|
|
|
=/ new-keys [~bud encr auth suit life]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-28 22:29:20 +03:00
|
|
|
%+ expect-eq
|
2021-05-04 20:27:43 +03:00
|
|
|
!> [suit auth encr]
|
2021-04-28 22:29:20 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-bud state)
|
|
|
|
=^ f state (n state (changed-keys:l1 new-keys))
|
2021-04-29 23:31:45 +03:00
|
|
|
|1:keys.net:(~(got by points.state) ~bud)
|
2021-04-28 22:29:20 +03:00
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
++ test-l1-star-escape-requested ^- tang
|
2021-05-06 06:25:34 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> [~ ~wes]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-wes state)
|
|
|
|
=^ f state (init-sambud state)
|
|
|
|
=^ f state (n state (escape-requested:l1 ~sambud ~wes))
|
|
|
|
escape.net:(~(got by points.state) ~sambud)
|
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
++ test-l1-star-escape-canceled ^- tang
|
2021-05-06 06:25:34 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> ~
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-wes state)
|
|
|
|
=^ f state (init-sambud state)
|
|
|
|
=^ f state (n state (escape-requested:l1 ~sambud ~wes))
|
|
|
|
=^ f state (n state (escape-canceled:l1 ~sambud ~wes))
|
|
|
|
escape.net:(~(got by points.state) ~sambud)
|
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
++ test-l1-star-adopt-accept ^- tang
|
2021-05-06 06:25:34 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> [~ %.y ~wes]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-wes state)
|
|
|
|
=^ f state (init-sambud state)
|
|
|
|
=^ f state (n state (escape-requested:l1 ~sambud ~wes))
|
|
|
|
=^ f state (n state (escape-accepted:l1 ~sambud ~wes))
|
|
|
|
[escape.net sponsor.net]:(~(got by points.state) ~sambud)
|
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
++ test-l1-star-lost-sponsor ^- tang
|
2021-05-06 06:25:34 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> [~ %.n ~bud]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-sambud state)
|
|
|
|
=^ f state (n state (lost-sponsor:l1 ~sambud ~bud))
|
|
|
|
[escape.net sponsor.net]:(~(got by points.state) ~sambud)
|
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
:: TODO: sponsorship tests for l1 planets, and L1/L2 sponsorship tests
|
2021-05-06 06:25:34 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-l2-set-spawn-proxy ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ marbud-sproxy [marbud-own (addr %marbud-skey)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
%+ expect-eq
|
2021-05-06 05:55:15 +03:00
|
|
|
!> [(addr %marbud-skey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 marbud-sproxy))
|
2021-04-15 01:53:38 +03:00
|
|
|
spawn-proxy.own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
++ test-l2-set-transfer-proxy ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ marbud-tproxy [marbud-own (addr %marbud-tkey)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
%+ expect-eq
|
2021-05-06 05:55:15 +03:00
|
|
|
!> [(addr %marbud-tkey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(set-transfer-proxy:l2 0 marbud-tproxy))
|
2021-04-15 01:53:38 +03:00
|
|
|
transfer-proxy.own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
++ test-l2-set-management-proxy ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ marbud-mproxy [marbud-own (addr %marbud-mkey)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
%+ expect-eq
|
2021-05-06 05:55:15 +03:00
|
|
|
!> [(addr %marbud-mkey) 0]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(set-management-proxy:l2 0 marbud-mproxy))
|
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-05-11 21:28:43 +03:00
|
|
|
=/ marbud-sproxy [marbud-own (addr %marbud-skey)]
|
|
|
|
=/ lt-ospawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-sspawn [marbud-spn ~linnup-torsyx (addr %lt-key-0)]
|
2021-04-15 01:53:38 +03:00
|
|
|
::
|
2021-05-06 18:37:02 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
|
|
|
:: Tests l2 spawning with ownership
|
|
|
|
!> [`@ux`(addr %lt-key-0) 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-ospawn))
|
|
|
|
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
:: Tests l2 spawning with spawn proxy
|
|
|
|
!> [`@ux`(addr %lt-key-0) 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 marbud-sproxy))
|
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-sspawn))
|
|
|
|
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
==
|
2021-04-09 23:22:52 +03:00
|
|
|
::
|
2021-05-06 05:55:15 +03:00
|
|
|
++ test-marbud-l2-double-spawn ^- tang
|
|
|
|
:: Attempts to spawn the same planet twice, once with ownership and once with spawn proxy
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ marbud-sproxy [marbud-own (addr %marbud-skey)]
|
|
|
|
=/ lt-ospawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-sspawn [marbud-spn ~linnup-torsyx (addr %lt-key-1)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-06 05:55:15 +03:00
|
|
|
%- expect-fail
|
|
|
|
|.
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 marbud-sproxy))
|
|
|
|
=^ f state (n state %bat q:(spawn:l2 1 lt-ospawn))
|
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-sspawn))
|
|
|
|
state
|
|
|
|
::
|
2021-05-06 07:54:13 +03:00
|
|
|
++ test-marbud-l2-change-keys ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ new-keys-own [marbud-own encr auth suit |]
|
|
|
|
=/ new-keys-mgt [marbud-mgt encr auth suit |]
|
|
|
|
=/ marbud-mproxy [marbud-own (addr %marbud-mkey)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-28 22:13:31 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2021-05-04 20:27:43 +03:00
|
|
|
!> [suit auth encr]
|
2021-04-28 22:13:31 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-own))
|
2021-04-29 23:31:45 +03:00
|
|
|
|1:keys.net:(~(got by points.state) ~marbud)
|
2021-04-28 22:13:31 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
2021-05-04 20:27:43 +03:00
|
|
|
!> [suit auth encr]
|
2021-04-28 22:13:31 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(set-management-proxy:l2 0 marbud-mproxy))
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-mgt))
|
2021-04-29 23:31:45 +03:00
|
|
|
|1:keys.net:(~(got by points.state) ~marbud)
|
2021-04-28 22:13:31 +03:00
|
|
|
::
|
2021-04-28 22:29:20 +03:00
|
|
|
:: TODO: make sure nobody else can change these keys
|
2021-04-28 22:13:31 +03:00
|
|
|
==
|
|
|
|
::
|
2021-05-04 20:27:43 +03:00
|
|
|
:: TODO: transfer breach via transfer proxy
|
2021-05-06 18:29:17 +03:00
|
|
|
++ test-marbud-l2-proxies-transfer ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ new-keys [marbud-own encr auth suit |]
|
|
|
|
=/ marbud-sproxy [marbud-own (addr %marbud-skey)]
|
|
|
|
=/ marbud-mproxy [marbud-own (addr %marbud-mkey)]
|
|
|
|
=/ marbud-tproxy [marbud-own (addr %marbud-key-1)]
|
|
|
|
=/ marbud-transfer-breach [[~marbud %marbud-key-1 %transfer] (addr %marbud-key-1) &]
|
|
|
|
=/ marbud-transfer-no-breach [[~marbud %marbud-key-1 %transfer] (addr %marbud-key-1) |]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-30 23:39:13 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2021-05-06 18:29:17 +03:00
|
|
|
:: Tests that proxies are reset on transfer with breach
|
2021-05-06 05:55:15 +03:00
|
|
|
::
|
2021-04-30 23:39:13 +03:00
|
|
|
!>
|
|
|
|
:* [(addr %marbud-key-1) 3] :: ownership
|
|
|
|
[0 0] :: spawn-proxy
|
|
|
|
[0 0] :: management-proxy
|
|
|
|
[0 0] :: voting-proxy
|
|
|
|
[0 1] :: transfer-proxy
|
|
|
|
==
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 marbud-sproxy))
|
|
|
|
=^ f state (n state %bat q:(set-management-proxy:l2 1 marbud-mproxy))
|
|
|
|
=^ f state (n state %bat q:(set-transfer-proxy:l2 2 marbud-tproxy))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 marbud-transfer-breach))
|
2021-04-30 23:39:13 +03:00
|
|
|
^- [[@ @] [@ @] [@ @] [@ @] [@ @]]
|
|
|
|
own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2021-05-06 18:29:17 +03:00
|
|
|
:: Tests that networking keys are reset on transfer with breach
|
2021-04-30 23:39:13 +03:00
|
|
|
!>
|
|
|
|
[0 0 0]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 1 marbud-own (addr %marbud-key-0) &))
|
2021-04-30 23:39:13 +03:00
|
|
|
|1:keys.net:(~(got by points.state) ~marbud)
|
2021-05-06 18:29:17 +03:00
|
|
|
::
|
2021-04-30 23:39:13 +03:00
|
|
|
%+ expect-eq
|
2021-05-06 18:29:17 +03:00
|
|
|
:: Tests that proxies are not reset when transfering without breach
|
2021-04-30 23:39:13 +03:00
|
|
|
!>
|
|
|
|
:* [(addr %marbud-key-1) 3] :: ownership
|
2021-05-06 18:29:17 +03:00
|
|
|
[(addr %marbud-skey) 0] :: spawn-proxy
|
|
|
|
[(addr %marbud-mkey) 0] :: management-proxy
|
2021-04-30 23:39:13 +03:00
|
|
|
[0 0] :: voting-proxy
|
|
|
|
[0 1] :: transfer-proxy
|
|
|
|
==
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 07:54:13 +03:00
|
|
|
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 marbud-sproxy))
|
|
|
|
=^ f state (n state %bat q:(set-management-proxy:l2 1 marbud-mproxy))
|
|
|
|
=^ f state (n state %bat q:(set-transfer-proxy:l2 2 marbud-tproxy))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 marbud-transfer-no-breach))
|
2021-04-30 23:39:13 +03:00
|
|
|
^- [[@ @] [@ @] [@ @] [@ @] [@ @]]
|
|
|
|
own:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2021-05-06 18:29:17 +03:00
|
|
|
:: Tests that networking keys are not reset when transfering without breach
|
2021-04-30 23:39:13 +03:00
|
|
|
!>
|
2021-05-04 20:27:43 +03:00
|
|
|
[suit auth encr]
|
2021-04-30 23:39:13 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 1 marbud-own (addr %marbud-key-0) |))
|
2021-04-30 23:39:13 +03:00
|
|
|
|1:keys.net:(~(got by points.state) ~marbud)
|
2021-05-01 00:16:53 +03:00
|
|
|
==
|
|
|
|
::
|
2021-05-04 20:27:43 +03:00
|
|
|
:: TODO: life+rift changes via transfer proxy
|
|
|
|
::
|
2021-05-01 00:16:53 +03:00
|
|
|
++ test-marbud-keys-life-rift ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ new-keys-no-reset [marbud-own encr auth suit |]
|
|
|
|
=/ new-keys-yes-reset [marbud-own encr auth suit &]
|
|
|
|
=/ zero-keys-no-reset [marbud-own 0 0 0 |]
|
|
|
|
=/ zero-keys-yes-reset [marbud-own 0 0 0 &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-01 00:16:53 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2021-05-01 00:42:30 +03:00
|
|
|
:: breach=%.n
|
2021-05-01 00:16:53 +03:00
|
|
|
!> [0 1] :: [rift life]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-no-reset))
|
2021-05-01 00:16:53 +03:00
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2021-05-01 00:42:30 +03:00
|
|
|
:: breach=%.y
|
2021-05-01 00:16:53 +03:00
|
|
|
!> [1 1]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 20:27:43 +03:00
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-yes-reset))
|
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
:: networking keys set incremenets life, reset=%.y
|
|
|
|
:: then zero keys and transfer, should increment rift but not life
|
|
|
|
::
|
|
|
|
!> [2 2]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-yes-reset)) :: inc life and rift
|
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 1 zero-keys-no-reset)) :: inc life
|
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 2 zero-keys-yes-reset)) :: inc rift
|
2021-05-01 00:16:53 +03:00
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
2021-05-04 20:27:43 +03:00
|
|
|
::
|
2021-05-01 00:16:53 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ test-marbud-transfer-life-rift ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ new-keys-no-reset [marbud-own encr auth suit |]
|
|
|
|
=/ new-keys-yes-reset [marbud-own encr auth suit &]
|
|
|
|
=/ zero-keys-no-reset [marbud-own 0 0 0 |]
|
|
|
|
=/ zero-keys-yes-reset [marbud-own 0 0 0 &]
|
|
|
|
=/ marbud-transfer-no-breach [marbud-own (addr %marbud-key-1) |]
|
|
|
|
=/ marbud-transfer-yes-breach [marbud-own (addr %marbud-key-1) &]
|
2021-05-06 05:55:15 +03:00
|
|
|
::
|
2021-05-01 00:16:53 +03:00
|
|
|
;: weld
|
|
|
|
%+ expect-eq
|
2021-05-04 20:27:43 +03:00
|
|
|
:: networking keys not set, reset=%.n
|
|
|
|
::
|
2021-05-01 00:45:24 +03:00
|
|
|
!> [0 0] :: [rift life]
|
2021-05-01 00:16:53 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 marbud-transfer-no-breach))
|
2021-05-01 00:16:53 +03:00
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
%+ expect-eq
|
2021-05-04 20:27:43 +03:00
|
|
|
:: networking keys not set, reset=%.y
|
|
|
|
::
|
|
|
|
!> [0 0]
|
2021-05-01 00:16:53 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 marbud-transfer-no-breach))
|
2021-05-01 00:16:53 +03:00
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
2021-05-04 20:27:43 +03:00
|
|
|
::
|
|
|
|
%+ expect-eq
|
|
|
|
:: networking keys set incremenets life, reset=%.y
|
|
|
|
:: then zero keys and transfer, should increment rift but not life
|
|
|
|
:: TODO: transferring and reset with already zeroed keys ought to incr rift but not life, right?
|
|
|
|
:: but currently the transfer w/ reset increments both life and rift, despite keys already being 0
|
|
|
|
::
|
|
|
|
!> [2 2]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 0 new-keys-yes-reset)) :: inc life and rift
|
|
|
|
=^ f state (n state %bat q:(configure-keys:l2 1 zero-keys-no-reset)) :: inc life
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 2 marbud-transfer-yes-breach)) :: inc rift
|
2021-05-04 20:27:43 +03:00
|
|
|
[rift.net life.keys.net]:(~(got by points.state) ~marbud)
|
|
|
|
::
|
|
|
|
==
|
2021-04-30 23:39:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-dopbud-l2-spawn ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ pp-spawn [dopbud-own ~palsep-picdun (addr %pp-key-0)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
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-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 pp-spawn))
|
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
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ pp-spawn [dopbud-own ~palsep-picdun (addr %pp-key-0)]
|
|
|
|
=/ lr-spawn [[~dopbud %dopbud-key-1 %own] ~laclur-rachul (addr %lr-key-0)]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
%+ 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-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 pp-spawn))
|
2021-04-22 22:18:23 +03:00
|
|
|
=^ f state (n state (owner-changed:l1 ~dopbud (addr %dopbud-key-1)))
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 1 lr-spawn))
|
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))
|
2021-04-28 08:58:19 +03:00
|
|
|
:: =^ f state (n state %bat q:(spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
2021-04-23 21:52:48 +03:00
|
|
|
:: 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))
|
2021-04-28 08:58:19 +03:00
|
|
|
:: =^ f state (n state %bat q:(spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
2021-04-23 21:52:48 +03:00
|
|
|
:: state
|
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
++ test-linnup-torsyx-l2-transfer-ownership ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-04-15 01:53:38 +03:00
|
|
|
%+ 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-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-04-15 01:53:38 +03:00
|
|
|
owner.own:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
|
|
|
++ test-palsep-picdun-l2-transfer-ownership ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ pp-spawn [dopbud-own ~palsep-picdun (addr %pp-key-0)]
|
|
|
|
=/ pp-transfer-yes-breach [[~palsep-picdun %pp-key-0 %transfer] (addr %pp-key-0) &]
|
2021-04-15 01:53:38 +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
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-dopbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 pp-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 pp-transfer-yes-breach))
|
2021-04-15 01:53:38 +03:00
|
|
|
owner.own:(~(got by points.state) ~palsep-picdun)
|
|
|
|
::
|
2021-05-01 00:42:30 +03:00
|
|
|
++ test-linnup-torsyx-l2-escape-request ^- tang
|
|
|
|
:: TODO: Are you supposed to be able to request escape to a non-existent star?
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-01 00:42:30 +03:00
|
|
|
%+ expect-eq
|
2021-05-04 21:10:25 +03:00
|
|
|
!> [~ ~litbud]
|
2021-05-01 00:42:30 +03:00
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
2021-05-04 21:10:25 +03:00
|
|
|
=^ f state (init-litbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(escape:l2 0 [lt-own] ~litbud))
|
2021-05-01 00:42:30 +03:00
|
|
|
escape.net:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-05-04 21:10:25 +03:00
|
|
|
++ test-linnup-torsyx-l2-cancel-escape-request ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-04 21:10:25 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> ~
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (init-litbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(escape:l2 0 lt-own ~litbud))
|
|
|
|
=^ f state (n state %bat q:(cancel-escape:l2 1 lt-own ~litbud))
|
2021-05-04 21:10:25 +03:00
|
|
|
escape.net:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-05-04 21:11:19 +03:00
|
|
|
++ test-linnup-torsyx-l2-adopt-accept ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-04 21:10:25 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> [~ %.y ~litbud]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (init-litbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(escape:l2 0 lt-own ~litbud))
|
|
|
|
=^ f state (n state %bat q:(adopt:l2 0 litbud-own ~linnup-torsyx))
|
2021-05-04 21:10:25 +03:00
|
|
|
[escape.net sponsor.net]:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-05-04 21:11:19 +03:00
|
|
|
++ test-linnup-torsyx-l2-adopt-reject ^- tang
|
2021-05-04 21:10:25 +03:00
|
|
|
:: TODO: at the moment the default sponsor is always ~zod, but it should probably
|
|
|
|
:: be ~marbud here
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-04 21:10:25 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> ~
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (init-litbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(escape:l2 0 lt-own ~litbud))
|
|
|
|
=^ f state (n state %bat q:(reject:l2 0 litbud-own ~linnup-torsyx))
|
2021-05-04 21:10:25 +03:00
|
|
|
escape.net:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-05-04 21:11:19 +03:00
|
|
|
++ test-linnup-torsyx-l2-detach ^- tang
|
2021-05-11 21:28:43 +03:00
|
|
|
=/ lt-spawn [marbud-own ~linnup-torsyx (addr %lt-key-0)]
|
|
|
|
=/ lt-transfer-yes-breach [lt-xfr (addr %lt-key-0) &]
|
2021-05-06 07:54:13 +03:00
|
|
|
::
|
2021-05-04 21:10:25 +03:00
|
|
|
%+ expect-eq
|
|
|
|
!> [~ %.n ~marbud]
|
|
|
|
::
|
|
|
|
!>
|
|
|
|
=| =^state:naive
|
|
|
|
=^ f state (init-marbud state)
|
|
|
|
=^ f state (init-litbud state)
|
2021-05-06 05:55:15 +03:00
|
|
|
=^ f state (n state %bat q:(spawn:l2 0 lt-spawn))
|
|
|
|
=^ f state (n state %bat q:(transfer-point:l2 0 lt-transfer-yes-breach))
|
2021-05-11 21:28:43 +03:00
|
|
|
=^ f state (n state %bat q:(detach:l2 1 marbud-own ~linnup-torsyx))
|
2021-05-04 21:10:25 +03:00
|
|
|
[escape.net sponsor.net]:(~(got by points.state) ~linnup-torsyx)
|
|
|
|
::
|
2021-04-28 08:58:19 +03:00
|
|
|
:: TODO: signature format changed; regenerate
|
|
|
|
::
|
|
|
|
:: ++ test-metamask-signature ^- tang
|
|
|
|
:: =/ meta-owner=address
|
|
|
|
:: (hex-to-num:ethereum '0xb026b0AA6e686F2386051b31A03E5fB95513e1c0')
|
|
|
|
:: =/ tx 0x123.0000.0102.0a00.0001.0200
|
|
|
|
:: =/ sig
|
|
|
|
:: %- hex-to-num:ethereum
|
|
|
|
:: :: Must reverse endianness of tx to sign in metamask
|
|
|
|
:: ::
|
|
|
|
:: %^ cat 3
|
|
|
|
:: '0x5b85936ab7b9db8d72416648e6eb1b844a4545ddb7c7c646a74bc3a4fb001a2'
|
|
|
|
:: '8583bf12ca837b289036a6cc9e6359ed07dda2b87929b5dd7189a3057a395341f1c'
|
|
|
|
:: ::
|
|
|
|
:: %+ expect-eq
|
|
|
|
:: !> [0x123 0]
|
|
|
|
:: ::
|
|
|
|
:: !>
|
|
|
|
:: =| =^state:naive
|
|
|
|
:: =^ f state (init-marbud state)
|
|
|
|
:: :: =^ f state (n state %bat q:(transfer-point:l2 0 ~marbud (key ~marbud) %own &))
|
|
|
|
:: :: =^ f state (n state %bat q:(set-transfer-proxy:l2 1 ~marbud %own 0x123))
|
|
|
|
:: =^ f state
|
|
|
|
:: %^ n state %bat
|
|
|
|
:: q:(transfer-point:l2 0 ~marbud %marbud-key-0 meta-owner %own &)
|
|
|
|
:: =^ f state (n state %bat (cat 3 sig tx))
|
|
|
|
:: transfer-proxy.own:(~(got by points.state) ~marbud)
|
2021-03-18 03:27:30 +03:00
|
|
|
--
|