From 4fda4527fb68d297d177b998e16643d8c4956078 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 27 Feb 2019 00:41:12 +0100 Subject: [PATCH 01/13] Add more contract addresses and block numbers --- sys/zuse.hoon | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/zuse.hoon b/sys/zuse.hoon index 6689b8a27b..b9ef8b58be 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -7194,9 +7194,19 @@ :: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten ++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet :: + ++ linear-star-release + 0x86cd.9cd0.992f.0423.1751.e376.1de4.5cec.ea5d.1801 + :: + ++ conditional-star-release + 0x8c24.1098.c3d3.498f.e126.1421.633f.d579.86d7.4aea + :: :: launch: block number of azimuth deploy :: ++ launch 6.784.800 + :: + :: public: block number of azimuth becoming independent + :: + ++ public 7.033.765 -- :: :: hashes of ship event signatures From 7c88bd94f07551ee00f7fc1aecd0dfe0a54df70f Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 27 Feb 2019 00:45:38 +0100 Subject: [PATCH 02/13] Implement minimum viable Azimuth analytics --- app/gaze.hoon | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 app/gaze.hoon diff --git a/app/gaze.hoon b/app/gaze.hoon new file mode 100644 index 0000000000..2e48ab5bdc --- /dev/null +++ b/app/gaze.hoon @@ -0,0 +1,102 @@ +:: gaze: azimuth analytics +:: +/+ *eth-watcher +:: +=, ethereum +=, azimuth +:: +|% +++ state + $: logs=loglist + == +:: +:: +++ move (pair bone card) +++ card + $% [%poke wire [ship %eth-watcher] %eth-watcher-action action] + == +-- +:: +|_ [bowl:gall state] +++ prep + |= old=(unit state) + ?~ old + [~ ..prep] + [~ ..prep(+<+ u.old)] +:: +++ poke-noun + |= a=?(%look %simple) + ^- (quip move _+>) + ?- a + %look + :_ +>.$ + :_ ~ + ^- move + :- ost + :* %poke + `wire`/look + `[ship %eth-watcher]`[our %eth-watcher] + %eth-watcher-action + :: + ^- action + :+ %watch dap + :* (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) + public:contracts + ~ + ~[azimuth:contracts] + ~ + == + == + :: + %simple + =/ loz=loglist + .^(loglist %gx /(scot %p our)/eth-watcher/(scot %da now)/[dap]/noun) + :: lockup: ships that went into lockup + :: + =/ lockup=(set ship) + %- ~(gas in *(set ship)) + %+ murn loz + |= log=event-log:rpc + ^- (unit ship) + =+ dif=(event-log-to-point-diff log) + ?~ dif ~ + =* diz q.u.dif + ?. ?=(%owner -.diz) ~ + ?: =(linear-star-release:contracts new.diz) `p.u.dif + ?: =(conditional-star-release:contracts new.diz) `p.u.dif + ~ + :: + =+ activated=(filter loz activated:azimuth-events lockup) + =+ spawned=(filter loz spawned:azimuth-events lockup) + =+ transfer=(filter loz owner-changed:azimuth-events lockup) + =+ transfer-u=(~(gas in *(set ship)) transfer) + =+ rekeyed=(filter loz changed-keys:azimuth-events lockup) + =+ rekeyed-u=(~(gas in *(set ship)) rekeyed) + ~& ;: weld + "Since launch, there have been: " + "- {<(lent activated)>} points activated " + "(out of {<(lent spawned)>} spawned), " + "- {<(sub (sub (lent transfer) (lent spawned)) (lent activated))>} point transfers " + "({<(sub ~(wyt in transfer-u) (lent spawned))>} unique), " + "- {<(lent rekeyed)>} key configurations " + "({<~(wyt in rekeyed-u)>} unique)." + == + [~ +>.$] + == +:: +:: filter: find ships that were the subject of some :event +:: +++ filter + |= [logs=loglist event=@ux exclude=(set ship)] + %+ murn logs + |= log=event-log:rpc + ^- (unit ship) + ?. =(event i.topics.log) ~ + =+ dif=(event-log-to-point-diff log) + ?~ dif ~ + =/ who + ?: ?=(%spawned -.q.u.dif) who.q.u.dif + p.u.dif + ?: (~(has in exclude) who) ~ + `who +-- From 863723774c26c09576fe71b2dc45f6472fd3432a Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 4 Mar 2019 22:39:20 +0100 Subject: [PATCH 03/13] Update Gaze to track events as they happen and process them into diffs --- app/gaze.hoon | 231 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 210 insertions(+), 21 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 2e48ab5bdc..1f01413727 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -1,5 +1,10 @@ :: gaze: azimuth analytics :: +::TODO daily stats, but also sane longer-period stats +:: probably convert block numbers to day, then store difs by day +:: every day, week, and month, append entry to csv file with stat counters +:: not on a timer, but whenever we see a block belogns to the next day/week etc +:: /+ *eth-watcher :: =, ethereum @@ -7,17 +12,36 @@ :: |% ++ state - $: logs=loglist + $: :: qued: event logs waiting on block timestamp, oldest first + ::TODO do we actually gain anything by oldest first? + :: it's baked into the logic now... + :: time: timstamps of block numbers + :: seen: events sorted by timestamp + :: + qued=loglist + time=(map @ud @da) + seen=(list [wen=@da wat=event]) + == +:: +++ event + $% [%azimuth who=ship dif=diff-point] + ::TODO [%invites *] == :: :: ++ move (pair bone card) ++ card - $% [%poke wire [ship %eth-watcher] %eth-watcher-action action] + $% [%hiss wire (unit user:eyre) mark %hiss hiss:eyre] + :: [%wait wire @da] + :: [%rest @da] + [%poke wire [ship %eth-watcher] %eth-watcher-action action] + [%peer wire [ship %eth-watcher] path] == -- :: |_ [bowl:gall state] +++ node-url (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) +:: ++ prep |= old=(unit state) ?~ old @@ -25,27 +49,38 @@ [~ ..prep(+<+ u.old)] :: ++ poke-noun - |= a=?(%look %simple) + |= a=?(%kick-watcher %regaze %simple %debug) ^- (quip move _+>) ?- a - %look + %kick-watcher :_ +>.$ - :_ ~ - ^- move - :- ost - :* %poke - `wire`/look - `[ship %eth-watcher]`[our %eth-watcher] - %eth-watcher-action - :: - ^- action - :+ %watch dap - :* (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) - public:contracts - ~ - ~[azimuth:contracts] - ~ - == + :~ + :- ost + :* %poke + /look + [our %eth-watcher] + %eth-watcher-action + :: + ^- action + :+ %watch dap + :* node-url + public:contracts + ~ + ~[azimuth:contracts] + ~ + == + == + == + :: + %regaze + :_ +>.$(qued ~, seen ~) + :~ + :- ost + :* %peer + /look + [our %eth-watcher] + /[dap] + == == :: %simple @@ -82,9 +117,16 @@ "({<~(wyt in rekeyed-u)>} unique)." == [~ +>.$] + :: + %debug + ~& latest=(turn (scag 10 seen) head) + ~& oldest=(turn (slag (sub (lent seen) 10) seen) head) + ~& time=~(wyt by time) + ~& qued=(lent qued) + [~ +>.$] == :: -:: filter: find ships that were the subject of some :event +:: +filter: find ships that were the subject of some :event :: ++ filter |= [logs=loglist event=@ux exclude=(set ship)] @@ -99,4 +141,151 @@ p.u.dif ?: (~(has in exclude) who) ~ `who +:: +:: +locked: set of galaxies whose stars got locked up +:: +++ locked + %- ~(gas in *(set ship)) + :~ ~sev + ~wes + == +:: +:: +diff-eth-watcher-update: process new logs, clear state on rollback +:: +++ diff-eth-watcher-update + |= [=wire =^update] + ^- (quip move _+>) + =^ logs +>.$ + ?- -.update + %snap ~& [%got-snap (lent logs.snapshot.update)] + [logs.snapshot.update +>.$(qued ~, seen ~)] + %logs ~& [%got-logs (lent loglist.update)] + [loglist.update +>.$] + == + ?~ logs [~ +>.$] + =- =^ moz +>.$ (queue-logs mistime) + [moz (process-logs havtime)] + ^- [havtime=loglist mistime=loglist] + %+ skid `loglist`logs + |= log=event-log:rpc + %- ~(has by time) + block-number:(need mined.log) +:: +:: +queue-logs: hold on to new logs, requesting timestamps for them +:: +++ queue-logs + |= logs=loglist + ^- (quip move _+>) + ?~ logs [~ +>] + :- [(request-timestamps logs) ~] + +>(qued (weld qued (flop logs))) +:: +:: +request-timestamps: request block timestamps for the logs as necessary +:: +++ request-timestamps + |= logs=loglist + ^- move + =- [ost %hiss /timestamps ~ %json-rpc-response %hiss -] + ^- hiss:eyre + %+ json-request:rpc node-url + :- %a + ^- (list json) + %+ turn + ^- (list @ud) + =- ~(tap in -) + %- ~(gas in *(set @ud)) + ^- (list @ud) + %+ turn logs + |= log=event-log:rpc + block-number:(need mined.log) + |= num=@ud + ^- json + ~! *request:rpc + %+ request-to-json:rpc + `(scot %ud num) + [%eth-get-block-by-number num |] +:: +++ sigh-json-rpc-response + |= [=wire =response:rpc:jstd] + ^- (quip move _+>) + ?> ?=([%timestamps ~] wire) + ?: ?=(?(%error %fail) -.response) + ~? ?=(%error -.response) [%rpc-error +.response] + ~? ?=(%fail -.response) [%httr-fail hit.response] + ~& %retrying-timestamps + [[(request-timestamps qued) ~] +>] + ?> ?=(%batch -.response) + =- [~ (process-logs(time -, qued ~) qued)] + %- ~(gas by time) + :: for every result, get the block number and timestamp + :: + %+ turn bas.response + |= res=response:rpc:jstd + ^- (pair @ud @da) + ~| res + ?> ?=(%result -.res) + ~| id.res + :- (slav %ud id.res) + %- from-unix:chrono:userlib + %- parse-hex-result:rpc + ?> ?=(%o -.res.res) + (~(got by p.res.res) 'timestamp') +:: +:: +process logs that are in the queue +:: +++ process-logs + |= logs=loglist + ^+ +> + =- +>.$(qued (flop rest), seen (weld (flop logs) seen)) + %+ roll logs + |= [log=event-log:rpc rest=loglist logs=(list [@da event])] + =/ tim=(unit @da) + %- ~(get by time) + block-number:(need mined.log) + ?~ tim [[log rest] logs] + :- rest + =+ ven=(event-log-to-event log) + ?~ ven logs + [[u.tim u.ven] logs] +:: +++ event-log-to-event + |= log=event-log:rpc + ^- (unit event) + ?: =(azimuth:contracts address.log) + =+ (event-log-to-point-diff log) + ?~ - ~ + :: ignore initial events for locked up stars + :: + ::TODO do this filtering earlier, so we don't ask for unnecessary blocks + =; ignore=? ?:(ignore ~ `azimuth+u) + =* who=@p p.u + =* dif=diff-point q.u ::TODO want to use below, but mint-cove + :: ignore spawning of locked up stars + :: + ?| ?& (~(has in locked) who) + ?=(%spawned -.q.u) + == + :: + :: ignore spawn-transfer events of locked up stars + :: + ?& (~(has in locked) (^sein:title who)) + :: + ?| ?=(%activated -.q.u) + :: + ?& ?=(%owner -.q.u) + :: + ?| =(new.q.u linear-star-release:contracts) + =(new.q.u conditional-star-release:contracts) + == + == + == + == + == + ::TODO delegated sending support + ~ +:: +:: +export: generate a csv with per-period +:: +++ export + ~ -- From c6b3fd7fdfc0f9cd0d2f81c656bebf9106cc62a9 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 5 Mar 2019 19:47:18 +0100 Subject: [PATCH 04/13] Keep track of event stats per day --- app/gaze.hoon | 198 +++++++++++++++++++++++++------------------------- 1 file changed, 101 insertions(+), 97 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 1f01413727..6a25cfd51b 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -13,14 +13,16 @@ |% ++ state $: :: qued: event logs waiting on block timestamp, oldest first - ::TODO do we actually gain anything by oldest first? - :: it's baked into the logic now... :: time: timstamps of block numbers - :: seen: events sorted by timestamp + :: seen: events sorted by timestamp, newest first + :: days: stats by day, newest first + :: lock: when ships got locked up :: qued=loglist time=(map @ud @da) seen=(list [wen=@da wat=event]) + days=(list [day=@da sat=stats]) + lock=(map @p @da) == :: ++ event @@ -28,6 +30,13 @@ ::TODO [%invites *] == :: +++ stats + $: activated=(list @p) + spawned=(list @p) + transferred=(list @p) + configured=(list @p) + == +:: :: ++ move (pair bone card) ++ card @@ -44,12 +53,12 @@ :: ++ prep |= old=(unit state) - ?~ old + :: ?~ old [~ ..prep] - [~ ..prep(+<+ u.old)] + :: [~ ..prep(+<+ u.old)] :: ++ poke-noun - |= a=?(%kick-watcher %regaze %simple %debug) + |= a=?(%kick-watcher %regaze %debug) ^- (quip move _+>) ?- a %kick-watcher @@ -82,74 +91,23 @@ /[dap] == == - :: - %simple - =/ loz=loglist - .^(loglist %gx /(scot %p our)/eth-watcher/(scot %da now)/[dap]/noun) - :: lockup: ships that went into lockup - :: - =/ lockup=(set ship) - %- ~(gas in *(set ship)) - %+ murn loz - |= log=event-log:rpc - ^- (unit ship) - =+ dif=(event-log-to-point-diff log) - ?~ dif ~ - =* diz q.u.dif - ?. ?=(%owner -.diz) ~ - ?: =(linear-star-release:contracts new.diz) `p.u.dif - ?: =(conditional-star-release:contracts new.diz) `p.u.dif - ~ - :: - =+ activated=(filter loz activated:azimuth-events lockup) - =+ spawned=(filter loz spawned:azimuth-events lockup) - =+ transfer=(filter loz owner-changed:azimuth-events lockup) - =+ transfer-u=(~(gas in *(set ship)) transfer) - =+ rekeyed=(filter loz changed-keys:azimuth-events lockup) - =+ rekeyed-u=(~(gas in *(set ship)) rekeyed) - ~& ;: weld - "Since launch, there have been: " - "- {<(lent activated)>} points activated " - "(out of {<(lent spawned)>} spawned), " - "- {<(sub (sub (lent transfer) (lent spawned)) (lent activated))>} point transfers " - "({<(sub ~(wyt in transfer-u) (lent spawned))>} unique), " - "- {<(lent rekeyed)>} key configurations " - "({<~(wyt in rekeyed-u)>} unique)." - == - [~ +>.$] :: %debug ~& latest=(turn (scag 10 seen) head) ~& oldest=(turn (slag (sub (lent seen) 10) seen) head) + ~& :- 'order is' + =- ?:(sane 'sane' 'insane') + %+ roll seen + |= [[this=@da *] last=@da sane=?] + :- this + ?: =(*@da last) & + (lte this last) ~& time=~(wyt by time) ~& qued=(lent qued) + ~& days=(scag 5 days) [~ +>.$] == :: -:: +filter: find ships that were the subject of some :event -:: -++ filter - |= [logs=loglist event=@ux exclude=(set ship)] - %+ murn logs - |= log=event-log:rpc - ^- (unit ship) - ?. =(event i.topics.log) ~ - =+ dif=(event-log-to-point-diff log) - ?~ dif ~ - =/ who - ?: ?=(%spawned -.q.u.dif) who.q.u.dif - p.u.dif - ?: (~(has in exclude) who) ~ - `who -:: -:: +locked: set of galaxies whose stars got locked up -:: -++ locked - %- ~(gas in *(set ship)) - :~ ~sev - ~wes - == -:: :: +diff-eth-watcher-update: process new logs, clear state on rollback :: ++ diff-eth-watcher-update @@ -164,7 +122,10 @@ == ?~ logs [~ +>.$] =- =^ moz +>.$ (queue-logs mistime) - [moz (process-logs havtime)] + ~& [%put-in-queue (lent qued)] + =. +>.$ (process-logs havtime) + ~& [%put-in-queue2 (lent qued)] + [moz +>.$] ^- [havtime=loglist mistime=loglist] %+ skid `loglist`logs |= log=event-log:rpc @@ -219,6 +180,8 @@ %- ~(gas by time) :: for every result, get the block number and timestamp :: + ~& [%got-times (lent bas.response)] + ~& [%still-in-queue (lent qued)] %+ turn bas.response |= res=response:rpc:jstd ^- (pair @ud @da) @@ -236,17 +199,20 @@ ++ process-logs |= logs=loglist ^+ +> - =- +>.$(qued (flop rest), seen (weld (flop logs) seen)) + =- ~& [%processed (lent -)] + %_ +>.$ + seen (weld (flop -) seen) + days (count-events -) + == + ~& [%processing (lent logs)] %+ roll logs - |= [log=event-log:rpc rest=loglist logs=(list [@da event])] - =/ tim=(unit @da) - %- ~(get by time) + |= [log=event-log:rpc logs=(list [wen=@da wat=event])] + =/ tim=@da + %- ~(got by time) block-number:(need mined.log) - ?~ tim [[log rest] logs] - :- rest =+ ven=(event-log-to-event log) ?~ ven logs - [[u.tim u.ven] logs] + [[tim u.ven] logs] :: ++ event-log-to-event |= log=event-log:rpc @@ -258,34 +224,72 @@ :: ::TODO do this filtering earlier, so we don't ask for unnecessary blocks =; ignore=? ?:(ignore ~ `azimuth+u) - =* who=@p p.u - =* dif=diff-point q.u ::TODO want to use below, but mint-cove - :: ignore spawning of locked up stars - :: - ?| ?& (~(has in locked) who) - ?=(%spawned -.q.u) - == - :: - :: ignore spawn-transfer events of locked up stars - :: - ?& (~(has in locked) (^sein:title who)) - :: - ?| ?=(%activated -.q.u) - :: - ?& ?=(%owner -.q.u) - :: - ?| =(new.q.u linear-star-release:contracts) - =(new.q.u conditional-star-release:contracts) - == - == - == - == - == + ::TODO check against lock map + | ::TODO delegated sending support ~ :: +:: +count-events: add events to the daily stats +:: +++ count-events + |= logs=_seen :: oldest first + ^+ days + =/ head=[day=@da sat=stats] + ?^ days i.days + *[@da stats] + =+ tail=?~(days ~ t.days) + |- + :: when done, store updated head, but only if it's set + :: + ?~ logs + ?: =(*[@da stats] head) tail + [head tail] + =* log i.logs + :: calculate day for current event, set head if unset + :: + =/ day=@da + (sub wen.log (mod wen.log ~d1)) + =? day.head =(*@da day.head) day + :: same day as head, so add to it + :: + ?: =(day day.head) + %_ $ + sat.head (count-event wat.log sat.head) + logs t.logs + == + ~| [%weird-new-day old=day.head new=day] + ?> (gth day day.head) + :: newer day than head of days, so start new head + :: + %_ $ + tail [head tail] + head [day *stats] + == +:: +:: +count-event: add event to the stats, if it's relevant +:: +++ count-event + |= [eve=event sat=stats] + ^- stats + ?> ?=(%azimuth -.eve) + ?+ -.dif.eve sat + %activated sat(activated [who.eve activated.sat]) + %spawned sat(spawned [who.dif.eve spawned.sat]) + %owner sat(transferred [who.eve transferred.sat]) + %keys sat(configured [who.eve configured.sat]) + == +:: +:: +find-lockups: search the seen event log for lockup events +:: +:: lockup events are identified by a transfer to either the linear or +:: conditional star release contract. a timestamp of the lockup transfer +:: is saved so that we can discard all events prior to it. +:: +++ find-lockups + ~ ::TODO +:: :: +export: generate a csv with per-period :: ++ export - ~ + ~ ::TODO -- From 7e26b9351d59383f964a06f8f3c421116a999cef Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 5 Mar 2019 20:50:04 +0100 Subject: [PATCH 05/13] Track more stats, support export through scry --- app/gaze.hoon | 88 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 12 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 6a25cfd51b..13c738cd64 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -31,10 +31,17 @@ == :: ++ stats - $: activated=(list @p) - spawned=(list @p) + $: spawned=(list @p) + activated=(list @p) + transfer-p=(list @p) transferred=(list @p) configured=(list @p) + breached=(list @p) + request=(list @p) + sponsor=(list @p) + management-p=(list @p) + voting-p=(list @p) + spawn-p=(list @p) == :: :: @@ -52,7 +59,7 @@ ++ node-url (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) :: ++ prep - |= old=(unit state) + |= old=(unit *) ::state) :: ?~ old [~ ..prep] :: [~ ..prep(+<+ u.old)] @@ -108,6 +115,14 @@ [~ +>.$] == :: +++ peek-x + |= pax=path + ^- (unit (unit [mark *])) + ?~ pax ~ + ?. =(%days i.pax) ~ + :^ ~ ~ %txt + export +:: :: +diff-eth-watcher-update: process new logs, clear state on rollback :: ++ diff-eth-watcher-update @@ -122,9 +137,7 @@ == ?~ logs [~ +>.$] =- =^ moz +>.$ (queue-logs mistime) - ~& [%put-in-queue (lent qued)] =. +>.$ (process-logs havtime) - ~& [%put-in-queue2 (lent qued)] [moz +>.$] ^- [havtime=loglist mistime=loglist] %+ skid `loglist`logs @@ -202,7 +215,7 @@ =- ~& [%processed (lent -)] %_ +>.$ seen (weld (flop -) seen) - days (count-events -) + days (count-events (flop -)) == ~& [%processing (lent logs)] %+ roll logs @@ -273,10 +286,20 @@ ^- stats ?> ?=(%azimuth -.eve) ?+ -.dif.eve sat - %activated sat(activated [who.eve activated.sat]) - %spawned sat(spawned [who.dif.eve spawned.sat]) - %owner sat(transferred [who.eve transferred.sat]) - %keys sat(configured [who.eve configured.sat]) + %spawned sat(spawned [who.dif.eve spawned.sat]) + %activated sat(activated [who.eve activated.sat]) + %transfer-proxy ?: =(0x0 new.dif.eve) sat + sat(transfer-p [who.eve transfer-p.sat]) + %owner sat(transferred [who.eve transferred.sat]) + %keys sat(configured [who.eve configured.sat]) + %continuity sat(breached [who.eve breached.sat]) + %escape ?~ new.dif.eve sat + sat(request [who.eve request.sat]) + %sponsor ?. has.new.dif.eve sat + sat(sponsor [who.eve sponsor.sat]) + %management-proxy sat(management-p [who.eve management-p.sat]) + %voting-proxy sat(voting-p [who.eve voting-p.sat]) + %spawn-proxy sat(spawn-p [who.eve spawn-p.sat]) == :: :: +find-lockups: search the seen event log for lockup events @@ -288,8 +311,49 @@ ++ find-lockups ~ ::TODO :: -:: +export: generate a csv with per-period +:: +export: generate a csv of stats per day :: ++ export - ~ ::TODO + :- %- crip + ;: weld + "date," + "spawned," + "activated," + "transfer proxy," + "transferred," + "transferred (unique)," + "configured," + "configured (unique)," + "escape request," + "sponsor change" + == + |^ ^- (list @t) + %+ turn days + |= [day=@da stats] + %- crip + ;: weld + (scow %da day) "," + (count spawned) "," + (count activated) "," + (count transfer-p) "," + (unique transferred) "," + (unique configured) "," + (count request) "," + (count sponsor) + == + :: + ++ count + |* l=(list) + (num (lent l)) + :: + ++ unique + |* l=(list) + ;: weld + (count l) + "," + (num ~(wyt in (~(gas in *(set)) l))) + == + :: + ++ num (d-co:co 1) + -- -- From 3e6f61da809899ac18685c379b4c31adfc06c63f Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 5 Mar 2019 22:36:56 +0100 Subject: [PATCH 06/13] Support exporting monthly statistics --- app/gaze.hoon | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 13c738cd64..a4fcd8a79c 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -59,10 +59,10 @@ ++ node-url (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) :: ++ prep - |= old=(unit *) ::state) - :: ?~ old + |= old=(unit state) + ?~ old [~ ..prep] - :: [~ ..prep(+<+ u.old)] + [~ ..prep(+<+ u.old)] :: ++ poke-noun |= a=?(%kick-watcher %regaze %debug) @@ -119,9 +119,39 @@ |= pax=path ^- (unit (unit [mark *])) ?~ pax ~ - ?. =(%days i.pax) ~ - :^ ~ ~ %txt - export + ?: =(%days i.pax) + :^ ~ ~ %txt + (export days) + ?: =(%months i.pax) + :^ ~ ~ %txt + %- export + ^+ days + %+ roll (flop days) + |= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])] + ^+ mos + =/ mod=@da + %- year + =+ (yore day) + -(d.t 1) + ?~ mos [mod sat]~ + ?: !=(mod mod.i.mos) + [[mod sat] mos] + :_ t.mos + :- mod + ::TODO this is hideous. can we make a wet gate do this? + :* (weld spawned.sat spawned.sat.i.mos) + (weld activated.sat activated.sat.i.mos) + (weld transfer-p.sat transfer-p.sat.i.mos) + (weld transferred.sat transferred.sat.i.mos) + (weld configured.sat configured.sat.i.mos) + (weld breached.sat breached.sat.i.mos) + (weld request.sat request.sat.i.mos) + (weld sponsor.sat sponsor.sat.i.mos) + (weld management-p.sat management-p.sat.i.mos) + (weld voting-p.sat voting-p.sat.i.mos) + (weld spawn-p.sat spawn-p.sat.i.mos) + == + ~ :: :: +diff-eth-watcher-update: process new logs, clear state on rollback :: @@ -314,6 +344,7 @@ :: +export: generate a csv of stats per day :: ++ export + |= =_days :- %- crip ;: weld "date," From ae2d640061cc7b2e246e3fc4918a840475ef3229 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 6 Mar 2019 21:15:38 +0100 Subject: [PATCH 07/13] Fix list ordering, do lockup filtering But the lockup filtering doesn't seem to work quite right yet. --- app/gaze.hoon | 78 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index a4fcd8a79c..e52e22856c 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -166,11 +166,11 @@ [loglist.update +>.$] == ?~ logs [~ +>.$] - =- =^ moz +>.$ (queue-logs mistime) - =. +>.$ (process-logs havtime) + =- =^ moz +>.$ (queue-logs mistime) :: oldest first + =. +>.$ (process-logs havtime) :: oldest first [moz +>.$] ^- [havtime=loglist mistime=loglist] - %+ skid `loglist`logs + %+ skid (flop `loglist`logs) :: put oldest first |= log=event-log:rpc %- ~(has by time) block-number:(need mined.log) @@ -178,11 +178,11 @@ :: +queue-logs: hold on to new logs, requesting timestamps for them :: ++ queue-logs - |= logs=loglist + |= logs=loglist :: oldest first ^- (quip move _+>) ?~ logs [~ +>] :- [(request-timestamps logs) ~] - +>(qued (weld qued (flop logs))) + +>(qued (weld qued logs)) :: :: +request-timestamps: request block timestamps for the logs as necessary :: @@ -221,10 +221,10 @@ ?> ?=(%batch -.response) =- [~ (process-logs(time -, qued ~) qued)] %- ~(gas by time) + =/ max=@ud + (roll ~(tap in ~(key by time)) max) :: for every result, get the block number and timestamp :: - ~& [%got-times (lent bas.response)] - ~& [%still-in-queue (lent qued)] %+ turn bas.response |= res=response:rpc:jstd ^- (pair @ud @da) @@ -239,23 +239,32 @@ :: :: +process logs that are in the queue :: +:: ++ process-logs - |= logs=loglist + |= logs=loglist :: oldest first ^+ +> - =- ~& [%processed (lent -)] + ?~ logs +> + =- =< .(seen remove-lockups) %_ +>.$ - seen (weld (flop -) seen) - days (count-events (flop -)) + qued (flop rest) :: oldest first + seen (weld logs seen) :: newest first + days (count-events (flop logs)) :: oldest first + lock (find-lockups logs) == - ~& [%processing (lent logs)] - %+ roll logs - |= [log=event-log:rpc logs=(list [wen=@da wat=event])] - =/ tim=@da - %- ~(got by time) + %+ roll `loglist`logs + |= [log=event-log:rpc rest=loglist logs=(list [wen=@da wat=event])] + :: to ensure logs are processed in sane order, + :: stop processing as soon as we skipped one + :: + ?^ rest [[log rest] logs] + =/ tim=(unit @da) + %- ~(get by time) block-number:(need mined.log) + ?~ tim [[log rest] logs] + :- rest =+ ven=(event-log-to-event log) ?~ ven logs - [[tim u.ven] logs] + [[u.tim u.ven] logs] :: ++ event-log-to-event |= log=event-log:rpc @@ -339,7 +348,40 @@ :: is saved so that we can discard all events prior to it. :: ++ find-lockups - ~ ::TODO + |= =_seen + ^+ lock + %- ~(gas in lock) + %+ murn seen + |= [wen=@da wat=event] + ^- (unit [@p @da]) + :: ?. ?=(%azimuth -.wat) ~ + ?+ -.dif.wat ~ + %owner + ?. ?| =(linear-star-release:contracts new.dif.wat) + =(conditional-star-release:contracts new.dif.wat) + == + ~ + `[who.wat wen] + == +:: +++ remove-lockups + ^+ seen + ~& [%removing ~(wyt by lock)] + %+ murn seen + |= ven=[wen=@da wat=event] + ^- (unit _ven) + :: ?. ?=(%azimuth -.wat.ven) `ven + =+ who=(who-from-event wat.ven) + =+ lok=(~(get by lock) who) + ?~ lok `ven + ?: (lte wen.ven u.lok) ~ + `ven +:: +++ who-from-event + |= eve=event + ?+ -.dif.eve who.eve + %spawned who.dif.eve + == :: :: +export: generate a csv of stats per day :: From 49f7f2a9c854387a98c3dd0708e758f3a541af2c Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 8 Mar 2019 15:29:11 +0100 Subject: [PATCH 08/13] Do lockup exclusion in a much dumber way --- app/gaze.hoon | 90 ++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 55 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index e52e22856c..a4d6c782d4 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -16,13 +16,11 @@ :: time: timstamps of block numbers :: seen: events sorted by timestamp, newest first :: days: stats by day, newest first - :: lock: when ships got locked up :: qued=loglist time=(map @ud @da) seen=(list [wen=@da wat=event]) days=(list [day=@da sat=stats]) - lock=(map @p @da) == :: ++ event @@ -65,11 +63,11 @@ [~ ..prep(+<+ u.old)] :: ++ poke-noun - |= a=?(%kick-watcher %regaze %debug) + |= a=?(%kick-watcher %regaze %losetime %debug) ^- (quip move _+>) ?- a %kick-watcher - :_ +>.$ + :_ +>.$(qued ~, seen ~, days ~, time ~) :~ :- ost :* %poke @@ -89,7 +87,7 @@ == :: %regaze - :_ +>.$(qued ~, seen ~) + :_ +>.$(qued ~, seen ~, days ~) :~ :- ost :* %peer @@ -98,10 +96,13 @@ /[dap] == == + :: + %losetime + [~ +>.$(time ~)] :: %debug - ~& latest=(turn (scag 10 seen) head) - ~& oldest=(turn (slag (sub (lent seen) 10) seen) head) + ~& latest=(turn (scag 5 seen) head) + ~& oldest=(turn (slag (sub (lent seen) 5) seen) head) ~& :- 'order is' =- ?:(sane 'sane' 'insane') %+ roll seen @@ -111,7 +112,7 @@ (lte this last) ~& time=~(wyt by time) ~& qued=(lent qued) - ~& days=(scag 5 days) + ~& days=(lent days) [~ +>.$] == :: @@ -169,11 +170,16 @@ =- =^ moz +>.$ (queue-logs mistime) :: oldest first =. +>.$ (process-logs havtime) :: oldest first [moz +>.$] - ^- [havtime=loglist mistime=loglist] - %+ skid (flop `loglist`logs) :: put oldest first - |= log=event-log:rpc - %- ~(has by time) - block-number:(need mined.log) + :: sort based on timstamp known, throw out lockup logs + :: + %+ roll `loglist`logs + |= [log=event-log:rpc havtime=loglist mistime=loglist] + ^+ [havtime mistime] + =+ bon=block-number:(need mined.log) + ?: (is-lockup-block bon) [havtime mistime] + ?: (~(has by time) bon) + [[log havtime] mistime] + [havtime [log mistime]] :: :: +queue-logs: hold on to new logs, requesting timestamps for them :: @@ -244,12 +250,10 @@ |= logs=loglist :: oldest first ^+ +> ?~ logs +> - =- =< .(seen remove-lockups) - %_ +>.$ + =- %_ +>.$ qued (flop rest) :: oldest first seen (weld logs seen) :: newest first days (count-events (flop logs)) :: oldest first - lock (find-lockups logs) == %+ roll `loglist`logs |= [log=event-log:rpc rest=loglist logs=(list [wen=@da wat=event])] @@ -272,12 +276,7 @@ ?: =(azimuth:contracts address.log) =+ (event-log-to-point-diff log) ?~ - ~ - :: ignore initial events for locked up stars - :: - ::TODO do this filtering earlier, so we don't ask for unnecessary blocks - =; ignore=? ?:(ignore ~ `azimuth+u) - ::TODO check against lock map - | + `azimuth+u ::TODO delegated sending support ~ :: @@ -341,41 +340,22 @@ %spawn-proxy sat(spawn-p [who.eve spawn-p.sat]) == :: -:: +find-lockups: search the seen event log for lockup events +:: +is-lockup-block: whether the block contains lockup/ignorable transactions :: -:: lockup events are identified by a transfer to either the linear or -:: conditional star release contract. a timestamp of the lockup transfer -:: is saved so that we can discard all events prior to it. +:: this is the stupid dumb equivalent to actually identifying lockup +:: transactions procedurally, which is still in git history, but didn't +:: work quite right for unidentified reasons :: -++ find-lockups - |= =_seen - ^+ lock - %- ~(gas in lock) - %+ murn seen - |= [wen=@da wat=event] - ^- (unit [@p @da]) - :: ?. ?=(%azimuth -.wat) ~ - ?+ -.dif.wat ~ - %owner - ?. ?| =(linear-star-release:contracts new.dif.wat) - =(conditional-star-release:contracts new.dif.wat) - == - ~ - `[who.wat wen] - == -:: -++ remove-lockups - ^+ seen - ~& [%removing ~(wyt by lock)] - %+ murn seen - |= ven=[wen=@da wat=event] - ^- (unit _ven) - :: ?. ?=(%azimuth -.wat.ven) `ven - =+ who=(who-from-event wat.ven) - =+ lok=(~(get by lock) who) - ?~ lok `ven - ?: (lte wen.ven u.lok) ~ - `ven +++ is-lockup-block + |= num=@ud + ^- ? + %+ roll + ^- (list [@ud @ud]) + :~ [7.050.978 7.051.038] + == + |= [[start=@ud end=@ud] in=_|] + ?: in & + &((gte num start) (lte num end)) :: ++ who-from-event |= eve=event From 945d74de865b46f69ad24a3199c2db8bfba9b542 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 8 Mar 2019 16:18:40 +0100 Subject: [PATCH 09/13] Support exporting "raw" event logs --- app/gaze.hoon | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/app/gaze.hoon b/app/gaze.hoon index a4d6c782d4..810b43da7c 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -152,6 +152,8 @@ (weld voting-p.sat voting-p.sat.i.mos) (weld spawn-p.sat spawn-p.sat.i.mos) == + ?: =(%raw i.pax) + ``txt+export-raw ~ :: :: +diff-eth-watcher-update: process new logs, clear state on rollback @@ -409,4 +411,48 @@ :: ++ num (d-co:co 1) -- +:: +:: +export-raw: generate a csv of individual transactions +:: +++ export-raw + :- %- crip + ;: weld + "date," + "point," + "event," + "field 1" + == + |^ ^- (list @t) + %+ turn seen + |= [wen=@da wat=event] + %- crip + ;: weld + (scow %da wen) "," + (pon who.wat) "," + (point-diff-to-row dif.wat) + == + :: + ++ point-diff-to-row + |= dif=diff-point + ?- -.dif + %full "full," + %owner "owner,{(adr new.dif)}" + %activated "activated," + %spawned "spawned,{(pon who.dif)}" + %keys "keys,{(num life.dif)}" + %continuity "breached,{(num new.dif)}" + %sponsor "sponsor,{(spo has.new.dif)} {(pon who.new.dif)}" + %escape "escape-req,{(req new.dif)}" + %management-proxy "management-p,{(adr new.dif)}" + %voting-proxy "voting-p,{(adr new.dif)}" + %spawn-proxy "spawn-p,{(adr new.dif)}" + %transfer-proxy "transfer-p,{(adr new.dif)}" + == + :: + ++ num (d-co:co 1) + ++ pon (cury scow %p) + ++ adr ['0' 'x' (x-co:co 20)] + ++ spo |=(h=? ?:(h "escaped to" "detached from")) + ++ req |=(r=(unit @p) ?~(r "canceled" (pon u.r))) + -- -- From 62c87f5fba5ad216ca6ddd6a2369e6f018274649 Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 8 Mar 2019 16:51:10 +0100 Subject: [PATCH 10/13] Shuffle arms around, add comments --- app/gaze.hoon | 139 ++++++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 66 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 810b43da7c..bbb86a9820 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -62,8 +62,14 @@ [~ ..prep] [~ ..prep(+<+ u.old)] :: +:: +poke-noun: do a thing +:: +:: %kick-watcher: reset, tell %eth-watcher to look for events for us +:: %regaze: reset (but keep timestamps), subscribe to eth-watcher +:: %debug: print debug info +:: ++ poke-noun - |= a=?(%kick-watcher %regaze %losetime %debug) + |= a=?(%kick-watcher %regaze %debug) ^- (quip move _+>) ?- a %kick-watcher @@ -96,9 +102,6 @@ /[dap] == == - :: - %losetime - [~ +>.$(time ~)] :: %debug ~& latest=(turn (scag 5 seen) head) @@ -116,46 +119,6 @@ [~ +>.$] == :: -++ peek-x - |= pax=path - ^- (unit (unit [mark *])) - ?~ pax ~ - ?: =(%days i.pax) - :^ ~ ~ %txt - (export days) - ?: =(%months i.pax) - :^ ~ ~ %txt - %- export - ^+ days - %+ roll (flop days) - |= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])] - ^+ mos - =/ mod=@da - %- year - =+ (yore day) - -(d.t 1) - ?~ mos [mod sat]~ - ?: !=(mod mod.i.mos) - [[mod sat] mos] - :_ t.mos - :- mod - ::TODO this is hideous. can we make a wet gate do this? - :* (weld spawned.sat spawned.sat.i.mos) - (weld activated.sat activated.sat.i.mos) - (weld transfer-p.sat transfer-p.sat.i.mos) - (weld transferred.sat transferred.sat.i.mos) - (weld configured.sat configured.sat.i.mos) - (weld breached.sat breached.sat.i.mos) - (weld request.sat request.sat.i.mos) - (weld sponsor.sat sponsor.sat.i.mos) - (weld management-p.sat management-p.sat.i.mos) - (weld voting-p.sat voting-p.sat.i.mos) - (weld spawn-p.sat spawn-p.sat.i.mos) - == - ?: =(%raw i.pax) - ``txt+export-raw - ~ -:: :: +diff-eth-watcher-update: process new logs, clear state on rollback :: ++ diff-eth-watcher-update @@ -183,6 +146,23 @@ [[log havtime] mistime] [havtime [log mistime]] :: +:: +is-lockup-block: whether the block contains lockup/ignorable transactions +:: +:: this is the stupid dumb equivalent to actually identifying lockup +:: transactions procedurally, which is still in git history, but didn't +:: work quite right for unidentified reasons +:: +++ is-lockup-block + |= num=@ud + ^- ? + %+ roll + ^- (list [@ud @ud]) + :~ [7.050.978 7.051.038] + == + |= [[start=@ud end=@ud] in=_|] + ?: in & + &((gte num start) (lte num end)) +:: :: +queue-logs: hold on to new logs, requesting timestamps for them :: ++ queue-logs @@ -217,6 +197,8 @@ `(scot %ud num) [%eth-get-block-by-number num |] :: +:: +sigh-json-rpc-response: get block details, extract timestamps +:: ++ sigh-json-rpc-response |= [=wire =response:rpc:jstd] ^- (quip move _+>) @@ -247,7 +229,6 @@ :: :: +process logs that are in the queue :: -:: ++ process-logs |= logs=loglist :: oldest first ^+ +> @@ -272,6 +253,8 @@ ?~ ven logs [[u.tim u.ven] logs] :: +:: +event-log-to-event: turn raw log into gaze noun +:: ++ event-log-to-event |= log=event-log:rpc ^- (unit event) @@ -342,32 +325,56 @@ %spawn-proxy sat(spawn-p [who.eve spawn-p.sat]) == :: -:: +is-lockup-block: whether the block contains lockup/ignorable transactions :: -:: this is the stupid dumb equivalent to actually identifying lockup -:: transactions procedurally, which is still in git history, but didn't -:: work quite right for unidentified reasons +:: +peek-x: accept gall scry :: -++ is-lockup-block - |= num=@ud - ^- ? - %+ roll - ^- (list [@ud @ud]) - :~ [7.050.978 7.051.038] +:: %/days/txt: per day, digest stats +:: %/months/txt: per month, digest stats +:: %/raw/txt: all observed events +:: +++ peek-x + |= pax=path + ^- (unit (unit [mark *])) + ?~ pax ~ + ?: =(%days i.pax) + :^ ~ ~ %txt + (export-days days) + ?: =(%months i.pax) + :^ ~ ~ %txt + %- export-days + ^+ days + %+ roll (flop days) + |= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])] + ^+ mos + =/ mod=@da + %- year + =+ (yore day) + -(d.t 1) + ?~ mos [mod sat]~ + ?: !=(mod mod.i.mos) + [[mod sat] mos] + :_ t.mos + :- mod + ::TODO this is hideous. can we make a wet gate do this? + :* (weld spawned.sat spawned.sat.i.mos) + (weld activated.sat activated.sat.i.mos) + (weld transfer-p.sat transfer-p.sat.i.mos) + (weld transferred.sat transferred.sat.i.mos) + (weld configured.sat configured.sat.i.mos) + (weld breached.sat breached.sat.i.mos) + (weld request.sat request.sat.i.mos) + (weld sponsor.sat sponsor.sat.i.mos) + (weld management-p.sat management-p.sat.i.mos) + (weld voting-p.sat voting-p.sat.i.mos) + (weld spawn-p.sat spawn-p.sat.i.mos) == - |= [[start=@ud end=@ud] in=_|] - ?: in & - &((gte num start) (lte num end)) + ?: =(%raw i.pax) + ``txt+export-raw + ~ :: -++ who-from-event - |= eve=event - ?+ -.dif.eve who.eve - %spawned who.dif.eve - == +:: +export-days: generate a csv of stats per day :: -:: +export: generate a csv of stats per day -:: -++ export +++ export-days |= =_days :- %- crip ;: weld From fe0ae82fb48d3dec7d90255a753b16e16a87321f Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 8 Mar 2019 17:25:52 +0100 Subject: [PATCH 11/13] Write events and stats to clay every hour --- app/gaze.hoon | 103 +++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 39 deletions(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index bbb86a9820..94bd840603 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -1,9 +1,4 @@ -:: gaze: azimuth analytics -:: -::TODO daily stats, but also sane longer-period stats -:: probably convert block numbers to day, then store difs by day -:: every day, week, and month, append entry to csv file with stat counters -:: not on a timer, but whenever we see a block belogns to the next day/week etc +:: gaze: azimuth statistics :: /+ *eth-watcher :: @@ -45,21 +40,23 @@ :: ++ move (pair bone card) ++ card - $% [%hiss wire (unit user:eyre) mark %hiss hiss:eyre] - :: [%wait wire @da] - :: [%rest @da] - [%poke wire [ship %eth-watcher] %eth-watcher-action action] + $% [%poke wire [ship %eth-watcher] %eth-watcher-action action] [%peer wire [ship %eth-watcher] path] + [%hiss wire (unit user:eyre) mark %hiss hiss:eyre] + [%wait wire @da] + [%info wire desk nori:clay] == -- :: |_ [bowl:gall state] ++ node-url (need (de-purl:html 'http://eth-mainnet.urbit.org:8545')) +++ export-frequency ~h1 :: ++ prep |= old=(unit state) ?~ old - [~ ..prep] + :_ ..prep + [ost %wait /export (add now export-frequency)]~ [~ ..prep(+<+ u.old)] :: :: +poke-noun: do a thing @@ -326,6 +323,28 @@ == :: :: +:: +wake-export: periodically export data +:: +++ wake-export + |= [=wire ~] + ^- (quip move _+>) + :_ +> + :~ [ost %wait /export (add now export-frequency)] + (export-move %days (export-days days)) + (export-move %months (export-months days)) + (export-move %events export-raw) + == +:: +:: +export-move: %info move to write exported .txt +:: +++ export-move + |= [nom=@t dat=(list @t)] + ^- move + :^ ost %info /export/[nom] + %+ foal:space:userlib + /(scot %p our)/home/(scot %da now)/gaze-exports/[nom]/txt + [%txt !>(dat)] +:: :: +peek-x: accept gall scry :: :: %/days/txt: per day, digest stats @@ -334,44 +353,50 @@ :: ++ peek-x |= pax=path - ^- (unit (unit [mark *])) + ^- (unit (unit (pair mark *))) ?~ pax ~ ?: =(%days i.pax) :^ ~ ~ %txt (export-days days) ?: =(%months i.pax) :^ ~ ~ %txt - %- export-days - ^+ days - %+ roll (flop days) - |= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])] - ^+ mos - =/ mod=@da - %- year - =+ (yore day) - -(d.t 1) - ?~ mos [mod sat]~ - ?: !=(mod mod.i.mos) - [[mod sat] mos] - :_ t.mos - :- mod - ::TODO this is hideous. can we make a wet gate do this? - :* (weld spawned.sat spawned.sat.i.mos) - (weld activated.sat activated.sat.i.mos) - (weld transfer-p.sat transfer-p.sat.i.mos) - (weld transferred.sat transferred.sat.i.mos) - (weld configured.sat configured.sat.i.mos) - (weld breached.sat breached.sat.i.mos) - (weld request.sat request.sat.i.mos) - (weld sponsor.sat sponsor.sat.i.mos) - (weld management-p.sat management-p.sat.i.mos) - (weld voting-p.sat voting-p.sat.i.mos) - (weld spawn-p.sat spawn-p.sat.i.mos) - == + (export-months days) ?: =(%raw i.pax) ``txt+export-raw ~ :: +:: +export-months: generate a csv of stats per month +:: +++ export-months + |= =_days + %- export-days + ^+ days + %+ roll (flop days) + |= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])] + ^+ mos + =/ mod=@da + %- year + =+ (yore day) + -(d.t 1) + ?~ mos [mod sat]~ + ?: !=(mod mod.i.mos) + [[mod sat] mos] + :_ t.mos + :- mod + ::TODO this is hideous. can we make a wet gate do this? + :* (weld spawned.sat spawned.sat.i.mos) + (weld activated.sat activated.sat.i.mos) + (weld transfer-p.sat transfer-p.sat.i.mos) + (weld transferred.sat transferred.sat.i.mos) + (weld configured.sat configured.sat.i.mos) + (weld breached.sat breached.sat.i.mos) + (weld request.sat request.sat.i.mos) + (weld sponsor.sat sponsor.sat.i.mos) + (weld management-p.sat management-p.sat.i.mos) + (weld voting-p.sat voting-p.sat.i.mos) + (weld spawn-p.sat spawn-p.sat.i.mos) + == +:: :: +export-days: generate a csv of stats per day :: ++ export-days From f8ae07cb4bbea269ec066916ac961d41d930ba83 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 12 Mar 2019 00:13:16 +0100 Subject: [PATCH 12/13] Fix address printing --- app/gaze.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index 94bd840603..d76bc03916 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -483,7 +483,7 @@ :: ++ num (d-co:co 1) ++ pon (cury scow %p) - ++ adr ['0' 'x' (x-co:co 20)] + ++ adr |=(a=@ ['0' 'x' ((x-co:co 20) a)]) ++ spo |=(h=? ?:(h "escaped to" "detached from")) ++ req |=(r=(unit @p) ?~(r "canceled" (pon u.r))) -- From e0fe41cf4089503e02adbcb24a9d2003c52e57a4 Mon Sep 17 00:00:00 2001 From: Fang Date: Sat, 23 Mar 2019 11:41:00 +0100 Subject: [PATCH 13/13] Print Ethereum addresses at the correct length --- app/gaze.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/gaze.hoon b/app/gaze.hoon index d76bc03916..3c2121e87b 100644 --- a/app/gaze.hoon +++ b/app/gaze.hoon @@ -483,7 +483,7 @@ :: ++ num (d-co:co 1) ++ pon (cury scow %p) - ++ adr |=(a=@ ['0' 'x' ((x-co:co 20) a)]) + ++ adr |=(a=@ ['0' 'x' ((x-co:co (mul 2 20)) a)]) ++ spo |=(h=? ?:(h "escaped to" "detached from")) ++ req |=(r=(unit @p) ?~(r "canceled" (pon u.r))) --