mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-29 18:06:43 +03:00
naive: make bitlengths explicit
Also switches everything to ropsten by default, including ivory pill. Batches work on ropsten now. Also adds +tx as a hacky development tool to create text for metamask to sign and then turn that into a batch. A useful reference for bridge and aggregator work.
This commit is contained in:
parent
a644d8a5b2
commit
f2c43edc99
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:185ea5e76dc48695e55efc543377e0682e485f81b16e3b443f9be881d026d4f2
|
||||
size 2616564
|
||||
oid sha256:5758d6cd7f5a36b9f45e988bf032951e40711541d9edbf9d2d85efba1e959257
|
||||
size 4080881
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bb221ce7316346bfaf1ddd953927c0f2afe7eaf5b160bed545f67ec7e5ccb005
|
||||
size 9410487
|
||||
oid sha256:286d903dfa7aa3d46210e21e7403dfb89c8068544b9939f0807771b7fe9d0345
|
||||
size 9543574
|
||||
|
@ -1,9 +1,9 @@
|
||||
/- eth-watcher
|
||||
/+ ethereum, azimuth, naive, default-agent, verb, dbug
|
||||
/* snap %eth-logs /app/naive/logs/eth-logs
|
||||
/* snap %eth-logs /app/azimuth/logs/eth-logs
|
||||
::
|
||||
=/ last-snap :: maybe just use the last one?
|
||||
%+ roll `(list event-log:rpc:ethereum)`snap
|
||||
%+ roll `(list event-log:rpc:ethereum)`~ ::snap
|
||||
|= [log=event-log:rpc:ethereum last=@ud]
|
||||
?~ mined.log
|
||||
last
|
||||
@ -35,6 +35,7 @@
|
||||
++ verifier
|
||||
^- ^verifier:naive
|
||||
|= [dat=@ v=@ r=@ s=@]
|
||||
?: (gth v 3) ~ :: TODO: move to jet
|
||||
=/ result
|
||||
%- mule
|
||||
|.
|
||||
@ -74,9 +75,12 @@
|
||||
[%log event-log]
|
||||
?~ input.u.mined.i.logs
|
||||
[%bat *@]
|
||||
?. =(0x2688.7f26 (end [3 4] (swp 5 u.input.u.mined.i.logs)))
|
||||
=/ len (met 3 u.input.u.mined.i.logs)
|
||||
=/ fun
|
||||
(rsh [3 (sub len 4)] u.input.u.mined.i.logs)
|
||||
?. =(0x2688.7f26 fun)
|
||||
[%bat *@]
|
||||
[%bat (rsh [3 4] u.input.u.mined.i.logs)]
|
||||
[%bat (end [3 (sub len 4)] u.input.u.mined.i.logs)]
|
||||
=/ res (mule |.((%*(. naive lac |) verifier nas input)))
|
||||
?- -.res
|
||||
%& p.res
|
||||
@ -88,11 +92,6 @@
|
||||
=^ effects-2 nas $(logs t.logs)
|
||||
[(welp effects-1 effects-2) nas]
|
||||
::
|
||||
++ run-batch
|
||||
|= [nas=^state:naive batch=@]
|
||||
^+ *naive
|
||||
(%*(. naive lac |) verifier nas %bat batch)
|
||||
::
|
||||
++ to-udiffs
|
||||
|= effects=(list tagged-diff)
|
||||
^- =udiffs:point
|
||||
@ -109,7 +108,7 @@
|
||||
++ jael-update
|
||||
|= =udiffs:point
|
||||
^- (list card:agent:gall)
|
||||
?: & ~
|
||||
?: & ~ :: XX
|
||||
:- [%give %fact ~[/] %azimuth-udiffs !>(udiffs)]
|
||||
|- ^- (list card:agent:gall)
|
||||
?~ udiffs
|
||||
@ -211,7 +210,7 @@
|
||||
=. logs.state logs
|
||||
$(mark %noun, vase !>(%rerun))
|
||||
::
|
||||
?. ?=(%azimuth-tracker-poke mark)
|
||||
?. ?=(%azimuth-poke mark)
|
||||
(on-poke:def mark vase)
|
||||
=+ !<(poke=poke-data vase)
|
||||
?- -.poke
|
BIN
pkg/arvo/app/azimuth/logs.eth-logs
Normal file
BIN
pkg/arvo/app/azimuth/logs.eth-logs
Normal file
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c126c80e152c63672bc91180fa307c08016c4d763ff167332423b62795228144
|
||||
size 14171684
|
@ -10,5 +10,5 @@
|
||||
[leaf+(scow %ud block)]~
|
||||
.^ @ud
|
||||
%gx
|
||||
/(scot %p our)/eth-watcher/(scot %da now)/block/azimuth-tracker/noun
|
||||
/(scot %p our)/eth-watcher/(scot %da now)/block/azimuth/noun
|
||||
==
|
||||
|
@ -1,4 +0,0 @@
|
||||
:: Kick azimuth-tracker
|
||||
:- %say
|
||||
|= *
|
||||
[%azimuth-tracker-poke %listen ~ %| %azimuth-tracker]
|
@ -1,4 +0,0 @@
|
||||
:: Change node url for azimuth-tracker
|
||||
:- %say
|
||||
|= [* [url=@ta ~] ~]
|
||||
[%azimuth-tracker-poke %watch url]
|
4
pkg/arvo/gen/azimuth/kick.hoon
Normal file
4
pkg/arvo/gen/azimuth/kick.hoon
Normal file
@ -0,0 +1,4 @@
|
||||
:: Kick azimuth
|
||||
:- %say
|
||||
|= *
|
||||
[%azimuth-poke %listen ~ %| %azimuth]
|
@ -1,4 +1,5 @@
|
||||
:: Add a source for azimuth-tracker
|
||||
:: Add a source for azimuth
|
||||
::
|
||||
=> |%
|
||||
+$ src
|
||||
$% [%ship =ship ~]
|
||||
@ -12,4 +13,4 @@
|
||||
%ship [%& ship.src]
|
||||
%app [%| term.src]
|
||||
==
|
||||
[%azimuth-tracker-poke %listen whos source]
|
||||
[%azimuth-poke %listen whos source]
|
4
pkg/arvo/gen/azimuth/watch.hoon
Normal file
4
pkg/arvo/gen/azimuth/watch.hoon
Normal file
@ -0,0 +1,4 @@
|
||||
:: Change node url for azimuth
|
||||
:- %say
|
||||
|= [* [url=@ta ~] ~]
|
||||
[%azimuth-poke %watch url]
|
34
pkg/arvo/gen/tx.hoon
Normal file
34
pkg/arvo/gen/tx.hoon
Normal file
@ -0,0 +1,34 @@
|
||||
:: ethereum.request({method: 'personal_sign', params: ['tx',count]}).then(console.log)
|
||||
:: ethereum.request({method: 'eth_sendTransaction', params: [{from: count, gasPrice: '0x2540be400', to: '0xb58101cd3bbbcc6fa40bcdb04bb71623b5c7d39b', gas: '0x10000', data: 'batch', chainId: '0x3'}]}).then(console.log)
|
||||
::
|
||||
/+ eth=ethereum
|
||||
/= tt /tests/lib/naive
|
||||
|%
|
||||
++ print-for-web3
|
||||
|= =octs
|
||||
^- @t
|
||||
=/ txt (crip (render-hex-bytes:eth octs))
|
||||
?> =(p.octs (met 4 txt))
|
||||
(cat 3 '0x' (rev 4 (met 4 txt) txt))
|
||||
::
|
||||
++ print-for-batch
|
||||
|= =octs
|
||||
^- @t
|
||||
(crip (render-hex-bytes:eth octs))
|
||||
--
|
||||
|= sig=(unit @t)
|
||||
^- @t
|
||||
=/ account (hex-to-num:eth '0xb026b0AA6e686F2386051b31A03E5fB95513e1c0')
|
||||
=/ tx=octs (set-spawn-proxy:l2:tt 0 ~ravmun-mitbus %ravmun %own account)
|
||||
=/ prep=octs [(sub p.tx 65) (rsh 3^65 q.tx)]
|
||||
=/ nonced=octs [(add p.prep 4) (can 3 4^1 prep ~)]
|
||||
?~ sig
|
||||
(cat 3 'sign: ' (print-for-web3 nonced))
|
||||
=/ batch=@t
|
||||
%: rap 3
|
||||
'0x26887f26'
|
||||
(print-for-batch prep)
|
||||
(rsh 3^2 u.sig)
|
||||
~
|
||||
==
|
||||
(cat 3 'batch: ' batch)
|
@ -66,7 +66,7 @@
|
||||
:~ %dojo
|
||||
%spider
|
||||
%eth-watcher
|
||||
%azimuth-tracker
|
||||
%azimuth
|
||||
%ping
|
||||
%goad
|
||||
%lens
|
||||
|
@ -63,6 +63,8 @@
|
||||
|%
|
||||
:: Transfers on L1 to this address count as depositing to L2
|
||||
::
|
||||
:: 0x1234567890123456789012345678901234567890
|
||||
::
|
||||
++ deposit-address 0x1234.5678.9012.3456.7890.1234.5678.9012.3456.7890
|
||||
++ log-names
|
||||
|%
|
||||
@ -209,7 +211,7 @@
|
||||
+$ effects (list diff)
|
||||
+$ proxy ?(%own %spawn %manage %vote %transfer)
|
||||
+$ roll (list raw-tx)
|
||||
+$ raw-tx [sig=@ raw=@ =tx]
|
||||
+$ raw-tx [sig=@ raw=octs =tx]
|
||||
+$ tx [from=[=ship =proxy] skim-tx]
|
||||
+$ skim-tx
|
||||
$% [%transfer-point =ship =address reset=?]
|
||||
@ -275,7 +277,10 @@
|
||||
?~ res
|
||||
~
|
||||
:- ~ :_ rest.batch.u.res
|
||||
[sig (end [0 len.batch.u.res] orig-batch) tx.u.res]
|
||||
=/ len-bytes
|
||||
?> =(0 (mod len.batch.u.res 8))
|
||||
(div len.batch.u.res 8)
|
||||
[sig [len-bytes (end [0 len.batch.u.res] orig-batch)] tx.u.res]
|
||||
::
|
||||
++ parse-tx
|
||||
^- (unit [tx _batch])
|
||||
@ -366,15 +371,20 @@
|
||||
%vote voting-proxy.own.u.point
|
||||
%transfer transfer-proxy.own.u.point
|
||||
==
|
||||
:: TODO: do we need to preserve the length of the raw tx?
|
||||
::
|
||||
=/ prepared-data (dad [5 1] nonce.need raw.raw-tx)
|
||||
=/ prepared-data=octs
|
||||
:- (add 4 p.raw.raw-tx)
|
||||
(can 3 4^nonce.need raw.raw-tx ~)
|
||||
=/ signed-data
|
||||
=/ len (ud-to-len p.prepared-data)
|
||||
%- keccak-256:keccak:crypto
|
||||
%- as-octs:mimes:html
|
||||
%^ cat 3 '\19Ethereum Signed Message:\0a'
|
||||
%^ cat 3 (ud-to-len (met 3 prepared-data))
|
||||
prepared-data
|
||||
:- :(add 26 (met 3 len) p.prepared-data)
|
||||
%: can 3
|
||||
26^'\19Ethereum Signed Message:\0a'
|
||||
(met 3 len)^len
|
||||
prepared-data
|
||||
~
|
||||
==
|
||||
=/ dress (verify-sig sig.raw-tx signed-data)
|
||||
?~ dress
|
||||
|
|
||||
@ -911,4 +921,5 @@
|
||||
(receive-log state event-log.input)
|
||||
:: Received L2 batch
|
||||
::
|
||||
%+ debug %batch
|
||||
(receive-batch verifier state batch.input)
|
||||
|
@ -207,7 +207,7 @@
|
||||
[our our]
|
||||
app
|
||||
%poke
|
||||
%azimuth-tracker-poke
|
||||
%azimuth-poke
|
||||
!>([%watch (crip (en-purl:html purl))])
|
||||
==
|
||||
::
|
||||
@ -312,26 +312,26 @@
|
||||
::
|
||||
:: start subscriptions
|
||||
::
|
||||
=. +>.$ (poke-watch hen %azimuth-tracker nod.own.pki)
|
||||
=. +>.$ (poke-watch hen %azimuth nod.own.pki)
|
||||
=. +>.$
|
||||
:: get everything from azimuth-tracker because jael subscriptions
|
||||
:: seem to be flaky for now
|
||||
::
|
||||
?: &
|
||||
%- curd =< abet
|
||||
(sources:~(feel su hen now pki etn) ~ [%| %azimuth-tracker])
|
||||
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
|
||||
::
|
||||
?- (clan:title our)
|
||||
%czar
|
||||
%- curd =< abet
|
||||
(sources:~(feel su hen now pki etn) ~ [%| %azimuth-tracker])
|
||||
(sources:~(feel su hen now pki etn) ~ [%| %azimuth])
|
||||
::
|
||||
*
|
||||
=. +>.$
|
||||
%- curd =< abet
|
||||
%+ sources:~(feel su hen now pki etn)
|
||||
(silt (turn spon-points head))
|
||||
[%| %azimuth-tracker]
|
||||
[%| %azimuth]
|
||||
%- curd =< abet
|
||||
(sources:~(feel su hen now pki etn) ~ [%& (need spon-ship)])
|
||||
==
|
||||
|
@ -63,16 +63,21 @@
|
||||
[:(welp f1 f2) state]
|
||||
::
|
||||
++ sign-tx
|
||||
|= [pk=@ nonce=@ud tx=@] ^- @
|
||||
=/ prepared-data (dad:naive 5 nonce tx)
|
||||
|= [pk=@ nonce=@ud tx=octs] ^- octs
|
||||
=/ prepared-data=octs [(add 4 p.tx) (can 3 4^nonce tx ~)]
|
||||
=/ sign-data
|
||||
=/ len (rsh [3 2] (scot %ui p.prepared-data))
|
||||
%- keccak-256:keccak:crypto
|
||||
%- as-octs:mimes:html
|
||||
%^ cat 3 '\19Ethereum Signed Message:\0a'
|
||||
%^ cat 3 (rsh [3 2] (scot %ui (met 3 prepared-data)))
|
||||
prepared-data
|
||||
:- :(add 26 (met 3 len) p.prepared-data)
|
||||
%: can 3
|
||||
26^'\19Ethereum Signed Message:\0a'
|
||||
(met 3 len)^len
|
||||
prepared-data
|
||||
~
|
||||
==
|
||||
=+ (ecdsa-raw-sign:secp256k1:secp:crypto sign-data pk)
|
||||
(cat 3 (can 3 1^v 32^s 32^r ~) tx)
|
||||
:- :(add 1 32 32 p.tx)
|
||||
(can 3 1^v 32^s 32^r tx ~)
|
||||
::
|
||||
++ l1
|
||||
|%
|
||||
@ -150,13 +155,14 @@
|
||||
|%
|
||||
::
|
||||
++ spawn
|
||||
|= [nonce=@ud parent=ship pk=@ proxy=@tas child=ship =address] ^- @
|
||||
|= [nonce=@ud parent=ship pk=@ proxy=@tas child=ship =address] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-ship-address:bits %spawn parent proxy child address)
|
||||
::
|
||||
++ transfer-point
|
||||
|= [nonce=@ud =ship pk=@ =address proxy=@tas reset=?] ^- @
|
||||
|= [nonce=@ud =ship pk=@ =address proxy=@tas reset=?] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
:- :(add 1 4 1 4 20)
|
||||
%: can 3
|
||||
(from-proxy:bits proxy)
|
||||
4^ship
|
||||
@ -167,8 +173,12 @@
|
||||
==
|
||||
::
|
||||
++ configure-keys
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas breach=@ encrypt=@ auth=@ crypto-suite=@] ^- @
|
||||
|= $: nonce=@ud =ship pk=@ proxy=@tas
|
||||
breach=@ encrypt=@ auth=@ crypto-suite=@
|
||||
==
|
||||
^- octs
|
||||
%^ sign-tx pk nonce
|
||||
:- :(add 1 4 1 4 32 32 4)
|
||||
%: can 3
|
||||
(from-proxy:bits proxy)
|
||||
4^ship
|
||||
@ -181,42 +191,43 @@
|
||||
==
|
||||
::
|
||||
++ escape
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-escape:bits %escape child proxy parent)
|
||||
::
|
||||
++ cancel-escape
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-escape:bits %cancel-escape child proxy parent)
|
||||
::
|
||||
++ adopt
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-escape:bits %adopt child proxy parent)
|
||||
::
|
||||
++ reject
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-escape:bits %reject child proxy parent)
|
||||
::
|
||||
++ detach
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- @
|
||||
|= [nonce=@ud child=ship pk=@ proxy=@tas parent=ship] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-escape:bits %detach child proxy parent)
|
||||
::
|
||||
++ set-management-proxy
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
^- octs
|
||||
(take-ship-address:bits %set-management-proxy ship proxy ship address)
|
||||
::
|
||||
++ set-spawn-proxy
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-ship-address:bits %set-spawn-proxy ship proxy ship address)
|
||||
::
|
||||
++ set-transfer-proxy
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- @
|
||||
|= [nonce=@ud =ship pk=@ proxy=@tas =address] ^- octs
|
||||
%^ sign-tx pk nonce
|
||||
(take-ship-address:bits %set-transfer-proxy ship proxy ship address)
|
||||
::
|
||||
@ -227,7 +238,7 @@
|
||||
:: TODO: Shouldn't need to pass all these arguments along - they should already be in the subject somewhere
|
||||
::
|
||||
++ take-escape
|
||||
|= [action=@tas child=ship proxy=@tas parent=ship] ^- @
|
||||
|= [action=@tas child=ship proxy=@tas parent=ship] ^- octs
|
||||
=/ op
|
||||
?+ action !!
|
||||
%escape %3
|
||||
@ -236,6 +247,7 @@
|
||||
%reject %6
|
||||
%detach %7
|
||||
==
|
||||
:- :(add 1 4 1 4 4)
|
||||
%: can 3
|
||||
(from-proxy proxy)
|
||||
4^child
|
||||
@ -246,7 +258,7 @@
|
||||
==
|
||||
::
|
||||
++ take-ship-address
|
||||
|= [action=@tas from=ship proxy=@tas target=ship =address] ^- @
|
||||
|= [action=@tas from=ship proxy=@tas target=ship =address] ^- octs
|
||||
=/ op
|
||||
?+ action !!
|
||||
%spawn %1
|
||||
@ -254,6 +266,7 @@
|
||||
%set-spawn-proxy %9
|
||||
%set-transfer-proxy %10
|
||||
==
|
||||
:- :(add 1 4 1 4 20)
|
||||
%: can 3
|
||||
(from-proxy proxy)
|
||||
4^from
|
||||
@ -313,8 +326,8 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ f state (n state %bat (transfer-point:l2 0 ~marbud %marbud-key-0 (addr %marbud-key-0) %own |))
|
||||
=^ f state (n state %bat (transfer-point:l2 1 ~marbud %marbud-key-0 0x234 %own |))
|
||||
=^ f state (n state %bat q:(transfer-point:l2 0 ~marbud %marbud-key-0 (addr %marbud-key-0) %own |))
|
||||
=^ f state (n state %bat q:(transfer-point:l2 1 ~marbud %marbud-key-0 0x234 %own |))
|
||||
owner.own:(~(got by points.state) ~marbud)
|
||||
::
|
||||
++ test-l1-changed-spawn-proxy ^- tang
|
||||
@ -364,7 +377,7 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ f state (n state %bat (set-spawn-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
||||
=^ f state (n state %bat q:(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
|
||||
@ -374,7 +387,7 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ f state (n state %bat (set-transfer-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
||||
=^ f state (n state %bat q:(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
|
||||
@ -384,7 +397,7 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ f state (n state %bat (set-management-proxy:l2 0 ~marbud %marbud-key-0 %own 0x123))
|
||||
=^ f state (n state %bat q:(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
|
||||
@ -403,7 +416,7 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ f state (n state %bat (spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (addr %ll-key-0)))
|
||||
=^ f state (n state %bat q:(spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (addr %ll-key-0)))
|
||||
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
||||
::
|
||||
++ test-marbud-l2-spawn-w-proxy ^- tang
|
||||
@ -413,8 +426,8 @@
|
||||
!>
|
||||
=| =^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)))
|
||||
=^ f state (n state %bat q:(set-spawn-proxy:l2 0 ~marbud %marbud-key-0 %own (addr %marbud-spawn-0)))
|
||||
=^ f state (n state %bat q:(spawn:l2 0 ~marbud %marbud-spawn-0 %spawn ~linnup-torsyx (addr %ll-key-0)))
|
||||
transfer-proxy.own:(~(got by points.state) ~linnup-torsyx)
|
||||
::
|
||||
++ test-dopbud-l2-spawn ^- tang
|
||||
@ -424,7 +437,7 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-dopbud state)
|
||||
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
||||
=^ f state (n state %bat q:(spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
||||
transfer-proxy.own:(~(got by points.state) ~palsep-picdun)
|
||||
::
|
||||
++ test-dopbud-l2-spawn-after-transfer ^- tang
|
||||
@ -434,9 +447,9 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-dopbud state)
|
||||
=^ f state (n state %bat (spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
||||
=^ f state (n state %bat q:(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)))
|
||||
=^ f state (n state %bat q:(spawn:l2 1 ~dopbud %dopbud-key-1 %own ~laclur-rachul (addr %lr-key-0)))
|
||||
transfer-proxy.own:(~(got by points.state) ~laclur-rachul)
|
||||
::
|
||||
:: ++ test-sambud-double-spawn ^- tang
|
||||
@ -452,7 +465,7 @@
|
||||
:: =^ 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)))
|
||||
:: =^ f state (n state %bat q:(spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
||||
:: transfer-proxy.own:(~(got by points.state) ~lisdur-fodrys)
|
||||
:: %.n
|
||||
::
|
||||
@ -466,7 +479,7 @@
|
||||
:: =^ 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)))
|
||||
:: =^ f state (n state %bat q:(spawn:l2 0 ~sambud %sambud-key-0 %own ~lisdur-fodrys (addr %ld-key-1)))
|
||||
:: state
|
||||
::
|
||||
++ test-linnup-torsyx-l2-transfer-ownership ^- tang
|
||||
@ -476,8 +489,8 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-marbud state)
|
||||
=^ 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 &))
|
||||
=^ f state (n state %bat q:(spawn:l2 0 ~marbud %marbud-key-0 %own ~linnup-torsyx (addr %lt-key-0)))
|
||||
=^ f state (n state %bat q:(transfer-point:l2 0 ~linnup-torsyx %lt-key-0 (addr %lt-key-0) %transfer &))
|
||||
owner.own:(~(got by points.state) ~linnup-torsyx)
|
||||
::
|
||||
++ test-palsep-picdun-l2-transfer-ownership ^- tang
|
||||
@ -487,33 +500,35 @@
|
||||
!>
|
||||
=| =^state:naive
|
||||
=^ f state (init-dopbud state)
|
||||
=^ 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 &))
|
||||
=^ f state (n state %bat q:(spawn:l2 0 ~dopbud %dopbud-key-0 %own ~palsep-picdun (addr %pp-key-0)))
|
||||
=^ f state (n state %bat q:(transfer-point:l2 0 ~palsep-picdun %pp-key-0 (addr %pp-key-0) %transfer &))
|
||||
owner.own:(~(got by points.state) ~palsep-picdun)
|
||||
::
|
||||
++ 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 (transfer-point:l2 0 ~marbud (key ~marbud) %own &))
|
||||
:: =^ f state (n state %bat (set-transfer-proxy:l2 1 ~marbud %own 0x123))
|
||||
=^ f state
|
||||
%^ n state %bat
|
||||
(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)
|
||||
:: 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)
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user