mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
naive: capture rpc errors when sending l2 batches
This commit is contained in:
parent
3cee0ff3b8
commit
766e2ab610
@ -223,13 +223,13 @@
|
||||
=+ !<([=term =tang] q.cage.sign)
|
||||
%- (slog leaf+"{(trip dap.bowl)} failed" leaf+<term> tang)
|
||||
=^ cards state
|
||||
(on-thread-result:do (rash i.t.wire dem) %.n^term)
|
||||
(on-thread-result:do (rash i.t.wire dem) %.n^'thread failed')
|
||||
[cards this]
|
||||
::
|
||||
%thread-done
|
||||
~& ['all submitted to' t.wire]
|
||||
:: is aggregator/send thread expected to maybe return an error?
|
||||
=+ !<(result=(each @ud term) q.cage.sign)
|
||||
=+ !<(result=(each @ud @t) q.cage.sign)
|
||||
=^ cards state
|
||||
(on-thread-result:do (rash i.t.wire dem) result)
|
||||
[cards this]
|
||||
@ -420,7 +420,7 @@
|
||||
:: +on-thread-result: await resend after thread success or failure
|
||||
::
|
||||
++ on-thread-result
|
||||
|= [nonce=@ud result=(each @ud term)]
|
||||
|= [nonce=@ud result=(each @ud @t)]
|
||||
^- (quip card _state)
|
||||
:: update gas price for this tx in state
|
||||
::
|
||||
|
@ -67,14 +67,19 @@
|
||||
::
|
||||
::NOTE this fails the thread if sending fails, which in the app gives us
|
||||
:: the "retry with same gas price" behavior we want
|
||||
;< jon=json bind:m
|
||||
%+ request-rpc:ethio endpoint
|
||||
[`'sendRawTransaction' %eth-send-raw-transaction tx]
|
||||
::TODO check that tx-hash in jon is non-zero?
|
||||
::TODO enforce max here, or in app?
|
||||
:: add five gwei to gas price of next attempt
|
||||
::
|
||||
(pure:m !>(%.y^(add use-gas-price 5.000.000.000)))
|
||||
;< =response:rpc bind:m (send-batch endpoint tx)
|
||||
%- pure:m
|
||||
!> ^- (each @ud @t)
|
||||
?+ -.response %.n^'unexpected rpc response'
|
||||
%error %.n^message.res
|
||||
:: TODO:
|
||||
:: check that tx-hash in +.response is non-zero?
|
||||
:: log tx-hash to getTransactionReceipt(tx-hash)?
|
||||
:: enforce max here, or in app?
|
||||
:: add five gwei to gas price of next attempt
|
||||
::
|
||||
%result %.y^(add use-gas-price 5.000.000.000)
|
||||
==
|
||||
::
|
||||
::TODO should be distilled further, partially added to strandio?
|
||||
++ fetch-gas-price
|
||||
@ -106,4 +111,19 @@
|
||||
%. u.jon
|
||||
=, dejs-soft:format
|
||||
(ot 'result'^(ot 'FastGasPrice'^ni ~) ~)
|
||||
::
|
||||
++ send-batch
|
||||
|= [endpoint=@ta batch=@ux]
|
||||
=/ m (strand:strandio ,response:rpc)
|
||||
^- form:m
|
||||
=/ req=[(unit @t) request:rpc:ethereum]
|
||||
[`'sendRawTransaction' %eth-send-raw-transaction batch]
|
||||
;< res=(list response:rpc) bind:m
|
||||
(request-batch-rpc-loose:ethio endpoint [req]~)
|
||||
?: ?=([* ~] res)
|
||||
(pure:m i.res)
|
||||
%+ strand-fail:strandio
|
||||
%unexpected-multiple-results
|
||||
[>(lent res)< ~]
|
||||
::
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user