Implement %eth-watcher, an app for tracking Ethereum events#1081
Conversation
Poke with [%watch %sometag config:eth-watcher] to initialize, then subscribe at /sometag to receive updates in the shape of [%snap snapshot:eth-watcher] for initial and on-reorg logs, [%logs loglist] for logs as they happen.
|
Whatever they are, if they don't have existing DNS they should
get("external-foo."?) names under urbit.org
…On Friday, 22 February 2019, Dawid Ciężarkiewicz ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/eth-watcher.hoon
<#1081 (comment)>:
> + [~ ..prep(+<+ u.old)]
+::
+++ poke-noun
+ |= [what=?(%debug %debug-init %save %load) =name]
+ ^- (quip move _+>)
+ =+ eye=(fall (~(get by eyes) name) *eye)
+ ?- what
+ %debug
+ ~& [%log-lent (lent logs.eye)]
+ ~& [%last-heard last-heard-block.eye]
+ [~ +>.$]
+ ::
+ %debug-init
+ =- done:(init:watcher name -)
+ ^- config
+ :* (need (de-purl:html 'http://104.198.35.227:8545')) :: parity
What are these IPs?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1081 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABxXhpS6jXNH7HEWODOY5ju8CQOVsIu8ks5vQCkCgaJpZM4bJ--W>
.
|
philipcmonk
left a comment
There was a problem hiding this comment.
A couple of small things that should be addressed, but mostly stylistic comments, take or leave those.
Appears to be about as good as the %jael implementation. If you find ways to make this more robust, please port to %jael as well!
| [t.wir res] | ||
| :: | ||
| ++ watcher | ||
| |_ $: =name |
There was a problem hiding this comment.
The |_/++open/++init pattern is interesting, I've usually seen it as an explicit =|/|% to communicate that you're not meant to replace the sample.
There was a problem hiding this comment.
I've seen that before in places. I prefer |_ in that it very clearly communicates that "these things are used/changed inside this core". I agree this does leave the sample there easily touchable, which may add some confusion back in...
app/eth-watcher.hoon
Outdated
| logs.eye logs.snap | ||
| == | ||
| -- | ||
| -- No newline at end of file |
There was a problem hiding this comment.
need a trailing newline
There was a problem hiding this comment.
"Need"? Is there something that would be tripped up by not having trailing newlines?
There was a problem hiding this comment.
Yeah, isn't that what sunk ~zod one of those times? We might manage to parse it for gall apps, but at least hoon.hoon really needs a trailing newline or it won't compile. Plus, a text file with no trailing newline is really malformed.
| @@ -0,0 +1,38 @@ | |||
| :: eth-watcher utilities | |||
There was a problem hiding this comment.
Why are these two in a separate lib? Do we expect clients to use them?
There was a problem hiding this comment.
I imagine clients may want ++store-new-logs, yes. ++log-to-id is just there to support it, though maybe it belongs in zuse instead?
This is more or less a port of jael's Ethereum watching logic, without the Azimuth-specific transformations and with some extra niceties to make this generically usable.
Poke with
[%watch %sometag config:eth-watcher]to initialize,then subscribe at
/sometagto receive updates in the shape of[%snap snapshot:eth-watcher]for initial and on-reorg logs,[%logs loglist]for logs as they happen.I haven't thoroughly tested the peer/subscription functionality yet, but an app that uses this to build Azimuth statistics is next on my to-do list. That'll both hit that, and tell me whether there's any functionality that is still missing from this.
So, ready for review, but might see a small addition or two.