roller: add azimuth refresh-rate to getConfig RPC

This commit is contained in:
yosoyubik 2021-11-04 09:54:25 +01:00
parent 07d5ddfe0c
commit 1c641629e2
6 changed files with 62 additions and 14 deletions

View File

@ -148,6 +148,7 @@
%get-point `(get-point id +.params point:scry)
%get-dns `(get-dns id +.params dns:scry)
%get-naive-state `(get-naive id +.params naive-state:scry)
%get-refresh `(get-refresh id +.params refresh:scry)
==
--
::
@ -171,5 +172,11 @@
%gx
(~(scry agentio bowl) %azimuth /nas/noun)
==
::
++ refresh
.^ @dr
%gx
(~(scry agentio bowl) %azimuth /refresh/noun)
==
--
--

View File

@ -43,6 +43,9 @@
+$ tagged-diff [=id:block diff:naive]
+$ network ?(%mainnet %ropsten %local)
+$ card card:agent:gall
:: TODO: add to state?
::
++ refresh ~m5
--
::
=| state=app-state
@ -59,7 +62,14 @@
^- (quip card _this)
=. net.state %local
:_ this
[%pass /eth-watcher %agent [our.bowl %eth-watcher] %watch /logs/[dap.bowl]]~
:_ ~
:* %pass
/eth-watcher
%agent
[our.bowl %eth-watcher]
%watch
/logs/[dap.bowl]
==
::
++ on-save !>(state)
++ on-load
@ -140,6 +150,7 @@
[%x %nas ~] ``noun+!>(nas.state)
[%x %dns ~] ``noun+!>(dns.nas.state)
[%x %own ~] ``noun+!>(own.state)
[%x %refresh ~] ``atom+!>(refresh)
[%x %point @ ~] ``noun+(point i.t.t.path)
==
::
@ -319,7 +330,7 @@
=/ args=vase !>
:+ %watch /[dap.bowl]
^- config:eth-watcher
:* url.state =(%czar (clan:title our.bowl)) ~m5 ~h30
:* url.state =(%czar (clan:title our.bowl)) refresh ~h30
(max launch.net last-snap)
~[azimuth.net]
~[naive.net]

View File

@ -301,6 +301,8 @@
==
::
++ config
^- [azimuth-config roller-config]
:- refresh
.^ roller-config
%gx
%+ ~(scry agentio bowl)
@ -321,5 +323,11 @@
%gx
(~(scry agentio bowl) %roller /predicted/noun)
==
::
++ refresh
.^ @dr
%gx
(~(scry agentio bowl) %azimuth /refresh/noun)
==
--
--

View File

@ -101,6 +101,7 @@
:: TODO: add to config
::
++ resend-time ~m5
++ update-rate ~m1
::
++ lverb &
--
@ -334,6 +335,7 @@
:* next-batch
frequency
resend-time
update-rate
contract
chain-id
==
@ -874,7 +876,7 @@
?. derive ~
:: derive predicted state in 1m.
::
[(wait:b:sys /predict (add ~m1 now.bowl))]~
[(wait:b:sys /predict (add update-rate now.bowl))]~
:: +set-timer: %wait until next whole :frequency
::
++ set-timer
@ -1110,7 +1112,7 @@
?. derive ~
:: derive predicted/ownership state in 1m.
::
[(wait:b:sys /predict (add ~m1 now.bowl))]~
[(wait:b:sys /predict (add update-rate now.bowl))]~
::
?: ?=(%point -.diff) [~ state]
?> ?=(%tx -.diff)

View File

@ -345,17 +345,25 @@
::
++ tx-status |=(=^tx-status ^-(json s+status.tx-status))
::
++ config
|= roller-config
++ roller-config
|= [az=^azimuth-config ro=^roller-config]
^- json
%- pairs
:~ ['nextBatch' (time next-batch)]
['frequency' (numb (div frequency ~s1))]
['refreshTime' (numb (div refresh-time ~s1))]
['contract' (hex 20 contract)]
['chainId' (numb chain-id)]
:~ ['azimuthRefreshRate' (numb (div refresh-rate.az ~s1))]
['nextBatch' (time next-batch.ro)]
['frequency' (numb (div frequency.ro ~s1))]
['rollerResendTime' (numb (div resend-time.ro ~s1))]
['rollerUpdateRate' (numb (div update-rate.ro ~s1))]
['contract' (hex 20 contract.ro)]
['chainId' (numb chain-id.ro)]
==
::
++ azimuth-config
|= config=^azimuth-config
^- json
%- pairs
['refreshRate' (numb (div refresh-rate.config ~s1))]~
::
++ hex
|= [p=@ q=@]
^- json
@ -578,11 +586,11 @@
[%result id (hist-txs:to-json (scry u.address))]
::
++ get-config
|= [id=@t params=(map @t json) =roller-config]
|= [id=@t params=(map @t json) config=[azimuth-config roller-config]]
^- response:rpc
?. =((lent ~(tap by params)) 0)
~(params error:json-rpc id)
[%result id (config:to-json roller-config)]
[%result id (roller-config:to-json config)]
::
++ hash-transaction
|= [id=@t params=(map @t json) chain-id=@]
@ -609,4 +617,11 @@
?. =((lent ~(tap by params)) 0)
~(params error:json-rpc id)
[%result id (naive-state:to-json state)]
::
++ get-refresh
|= [id=@t params=(map @t json) =azimuth-config]
^- response:rpc
?. =((lent ~(tap by params)) 0)
~(params error:json-rpc id)
[%result id (azimuth-config:to-json azimuth-config)]
--

View File

@ -6,10 +6,15 @@
+$ owner [=proxy:naive =address:naive]
+$ owners (jug owner ship)
::
+$ azimuth-config
$: refresh-rate=@dr
==
::
+$ roller-config
$: next-batch=time
frequency=@dr
refresh-time=@dr
resend-time=@dr
update-rate=@dr
contract=@ux
chain-id=@
==