diff --git a/pkg/arvo/gen/tx.hoon b/pkg/arvo/gen/tx.hoon index 5ce216bc18..a073af29ca 100644 --- a/pkg/arvo/gen/tx.hoon +++ b/pkg/arvo/gen/tx.hoon @@ -41,15 +41,15 @@ |= 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 ~)] +=/ tx=octs + (take-ship-address:bits:l2:tt %set-spawn-proxy ~ravmun-mitbus %own account) +=/ prepped=octs (prepare-for-sig:tt 3 0 tx) ?~ sig - (cat 3 'sign: ' (print-for-web3 nonced)) + (cat 3 'sign: ' (print-for-web3 prepped)) =/ batch=@t %: rap 3 '0x26887f26' - (print-for-batch prep) + (print-for-batch tx) (rsh 3^2 u.sig) ~ == diff --git a/pkg/arvo/lib/azimuth.hoon b/pkg/arvo/lib/azimuth.hoon index 7046844ad1..96e9967ea1 100644 --- a/pkg/arvo/lib/azimuth.hoon +++ b/pkg/arvo/lib/azimuth.hoon @@ -136,7 +136,7 @@ :: ++ launch 4.601.630 ++ public launch - ++ chain-id 1 + ++ chain-id 3 -- :: :: Local contract addresses diff --git a/pkg/arvo/lib/naive.hoon b/pkg/arvo/lib/naive.hoon index e75ee1f97c..010627eab4 100644 --- a/pkg/arvo/lib/naive.hoon +++ b/pkg/arvo/lib/naive.hoon @@ -125,10 +125,10 @@ |% :: ethereum address, 20 bytes. :: -+$ address @ux -+$ nonce @ud -+$ dominion ?(%l1 %l2 %spawn) -+$ keys [=life suite=@ud auth=@ crypt=@] ++$ address @ux ++$ nonce @ud ++$ dominion ?(%l1 %l2 %spawn) ++$ keys [=life suite=@ud auth=@ crypt=@] ++ point $: :: domain :: @@ -206,7 +206,11 @@ $% [%bat batch=@] [%log =event-log] == -:: ECDSA verifier +:: ECDSA verifier. +:: +:: Must keccak `dat` and recover the ethereum address which signed. +:: Must not crash. `v` will normally be between 0 and 3; if it is not, +:: should produce null. :: +$ verifier $-([dat=octs v=@ r=@ s=@] (unit address)) -- => @@ -333,7 +337,7 @@ ^- ? |^ =/ point (get-point state ship.from.tx.raw-tx) - ?> ?=(^ point) :: we never parse more than four bytes + ?> ?=(^ point) :: we never parse more than four bytes for a ship =/ need=[=address =nonce] ?- proxy.from.tx.raw-tx %own owner.own.u.point @@ -708,7 +712,7 @@ `net.point =/ =keys [+(life.keys.net.point) 0 0 0] :- :~ [%point ship %rift +(rift.net.point)] - [%point ship %keys keys] :: TODO: 0? + [%point ship %keys keys] == [+(rift.net.point) keys sponsor.net.point escape.net.point] =/ effects-3 diff --git a/pkg/arvo/tests/lib/naive.hoon b/pkg/arvo/tests/lib/naive.hoon index 593a35cfaf..27db42bf76 100644 --- a/pkg/arvo/tests/lib/naive.hoon +++ b/pkg/arvo/tests/lib/naive.hoon @@ -65,16 +65,7 @@ :: ++ sign-tx |= [pk=@ nonce=@ud tx=octs] ^- octs - =/ prepared-data=octs - =/ chain-t (rsh [3 2] (scot %ui 1.337)) - %: cad:naive 3 - 14^'UrbitIDV1Chain' - (met 3 chain-t)^chain-t - 1^':' - 4^nonce - tx - ~ - == + =/ prepared-data (prepare-for-sig 1.337 nonce tx) =/ sign-data =/ len (rsh [3 2] (scot %ui p.prepared-data)) %- keccak-256:keccak:crypto @@ -87,6 +78,19 @@ =+ (ecdsa-raw-sign:secp256k1:secp:crypto sign-data pk) (cad:naive 3 1^v 32^s 32^r tx ~) :: +++ prepare-for-sig + |= [chain-id=@ud nonce=@ud tx=octs] + ^- 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 + ~ + == +:: ++ l1 |% ::