From 4f51cfc6bb76bdec39373b8c4381c4ca3fc7777b Mon Sep 17 00:00:00 2001 From: Fang Date: Fri, 21 Dec 2018 15:59:12 +0100 Subject: [PATCH] Make Urbit-side sponsorship state match chain state more closely We always have a sponsor, plus a flag that says whether they're actively sponsoring us. If they aren't they recently kicked us. Because we can't do anything without a sponsor, we still try with them. --- sys/vane/dill.hoon | 2 +- sys/vane/jael.hoon | 7 ++----- sys/zuse.hoon | 31 +++++++++++++++++-------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/vane/dill.hoon b/sys/vane/dill.hoon index 6fadc05c4..336593453 100644 --- a/sys/vane/dill.hoon +++ b/sys/vane/dill.hoon @@ -69,7 +69,7 @@ ++ note-jael :: $% $: %dawn :: boot from keys =seed:able:jael :: identity params - spon=(unit ship) :: sponsor + spon=ship :: sponsor czar=(map ship [=life =pass]) :: galaxy table turf=(list turf) :: domains bloq=@ud :: block number diff --git a/sys/vane/jael.hoon b/sys/vane/jael.hoon index e98f4a62c..2bba2cb77 100644 --- a/sys/vane/jael.hoon +++ b/sys/vane/jael.hoon @@ -637,11 +637,8 @@ =/ pot (~(get by pos.eth.sub) who) ?: ?& ?=(^ pot) ?=(^ net.u.pot) - ?=(^ sponsor.u.net.u.pot) == - u.sponsor.u.net.u.pot - :: XX fall back to most recent sponsor instead? - :: + who.sponsor.u.net.u.pot (^sein:title who) :: :: ++saxo:of ++ saxo :: sponsorship chain @@ -670,7 +667,7 @@ :: boot from keys :: $: $dawn :: =seed - :: spon=(unit ship) + :: spon=ship :: czar=(map ship [=life =pass]) :: turf=(list turf)} :: bloq=@ud diff --git a/sys/zuse.hoon b/sys/zuse.hoon index 01f040f2f..56a98f2ee 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -148,7 +148,7 @@ $: =life =pass continuity-number=@ud - sponsor=(unit @p) ::TODO doesn't 100% reflect chain state + sponsor=[has=? who=@p] escape=(unit @p) == :: @@ -175,7 +175,7 @@ [%spawned who=@p] :: Spawned [%keys =life =pass] :: ChangedKeys [%continuity new=@ud] :: BrokeContinuity - [%sponsor new=(unit @p)] :: EscapeAcc/LostSpons + [%sponsor new=[has=? who=@p]] :: EscapeAcc/LostSpons [%escape new=(unit @p)] :: EscapeReq/Can [%management-proxy new=address] :: ChangedManagementPro [%voting-proxy new=address] :: ChangedVotingProxy @@ -1848,7 +1848,7 @@ [%hail p=ship q=remote] :: remote update $: %dawn :: boot from keys =seed:able:jael :: identity params - spon=(unit ship) :: sponsor + spon=ship :: sponsor czar=(map ship [=life =pass]) :: galaxy table turf=(list turf) :: domains bloq=@ud :: block number @@ -7290,8 +7290,7 @@ :: continuity-number :: - ?. has-sponsor ~ - ``@p`sponsor + [has-sponsor `@p`sponsor] :: ?. escape-requested ~ ``@p`escape-to @@ -7339,12 +7338,12 @@ ?: =(event.log escape-accepted) =+ ^- [who=@ wer=@] (decode-topics topics.log ~[%uint %uint]) - `[who %sponsor `wer] + `[who %sponsor & wer] :: ?: =(event.log lost-sponsor) =+ ^- [who=@ pos=@] (decode-topics topics.log ~[%uint %uint]) - `[who %sponsor ~] + `[who %sponsor | pos] :: ?: =(event.log changed-keys) =/ who=@ (decode-topics topics.log ~[%uint]) @@ -7395,7 +7394,7 @@ :: %activated %_ pot - net `[0 0 0 `(^sein:title who.dif) ~] + net `[0 0 0 &^(^sein:title who.dif) ~] kid ?. ?=(?(%czar %king) (clan:title who.dif)) ~ `[0x0 ~] == @@ -7416,8 +7415,10 @@ pot(life.u.net life.dif, pass.u.net pass.dif) :: %sponsor - ?~ new.dif pot(sponsor.u.net ~) - pot(sponsor.u.net new.dif, escape.u.net ~) + %= pot + sponsor.u.net new.dif + escape.u.net ?:(has.new.dif ~ escape.u.net.pot) + == :: %continuity pot(continuity-number.u.net new.dif) %escape pot(escape.u.net new.dif) @@ -8429,7 +8430,7 @@ :: ++ veri |= [=seed:able:jael =point:azimuth =live] - ^- (each sponsor=(unit ship) error=term) + ^- (each sponsor=ship error=term) =/ rac (clan:title who.seed) =/ cub (nol:nu:crub:crypto key.seed) ?- rac @@ -8446,7 +8447,7 @@ :: ?. ?=(%1 lyf.seed) [%| %invalid-life] - [%& ~] + [%& ~marzod] ::TODO how to do comet sponsorship? :: %earl :: a moon must be signed by the parent @@ -8471,7 +8472,7 @@ :: ?^ live [%| %already-booted] - [%& ~] + [%& (^sein:title who.seed)] :: * :: on-chain ships must be launched @@ -8496,7 +8497,9 @@ [%| %already-booted] :: produce the sponsor for vere :: - [%& sponsor.u.net.point] + ~? !has.sponsor.u.net.point + [%no-sponsorship-guarantees-from who.sponsor.u.net.point] + [%& who.sponsor.u.net.point] == -- -- ::