From a47ef9ac7758c3a6fe89546ce48b737cc1b42357 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Wed, 24 Jul 2019 15:54:45 -0700 Subject: [PATCH] wip --- pkg/arvo/app/aqua.hoon | 5 ++-- pkg/arvo/app/azimuth-tracker.hoon | 9 ++++--- pkg/arvo/app/ph.hoon | 7 ++++++ pkg/arvo/lib/hood/drum.hoon | 22 ++++++++--------- pkg/arvo/lib/ph/azimuth.hoon | 41 ++++++++++++++++++++----------- pkg/arvo/lib/ph/util.hoon | 11 ++++----- pkg/arvo/lib/tapp.hoon | 8 +++--- pkg/arvo/sur/aquarium.hoon | 3 +-- pkg/arvo/sys/vane/clay.hoon | 3 +-- pkg/arvo/sys/vane/kale.hoon | 12 ++++++--- 10 files changed, 72 insertions(+), 49 deletions(-) diff --git a/pkg/arvo/app/aqua.hoon b/pkg/arvo/app/aqua.hoon index 20f7d74df7..38686c89fa 100644 --- a/pkg/arvo/app/aqua.hoon +++ b/pkg/arvo/app/aqua.hoon @@ -169,7 +169,7 @@ =. ..abet-pe =/ sof ((soft unix-effect) i.effects) ?~ sof - ~? aqua-debug=| [who=who %unknown-effect i.effects] + ~? aqua-debug=& [who=who %unknown-effect i.effects] ..abet-pe (publish-effect u.sof) $(effects t.effects) @@ -366,7 +366,8 @@ %e %eyre %f %ford %g %gall - %j %ford + %j %jael + %k %kale == =/ pax /(scot %p our.hid)/home/(scot %da now.hid)/sys/vane/[vane] diff --git a/pkg/arvo/app/azimuth-tracker.hoon b/pkg/arvo/app/azimuth-tracker.hoon index 0afba5268e..37aea63ebc 100644 --- a/pkg/arvo/app/azimuth-tracker.hoon +++ b/pkg/arvo/app/azimuth-tracker.hoon @@ -152,6 +152,7 @@ =/ m (async:stdio ,block) ^- form:m ;< =json bind:m (request-rpc url `'block number' %eth-block-number ~) + ~& [%block-number json (parse-eth-block-number:rpc:ethereum json)] (get-block-by-number url (parse-eth-block-number:rpc:ethereum json)) :: ++ get-block-by-number @@ -296,7 +297,7 @@ =/ a-purl=purl:eyre node.p.source =. url.state (crip (en-purl:html a-purl)) =. whos.state whos - (watch state url.state launch:contracts:azimuth) + (watch state url.state 0) :: launch:contracts:azimuth) :: :: Start watching a node :: @@ -317,9 +318,11 @@ |= state=app-state =/ m (async:stdio ,app-state) ^- form:m - ~& [%get-updates number.state] + ~& [%get-updatessss number.state] ;< =latest=block bind:m (get-latest-block url.state) + ~& [%latest-block number.state] ;< =new=number:block bind:m (zoom state number.id.latest-block) + ~& [%zoomed-to number.state] =. number.state new-number |- ^- form:m =* walk-loop $ @@ -403,7 +406,7 @@ |= [state=app-state =latest=number:block] =/ m (async:stdio ,number:block) ^- form:m - =/ zoom-margin=number:block 30 + =/ zoom-margin=number:block 3 ?: (lth latest-number (add number.state zoom-margin)) (pure:m number.state) =/ to-number=number:block (sub latest-number zoom-margin) diff --git a/pkg/arvo/app/ph.hoon b/pkg/arvo/app/ph.hoon index b820f2a25e..8c286f21a4 100644 --- a/pkg/arvo/app/ph.hoon +++ b/pkg/arvo/app/ph.hoon @@ -133,16 +133,23 @@ %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud)) + ~& > 'BUD DONE' ;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev)) + ~& > 'DEV DONE' (send-hi ~bud ~dev) + ~& > 'HI DONE' ;< eth-node=_eth-node bind:m (breach-and-hear:eth-node our.hid ~dev ~bud) + ~& > 'BREACH DONE' ;< [eth-node=_eth-node ~] bind:m %+ (wrap-philter ,_eth-node ,~) router:eth-node ;< ~ bind:m (send-hi-not-responding ~bud ~dev) + ~& > 'HI NOT RESPONDING DONE' ;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev)) + ~& > 'REBOOT DEV DONE' (wait-for-dojo ~bud "hi ~dev successful") + ~& > 'DONE' (pure:m ~) :: :+ %breach-hi-cousin diff --git a/pkg/arvo/lib/hood/drum.hoon b/pkg/arvo/lib/hood/drum.hoon index ed61c9e990..9b987da687 100644 --- a/pkg/arvo/lib/hood/drum.hoon +++ b/pkg/arvo/lib/hood/drum.hoon @@ -85,18 +85,18 @@ [%base %dojo] [%base %modulo] == - :~ [%home %lens] - [%home %acme] - [%home %dns] + :~ :: [%home %lens] + :: [%home %acme] + :: [%home %dns] [%home %dojo] - [%home %hall] - [%home %talk] - [%home %modulo] - [%home %launch] - [%home %chat] - [%home %publish] - [%home %clock] - [%home %weather] + :: [%home %hall] + :: [%home %talk] + :: [%home %modulo] + :: [%home %launch] + :: [%home %chat] + :: [%home %publish] + :: [%home %clock] + :: [%home %weather] [%home %azimuth-tracker] == :: diff --git a/pkg/arvo/lib/ph/azimuth.hoon b/pkg/arvo/lib/ph/azimuth.hoon index 3476466241..14b5b1aa31 100644 --- a/pkg/arvo/lib/ph/azimuth.hoon +++ b/pkg/arvo/lib/ph/azimuth.hoon @@ -30,14 +30,15 @@ |= pin=ph-input ^- output:n =, enjs:format - =/ thus (extract-thus-to uf.pin 'http://localhost:8545') - ?~ thus + =/ ask (extract-request uf.pin 'http://localhost:8545/') + ?~ ask [& ~ %wait ~] - ?~ r.mot.u.thus + ?~ body.request.u.ask [& ~ %wait ~] - =/ req q.u.r.mot.u.thus + =/ req q.u.body.request.u.ask |^ ^- output:n =/ method (get-method req) + :: =; a ~& [%give-azimuth-response a] - ?: =(method 'eth_blockNumber') :- | :_ [%wait ~] %+ answer-request req @@ -46,19 +47,22 @@ :- | :_ [%wait ~] %+ answer-request req :- %o - =/ hash (get-block-hash req) - =/ number (hash-to-number (hex-to-num:ethereum hash)) + =/ number (hex-to-num:ethereum (get-block-hash req)) + ~& number=number + =/ hash (number-to-hash number) + ~& hash=hash =/ parent-hash (number-to-hash ?~(number number (dec number))) + ~& parent-hash=parent-hash %- malt ^- (list (pair term json)) - :~ hash+s+hash + :~ hash+s+(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash))) number+s+(crip (num-to-hex:ethereum number)) 'parentHash'^s+(crip (num-to-hex:ethereum parent-hash)) == ?: =(method 'eth_getLogs') :- | :_ [%wait ~] %+ answer-request req - ?~ (get-param-obj-maybe req 'blockHash') + ?^ (get-param-obj-maybe req 'blockHash') %- logs-by-hash (get-param-obj req 'blockHash') %+ logs-by-range @@ -155,9 +159,8 @@ =, dejs:format =/ id %. (need (de-json:html req)) - (ot params+(ar so) ~) - ?> ?=([* * ~] id) - i.id + (ot params+(at so bo ~) ~) + -.id :: ++ answer-request |= [req=@t result=json] @@ -175,23 +178,31 @@ who.pin //http-client/0v1n.2m9vh %receive - num.u.thus + num.u.ask [%start [200 ~] `(as-octs:mimes:html resp) &] == :: ++ number-to-hash |= =number:block:able:kale - `@`(cat 3 0x5363 number) + ^- @ + ?: (lth number launch:contracts:azimuth) + (cat 3 0x5364 (sub launch:contracts:azimuth number)) + (cat 3 0x5363 (sub number launch:contracts:azimuth)) :: ++ hash-to-number |= =hash:block:able:kale - (div hash 0x1.0000) + (add launch:contracts:azimuth (div hash 0x1.0000)) :: ++ logs-by-range |= [from-block=@ud to-block=@ud] %+ logs-to-json from-block + ?: (lth to-block launch:contracts:azimuth) + ~ %+ swag - [(sub from-block launch:contracts:azimuth) (sub to-block from-block)] + ?: (lth from-block launch:contracts:azimuth) + [0 (sub to-block launch:contracts:azimuth)] + :- (sub from-block launch:contracts:azimuth) + (sub to-block from-block) logs :: ++ logs-by-hash diff --git a/pkg/arvo/lib/ph/util.hoon b/pkg/arvo/lib/ph/util.hoon index 995f9db0bf..4d370b0524 100644 --- a/pkg/arvo/lib/ph/util.hoon +++ b/pkg/arvo/lib/ph/util.hoon @@ -80,13 +80,12 @@ :: :: Check if given effect is an http request; extract :: -++ extract-thus-to +++ extract-request |= [uf=unix-effect dest=@t] - ^- (unit [num=@ud mot=moth:eyre]) - ?. ?=(%thus -.q.uf) ~ - ?~ q.q.uf ~ - ?. =(p.u.q.q.uf (rash dest auri:de-purl:html)) ~ - `[p.q.uf q.u.q.q.uf] + ^- (unit [num=@ud =request:http]) + ?. ?=(%request -.q.uf) ~ + ?. =(dest url.request.q.uf) ~ + `[id.q.uf request.q.uf] :: :: Scry into a running aqua ship :: diff --git a/pkg/arvo/lib/tapp.hoon b/pkg/arvo/lib/tapp.hoon index c5071b7d21..3d8dfc479e 100644 --- a/pkg/arvo/lib/tapp.hoon +++ b/pkg/arvo/lib/tapp.hoon @@ -254,10 +254,10 @@ :: XX use only for development may break contracts! :: XX if active clam contracts only to abort transaction? :: - :: ~& [%tapp-reset dap.bowl] - :: `this-tapp - ~| [%tapp-load-incompatible dap.bowl] - !! + ~& [%tapp-reset dap.bowl] + `this-tapp + :: ~| [%tapp-load-incompatible dap.bowl] + :: !! :: :: because the clam replaces the active continuation with :: the bunt of its mold, we must fail the transaction diff --git a/pkg/arvo/sur/aquarium.hoon b/pkg/arvo/sur/aquarium.hoon index dd1c89d444..59d56f781e 100644 --- a/pkg/arvo/sur/aquarium.hoon +++ b/pkg/arvo/sur/aquarium.hoon @@ -44,8 +44,6 @@ %+ pair wire $% [%wack p=@] [%whom p=ship] - [%live p=@ud q=(unit @ud)] - [%barn ~] [%boot $%([%fake p=ship] [%dawn p=dawn-event])] unix-task == @@ -60,6 +58,7 @@ [%sleep ~] [%restore ~] [%init ~] + [%request id=@ud request=request:http] == +$ pill [boot-ova=* kernel-ova=(list unix-event) userspace-ova=(list unix-event)] diff --git a/pkg/arvo/sys/vane/clay.hoon b/pkg/arvo/sys/vane/clay.hoon index 166616b828..8b95318e37 100644 --- a/pkg/arvo/sys/vane/clay.hoon +++ b/pkg/arvo/sys/vane/clay.hoon @@ -2402,7 +2402,6 @@ :: Must uni the old-lat into the new-lat so that if we recreate :: the same blob hash, we use the old blob not the new one. Else :: you get mutually recurring %delta blobs. - :: ++ add-blobs |= [new-blobs=(map path blob) old-lat=(map lobe blob)] ^- (map lobe blob) @@ -4107,7 +4106,7 @@ %boat :_ ..^$ [hen %give %hill (turn ~(tap by mon.ruf) head)]~ - ::. + :: %cred =. cez.ruf ?~ cew.req (~(del by cez.ruf) nom.req) diff --git a/pkg/arvo/sys/vane/kale.hoon b/pkg/arvo/sys/vane/kale.hoon index 684c650559..2a98be6018 100644 --- a/pkg/arvo/sys/vane/kale.hoon +++ b/pkg/arvo/sys/vane/kale.hoon @@ -83,7 +83,7 @@ $>(%want task:able:ames) :: send message == :: $: %k :: to self - $>(%listen task) :: set ethereum source + $>(%listen task) :: set ethereum source == :: $: @tas :: $% $>(%init vane-task) :: report install @@ -411,6 +411,7 @@ :: ships with real keys must have domains, :: those with fake keys must not :: + ~| [fak.own.pki tuf.own.pki] ?< =(fak.own.pki ?=(^ tuf.own.pki)) +>.$(moz [[hen %give %turf tuf.own.pki] moz]) :: @@ -676,7 +677,10 @@ yen.etn (~(put in yen.etn) hen) moz %- welp :_ moz + ~& [%kale-sources-feed etn=etn] %+ turn + ^- (list (pair source-id (set ship))) + :- [default-source.etn ~] ~(tap by ship-sources-reverse.etn) |= [=source-id whos=(set ship)] [hen %give %source whos (~(got by sources.etn) source-id)] @@ -782,8 +786,8 @@ ?~ whol ship-sources.etn (~(put by $(whol t.whol)) i.whol source-id) - =. ship-sources-reverse - %- ~(gas ju ship-sources-reverse) + =. ship-sources-reverse.etn + %- ~(gas ju ship-sources-reverse.etn) (turn whol |=(=ship [source-id ship])) ..feed (exec yen.etn [%give %source whos source]) @@ -841,7 +845,7 @@ :: old/state == ^+ ..^$ - ..^$(fak.own.pki.lex &) + ..^$ :: ..^$(lex old) :: :: ++scry ++ scry :: inspect