mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 22:01:46 +03:00
naive: l2 csv export csv file
passes to clay to ask it to write the csv to disk
This commit is contained in:
parent
0f8ea20ac0
commit
0786f62e8b
@ -117,8 +117,10 @@
|
|||||||
(run-logs-from-state-map nas.snap logs net naive-contract chain-id)
|
(run-logs-from-state-map nas.snap logs net naive-contract chain-id)
|
||||||
=/ rolling=block-map (collate-roll-data blocks block-jar rolls-map timestamps tx-data)
|
=/ rolling=block-map (collate-roll-data blocks block-jar rolls-map timestamps tx-data)
|
||||||
=/ flat (flatten-data rolling)
|
=/ flat (flatten-data rolling)
|
||||||
|
=/ csv=(list cord) (make-csv flat)
|
||||||
|
;< ~ bind:m (export-csv csv)
|
||||||
::
|
::
|
||||||
(pure:m !>(flat))
|
(pure:m !>(csv))
|
||||||
::
|
::
|
||||||
++ collate-roll-data
|
++ collate-roll-data
|
||||||
|= $: blocks=(list blocknum)
|
|= $: blocks=(list blocknum)
|
||||||
@ -158,14 +160,9 @@
|
|||||||
|- ^- (list tx-data)
|
|- ^- (list tx-data)
|
||||||
?~ blocks tx-list
|
?~ blocks tx-list
|
||||||
=/ block=blocknum i.blocks
|
=/ block=blocknum i.blocks
|
||||||
=/ val=[timestamp=@da rolls=(map keccak [[gas=@ud sender=address] =effects:naive])]
|
=/ bor (~(got by block-map) block)
|
||||||
(~(got by block-map) block)
|
|
||||||
=/ timestamp timestamp.val
|
|
||||||
=/ block-rolls rolls.val
|
|
||||||
:: =/ [timestamp block-rolls]
|
|
||||||
:: [timestamp rolls]:(~(got by block-map) block)
|
|
||||||
=/ roll-list=(list keccak)
|
=/ roll-list=(list keccak)
|
||||||
~(tap in ~(key by block-rolls))
|
~(tap in ~(key by rolls.bor))
|
||||||
=| block-tx-list=(list tx-data)
|
=| block-tx-list=(list tx-data)
|
||||||
:: recurse through each roll, getting the transaction data from the effects
|
:: recurse through each roll, getting the transaction data from the effects
|
||||||
|-
|
|-
|
||||||
@ -176,7 +173,7 @@
|
|||||||
==
|
==
|
||||||
=/ roll-hash=keccak i.roll-list
|
=/ roll-hash=keccak i.roll-list
|
||||||
=/ roll=[[gas=@ud sender=address] =effects:naive]
|
=/ roll=[[gas=@ud sender=address] =effects:naive]
|
||||||
(~(got by block-rolls) roll-hash)
|
(~(got by rolls.bor) roll-hash)
|
||||||
:: recurse through the list of effects, building up transaction data as we
|
:: recurse through the list of effects, building up transaction data as we
|
||||||
:: go. there's a choice here to use the effects, or the submitted
|
:: go. there's a choice here to use the effects, or the submitted
|
||||||
:: raw-tx. the effects include whether or not a transaction failed,
|
:: raw-tx. the effects include whether or not a transaction failed,
|
||||||
@ -191,8 +188,8 @@
|
|||||||
:: what nonce was actually submitted without the private key of the signer.
|
:: what nonce was actually submitted without the private key of the signer.
|
||||||
=| roll-tx-list=(list tx-data)
|
=| roll-tx-list=(list tx-data)
|
||||||
=| nonce-and-tx=[_| _|]
|
=| nonce-and-tx=[_| _|]
|
||||||
=/ =tx-data :* block timestamp sender.roll roll-hash *keccak *ship
|
=/ =tx-data :* block timestamp.bor sender.roll roll-hash *keccak
|
||||||
*proxy:naive *nonce:naive gas.roll *@ | *action
|
*ship *proxy:naive *nonce:naive gas.roll *@ | *action
|
||||||
==
|
==
|
||||||
|-
|
|-
|
||||||
:: if we've gotten both the %nonce and %tx diff from a transaction, add the
|
:: if we've gotten both the %nonce and %tx diff from a transaction, add the
|
||||||
@ -238,74 +235,61 @@
|
|||||||
~& >> '%tx associated to a different ship than %nonce!'
|
~& >> '%tx associated to a different ship than %nonce!'
|
||||||
!!
|
!!
|
||||||
%= $
|
%= $
|
||||||
+.nonce-and-tx &
|
+.nonce-and-tx &
|
||||||
effects.roll t.effects.roll
|
effects.roll t.effects.roll
|
||||||
length.tx-data -.raw.raw-tx.diff
|
length.tx-data -.raw.raw-tx.diff
|
||||||
tx-hash.tx-data (hash-raw-tx:naive-tx raw-tx.diff)
|
tx-hash.tx-data (hash-raw-tx:naive-tx raw-tx.diff)
|
||||||
action.tx-data +<.tx.raw-tx.diff
|
action.tx-data +<.tx.raw-tx.diff
|
||||||
suc.tx-data ?~ err.diff & |
|
suc.tx-data ?~ err.diff & |
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
:: ++ flatten-data
|
++ export-csv
|
||||||
:: :: Takes in rolls-map and makes it suitable to be saved as a csv
|
|= in=(list cord)
|
||||||
:: |= =rolls-map
|
=/ m (strand ,~)
|
||||||
:: =/ blocks=(list blocknum) ~(tap in ~(key by rolls-map))
|
^- form:m
|
||||||
:: =| data=(list (list @t))
|
;< =bowl:spider bind:m get-bowl
|
||||||
:: :- %- crip
|
=- (send-raw-card %pass / %arvo %c %info -)
|
||||||
:: ;: weld
|
%+ foal:space:userlib
|
||||||
:: "block number,"
|
/(scot %p our.bowl)/base/(scot %da now.bowl)/naive-exports/csv/txt
|
||||||
:: "timestamp,"
|
[%txt !>(in)]
|
||||||
:: "roller addres,"
|
::
|
||||||
:: "roll hash,"
|
++ make-csv
|
||||||
:: ::"tx hash,"
|
:: Takes in rolls-map and makes it suitable to be saved as a csv
|
||||||
:: "sending ship,"
|
|= in=(list tx-data)
|
||||||
:: "sending proxy,"
|
^- (list cord)
|
||||||
:: "nonce,"
|
:- %- crip
|
||||||
:: "gas price,"
|
;: weld
|
||||||
:: "length of input data,"
|
"block number,"
|
||||||
:: "success or failure,"
|
"timestamp,"
|
||||||
:: "function name"
|
"roller addres,"
|
||||||
:: ==
|
"roll hash,"
|
||||||
:: :: TODO: four nested traps is a bit much. figure out something better
|
"tx hash,"
|
||||||
:: |-
|
"sending ship,"
|
||||||
:: ?~ blocks data
|
"sending proxy,"
|
||||||
:: =/ block=blocknum i.blocks
|
"nonce,"
|
||||||
:: =/ timestamp=@da timestamp:(~(got by rolls-map) block)
|
"gas price,"
|
||||||
:: =/ roll-list=(list keccak) ~(tap in ~(key by rolls:(~(got by rolls-map) block)))
|
"length of input data,"
|
||||||
:: =| tx-by-roll=(list @t)
|
"success or failure,"
|
||||||
:: |-
|
"function name"
|
||||||
:: ?~ roll-list tx-by-roll
|
==
|
||||||
:: =/ txh=keccak i.roll-list
|
%+ turn in
|
||||||
:: ::=/ [gas=@da sender=address] -:(~(got by (~(got by rolls-map) block)) txh)
|
|= =tx-data
|
||||||
:: =+ -:(~(got by (~(got by rolls-map) block)) txh)
|
%- crip
|
||||||
:: =/ cur-batch=effects:naive effects:(~(got by (~(got by rolls-map) block) txh))
|
;: weld
|
||||||
:: :: a given transaction in a batch has several diffs: a %nonce, followed by a %tx, and then
|
(scow %ux block.tx-data) ","
|
||||||
:: :: one or more %points. I think...
|
(scow %da timestamp.tx-data) ","
|
||||||
:: :: This assumes that the %tx following a %nonce come from the same transaction.
|
(scow %ux roller.tx-data) ","
|
||||||
:: |-
|
(scow %ux roll-hash.tx-data) ","
|
||||||
:: ?~ cur-batch stuff
|
(scow %ux tx-hash.tx-data) ","
|
||||||
:: =/ effect=diff:naive i.cur-batch
|
(scow %p sender.tx-data) ","
|
||||||
:: =| [=ship:naive =proxy:naive =nonce:naive length=@ud suc=? function=@tas done=_%.n]
|
(scow %tas proxy.tx-data) ","
|
||||||
:: |- :: iterate until you get both a %nonce and a %tx
|
(scow %ud nonce.tx-data) ","
|
||||||
:: ?- effect
|
(scow %ud gas.tx-data) ","
|
||||||
:: [%nonce *] =. nonce nonce.effect ^$(cur-batch t.cur-batch)
|
(scow %$ length.tx-data) ","
|
||||||
:: [%tx *] =:
|
(scow %f suc.tx-data) ","
|
||||||
:: [%operator *] $(cur-batch t.cur-batch)
|
(scow %tas action.tx-data)
|
||||||
:: [%dns *] $(cur-batch t.cur-batch)
|
==
|
||||||
:: [%point *]
|
|
||||||
:: =/ glue-diffs=(list effects:naive)
|
|
||||||
:: |-
|
|
||||||
:: =| =effects:naive
|
|
||||||
:: ?~
|
|
||||||
:: %- crip
|
|
||||||
:: ;: weld
|
|
||||||
:: (scow %ux block)
|
|
||||||
:: (scow %da timestamp)
|
|
||||||
:: (scow %ux address)
|
|
||||||
:: (scow %ux txh)
|
|
||||||
:: :: transaction hash
|
|
||||||
:: (scow %p ship)
|
|
||||||
::
|
::
|
||||||
++ get-tx-data
|
++ get-tx-data
|
||||||
:: retrieves transaction receipts for rolls, extracting the gas cost and sender
|
:: retrieves transaction receipts for rolls, extracting the gas cost and sender
|
||||||
|
Loading…
Reference in New Issue
Block a user