naive: snapshot improvements

This commit is contained in:
Philip Monk 2021-04-20 21:57:04 -07:00
parent 05b281e247
commit 1b5bc0f476
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
6 changed files with 48 additions and 15 deletions

View File

@ -23,7 +23,7 @@
==
::
:: history: newest block first, oldest event first
+$ history (list loglist)
+$ history (list loglist)
--
::
:: Helpers
@ -462,7 +462,6 @@
++ release-logs
|= [=path dog=watchdog]
^- (quip card watchdog)
~& > release-logs=pending-logs.dog
?: (lth number.dog 0) :: TODO: 30!
`dog
=/ rel-number (sub number.dog 0) :: TODO: 30!

View File

@ -1,5 +1,12 @@
/- eth-watcher
/+ ethereum, azimuth, naive, default-agent, verb, dbug
/* snap %eth-logs /app/naive/logs/eth-logs
=/ last-snap :: maybe just use the last one?
%+ roll snap
|= [log=event-log:rpc:ethereum last=@ud]
?~ mined.log
last
(max block-number.u.mined.log last)
=, jael
|%
++ app-state
@ -50,27 +57,20 @@
++ run-logs
|= [nas=^state:naive logs=(list event-log:rpc:ethereum)]
^- [(list tagged-diff) ^state:naive]
~& > run-logs=logs
?~ logs
~& >> %done
`nas
?~ mined.i.logs
~& >> %majored
$(logs t.logs)
=^ raw-effects nas
=/ =^input:naive
?: =(azimuth:contracts:azimuth address.i.logs)
~& >> %amizuth
=/ data (data-to-hex data.i.logs)
=/ =event-log:naive
[address.i.logs data topics.i.logs]
[%log event-log]
~& >> %layer-2
?~ input.u.mined.i.logs
~& [%strange-no-batch-2 i.logs]
[%bat *@]
?. =(0x2688.7f26 (end [3 4] (swp 5 u.input.u.mined.i.logs)))
~& [%strange-no-batch-3 i.logs `@ux`(end [3 4] (swp 5 u.input.u.mined.i.logs))]
[%bat *@]
[%bat (rsh [3 4] u.input.u.mined.i.logs)]
=/ res (mule |.((%*(. naive lac |) verifier nas input)))
@ -123,8 +123,8 @@
:+ %watch /[dap]
^- config:eth-watcher
:* url.state =(%czar (clan:title our)) ~m5 ~h30
launch:contracts:azimuth
~ :: ~[azimuth:contracts:azimuth]
(max launch:contracts:azimuth last-snap)
~[azimuth:contracts:azimuth]
~[naive:contracts:azimuth]
(topics whos.state)
==
@ -190,13 +190,23 @@
?: =(%noun mark)
?+ q.vase !!
%rerun
~& [%rerunning (lent logs.state)]
=^ effects nas.state (run-logs *^state:naive logs.state)
`this
::
%resub
:_ this :_ ~
[%pass /eth-watcher %agent [our.bowl %eth-watcher] %watch /logs/[dap.bowl]]
::
%resnap
=. logs.state snap
$(mark %noun, vase !>(%rerun))
==
?: =(%eth-logs mark)
=+ !<(logs=(list event-log:rpc:ethereum) vase)
=. logs.state logs
$(mark %noun, vase !>(%rerun))
::
?. ?=(%azimuth-tracker-poke mark)
(on-poke:def mark vase)
=+ !<(poke=poke-data vase)

View File

@ -78,7 +78,7 @@
:: # constants
::
:: contract addresses
++ contracts local-contracts
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract

View File

@ -10,6 +10,10 @@
:: - When depositing, clear proxies (maybe require reset)
:: - Maybe require that we're not depositing from a contract?
::
:: TODO: wraps and identities are verified at the beginning but
:: executed later. that's no good, since the ownership could change
:: throughout the wrap or batch.
::
:: TODO: can an L1 star adopt an L2 planet? It's not obvious how --
:: maybe they need to adopt as an L2 transaction? That sounds right I
:: think. Can an L2 star adopt an L1 planet? I guess, but L1 wouldn't

View File

@ -0,0 +1,20 @@
:: list of ethereum logs
::
/+ ethereum
::
|_ logs=(list event-log:rpc:ethereum)
++ grab
|%
++ noun (list event-log:rpc:ethereum)
++ mime
|= [mite =octs]
(noun (cue q.octs))
--
::
++ grow
|%
++ mime
[/application/x-ethereum-logs (as-octs:mimes:html (jam logs))]
--
++ grad %mime
--

View File

@ -84,10 +84,11 @@
^- form:m
~& > [%zoom-start number.pup latest-number]
=/ zoom-margin=number:block 0 :: TODO: 30!
=/ zoom-step=number:block 10.000
=/ zoom-step=number:block 100.000
?: (lth latest-number (add number.pup zoom-margin))
(pure:m pup)
=/ up-to-number=number:block (sub latest-number zoom-margin)
=/ up-to-number=number:block
(min (add 1.000.000 number.pup) (sub latest-number zoom-margin))
|-
~& > [%zooming number.pup up-to-number]
=* loop $
@ -117,7 +118,6 @@
number.pup
to-number
==
~& > [%zoom-loglist loglist]
=? pending-logs.pup ?=(^ loglist)
(~(put by pending-logs.pup) to-number loglist)
loop(number.pup +(to-number))