mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 04:11:49 +03:00
jael: add "eager" mode to avoid hitting nodes as much
This commit is contained in:
parent
15bd35301e
commit
18c3e7253b
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:04735cc4764f9a3e6c4fb5b046a6b9590664fe9f644578c58f3bc6acc911b723
|
oid sha256:3f516fece44715fff856766856ad61abf1b9164a0ba9f80f63f23da9d21df1cc
|
||||||
size 9606039
|
size 9617783
|
||||||
|
@ -88,7 +88,8 @@
|
|||||||
^- card:agent:gall
|
^- card:agent:gall
|
||||||
=/ args=vase !>
|
=/ args=vase !>
|
||||||
:* %watch /[dap]
|
:* %watch /[dap]
|
||||||
url.state ~m5 launch:contracts:azimuth
|
url.state =(~ whos.state) ~m5
|
||||||
|
launch:contracts:azimuth
|
||||||
~[azimuth:contracts:azimuth]
|
~[azimuth:contracts:azimuth]
|
||||||
(topics whos.state)
|
(topics whos.state)
|
||||||
==
|
==
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
=> |%
|
=> |%
|
||||||
+$ card card:agent:gall
|
+$ card card:agent:gall
|
||||||
+$ app-state
|
+$ app-state
|
||||||
$: %2
|
$: %3
|
||||||
dogs=(map path watchdog)
|
dogs=(map path watchdog)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -92,17 +92,52 @@
|
|||||||
%- (slog leaf+"upgrading eth-watcher from %1" ~)
|
%- (slog leaf+"upgrading eth-watcher from %1" ~)
|
||||||
:_ old-state(- %2)
|
:_ old-state(- %2)
|
||||||
%+ turn ~(tap by dogs.old-state)
|
%+ turn ~(tap by dogs.old-state)
|
||||||
|= [=path dog=watchdog]
|
|= [=path dog=watchdog-1]
|
||||||
(wait-shortcut path now.bowl)
|
(wait-shortcut path now.bowl)
|
||||||
::
|
::
|
||||||
[cards-1 this(state ?>(?=(%2 -.old-state) old-state))]
|
=? old-state ?=(%2 -.old-state)
|
||||||
|
%- (slog leaf+"upgrading eth-watcher from %2" ~)
|
||||||
|
^- app-state
|
||||||
|
%= old-state
|
||||||
|
- %3
|
||||||
|
dogs
|
||||||
|
%- ~(run by dogs.old-state)
|
||||||
|
|= dog=watchdog-1
|
||||||
|
%= dog
|
||||||
|
-> [| ->.dog]
|
||||||
|
==
|
||||||
|
==
|
||||||
|
::
|
||||||
|
[cards-1 this(state ?>(?=(%3 -.old-state) old-state))]
|
||||||
::
|
::
|
||||||
+$ app-states
|
+$ app-states
|
||||||
$%(app-state-0 app-state-1 app-state)
|
$%(app-state-0 app-state-1 app-state-2 app-state)
|
||||||
|
::
|
||||||
|
+$ app-state-2
|
||||||
|
$: %2
|
||||||
|
dogs=(map path watchdog-1)
|
||||||
|
==
|
||||||
::
|
::
|
||||||
+$ app-state-1
|
+$ app-state-1
|
||||||
$: %1
|
$: %1
|
||||||
dogs=(map path watchdog)
|
dogs=(map path watchdog-1)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ watchdog-1
|
||||||
|
$: config-1
|
||||||
|
running=(unit =tid:spider)
|
||||||
|
=number:block
|
||||||
|
=pending-logs
|
||||||
|
=history
|
||||||
|
blocks=(list block)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
+$ config-1
|
||||||
|
$: url=@ta
|
||||||
|
refresh-rate=@dr
|
||||||
|
from=number:block
|
||||||
|
contracts=(list address:ethereum)
|
||||||
|
=topics
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ app-state-0
|
+$ app-state-0
|
||||||
@ -218,6 +253,9 @@
|
|||||||
::
|
::
|
||||||
[%x %dogs ~]
|
[%x %dogs ~]
|
||||||
``noun+!>(~(key by dogs.state))
|
``noun+!>(~(key by dogs.state))
|
||||||
|
::
|
||||||
|
[%x %dogs %configs ~]
|
||||||
|
``noun+!>((~(run by dogs.state) |=(=watchdog -.watchdog)))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-agent
|
++ on-agent
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|%
|
|%
|
||||||
+$ config
|
+$ config
|
||||||
$: url=@ta
|
$: url=@ta
|
||||||
|
eager=?
|
||||||
refresh-rate=@dr
|
refresh-rate=@dr
|
||||||
from=number:block
|
from=number:block
|
||||||
contracts=(list address:ethereum)
|
contracts=(list address:ethereum)
|
||||||
|
@ -77,8 +77,11 @@
|
|||||||
$% $: %a :: to %ames
|
$% $: %a :: to %ames
|
||||||
$>(%plea task:able:ames) :: send request message
|
$>(%plea task:able:ames) :: send request message
|
||||||
== ::
|
== ::
|
||||||
$: %g :: to self
|
$: %b :: to %behn
|
||||||
$>(%deal task:able:gall) :: set ethereum source
|
$>(%wait task:able:behn) :: set timer
|
||||||
|
== ::
|
||||||
|
$: %g :: to %gall
|
||||||
|
$>(%deal task:able:gall) :: talk to app
|
||||||
== ::
|
== ::
|
||||||
$: %j :: to self
|
$: %j :: to self
|
||||||
$>(%listen task) :: set ethereum source
|
$>(%listen task) :: set ethereum source
|
||||||
@ -91,11 +94,14 @@
|
|||||||
:: ::
|
:: ::
|
||||||
+$ sign :: in result $<-
|
+$ sign :: in result $<-
|
||||||
$~ [%a %done ~] ::
|
$~ [%a %done ~] ::
|
||||||
$% $: %a
|
$% $: %a ::
|
||||||
$% $>(%boon gift:able:ames) :: message response
|
$% $>(%boon gift:able:ames) :: message response
|
||||||
$>(%done gift:able:ames) :: message (n)ack
|
$>(%done gift:able:ames) :: message (n)ack
|
||||||
$>(%lost gift:able:ames) :: lost boon
|
$>(%lost gift:able:ames) :: lost boon
|
||||||
== ==
|
== == ::
|
||||||
|
$: %b ::
|
||||||
|
$>(%wake gift:able:behn) ::
|
||||||
|
== ::
|
||||||
$: %g ::
|
$: %g ::
|
||||||
$> $? %onto ::
|
$> $? %onto ::
|
||||||
%unto ::
|
%unto ::
|
||||||
@ -298,7 +304,7 @@
|
|||||||
(~(gas by points) spon-points)
|
(~(gas by points) spon-points)
|
||||||
=. +>.$
|
=. +>.$
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(public-keys:~(feel su hen our pki etn) %full points)
|
(public-keys:~(feel su hen our now pki etn) %full points)
|
||||||
::
|
::
|
||||||
:: start subscriptions
|
:: start subscriptions
|
||||||
::
|
::
|
||||||
@ -310,16 +316,16 @@
|
|||||||
?- (clan:title our)
|
?- (clan:title our)
|
||||||
%czar
|
%czar
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
|
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
|
||||||
::
|
::
|
||||||
*
|
*
|
||||||
=. +>.$
|
=. +>.$
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
%+ sources:~(feel su hen our pki etn)
|
%+ sources:~(feel su hen our now pki etn)
|
||||||
(silt (turn spon-points head))
|
(silt (turn spon-points head))
|
||||||
[%| %azimuth-tracker]
|
[%| %azimuth-tracker]
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(sources:~(feel su hen our pki etn) ~ [%& (need spon-ship)])
|
(sources:~(feel su hen our now pki etn) ~ [%& (need spon-ship)])
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
=. moz
|
=. moz
|
||||||
@ -388,7 +394,7 @@
|
|||||||
%listen
|
%listen
|
||||||
~& [%jael-listen whos source]:tac
|
~& [%jael-listen whos source]:tac
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(sources:~(feel su hen our pki etn) [whos source]:tac)
|
(sources:~(feel su hen our now pki etn) [whos source]:tac)
|
||||||
::
|
::
|
||||||
:: cancel all trackers from duct
|
:: cancel all trackers from duct
|
||||||
:: {$nuke whos=(set ship)}
|
:: {$nuke whos=(set ship)}
|
||||||
@ -420,7 +426,7 @@
|
|||||||
::
|
::
|
||||||
%rekey
|
%rekey
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(private-keys:~(feel su hen our pki etn) life.tac ring.tac)
|
(private-keys:~(feel su hen our now pki etn) life.tac ring.tac)
|
||||||
::
|
::
|
||||||
:: update private keys
|
:: update private keys
|
||||||
::
|
::
|
||||||
@ -432,14 +438,14 @@
|
|||||||
~& [%not-our-moon ship.tac]
|
~& [%not-our-moon ship.tac]
|
||||||
+>.$
|
+>.$
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(~(new-event su hen our pki etn) [ship udiff]:tac)
|
(~(new-event su hen our now pki etn) [ship udiff]:tac)
|
||||||
::
|
::
|
||||||
:: watch public keys
|
:: watch public keys
|
||||||
:: [%public-keys ships=(set ship)]
|
:: [%public-keys ships=(set ship)]
|
||||||
::
|
::
|
||||||
%public-keys
|
%public-keys
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(~(public-keys ~(feed su hen our pki etn) hen) ships.tac)
|
(~(public-keys ~(feed su hen our now pki etn) hen) ships.tac)
|
||||||
::
|
::
|
||||||
:: seen after breach
|
:: seen after breach
|
||||||
:: [%meet our=ship who=ship]
|
:: [%meet our=ship who=ship]
|
||||||
@ -475,7 +481,7 @@
|
|||||||
:: {$private-keys $~}
|
:: {$private-keys $~}
|
||||||
::
|
::
|
||||||
%private-keys
|
%private-keys
|
||||||
(curd abet:~(private-keys ~(feed su hen our pki etn) hen))
|
(curd abet:~(private-keys ~(feed su hen our now pki etn) hen))
|
||||||
::
|
::
|
||||||
%wegh
|
%wegh
|
||||||
%_ +>
|
%_ +>
|
||||||
@ -529,13 +535,26 @@
|
|||||||
[%a %boon *]
|
[%a %boon *]
|
||||||
=+ ;; [%public-keys-result =public-keys-result] payload.hin
|
=+ ;; [%public-keys-result =public-keys-result] payload.hin
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(public-keys:~(feel su hen our pki etn) public-keys-result)
|
(public-keys:~(feel su hen our now pki etn) public-keys-result)
|
||||||
::
|
::
|
||||||
[%a %lost *]
|
[%a %lost *]
|
||||||
:: TODO: better error handling
|
:: TODO: better error handling
|
||||||
::
|
::
|
||||||
~| %jael-ames-lost
|
~| %jael-ames-lost
|
||||||
!!
|
!!
|
||||||
|
::
|
||||||
|
[%b %wake *]
|
||||||
|
?^ error.hin
|
||||||
|
%- %+ slog
|
||||||
|
leaf+"jael unable to resubscribe, run :azimuth-tracker|listen"
|
||||||
|
u.error.hin
|
||||||
|
+>.$
|
||||||
|
?> ?=([%breach @ ~] tea)
|
||||||
|
=/ =source-id (slav %ud i.t.tea)
|
||||||
|
=/ =source (~(got by sources.etn) source-id)
|
||||||
|
=/ ships (~(get ju ship-sources-reverse.etn) source-id)
|
||||||
|
%- curd =< abet
|
||||||
|
(sources:~(feel su hen our now pki etn) ships source)
|
||||||
::
|
::
|
||||||
[%g %onto *]
|
[%g %onto *]
|
||||||
~& [%jael-onto tea hin]
|
~& [%jael-onto tea hin]
|
||||||
@ -561,7 +580,7 @@
|
|||||||
=* app i.tea
|
=* app i.tea
|
||||||
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
|
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
|
||||||
%- curd =< abet
|
%- curd =< abet
|
||||||
(~(new-event su hen our pki etn) peer-sign)
|
(~(new-event su hen our now pki etn) peer-sign)
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
:: :: ++curd:of
|
:: :: ++curd:of
|
||||||
@ -587,14 +606,15 @@
|
|||||||
=| moz=(list move)
|
=| moz=(list move)
|
||||||
=| $: hen=duct
|
=| $: hen=duct
|
||||||
our=ship
|
our=ship
|
||||||
|
now=@da
|
||||||
state-pki
|
state-pki
|
||||||
state-eth-node
|
state-eth-node
|
||||||
==
|
==
|
||||||
:: moz: moves in reverse order
|
:: moz: moves in reverse order
|
||||||
:: pki: relative urbit state
|
:: pki: relative urbit state
|
||||||
::
|
::
|
||||||
=* pki ->+<
|
=* pki ->+>-
|
||||||
=* etn ->+>
|
=* etn ->+>+
|
||||||
|%
|
|%
|
||||||
++ this-su .
|
++ this-su .
|
||||||
:: :: ++abet:su
|
:: :: ++abet:su
|
||||||
@ -811,9 +831,18 @@
|
|||||||
?& ?=(^ point)
|
?& ?=(^ point)
|
||||||
(gth rift.point.i.pointl rift.u.point)
|
(gth rift.point.i.pointl rift.u.point)
|
||||||
==
|
==
|
||||||
%+ public-keys-give
|
=. ..feel
|
||||||
(subscribers-on-ship who.i.pointl)
|
%+ public-keys-give
|
||||||
[%breach who.i.pointl]
|
(subscribers-on-ship who.i.pointl)
|
||||||
|
[%breach who.i.pointl]
|
||||||
|
=/ sor (~(get by sources-reverse) %& who.i.pointl)
|
||||||
|
?~ sor
|
||||||
|
..feel
|
||||||
|
:: delay resubscribing because Ames is going to clear any
|
||||||
|
:: messages we send now.
|
||||||
|
::
|
||||||
|
(emit hen %pass /breach/(scot %ud u.sor) %b %wait now)
|
||||||
|
::
|
||||||
=. ..feel
|
=. ..feel
|
||||||
%+ public-keys-give
|
%+ public-keys-give
|
||||||
(subscribers-on-ship who.i.pointl)
|
(subscribers-on-ship who.i.pointl)
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
;< =latest=block bind:m (get-latest-block:ethio url.pup)
|
;< =latest=block bind:m (get-latest-block:ethio url.pup)
|
||||||
;< pup=watchpup bind:m (zoom pup number.id.latest-block)
|
;< pup=watchpup bind:m (zoom pup number.id.latest-block)
|
||||||
=| vows=disavows
|
=| vows=disavows
|
||||||
|
?. eager.pup
|
||||||
|
(pure:m !>([vows pup]))
|
||||||
|- ^- form:m
|
|- ^- form:m
|
||||||
=* loop $
|
=* loop $
|
||||||
?: (gth number.pup number.id.latest-block)
|
?: (gth number.pup number.id.latest-block)
|
||||||
@ -72,7 +74,7 @@
|
|||||||
::
|
::
|
||||||
:: Zooming doesn't go forward one block at a time. As a
|
:: Zooming doesn't go forward one block at a time. As a
|
||||||
:: consequence, it cannot detect and handle reorgs. Only use it
|
:: consequence, it cannot detect and handle reorgs. Only use it
|
||||||
:: at a safe distance -- 500 blocks ago is probably sufficient.
|
:: at a safe distance -- 100 blocks ago is probably sufficient.
|
||||||
::
|
::
|
||||||
++ zoom
|
++ zoom
|
||||||
|= [pup=watchpup =latest=number:block]
|
|= [pup=watchpup =latest=number:block]
|
||||||
|
Loading…
Reference in New Issue
Block a user