Merge branch 'philip/jael-fix'

This commit is contained in:
Jared Tobin 2019-08-24 08:31:25 -02:30
commit 1076663018
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4
11 changed files with 181 additions and 124 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:56d796203244f34db81fc6567389a755fbdbeba67e68e96cccd7b9905813dc72
size 4930882
oid sha256:085710dcf810d97c228e526d53779887f18750d5180ee252c5566946b31f16a1
size 5223635

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f64b22612514cd43db3fcb62fea0ee442b83022021432163763f3e598999632b
size 15228738
oid sha256:5c41d46da7d12258f46dee61f7350701600b73f08ac5076c6b070378b3fc9ece
size 15526512

View File

@ -265,25 +265,27 @@
::
++ dawn
|= [who=ship seed=(unit seed:able:jael)]
^- dawn-event
=/ spon
^- dawn-event:able:jael
=/ spon=(list [ship point:azimuth])
|- ^- (list [ship point:azimuth])
=/ =ship (^sein:title who)
=/ spon-spon
?: ?=(%czar (clan:title ship))
[| ~zod]
[& (^sein:title ship)]
=/ life-rift ~|([ship lives] (~(got by lives) ship))
=/ =life lyfe.life-rift
=/ =rift rut.life-rift
=/ =pass
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public ship life %crypt))
(as-octs:mimes:html (get-public ship life %auth))
1
:^ ship=ship
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
=/ a-point=[^ship point:azimuth]
=/ spon-spon [& (^sein:title ship)]
=/ life-rift ~|([ship lives] (~(got by lives) ship))
=/ =life lyfe.life-rift
=/ =rift rut.life-rift
=/ =pass
%^ pass-from-eth:azimuth
(as-octs:mimes:html (get-public ship life %crypt))
(as-octs:mimes:html (get-public ship life %auth))
1
:^ ship
*[address address address address]:azimuth
`[life=life pass rift spon-spon ~]
~
?: ?=(%czar (clan:title ship))
[a-point]~
[a-point $(who ship)]
=/ =seed:able:jael
?^ seed
u.seed

View File

@ -49,7 +49,7 @@
:: Boot ship; don't check it succeeded.
::
++ boot-ship
|= [her=ship keys=(unit dawn-event)]
|= [her=ship keys=(unit dawn-event:able:jael)]
^+ *form:(ph ,~)
|= ph-input
[& (init her keys) %done ~]
@ -96,7 +96,7 @@
:: Boot a ship and verify it booted. Parent must already be booted.
::
++ raw-ship
|= [her=ship keys=(unit dawn-event)]
|= [her=ship keys=(unit dawn-event:able:jael)]
=/ m (ph ,~)
^- form:m
;< ~ bind:m (boot-ship her keys)

View File

@ -16,7 +16,7 @@
:: Start a ship (low-level; prefer +raw-ship)
::
++ init
|= [who=ship keys=(unit dawn-event)]
|= [who=ship keys=(unit dawn-event:able:jael)]
^- (list ph-event)
[%init-ship who keys]~
::

View File

@ -13,19 +13,10 @@
%+ pair wire
$% [%wack p=@]
[%whom p=ship]
[%boot $%([%fake p=ship] [%dawn p=dawn-event])]
[%boot $%($>(%fake task:able:jael) $>(%dawn task:able:jael))]
unix-task
==
::
+$ dawn-event
$: =seed:able:jael
spon=[=ship point:azimuth]
czar=(map ship [=rift =life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
==
::
++ module-ova
|= sys=path
^- (list [wire [%veer term path cord]])

View File

@ -19,11 +19,10 @@
==
::
+$ unix-event unix-event:pill-lib
+$ dawn-event dawn-event:pill-lib
+$ pill pill:pill-lib
::
+$ aqua-event
$% [%init-ship who=ship keys=(unit dawn-event)]
$% [%init-ship who=ship keys=(unit dawn-event:able:jael)]
[%pause-events who=ship]
[%snap-ships lab=term hers=(list ship)]
[%restore-snap lab=term]

View File

@ -54,6 +54,7 @@
$= zim :: public
$: yen=(jug duct ship) :: trackers
ney=(jug ship duct) :: reverse trackers
nel=(set duct) :: trackers of all
dns=dnses :: on-chain dns state
pos=(map ship point) :: on-chain ship state
== ::
@ -254,7 +255,8 @@
=/ cub (nol:nu:crub:crypto key.seed.tac)
%+ ~(put by pos.zim.pki)
our
[1 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) `ship.spon.tac]
=/ spon-ship ?~(spon.tac ~ `ship.i.spon.tac)
[1 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) spon-ship]
:: our initial private key
::
=. lyf.own.pki lyf.seed.tac
@ -266,15 +268,18 @@
=. tuf.own.pki turf.tac
:: our initial galaxy table as a +map from +life to +public
::
=/ spon-point=point
~| [%sponsor-point point]
?> ?=(^ net.spon.tac)
:* continuity-number.u.net.spon.tac
life.u.net.spon.tac
(malt [life.u.net.spon.tac 1 pass.u.net.spon.tac] ~)
?. has.sponsor.u.net.spon.tac
=/ spon-points=(list [ship point])
%+ turn spon.tac
|= [=ship az-point=point:azimuth]
~| [%sponsor-point az-point]
?> ?=(^ net.az-point)
:* ship
continuity-number.u.net.az-point
life.u.net.az-point
(malt [life.u.net.az-point 1 pass.u.net.az-point] ~)
?. has.sponsor.u.net.az-point
~
`who.sponsor.u.net.spon.tac
`who.sponsor.u.net.az-point
==
=/ points=(map =ship =point)
%- ~(run by czar.tac)
@ -282,7 +287,7 @@
^- point
[a-rift a-life (malt [a-life 1 a-pass] ~) ~]
=. points
(~(put by points) ship.spon.tac spon-point)
(~(gas by points) spon-points)
=. +>.$
%- curd =< abet
(public-keys:~(feel su hen our pki etn) %full points)
@ -297,13 +302,16 @@
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
::
*
=/ spon-ship
?> ?=(^ spon.tac)
ship.i.spon.tac
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen our pki etn)
(silt ship.spon.tac ~)
(silt spon-ship ~)
[%| %azimuth-tracker]
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%& ship.spon.tac])
(sources:~(feel su hen our pki etn) ~ [%& spon-ship])
==
::
=. moz
@ -392,6 +400,8 @@
?~ ships
yen.zim.pki
(~(del ju $(ships t.ships)) hen i.ships)
=? nel.zim.pki ?=(~ whos.tac)
(~(del in nel.zim.pki) hen)
?^ whos.tac
+>.$
%_ +>.$
@ -671,6 +681,16 @@
this-su
(public-keys:feel %diff a-ship u.a-diff)
::
++ subscribers-on-ship
|= =ship
^- (set duct)
=/ specific-subs (~(get ju ney.zim) ship)
=/ general-subs=(set duct)
?: ?=(?(%czar %king %duke) (clan:title ship))
nel.zim
~
(~(uni in specific-subs) general-subs)
::
++ feed
|_ :: hen: subscription source
::
@ -717,6 +737,8 @@
%+ turn ~(tap in whos)
|= who=ship
[hen who]
=? nel.zim ?=(~ whos)
(~(put in nel.zim) hen)
:: Give initial result
::
=/ =public-keys-result
@ -782,7 +804,7 @@
?~ pointl
..feel
%+ public-keys-give
(~(get ju ney.zim) who.i.pointl)
(subscribers-on-ship who.i.pointl)
[%full (my i.pointl ~)]
=* who who.public-keys-result
=/ a-diff=diff:point diff.public-keys-result
@ -803,7 +825,7 @@
==
=. pos.zim (~(put by pos.zim) who point)
%+ public-keys-give
(~(get ju ney.zim) who)
(subscribers-on-ship who)
?~ maybe-point
[%full (my [who point]~)]
[%diff who a-diff]

View File

@ -2072,14 +2072,7 @@
::
+= task :: in request ->$
$~ [%vega ~] ::
$% $: %dawn :: boot from keys
=seed:able:jael :: identity params
spon=[=ship point:azimuth-types] :: sponsor
czar=(map ship [=rift =life =pass]) :: galaxy table
turf=(list turf) :: domains
bloq=@ud :: block number
node=(unit purl:eyre) :: gateway url
== ::
$% [%dawn dawn-event] :: boot from keys
[%fake =ship] :: fake boot
[%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key
@ -2095,6 +2088,15 @@
$>(%west vane-task) :: remote request
== ::
::
+$ dawn-event
$: =seed
spon=(list [=ship point:azimuth-types])
czar=(map ship [=rift =life =pass])
turf=(list turf)
bloq=@ud
node=(unit purl:eyre)
==
::
++ block
=< block
|%
@ -8978,7 +8980,7 @@
::
++ veri
|= [=seed:able:jael =point:azimuth =live]
^- (each sponsor=ship error=term)
^- (unit error=term)
=/ rac (clan:title who.seed)
=/ cub (nol:nu:crub:crypto key.seed)
?- rac
@ -8986,39 +8988,35 @@
:: a comet address is the fingerprint of the keypair
::
?. =(who.seed `@`fig:ex:cub)
[%| %key-mismatch]
`%key-mismatch
:: a comet can never be breached
::
?^ live
[%| %already-booted]
`%already-booted
:: a comet can never be re-keyed
::
?. ?=(%1 lyf.seed)
[%| %invalid-life]
[%& (^sein:title who.seed)]
`%invalid-life
~
::
%earl
:: the parent must be launched
::
?~ net.point
[%| %parent-not-keyed]
[%& (^sein:title who.seed)]
~
::
*
:: on-chain ships must be launched
::
?~ net.point
[%| %not-keyed]
`%not-keyed
=* net u.net.point
:: boot keys must match the contract
::
?. =(pub:ex:cub pass.net)
~& [%key-mismatch pub:ex:cub pass.net]
[%| %key-mismatch]
`%key-mismatch
:: life must match the contract
::
?. =(lyf.seed life.net)
[%| %life-mismatch]
`%life-mismatch
:: the boot life must be greater than and discontinuous with
:: the last seen life (per the sponsor)
::
@ -9026,12 +9024,28 @@
?| ?=(%| breach.u.live)
(lte life.net life.u.live)
== ==
[%| %already-booted]
`%already-booted
:: produce the sponsor for vere
::
~? !has.sponsor.net
[%no-sponsorship-guarantees-from who.sponsor.net]
[%& who.sponsor.net]
~
==
:: +sponsor:dawn: retreive sponsor from point
::
++ sponsor
|= [who=ship =point:azimuth]
^- (each ship error=term)
?- (clan:title who)
%pawn [%& (^sein:title who)]
%earl [%& (^sein:title who)]
%czar [%& (^sein:title who)]
*
?~ net.point
[%| %not-booted]
?. has.sponsor.u.net.point
[%| %no-sponsor]
[%& who.sponsor.u.net.point]
==
--
-- ::

View File

@ -188,36 +188,36 @@
++ test-veri-good
=/ sed [~zod 1 sec ~]
%+ expect-eq
!> [%& ~zod]
!> ~
!> (veri:dawn sed pot ~)
::
++ test-veri-not-spawned
=/ sed [~zod 1 sec ~]
%+ expect-eq
!> [%| %not-keyed]
!> `%not-keyed
!> (veri:dawn sed =>(pot .(net ~)) ~)
::
++ test-veri-wrong-key
=/ sed [~zod 1 sec:ex:(pit:nu:crub:crypto 24 %foo) ~]
%+ expect-eq
!> [%| %key-mismatch]
!> `%key-mismatch
!> (veri:dawn sed pot ~)
::
++ test-veri-life-mismatch
=/ sed [~zod 2 sec ~]
%+ expect-eq
!> [%| %life-mismatch]
!> `%life-mismatch
!> (veri:dawn sed pot ~)
::
++ test-veri-already-booted
=/ sed [~zod 1 sec ~]
;: weld
%+ expect-eq
!> [%| %already-booted]
!> `%already-booted
!> (veri:dawn sed pot `[1 |])
::
%+ expect-eq
!> [%| %already-booted]
!> `%already-booted
!> (veri:dawn sed pot `[2 &])
==
::
@ -230,7 +230,7 @@
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%& (^sein:title who)]
!> ~
!> (veri:dawn sed pot ~)
::
++ test-veri-earl-parent-not-keyed
@ -242,7 +242,7 @@
(shaf %earl (sham who 1 pub:ex:cub))
[who 1 sec:ex:cub `sig]
%+ expect-eq
!> [%| %parent-not-keyed]
!> ~
!> (veri:dawn sed =>(pot .(net ~)) ~)
::
++ test-veri-pawn-good
@ -250,7 +250,7 @@
=/ who=ship `@`fig:ex:cub
=/ sed [who 1 sec:ex:cub ~]
%+ expect-eq
!> [%& ~mittun]
!> ~
!> (veri:dawn sed *point:azimuth-types ~)
::
++ test-veri-pawn-key-mismatch
@ -258,7 +258,7 @@
=/ who=ship `@`fig:ex:cub
=/ sed [who 1 sec:ex:(pit:nu:crub:crypto 24 %bar) ~]
%+ expect-eq
!> [%| %key-mismatch]
!> `%key-mismatch
!> (veri:dawn sed *point:azimuth-types ~)
::
++ test-veri-pawn-invalid-life
@ -266,7 +266,7 @@
=/ who=ship `@`fig:ex:cub
=/ sed [who 2 sec:ex:cub ~]
%+ expect-eq
!> [%| %invalid-life]
!> `%invalid-life
!> (veri:dawn sed *point:azimuth-types ~)
::
++ test-veri-pawn-already-booted
@ -274,6 +274,6 @@
=/ who=ship `@`fig:ex:cub
=/ sed [who 1 sec:ex:cub ~]
%+ expect-eq
!> [%| %already-booted]
!> `%already-booted
!> (veri:dawn sed *point:azimuth-types `[1 |])
--

View File

@ -295,6 +295,25 @@ _dawn_turf(c3_c* dns_c)
return tuf;
}
/* _dawn_sponsor(): retrieve sponsor from point
*/
static u3_noun
_dawn_sponsor(u3_noun who, u3_noun rac, u3_noun pot)
{
u3_noun uni = u3dc("sponsor:dawn", u3k(who), u3k(pot));
if ( c3n == u3h(uni) ) {
_dawn_fail(who, rac, uni);
return u3_none;
}
u3_noun pos = u3k(u3t(uni));
u3z(who); u3z(rac); u3z(pot); u3z(uni);
return pos;
}
/* u3_dawn_vent(): validated boot event
*/
u3_noun
@ -302,7 +321,7 @@ u3_dawn_vent(u3_noun seed)
{
u3_noun url, bok, pos, pon, zar, tuf;
u3_noun ship = u3h(seed);
u3_noun ship = u3k(u3h(seed));
u3_noun rank = u3do("clan:title", u3k(ship));
url = _dawn_purl(rank);
@ -336,27 +355,15 @@ u3_dawn_vent(u3_noun seed)
//
pot = u3v_wish("*point:azimuth");
}
else if ( c3__earl == rank ) {
pot = u3v_wish("*point:azimuth");
}
else {
u3_noun who;
if ( c3__earl == rank ) {
who = u3do("^sein:title", u3k(ship));
{
u3_noun seg = u3dc("scot", 'p', u3k(who));
c3_c* seg_c = u3r_string(seg);
u3l_log("boot: retrieving %s's public keys (for %s)\r\n",
seg_c, u3_Host.ops_u.who_c);
free(seg_c);
u3z(seg);
}
}
else {
who = u3k(ship);
u3l_log("boot: retrieving %s's public keys\r\n",
u3_Host.ops_u.who_c);
}
who = u3k(ship);
u3l_log("boot: retrieving %s's public keys\r\n",
u3_Host.ops_u.who_c);
{
u3_noun oct = u3dc("point:give:dawn", u3k(bok), u3k(who));
@ -382,21 +389,18 @@ u3_dawn_vent(u3_noun seed)
//
u3_noun sas = u3dt("veri:dawn", u3k(seed), u3k(pot), u3k(liv));
if ( c3n == u3h(sas) ) {
if ( u3_nul != sas ) {
// bails, won't return
_dawn_fail(ship, rank, sas);
return u3_none;
}
// ship: sponsor
// produced by +veri:dawn to avoid coupling to +point structure
// XX reconsider
//
pos = u3k(u3t(sas));
u3z(pot); u3z(liv); u3z(sas);
u3l_log("boot: getting sponsor\r\n");
pos = _dawn_sponsor(u3k(ship), u3k(rank), u3k(pot));
u3z(pot); u3z(liv);
}
// (map ship [=life =pass]): galaxy table
//
{
@ -426,22 +430,47 @@ u3_dawn_vent(u3_noun seed)
u3z(oct); u3z(fut);
}
{
u3l_log("boot: retrieving sponsor keys\r\n");
pon = u3_nul;
while (c3__czar != rank) {
u3_noun son;
// print message
//
{
u3_noun who = u3dc("scot", 'p', u3k(pos));
c3_c* who_c = u3r_string(who);
u3l_log("boot: retrieving keys for sponsor %s\r\n", who_c);
u3z(who);
free(who_c);
}
u3_noun oct = u3dc("point:give:dawn", u3k(bok), u3k(pos));
u3_noun luh = _dawn_eth_rpc(url_c, u3k(oct));
// retrieve +point:azimuth of pos (sponsor of ship)
//
{
u3_noun oct = u3dc("point:give:dawn", u3k(bok), u3k(pos));
u3_noun luh = _dawn_eth_rpc(url_c, u3k(oct));
pon = _dawn_need_unit(u3dc("point:take:dawn", u3k(pos), u3k(luh)),
"boot: failed to retrieve sponsor keys");
pon = u3nc(pos, pon);
u3z(oct); u3z(luh);
son = _dawn_need_unit(u3dc("point:take:dawn", u3k(pos), u3k(luh)),
"boot: failed to retrieve sponsor keys");
// append to sponsor chain list
//
pon = u3nc(u3nc(u3k(pos), u3k(son)), pon);
u3z(oct); u3z(luh);
}
// find next sponsor
//
u3z(ship); u3z(rank);
ship = pos;
rank = u3do("clan:title", u3k(ship));
pos = _dawn_sponsor(u3k(ship), u3k(rank), u3k(son));
u3z(son);
}
u3z(rank); u3z(pos); u3z(ship);
u3z(rank);
// [%dawn seed sponsor galaxies domains block eth-url snap]
// [%dawn seed sponsors galaxies domains block eth-url snap]
//
return u3nc(c3__dawn, u3nq(seed, pon, zar, u3nt(tuf, bok, url)));
}