From 937cc2ce4434397036eddac82e3bef344db72868 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Fri, 21 May 2021 15:07:08 +0200 Subject: [PATCH] naive: add aggregator sur --- pkg/arvo/app/aggregator.hoon | 24 ++------------------- pkg/arvo/app/azimuth-rpc.hoon | 10 +-------- pkg/arvo/lib/azimuth-rpc.hoon | 17 +++++---------- pkg/arvo/sur/aggregator.hoon | 35 +++++++++++++++++++++++++++++++ pkg/arvo/ted/aggregator/send.hoon | 13 ++---------- 5 files changed, 45 insertions(+), 54 deletions(-) create mode 100644 pkg/arvo/sur/aggregator.hoon diff --git a/pkg/arvo/app/aggregator.hoon b/pkg/arvo/app/aggregator.hoon index 98207e4e8..66c20ec78 100644 --- a/pkg/arvo/app/aggregator.hoon +++ b/pkg/arvo/app/aggregator.hoon @@ -26,6 +26,7 @@ ::TODO questions: :: - it's a bit weird how we just assume the raw and tx in raw-tx to match... :: +/- *aggregator /+ naive, default-agent, ethereum, dbug, verb /= ttttt /tests/lib/naive ::TODO use new lib :: @@ -53,27 +54,6 @@ endpoint=@t == :: -+$ keccak @ux -:: -+$ tx-status - $: status=?(%unknown %pending %sending %confirmed %failed) - pointer=(unit l1-tx-pointer) - == -:: -+$ l1-tx-pointer - $: =address:ethereum - nonce=@ud - == -:: -::TODO cache sender address? -+$ pend-tx [force=? =raw-tx:naive] -:: -+$ part-tx - $% [%raw raw=octs] - [%don =tx:naive] - [%ful raw=octs =tx:naive] ::TODO redundant? - == -:: +$ action $% [%submit force=? sig=@ tx=part-tx] [%cancel sig=@ keccak=@] @@ -430,7 +410,7 @@ %+ start-thread:spider /send/(scot %ud nonce) :- %aggregator-send - !> + !> ^- rpc-send-roll :* endpoint contract chain-id diff --git a/pkg/arvo/app/azimuth-rpc.hoon b/pkg/arvo/app/azimuth-rpc.hoon index 13735672d..debd238c8 100644 --- a/pkg/arvo/app/azimuth-rpc.hoon +++ b/pkg/arvo/app/azimuth-rpc.hoon @@ -1,6 +1,6 @@ :: Azimuth JSON-RPC API :: -/- rpc=json-rpc +/- rpc=json-rpc, *aggregator /+ naive, azimuth-rpc, json-rpc, @@ -11,14 +11,6 @@ version, agentio |% -:: FIXME: import tx-status, pend-tx from aggregator -:: -+$ tx-status - $: status=?(%unknown %pending %sent %confirmed %failed) - tx=(unit @ux) - == -:: -+$ pend-tx [force=? =raw-tx:naive] :: +$ card card:agent:gall :: diff --git a/pkg/arvo/lib/azimuth-rpc.hoon b/pkg/arvo/lib/azimuth-rpc.hoon index 69343bb86..1a3de7f4c 100644 --- a/pkg/arvo/lib/azimuth-rpc.hoon +++ b/pkg/arvo/lib/azimuth-rpc.hoon @@ -1,6 +1,6 @@ :: azimuth-rpc: command parsing and utilities :: -/- rpc=json-rpc +/- rpc=json-rpc, *aggregator /+ naive, json-rpc :: => :: Utilities @@ -19,14 +19,6 @@ %set-spawn-proxy %set-transfer-proxy == - :: FIXME: import tx-status, pend-tx from aggregator - :: - +$ tx-status - $: status=?(%unknown %pending %sent %confirmed %failed) - tx=(unit @ux) - == - :: - +$ pend-tx [force=? =raw-tx:naive] :: ++ from-json =, dejs-soft:format @@ -266,9 +258,10 @@ %- pairs :~ ['status' s+status.tx-status] :: - :- 'tx' - ?~ tx.tx-status ~ - s+(crip "0x{((x-co:co 20) u.tx.tx-status)}") + :- 'pointer' + ?~ pointer.tx-status ~ + =* pointer u.pointer.tx-status + (ownership address.pointer nonce.pointer) == -- :: diff --git a/pkg/arvo/sur/aggregator.hoon b/pkg/arvo/sur/aggregator.hoon new file mode 100644 index 000000000..96e536be2 --- /dev/null +++ b/pkg/arvo/sur/aggregator.hoon @@ -0,0 +1,35 @@ +/+ naive, ethereum +:: +|% ++$ keccak @ux +:: ++$ tx-status + $: status=?(%unknown %pending %sending %confirmed %failed) + pointer=(unit l1-tx-pointer) + == +:: ++$ l1-tx-pointer + $: =address:ethereum + nonce=@ud + == +:: +::TODO cache sender address? ++$ pend-tx [force=? =raw-tx:naive] +:: ++$ part-tx + $% [%raw raw=octs] + [%don =tx:naive] + [%ful raw=octs =tx:naive] ::TODO redundant? + == +:: ++$ rpc-send-roll + $: endpoint=@t + contract=address:ethereum + chain-id=@ + pk=@ + :: + nonce=@ud + next-gas-price=@ud + txs=(list raw-tx:naive) + == +-- \ No newline at end of file diff --git a/pkg/arvo/ted/aggregator/send.hoon b/pkg/arvo/ted/aggregator/send.hoon index 37a51f1b3..76bc1a676 100644 --- a/pkg/arvo/ted/aggregator/send.hoon +++ b/pkg/arvo/ted/aggregator/send.hoon @@ -1,6 +1,6 @@ :: aggregator/send: send rollup tx :: -/- rpc=json-rpc +/- rpc=json-rpc, *aggregator /+ naive, ethereum, ethio, strandio :: =/ gas-limit=@ud 30.000 ::TODO verify, maybe scale with roll size @@ -10,16 +10,7 @@ (keccak-256:keccak:crypto (as-octs:mimes:html 'batch(bytes)')) :: |= args=vase -=+ !< $: endpoint=@t - contract=address:ethereum - chain-id=@ - pk=@ - :: - nonce=@ud - next-gas-price=@ud - txs=(list raw-tx:naive) - == - args +=+ !<(rpc-send-roll args) =/ m (strand:strandio ,vase) |^ ^- form:m