azimuth: correctly load snapshot on boot

This commit is contained in:
Philip Monk 2021-11-09 00:22:32 -08:00
parent 45c1693085
commit ea199bfba9
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
3 changed files with 18 additions and 10 deletions

View File

@ -6,10 +6,16 @@
default-agent,
verb,
dbug
:: Generally don't update the snapshot until we have clay tombstoning.
:: To update, run:
:: =e -build-file %/lib/ethereum/hoon
:: =l .^((list event-log:rpc:e) %gx /=azimuth=/logs/noun)
:: */app/azimuth/logs/eth-logs &eth-logs l
::
/* snap %eth-logs /app/azimuth/logs/eth-logs
::
=/ last-snap :: maybe just use the last one?
%+ roll `(list event-log:rpc:ethereum)`~ ::snap
%+ roll `(list event-log:rpc:ethereum)`snap ::~
|= [log=event-log:rpc:ethereum last=@ud]
?~ mined.log
last
@ -24,7 +30,7 @@
+$ app-state
$: %0
url=@ta
net=network
=net
whos=(set ship)
nas=^state:naive
own=owners
@ -37,11 +43,10 @@
[%listen whos=(list ship) =source:jael]
:: %watch: configure node url and network
::
[%watch url=@ta net=network]
[%watch url=@ta =net]
==
::
+$ tagged-diff [=id:block diff:naive]
+$ network ?(%mainnet %ropsten %local)
+$ card card:agent:gall
:: TODO: add to state?
::
@ -117,9 +122,12 @@
net.state net.poke
url.state url.poke
own.state ~
logs.state ~
logs.state ?:(?=(%default net.poke) snap ~)
==
[start:do this]
%- %- slog :_ ~
leaf+"azimuth: loading snapshot with {<(lent logs.state)>} events"
=^ snap-cards state (run-logs:do logs.state)
[(weld (jael-update:do (to-udiffs:do snap-cards)) start:do) this]
==
::
++ on-watch
@ -314,11 +322,11 @@
[%give %fact ~[/event] %naive-diffs !>(+.tag)]
::
++ get-network
|= =network
|= =net
^- [azimuth=@ux naive=@ux chain-id=@ launch=@]
=< [azimuth naive chain-id launch]
=, azimuth
?- network
?- net
%mainnet mainnet-contracts
%ropsten ropsten-contracts
%local local-contracts

View File

@ -1,4 +1,4 @@
:: Change node url and network for azimuth
:- %say
|= [* [url=@ta net=?(%mainnet %ropsten %local) ~] ~]
|= [* [url=@ta net=?(%mainnet %ropsten %local %default) ~] ~]
[%azimuth-poke %watch url net]

View File

@ -5,7 +5,7 @@
|%
+$ owner [=proxy:naive =address:naive]
+$ owners (jug owner ship)
+$ net ?(%mainnet %ropsten %local)
+$ net ?(%mainnet %ropsten %local %default)
::
+$ config
$% [%frequency frequency=@dr]