migrate ames to kale

This commit is contained in:
Philip Monk 2019-07-23 11:39:29 -07:00
parent e2ff00bf9d
commit 577eed93b8
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
9 changed files with 158 additions and 60 deletions

View File

@ -435,8 +435,9 @@
[%fake who.ae]
[%dawn u.keys.ae]
-.userspace-ova.pil
[//http/0v1n.2m9vh %born ~]
[//http/0v1n.2m9vh %live 8.080 `8.445]
[//http-client/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %born ~]
[//http-server/0v1n.2m9vh %live 8.080 `8.445]
==
=. this abet-pe:initted
(pe who.ae)

View File

@ -7,7 +7,7 @@
from-number=number:block
==
+$ app-state
$: %1
$: %2
url=@ta
=number:block
=pending-udiffs

View File

@ -112,6 +112,19 @@
router:eth-node
(raw-ship ~bud `(dawn:eth-node ~bud))
(pure:m ~)
::
:+ %hi-az
~[~bud ~dev]
=. eth-node (spawn:eth-node ~dev)
;< [eth-node=_eth-node ~] bind:m
%+ (wrap-philter ,_eth-node ,~)
router:eth-node
;< ~ bind:m (raw-ship ~dev `(dawn:eth-node ~dev))
~& > %dev-done
;< ~ bind:m (raw-ship ~bud `(dawn:eth-node ~bud))
~& > %bud-done
(send-hi ~bud ~dev)
(pure:m ~)
::
:+ %breach-hi
~[~bud ~dev]

View File

@ -97,6 +97,7 @@
[%home %publish]
[%home %clock]
[%home %weather]
[%home %azimuth-tracker]
==
::
++ deft-fish :: default connects
@ -105,7 +106,7 @@
^- (list gill:gall)
[[our %talk] [our %dojo] ~]
::
++ make :: initial part
++ make :: initial part
|= our/ship
^- part
:* %drum

View File

@ -42,10 +42,26 @@
:- | :_ [%wait ~]
%+ answer-request req
s+(crip (num-to-hex:ethereum latest-block))
?: =(method 'eth_getBlockByNumber')
:- | :_ [%wait ~]
%+ answer-request req
:- %o
=/ hash (get-block-hash req)
=/ number (hash-to-number (hex-to-num:ethereum hash))
=/ parent-hash (number-to-hash ?~(number number (dec number)))
%- malt
^- (list (pair term json))
:~ hash+s+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
%+ logs-to-json
?~ (get-param-obj-maybe req 'blockHash')
%- logs-by-hash
(get-param-obj req 'blockHash')
%+ logs-by-range
(get-param-obj req 'fromBlock')
(get-param-obj req 'toBlock')
?: =(method 'eth_newFilter')
@ -67,7 +83,7 @@
:+ |
%+ answer-request req
~| [eth-filters latest-block]
(logs-to-json from-block.u.fil latest-block)
(logs-by-range from-block.u.fil latest-block)
=. last-block.u.fil latest-block
[%cont ..stay]
?: =(method 'eth_getFilterChanges')
@ -77,7 +93,7 @@
~|(%no-filter-not-implemented !!)
:+ |
%+ answer-request req
(logs-to-json last-block.u.fil latest-block)
(logs-by-range last-block.u.fil latest-block)
=. all.eth-filters
%+ ~(put by all.eth-filters)
fil-id
@ -110,6 +126,20 @@
?> ?=([* ~] array)
i.array
::
++ get-param-obj-maybe
|= [req=@t param=@t]
^- (unit @ud)
=, dejs-soft:format
=/ array
%. (need (de-json:html req))
(ot params+(ar (ot param^so ~)) ~)
?~ array
~
:- ~
?> ?=([* ~] u.array)
%- hex-to-num:ethereum
i.u.array
::
++ get-filter-id
|= req=@t
=, dejs:format
@ -120,6 +150,15 @@
?> ?=([* ~] id)
i.id
::
++ get-block-hash
|= req=@t
=, dejs:format
=/ id
%. (need (de-json:html req))
(ot params+(ar so) ~)
?> ?=([* * ~] id)
i.id
::
++ answer-request
|= [req=@t result=json]
^- (list ph-event)
@ -140,15 +179,30 @@
[%start [200 ~] `(as-octs:mimes:html resp) &]
==
::
++ logs-to-json
++ number-to-hash
|= =number:block:able:kale
`@`(cat 3 0x5363 number)
::
++ hash-to-number
|= =hash:block:able:kale
(div hash 0x1.0000)
::
++ logs-by-range
|= [from-block=@ud to-block=@ud]
%+ logs-to-json from-block
%+ swag
[(sub from-block launch:contracts:azimuth) (sub to-block from-block)]
logs
::
++ logs-by-hash
|= =hash:block:able:kale
=/ =number:block:able:kale (hash-to-number hash)
(logs-by-range number +(number))
::
++ logs-to-json
|= [count=@ud selected-logs=(list az-log)]
^- json
:- %a
=/ selected-logs
%+ swag
[(sub from-block launch:contracts:azimuth) (sub to-block from-block)]
logs
=/ count from-block
|- ^- (list json)
?~ selected-logs
~
@ -160,7 +214,8 @@
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5362)))
::
:+ 'blockHash' %s
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 `@`0x5363)))
=/ hash (number-to-hash count)
(crip (prefix-hex:ethereum (render-hex-bytes:ethereum 32 hash)))
::
:+ 'blockNumber' %s
(crip (num-to-hex:ethereum count))

View File

@ -41,6 +41,7 @@
:: sys/vane/jael: security
::
[%j /vane/jael]
[%k /vane/kale]
==
|= [=term =path]
=/ pax (weld sys path)

View File

@ -20,13 +20,13 @@
$: %d :: to %dill
$>(%flog task:able:dill) :: log output
== ::
$: %j :: to %jael
$: %k :: to %jael
$> $? %meet :: neighbor
%pubs :: view public keys
%public-keys :: view public keys
%turf :: view domains
%vein :: view private keys
%private-keys :: view private keys
== ::
task:able:jael ::
task:able:kale ::
== ::
$: @tas :: to any
$>(%west task:able) :: deliver message
@ -36,12 +36,12 @@
$% $: %b :: from %behn
$>(%wake gift:able:behn) :: timer activate
== ::
$: %j :: from %jael
$> $? %pubs :: public keys
$: %k :: from %jael
$> $? %public-keys :: public keys
%turf :: bind to domains
%vein :: private keys
%private-keys :: private keys
== ::
gift:able:jael ::
gift:able:kale ::
== ::
$: %g :: from %gall
$% [%mean p=ares] :: XX obsolete
@ -573,7 +573,7 @@
%- (sloy-light ski)
=/ pur=spur
/(scot %ud lyf)/(scot %p who)
[[151 %noun] %j our %deed da+now pur]
[[151 %noun] %k our %deed da+now pur]
:: +life-scry: for a +life
::
++ life-scry
@ -586,7 +586,7 @@
%- (sloy-light ski)
=/ pur=spur
/(scot %p who)
[[151 %noun] %j our %life da+now pur]
[[151 %noun] %k our %life da+now pur]
:: +sein-scry: for sponsor
::
++ sein-scry
@ -595,7 +595,7 @@
;; ship
%- need %- need
%- (sloy-light ski)
[[151 %noun] %j our %sein da+now /(scot %p who)]
[[151 %noun] %k our %sein da+now /(scot %p who)]
:: +saxo-scry: for sponsorship chain
::
++ saxo-scry
@ -604,7 +604,7 @@
;; (list ship)
%- need %- need
%- (sloy-light ski)
[[151 %noun] %j our %saxo da+now /(scot %p who)]
[[151 %noun] %k our %saxo da+now /(scot %p who)]
:: +turf-scry: for network domains
::
++ turf-scry
@ -613,7 +613,7 @@
|. ;; (list turf)
%- need %- need
%- (sloy-light ski)
[[151 %noun] %j our %turf da+now ~]
[[151 %noun] %k our %turf da+now ~]
::
++ vein :: vein:am
~/ %vein
@ -1358,7 +1358,7 @@
?- -.bon
%beer
=/ =wire /pubs/(scot %p p.bon)
:_ fox [hen [%pass wire %j %pubs p.bon]]~
:_ fox [hen [%pass wire %k %public-keys (silt p.bon ~)]]~
::
%bock
:: ignore %turf if we haven't yet learned a unix duct
@ -1371,7 +1371,7 @@
[gad.fox %give %turf tuf.fox]~
::
%brew
:_ fox [hen [%pass / %j %turf ~]]~
:_ fox [hen [%pass / %k %turf ~]]~
::
%cake
:: ~? ?=(^ r.bon) [%cake-woot-bad hen r.bon]
@ -1386,7 +1386,7 @@
%milk
:: ~& [%milk p.bon q.bon]
?> ?=([@ @ *] q.q.bon)
?> ?=(?(%a %c %e %g %j) i.q.q.bon)
?> ?=(?(%a %c %e %g %j %k) i.q.q.bon)
=/ =wire [(scot %p our) (scot %p p.bon) q.q.bon]
:_ fox [hen %pass wire i.q.q.bon %west p.bon t.q.q.bon r.bon]~
::
@ -1417,11 +1417,11 @@
::
%raki
:_ fox
[hen [%pass / %j %meet who=p.bon life=q.bon pass=r.bon]]~
[hen [%pass / %k %meet who=p.bon life=q.bon pass=r.bon]]~
::
%sake
=/ =wire /our/(scot %p our)
:_ fox [hen [%pass wire %j %vein ~]]~
:_ fox [hen [%pass wire %k %private-keys ~]]~
::
%wine
:_ fox
@ -1453,30 +1453,39 @@
%mack ?~ +>.sih $(sih [%g %nice ~]) :: XX using old code
$(sih [%g %mean `[%mack +>+.sih]])
::
%pubs
%public-keys
?. ?=([%pubs @ ~] tea)
~& [%strange-pubs tea]
[~ +>]
[~ +>.$]
?: ?& ?=(%diff -.public-keys-result.sih)
!?=(%keys -.diff.public-keys-result.sih)
==
[~ +>.$]
=/ her=ship (slav %p i.t.tea)
=/ gus (~(us go ton.fox) our)
=/ diz (myx:gus her)
?: =(0 life.sih)
:: this should clear lew.wod.dur.diz because it means
:: we no longer trust that their public key came to
:: us honestly (becuse of a %jael snapshot restore).
:: in practice, that crashes in ++cluy:las:as:go, so
:: we ignore for now.
~& [%ames-hear-empty-pub her]
[~ +>.$]
=/ ded=deed
[life.sih (~(got by pubs.sih) life.sih) oath=~]
?: ?=(%full -.public-keys-result.sih)
~| [her=her public-keys-result=public-keys-result.sih]
=/ a-point=(unit point:able:kale)
(~(get by points.public-keys-result.sih) her)
?~ a-point
~& [%no-keys her]
[*life *pass ~]
=/ a-pass=pass pass:(~(got by keys.u.a-point) life.u.a-point)
[life.u.a-point a-pass oath=~]
?> ?=(%keys -.diff.public-keys-result.sih)
?> =(her who.public-keys-result.sih)
=/ a-key-update=key-update:point:able:kale
to.diff.public-keys-result.sih
[life.a-key-update pass.a-key-update oath=~]
=. lew.wod.dur.diz `ded
=. ton.fox (~(su go ton.fox) (nux:gus diz))
[~ +>.$]
::
%unto [~ +>]
::
%vein
%private-keys
?. ?=([%our @ ~] tea)
~& [%strange-vein tea]
[~ +>]

View File

@ -79,15 +79,15 @@
$: %i ::
$>(%wegh task:able:iris) ::
== ::
$: %j ::
$: %k ::
$> $? %dawn ::
%fake ::
%wegh ::
== ::
task:able:jael ::
task:able:kale ::
== == ::
++ sign :: in result $<-
$~ [%j %init *@p] ::
$~ [%k %init *@p] ::
$% $: %a ::
$% [%nice ~] :: XX obsolete
$> $? %mass ::
@ -127,11 +127,11 @@
$: %i ::
$>(%mass gift:able:iris) ::
== ::
$: %j ::
$: %k ::
$> $? %init ::
%mass ::
== ::
gift:able:jael ::
gift:able:kale ::
== == ::
:::::::: :: dill tiles
--
@ -283,7 +283,7 @@
[hen %pass /heft/ford %f %wegh ~]
[hen %pass /heft/gall %g %wegh ~]
[hen %pass /heft/iris %i %wegh ~]
[hen %pass /heft/jael %j %wegh ~]
[hen %pass /heft/jael %k %wegh ~]
moz
==
==
@ -294,7 +294,7 @@
;; ship
%- need %- need
%- (sloy-light ski)
[[151 %noun] %j our %sein da+now /(scot %p who)]
[[151 %noun] %k our %sein da+now /(scot %p who)]
::
++ init :: initialize
~& [%dill-init our ram]
@ -302,6 +302,18 @@
=. moz
:_ moz
[hen %pass /merg/home %c %merg %home our %base da+now %init]
=. moz
:_ moz
:* hen
%pass
~
%g
%deal
[our our]
%azimuth-tracker
%poke
[%azimuth-tracker-poke -:!>([%init ~]) [%init ~]]
==
.
::
++ mere :: continue init
@ -385,14 +397,14 @@
|= sih/sign
^+ +>
?- sih
{?($a $b $c $e $f $g $i $j) $mass *}
{?($a $b $c $e $f $g $i $j %k) $mass *}
(wegh -.sih p.sih)
::
{$a $nice *}
:: ~& [%take-nice-ames sih]
+>
::
[%j %init *]
[%k %init *]
:: pass thru to unix
::
+>(moz :_(moz [hen %give +.sih]))
@ -440,7 +452,7 @@
:: +wegh: receive a memory report from a vane and maybe emit full report
::
++ wegh
|= [lal=?(%a %b %c %e %f %g %i %j) mas=mass]
|= [lal=?(%a %b %c %e %f %g %i %k) mas=mass]
^+ +>
:: update our listing of vane responses with this new one
::
@ -453,7 +465,7 @@
%f ~?(?=(^ f.hef.all) %double-mass-f hef.all(f `mas))
%g ~?(?=(^ g.hef.all) %double-mass-g hef.all(g `mas))
%i ~?(?=(^ i.hef.all) %double-mass-i hef.all(i `mas))
%j ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas))
%k ~?(?=(^ j.hef.all) %double-mass-j hef.all(j `mas))
==
:: if not all vanes have responded yet, no-op
::
@ -512,10 +524,10 @@
?> =(~ hey.all)
=. hey.all `hen
=/ boot
((soft $>($?(%dawn %fake) task:able:jael)) p.task)
((soft $>($?(%dawn %fake) task:able:kale)) p.task)
?~ boot
~| invalid-boot-event+hen !!
:_(..^$ [hen %pass / %j u.boot]~)
:_(..^$ [hen %pass / %k u.boot]~)
:: we are subsequently initialized. single-home
::
?: ?=(%init -.task)

View File

@ -580,7 +580,7 @@
?~ yez this-su
=* d i.yez
=. this-su
?. ?=([[%a @ @ *] *] d)
?. &(?=([[%a @ @ *] *] d) !=(%pubs i.t.i.d))
%- emit
[d %give %public-keys public-keys-result]
=/ our (slav %p i.t.i.d)
@ -635,6 +635,7 @@
::
++ public-keys
|= whos=(set ship)
~& [%public-keys-fake fak.own.pki whos]
?: fak.own.pki
(public-keys:fake whos)
=. ney.zim
@ -686,6 +687,7 @@
|%
++ public-keys
|= whos=(set ship)
~& [%fake-1 whos]
=/ whol=(list ship) ~(tap in whos)
=/ passes
|- ^- (list [who=ship =pass])
@ -694,12 +696,15 @@
=/ cub (pit:nu:crub:crypto 512 i.whol)
:- [i.whol pub:ex:cub]
$(whol t.whol)
~& [%fake-2 passes]
=/ points=(list (pair ship point))
%+ turn passes
|= [who=ship =pass]
^- [who=ship =point]
[who [rift=1 life=1 (my [1 1 pass] ~) `(^sein:title who)]]
~& [%fake-3 points]
=. moz [[hen %give %public-keys %full (my points)] moz]
~& [%fake-4 moz]
..feel
--
--
@ -788,7 +793,8 @@
|= [who=ship =life =pass]
:: XX rethink meet
^+ +>
!!
~& [%kale-meet-should-do-something-about-moons who life pass]
+>.$
--
--
:: ::::
@ -835,7 +841,7 @@
:: old/state
==
^+ ..^$
..^$
..^$(fak.own.pki.lex &)
:: ..^$(lex old)
:: :: ++scry
++ scry :: inspect