transaction firing now includes private key

This commit is contained in:
drbeefsupreme 2021-04-22 14:35:50 -04:00
parent 14b81f8ea4
commit b76f2c7f45
No known key found for this signature in database
GPG Key ID: B70D5683DE7F9EFC

View File

@ -39,7 +39,7 @@
|= =^state:naive
^- [effects:naive ^state:naive]
=^ f1 state (init-bud state)
=^ f2 state (n state (owner-changed:l1 ~dopbud (key ~dopbud)))
=^ f2 state (n state (owner-changed:l1 ~dopbud (key %dopbud-key-0)))
=^ f3 state (n state (changed-spawn-proxy:l1 ~dopbud deposit-address:naive))
[:(welp f1 f2 f3) state]
::
@ -49,7 +49,7 @@
|= =^state:naive
^- [effects:naive ^state:naive]
=^ f1 state (init-bud state)
=^ f2 state (n state (owner-changed:l1 ~marbud (key ~marbud)))
=^ f2 state (n state (owner-changed:l1 ~marbud (key %marbud-key-0)))
=^ f3 state (n state (owner-changed:l1 ~marbud deposit-address:naive))
[:(welp f1 f2 f3) state]
::
@ -133,18 +133,14 @@
::
|%
::
:: TODO: Allow requesting ship to differ from the ship the action is for
::
++ spawn
|= [nonce=@ud parent=ship proxy=@tas child=ship =address] ^- @
:: TODO: allow requesting ship and parent ship to differ
%^ sign-tx parent nonce
|= [nonce=@ud parent=ship prv=@ proxy=@tas child=ship =address] ^- @
%^ sign-tx prv nonce
(take-ship-address:bits %spawn parent proxy child address)
::
++ transfer-point
|= [nonce=@ud =ship =address proxy=@tas reset=?] ^- @
:: TODO: allow requesting ship and target ship to differ
%^ sign-tx ship nonce
|= [nonce=@ud =ship prv=@ =address proxy=@tas reset=?] ^- @
%^ sign-tx prv nonce
%: can 3
(from-proxy:bits proxy)
4^ship
@ -155,8 +151,8 @@
==
::
++ configure-keys
|= [nonce=@ud =ship proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@] ^- @
%^ sign-tx ship nonce
|= [nonce=@ud =ship prv=@ proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@] ^- @
%^ sign-tx prv nonce
%: can 3
(from-proxy:bits proxy)
4^ship
@ -169,43 +165,43 @@
==
::
++ escape
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
%^ sign-tx child nonce
|= [nonce=@ud child=ship prv=@ proxy=@tas parent=ship] ^- @
%^ sign-tx prv nonce
(take-escape:bits %escape child proxy parent)
::
++ cancel-escape
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
%^ sign-tx child nonce
|= [nonce=@ud child=ship prv=@ proxy=@tas parent=ship] ^- @
%^ sign-tx prv nonce
(take-escape:bits %cancel-escape child proxy parent)
::
++ adopt
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
%^ sign-tx child nonce
|= [nonce=@ud child=ship prv=@ proxy=@tas parent=ship] ^- @
%^ sign-tx prv nonce
(take-escape:bits %adopt child proxy parent)
::
++ reject
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
%^ sign-tx child nonce
|= [nonce=@ud child=ship prv=@ proxy=@tas parent=ship] ^- @
%^ sign-tx prv nonce
(take-escape:bits %reject child proxy parent)
::
++ detach
|= [nonce=@ud child=ship proxy=@tas parent=ship] ^- @
%^ sign-tx child nonce
|= [nonce=@ud child=ship prv=@ proxy=@tas parent=ship] ^- @
%^ sign-tx prv nonce
(take-escape:bits %detach child proxy parent)
::
++ set-management-proxy
|= [nonce=@ud =ship proxy=@tas =address] ^- @
%^ sign-tx ship nonce
|= [nonce=@ud =ship prv=@ proxy=@tas =address] ^- @
%^ sign-tx prv nonce
(take-ship-address:bits %set-management-proxy ship proxy ship address)
::
++ set-spawn-proxy
|= [nonce=@ud =ship proxy=@tas =address] ^- @
%^ sign-tx ship nonce
|= [nonce=@ud =ship prv=@ proxy=@tas =address] ^- @
%^ sign-tx prv nonce
(take-ship-address:bits %set-spawn-proxy ship proxy ship address)
::
++ set-transfer-proxy
|= [nonce=@ud =ship proxy=@tas =address] ^- @
%^ sign-tx ship nonce
|= [nonce=@ud =ship prv=@ proxy=@tas =address] ^- @
%^ sign-tx prv nonce
(take-ship-address:bits %set-transfer-proxy ship proxy ship address)
::
++ bits
@ -301,8 +297,8 @@
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (transfer-point:l2 0 ~marbud (key ~marbud) %own |))
=^ f state (n state %bat (transfer-point:l2 1 ~marbud 0x234 %own |))
=^ f state (n state %bat (transfer-point:l2 0 ~marbud %marbud-key-0 (key %marbud-key-0) %own |))
=^ f state (n state %bat (transfer-point:l2 1 ~marbud %marbud-key-0 0x234 %own |))
owner.own:(~(got by points.state) ~marbud)
::
++ test-l1-changed-spawn-proxy ^- tang
@ -352,7 +348,7 @@
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (set-spawn-proxy:l2 0 ~marbud %own 0x123))
=^ f state (n state %bat (set-spawn-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
spawn-proxy.own:(~(got by points.state) ~marbud)
::
++ test-l2-set-transfer-proxy ^- tang
@ -362,7 +358,7 @@
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (set-transfer-proxy:l2 0 ~marbud %own 0x123))
=^ f state (n state %bat (set-transfer-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
transfer-proxy.own:(~(got by points.state) ~marbud)
::
++ test-l2-set-management-proxy ^- tang
@ -372,7 +368,7 @@
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (set-management-proxy:l2 0 ~marbud %own 0x123))
=^ f state (n state %bat (set-management-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
management-proxy.own:(~(got by points.state) ~marbud)
::
++ test-l2-spawn-proxy-deposit ^- tang
@ -391,9 +387,9 @@
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (spawn:l2 0 ~marbud %own ~linnup-torsyx (key ~linnup-torsyx)))
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (key ~linnup-torsyx)))
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
::
::
++ test-dopbud-l2-spawn ^- tang
%+ expect-eq
!> [`@ux`(key ~palsep-picdun) 0]
@ -401,43 +397,41 @@
!>
=| =^state:naive
=^ f state (init-dopbud state)
=^ f state (n state %bat (spawn:l2 0 ~dopbud %own ~palsep-picdun (key ~palsep-picdun)))
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (key ~palsep-picdun)))
transfer-proxy.own:(~(got by points.state) ~palsep-picdun)
::
++ test-dopbud-l2-spawn-after-transfer ^- tang
:: Currently fails, does not spawn ~laclur-rachul unless you leave ~dopbud's ownership address alone
:: All individual transactions work fine though, its the sequence that breaks something.
%+ expect-eq
!> [`@ux`(key ~laclur-rachul) 0]
::
!>
=| =^state:naive
=^ f state (init-dopbud state)
=^ f state (n state %bat (spawn:l2 0 ~dopbud %own ~palsep-picdun (key ~palsep-picdun)))
=^ f state (n state (owner-changed:l1 ~dopbud 0x345))
=^ f state (n state %bat (spawn:l2 1 ~dopbud %own ~laclur-rachul (key ~laclur-rachul)))
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (key ~palsep-picdun)))
=^ f state (n state (owner-changed:l1 ~dopbud (key %dopbud-key-1)))
=^ f state (n state %bat (spawn:l2 1 ~dopbud %dopbud-key-1 %own ~laclur-rachul (key ~laclur-rachul)))
transfer-proxy.own:(~(got by points.state) ~laclur-rachul)
::
++ test-linnup-torsyx-l2-transfer-ownership ^- tang
%+ expect-eq
!> [`@ux`(key ~linnup-torsyx) 0]
!> [`@ux`(key %lt-key-0) 0]
::
!>
=| =^state:naive
=^ f state (init-marbud state)
=^ f state (n state %bat (spawn:l2 0 ~marbud %own ~linnup-torsyx (key ~linnup-torsyx)))
=^ f state (n state %bat (transfer-point:l2 0 ~linnup-torsyx (key ~linnup-torsyx) %transfer &))
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (key %lt-key-0)))
=^ f state (n state %bat (transfer-point:l2 0 ~linnup-torsyx %lt-key-0 (key %lt-key-0) %transfer &))
owner.own:(~(got by points.state) ~linnup-torsyx)
::
++ test-palsep-picdun-l2-transfer-ownership ^- tang
%+ expect-eq
!> [`@ux`(key ~palsep-picdun) 0]
!> [`@ux`(key %pp-key-0) 0]
::
!>
=| =^state:naive
=^ f state (init-dopbud state)
=^ f state (n state %bat (spawn:l2 0 ~dopbud %own ~palsep-picdun (key ~palsep-picdun)))
=^ f state (n state %bat (transfer-point:l2 0 ~palsep-picdun (key ~palsep-picdun) %transfer &))
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (key %pp-key-0)))
=^ f state (n state %bat (transfer-point:l2 0 ~palsep-picdun %pp-key-0 (key %pp-key-0) %transfer &))
owner.own:(~(got by points.state) ~palsep-picdun)
::
--