squash! naive: l2 csv refactoring for readability

This commit is contained in:
drbeefsupreme 2022-03-24 19:12:54 -04:00
parent b0cee44497
commit 61e70c928b
No known key found for this signature in database
GPG Key ID: B70D5683DE7F9EFC

View File

@ -98,16 +98,16 @@
=/ pax=path /naive-exports/csv :: data will be saved here =/ pax=path /naive-exports/csv :: data will be saved here
=/ m (strand ,vase) =/ m (strand ,vase)
^- form:m ^- form:m
;< logs=events bind:m (scry events /gx/azimuth/logs/noun) ;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ logs (scag 50 logs) :: to make debugging faster =/ events (scag 50 events) :: to make debugging faster
=/ [naive-contract=address chain-id=@] =/ [naive-contract=address chain-id=@]
[naive chain-id]:(get-network:dice net) [naive chain-id]:(get-network:dice net)
=/ snap=snap-state:dice snap =/ snap=snap-state:dice snap
%- %- slog :_ ~ %- %- slog :_ ~
leaf+"processing {<net>} ethereum logs with {<(lent logs)>} events" leaf+"processing {<net>} ethereum logs with {<(lent events)>} events"
:: ::
=/ =rolls-map =/ =rolls-map
(compute-effects nas.snap logs net naive-contract chain-id) (compute-effects nas.snap events net naive-contract chain-id)
:: I think this should work, but child threads seem to be broken :: I think this should work, but child threads seem to be broken
:: ;< =thread-result bind:m :: ;< =thread-result bind:m
:: %+ await-thread :: %+ await-thread
@ -341,7 +341,7 @@
:: determine whether the transactions were valid. :: determine whether the transactions were valid.
++ compute-effects ++ compute-effects
|= $: nas=^state:naive |= $: nas=^state:naive
logs=events =events
=net =net
naive-contract=address naive-contract=address
chain-id=@ud chain-id=@ud
@ -352,11 +352,11 @@
leaf+"processing state transitions beginning from stored snapshot" leaf+"processing state transitions beginning from stored snapshot"
:: ::
|- |-
?~ logs out ?~ events out
=/ log=event-log:rpc:ethereum i.logs =/ log=event-log:rpc:ethereum i.events
?~ mined.log ?~ mined.log
~& >> 'empty log' ~& >> 'empty log'
$(logs t.logs) $(events t.events)
=/ block=blocknum block-number.u.mined.log =/ block=blocknum block-number.u.mined.log
=/ =^input:naive =/ =^input:naive
:- block :- block
@ -370,7 +370,7 @@
=^ =effects:naive nas =^ =effects:naive nas
(%*(. naive lac |) verifier:naive-tx chain-id nas input) (%*(. naive lac |) verifier:naive-tx chain-id nas input)
%= $ %= $
logs t.logs events t.events
out ?. =(%bat +<.input) out ?. =(%bat +<.input)
out :: skip L1 logs out :: skip L1 logs
:: there's probably a better way to do this :: there's probably a better way to do this