From 555eae6e2536a0282b172cedc6ce0c3660ac32ee Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 30 Oct 2019 18:44:34 +0100 Subject: [PATCH] eth-watcher: ensure logs always sent oldest-first For easier "this happened, then that happened" on the client side. --- pkg/arvo/app/eth-watcher.hoon | 10 +++++++--- pkg/arvo/sur/eth-watcher.hoon | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/eth-watcher.hoon b/pkg/arvo/app/eth-watcher.hoon index 348634935b..08310f09a8 100644 --- a/pkg/arvo/app/eth-watcher.hoon +++ b/pkg/arvo/app/eth-watcher.hoon @@ -19,6 +19,7 @@ blocks=(list block) == :: + :: history: newest block first, oldest event first +$ history (list loglist) +$ pending-logs (map number:block loglist) :: @@ -278,7 +279,7 @@ (rewind [path dog] block) ;< [=new=pending-logs =released=loglist] bind:m (release-old-events path pending-logs.dog number.id.block) - ;< =new=loglist bind:m + ;< =new=loglist bind:m :: oldest first (get-logs-by-hash url.dog hash.id.block contracts.dog topics.dog) =. new-pending-logs (~(put by new-pending-logs) number.id.block new-loglist) @@ -360,7 +361,7 @@ ?: (lth latest-number (add number.dog zoom-margin)) (pure:m dog) =/ to-number=number:block (sub latest-number zoom-margin) - ;< =loglist bind:m + ;< =loglist bind:m :: oldest first %: get-logs-by-range url.dog contracts.dog @@ -461,7 +462,10 @@ :+ %diff %eth-watcher-diff :- %history ^- loglist - (zing history:(~(gut by dogs.state) t.path *watchdog)) + %- zing + %- flop + =< history + (~(gut by dogs.state) t.path *watchdog) (pure:m state) :: :: +handle-peek: get diagnostics data diff --git a/pkg/arvo/sur/eth-watcher.hoon b/pkg/arvo/sur/eth-watcher.hoon index a257836723..731a9c38a0 100644 --- a/pkg/arvo/sur/eth-watcher.hoon +++ b/pkg/arvo/sur/eth-watcher.hoon @@ -22,7 +22,7 @@ == :: +$ diff - $% :: %history: full event log history + $% :: %history: full event log history, oldest first :: [%history =loglist] :: %log: newly added log