mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 20:47:27 +03:00
Merge d15d832ef4
into release/next-userspace
This commit is contained in:
commit
ae6972e7b3
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ee148d17cf70c1b13577cc9456fe7bddaf4a9ff223d83bc6ef0b3175eb85e124
|
||||
size 12962526
|
||||
oid sha256:01d10efc143cba7d3b8f9951883521f6dabf711ac002c27d396b8f15abd14bfa
|
||||
size 12608565
|
||||
|
@ -2,7 +2,7 @@
|
||||
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|
||||
|%
|
||||
+$ state
|
||||
$: %13
|
||||
$: %14
|
||||
drum=state:drum
|
||||
helm=state:helm
|
||||
kiln=state:kiln
|
||||
@ -10,12 +10,13 @@
|
||||
+$ any-state
|
||||
$% state
|
||||
[ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
|
||||
[%7 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%8 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%9 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%10 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%11 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%12 drum=state:drum helm=state:helm kiln=state:kiln]
|
||||
[%7 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%8 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%9 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%10 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%11 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%12 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
[%13 drum=state:drum helm=state:helm kiln=state-1:kiln]
|
||||
==
|
||||
+$ any-state-tuple
|
||||
$: drum=any-state:drum
|
||||
|
20
pkg/arvo/gen/hood/fuse-list.hoon
Normal file
20
pkg/arvo/gen/hood/fuse-list.hoon
Normal file
@ -0,0 +1,20 @@
|
||||
:: Kiln: Fuse local desk from (optionally-)foreign sources
|
||||
::
|
||||
:::: /hoon/fuse/hood/gen
|
||||
::
|
||||
/+ *hood-kiln
|
||||
/* help-text %txt /gen/hood/fuse/help/txt
|
||||
=, clay
|
||||
::
|
||||
::::
|
||||
::
|
||||
=>
|
||||
|%
|
||||
+$ fuse-list-arg $@(~ [des=desk ~])
|
||||
--
|
||||
:- %say
|
||||
|= [* [arg=fuse-list-arg] ~]
|
||||
:- %kiln-fuse-list
|
||||
?~ arg
|
||||
~
|
||||
`des.arg
|
@ -2,14 +2,59 @@
|
||||
::
|
||||
:::: /hoon/fuse/hood/gen
|
||||
::
|
||||
/+ *hood-kiln
|
||||
/* help-text %txt /gen/hood/fuse/help/txt
|
||||
=, clay
|
||||
::
|
||||
::::
|
||||
::
|
||||
=>
|
||||
|%
|
||||
+$ fuse-arg
|
||||
$: des=desk
|
||||
:: specified as [germ path] instead of [path germ] so
|
||||
:: users can write mate//=home= instead of [/=home= %mate]
|
||||
::
|
||||
res=[?([%cancel ~] [bas=path con=(list [germ path])])]
|
||||
==
|
||||
::
|
||||
++ parse-fuse-source
|
||||
|= bec=beak
|
||||
^- fuse-source
|
||||
:: This is a slight overload of the label, but
|
||||
:: it provides a nicer interface for the user so
|
||||
:: we'll go with it.
|
||||
::
|
||||
?: ?=([%tas *] r.bec)
|
||||
?: =(p.r.bec %track)
|
||||
[p.bec q.bec %trak]
|
||||
bec
|
||||
bec
|
||||
::
|
||||
++ de-beak
|
||||
|= pax=path
|
||||
^- beak
|
||||
=/ bem=beam (need (de-beam pax))
|
||||
?> =(s.bem /)
|
||||
-.bem
|
||||
::
|
||||
++ path-to-fuse-source
|
||||
|= pax=path
|
||||
^- fuse-source
|
||||
(parse-fuse-source (de-beak pax))
|
||||
--
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] [arg=[?(~ [des=desk bas=beak con=(list [beak germ]) ~])]] ~]
|
||||
|= [* [arg=[?(~ fuse-arg)]] [overwrite=$~(| flag) ~]]
|
||||
:- %kiln-fuse
|
||||
?~ arg
|
||||
((slog (turn `wain`help-text |=(=@t leaf+(trip t)))) ~)
|
||||
[des bas con]:arg
|
||||
:- des.arg
|
||||
?: ?=([%cancel ~] res.arg)
|
||||
~
|
||||
:+ overwrite
|
||||
(path-to-fuse-source bas.res.arg)
|
||||
%+ turn
|
||||
con.res.arg
|
||||
|= [g=germ pax=path]
|
||||
^- [fuse-source germ]
|
||||
[(path-to-fuse-source pax) g]
|
||||
|
@ -1,8 +1,21 @@
|
||||
Usage:
|
||||
|
||||
|fuse %destination-desk base-beak ~[[source-beak %some-germ] [another-beak %another-germ]]
|
||||
|fuse %dest /=kids= mate//~nel/home= meet//~zod/kids/track
|
||||
|fuse %old-desk /=kids= only-that//~nus/test=, =overwrite &
|
||||
|fuse %desk-to-cancel-fuse-into %cancel
|
||||
|
||||
A fuse replaces the contents of %destination-desk with the merge of the
|
||||
specified beaks according to their merge strategies. This has no dependence
|
||||
on the previous state of %destination-desk so any commits/work there will
|
||||
be overwritten.
|
||||
A %fuse request in clay replaces the contents of %destination-desk
|
||||
with the merge of the specified beaks according to their merge
|
||||
strategies. This has no dependence on the previous state of %dest
|
||||
so any commits/work there will be overwritten.
|
||||
|
||||
|fuse extends this concept with the idea of a tracked source. When
|
||||
specifying beaks to include in your fuse, specify %track instead of
|
||||
a case. This will tell |fuse to retrieve the latest version of the
|
||||
source beak AND to rerun the %fuse request whenever that tracked
|
||||
source changes. A fuse can have many tracked sources, or none. The
|
||||
base may be tracked as well.
|
||||
|
||||
The overwrite flag allows you to overwrite a currently ongoing fuse.
|
||||
Without this flag, attempting a fuse into a desk that you already
|
||||
|fuse'd into will error.
|
||||
|
@ -3,11 +3,29 @@
|
||||
=, space:userlib
|
||||
=, format
|
||||
|%
|
||||
+$ state [%1 pith-1]
|
||||
+$ state state-2
|
||||
+$ state-2 [%2 pith-2]
|
||||
+$ state-1 [%1 pith-1]
|
||||
+$ state-0 [%0 pith-0]
|
||||
+$ any-state
|
||||
$% state
|
||||
[%0 pith-0]
|
||||
$% state-2
|
||||
state-1
|
||||
state-0
|
||||
==
|
||||
+$ pith-2 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
ota=(unit [=ship =desk =aeon]) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
:: map desk to the currently ongoing fuse request
|
||||
:: and the latest version numbers for beaks to
|
||||
fus=(map desk per-fuse)
|
||||
:: used for fuses - every time we get a fuse we
|
||||
:: bump this. used when calculating hashes to
|
||||
:: ensure they're unique even when the same
|
||||
:: request is made multiple times.
|
||||
hxs=(map desk @ud)
|
||||
== ::
|
||||
+$ pith-1 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
@ -31,6 +49,15 @@
|
||||
sud=@tas :: from desk
|
||||
cas=case :: at case
|
||||
==
|
||||
+$ per-fuse :: per fuse state
|
||||
:: map [ship desk] to latest version number we
|
||||
:: have for them. used for things we're %trak-ing
|
||||
:: our invariant here is to store the latest version
|
||||
:: number we've heard of.
|
||||
$: mox=(map [ship desk] let=@ud)
|
||||
:: relevant parts of originating request
|
||||
kf=kiln-fuse-data
|
||||
==
|
||||
+$ kiln-commit term ::
|
||||
+$ kiln-mount ::
|
||||
$: pax=path ::
|
||||
@ -55,12 +82,26 @@
|
||||
cas=case ::
|
||||
gim=?(%auto germ) ::
|
||||
==
|
||||
+$ fuse-source [who=ship des=desk ver=$@(%trak case)]
|
||||
:: actual poke
|
||||
+$ kiln-fuse
|
||||
$@ ~
|
||||
$: syd=desk
|
||||
bas=beak
|
||||
con=(list [beak germ])
|
||||
$@ ~ :: signifies clearing the fuse
|
||||
$: overwrite=flag :: force overwrite previous fuse
|
||||
bas=fuse-source
|
||||
con=(list [fuse-source germ])
|
||||
==
|
||||
==
|
||||
:: state tracked by kiln
|
||||
+$ kiln-fuse-data
|
||||
$: syd=desk
|
||||
bas=fuse-source
|
||||
con=(list [fuse-source germ])
|
||||
==
|
||||
:: Request to list current fuses. ~ means "list all"
|
||||
::
|
||||
+$ kiln-fuse-list (unit desk)
|
||||
--
|
||||
|= [bowl:gall state]
|
||||
?> =(src our)
|
||||
@ -85,6 +126,15 @@
|
||||
~[leaf+"from {<sud>}" leaf+"on {<who>}" leaf+"to {<syd>}"]
|
||||
::
|
||||
++ on-load
|
||||
=>
|
||||
|%
|
||||
++ state-1-to-2
|
||||
|= s=state-1
|
||||
^- state-2
|
||||
=/ p=pith-1 +.s
|
||||
:- %2
|
||||
[rem.p syn.p ota.p commit-timer.p *(map desk per-fuse) *(map desk @ud)]
|
||||
--
|
||||
|= [hood-version=@ud old=any-state]
|
||||
=< abet
|
||||
=? . ?=(%0 -.old)
|
||||
@ -97,8 +147,8 @@
|
||||
?: &(=(%base syd.i.syncs) !=(our her.i.syncs) =(%kids sud.i.syncs))
|
||||
`[syd her sud]:i.syncs
|
||||
$(syncs t.syncs)
|
||||
::
|
||||
=. +<+.$.abet
|
||||
%- state-1-to-2
|
||||
=- old(- %1, |3 [ota=~ commit-timer.old], syn -)
|
||||
?~ recognized-ota
|
||||
syn
|
||||
@ -108,7 +158,8 @@
|
||||
(poke-internal:update `[her sud]:u.recognized-ota)
|
||||
+(old +<+.$.abet)
|
||||
::
|
||||
?> ?=(%1 -.old)
|
||||
=? old ?=(%1 -.old) (state-1-to-2 old)
|
||||
?> ?=(%2 -.old)
|
||||
=. +<+.$.abet old
|
||||
..abet
|
||||
::
|
||||
@ -387,10 +438,76 @@
|
||||
?~ +< abet
|
||||
abet:abet:(merge:(work syd) ali sud cas gim)
|
||||
::
|
||||
++ poke-fuse-list
|
||||
=>
|
||||
|%
|
||||
++ format-fuse
|
||||
|= [into=desk pf=per-fuse]
|
||||
^- tank
|
||||
=/ sources=tape
|
||||
%+ reel
|
||||
con.kf.pf
|
||||
|= [[fs=fuse-source g=germ] acc=tape]
|
||||
^- tape
|
||||
;: weld
|
||||
" ["
|
||||
(format-fuse-source fs)
|
||||
" "
|
||||
<g>
|
||||
"]"
|
||||
acc
|
||||
==
|
||||
:- %leaf
|
||||
;: weld
|
||||
"|fuse {<into>} "
|
||||
(format-fuse-source bas.kf.pf)
|
||||
sources
|
||||
==
|
||||
:: +format-fuse-source: fuse source -> beak -> path
|
||||
::
|
||||
++ format-fuse-source
|
||||
|= fs=fuse-source
|
||||
^- tape
|
||||
=/ bec=beak [who.fs des.fs ?:(?=([%trak] ver.fs) [%tas %track] ver.fs)]
|
||||
<(en-beam [bec /])>
|
||||
--
|
||||
|= k=kiln-fuse-list
|
||||
^+ abet
|
||||
%. abet
|
||||
?~ k
|
||||
?~ fus
|
||||
(slog [leaf+"no ongoing fuses" ~])
|
||||
%- slog
|
||||
%+ roll
|
||||
~(tap by `(map desk per-fuse)`fus)
|
||||
|= [[syd=desk pf=per-fuse] acc=tang]
|
||||
^- tang
|
||||
[(format-fuse syd pf) acc]
|
||||
=/ pfu=(unit per-fuse) (~(get by fus) u.k)
|
||||
?~ pfu
|
||||
(slog [leaf+"no ongoing fuse for {<u.k>}" ~])
|
||||
(slog [(format-fuse u.k u.pfu) ~])
|
||||
::
|
||||
++ poke-fuse
|
||||
|= k=kiln-fuse
|
||||
?~ k abet
|
||||
abet:(emit [%pass /kiln/fuse/[syd.k] %arvo %c [%fuse syd.k bas.k con.k]])
|
||||
=/ payload +.k
|
||||
?~ payload
|
||||
:: cancelling an ongoing fuse
|
||||
%- (slog [leaf+"cancelling fuse into {<syd.k>}" ~])
|
||||
=/ f (fuzz syd.k now)
|
||||
?~ f
|
||||
abet
|
||||
abet:abet:delete:u.f
|
||||
?: &(!overwrite.payload (~(has by fus) syd.k))
|
||||
((slog [leaf+"existing fuse into {<syd.k>} - need =overwrite &" ~]) abet)
|
||||
=. fus (~(put by fus) syd.k [~ [syd.k bas.payload con.payload]])
|
||||
=/ old-cnt=@ud (~(gut by hxs) syd.k 0)
|
||||
=. hxs (~(put by hxs) syd.k +(old-cnt))
|
||||
=/ f (fuzz syd.k now)
|
||||
?~ f
|
||||
abet
|
||||
abet:abet:fuse:u.f
|
||||
::
|
||||
++ poke-cancel
|
||||
|= a=@tas
|
||||
@ -442,6 +559,7 @@
|
||||
%kiln-label =;(f (f !<(_+<.f vase)) poke-label)
|
||||
%kiln-merge =;(f (f !<(_+<.f vase)) poke-merge)
|
||||
%kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse)
|
||||
%kiln-fuse-list =;(f (f !<(_+<.f vase)) poke-fuse-list)
|
||||
%kiln-mount =;(f (f !<(_+<.f vase)) poke-mount)
|
||||
%kiln-ota =;(f (f !<(_+<.f vase)) poke:update)
|
||||
%kiln-ota-info =;(f (f !<(_+<.f vase)) poke-ota-info)
|
||||
@ -489,6 +607,21 @@
|
||||
[%autocommit *] %+ take-wake-autocommit t.wire
|
||||
?>(?=(%wake +<.sign-arvo) +>.sign-arvo)
|
||||
[%ota *] abet:(take:update t.wire sign-arvo)
|
||||
[%fuse-request @tas *]
|
||||
=/ f (fuzz i.t.wire now)
|
||||
?~ f
|
||||
abet
|
||||
abet:abet:(take:u.f t.t.wire sign-arvo)
|
||||
[%fuse @tas *] ?> ?=(%mere +<.sign-arvo)
|
||||
=/ syd=desk i.t.wire
|
||||
?. ?=([%| *] +>.sign-arvo)
|
||||
?~ p.p.sign-arvo
|
||||
abet
|
||||
=/ msg=tape "fuse merge conflict for {<syd>}"
|
||||
%- (slog [leaf+msg >p.p.sign-arvo< ~])
|
||||
abet
|
||||
%- (slog leaf+"failed fuse for {<syd>}" p.p.sign-arvo)
|
||||
abet
|
||||
*
|
||||
?+ +<.sign-arvo
|
||||
((slog leaf+"kiln: strange card {<+<.sign-arvo wire>}" ~) abet)
|
||||
@ -567,6 +700,122 @@
|
||||
++ spam
|
||||
|= mes=(list tank)
|
||||
((slog mes) ..spam)
|
||||
:: state machine for fuses
|
||||
::
|
||||
++ fuzz
|
||||
|= [syd=desk now=@da]
|
||||
=/ pfu=(unit per-fuse) (~(get by fus) syd)
|
||||
?~ pfu
|
||||
~
|
||||
=* kf kf.u.pfu
|
||||
=* mox mox.u.pfu
|
||||
=/ should-delete=flag |
|
||||
%- some
|
||||
|%
|
||||
:: finalize
|
||||
::
|
||||
++ abet
|
||||
?: should-delete
|
||||
..fuzz(fus (~(del by fus) syd))
|
||||
..fuzz(fus (~(put by fus) syd [mox kf]))
|
||||
::
|
||||
++ delete
|
||||
^+ ..delete
|
||||
=. should-delete &
|
||||
..delete
|
||||
:: queue moves
|
||||
::
|
||||
++ blab
|
||||
|= new=(list card:agent:gall)
|
||||
^+ +>
|
||||
+>.$(moz (welp new moz))
|
||||
:: +make-requests: send requests for each %trak source.
|
||||
::
|
||||
++ make-requests
|
||||
^+ ..abet
|
||||
=/ movs=(list card:agent:gall)
|
||||
%+ murn
|
||||
[[bas.kf *germ] con.kf]
|
||||
|= [fs=fuse-source germ]
|
||||
^- (unit card:agent:gall)
|
||||
?^ ver.fs
|
||||
:: static source, don't need to track
|
||||
~
|
||||
=/ bec=beak (realize-fuse-source fs &)
|
||||
?> =(who.fs p.bec)
|
||||
?> =(des.fs q.bec)
|
||||
=/ hax=@ud (mug [kf (~(got by hxs) syd)])
|
||||
=/ wir=wire
|
||||
/kiln/fuse-request/[syd]/(scot %p p.bec)/[q.bec]/(scot %ud hax)
|
||||
=/ rav=rave [%sing %w r.bec /]
|
||||
=/ rif=riff [q.bec `rav]
|
||||
`[%pass wir %arvo %c [%warp who.fs rif]]
|
||||
:: No need to keep state if all the sources are static
|
||||
?~ movs
|
||||
delete
|
||||
(blab movs)
|
||||
::
|
||||
++ send-fuse
|
||||
^+ ..abet
|
||||
=/ bas=beak (realize-fuse-source bas.kf |)
|
||||
=/ con=(list [beak germ])
|
||||
%+ turn
|
||||
con.kf
|
||||
|= [fs=fuse-source g=germ]
|
||||
[(realize-fuse-source fs |) g]
|
||||
%- blab
|
||||
[%pass /kiln/fuse/[syd] %arvo %c [%fuse syd bas con]]~
|
||||
::
|
||||
++ fuse
|
||||
^+ ..abet
|
||||
send-fuse:make-requests
|
||||
::
|
||||
++ take
|
||||
|= [wir=wire =sign-arvo]
|
||||
^+ ..fuse
|
||||
?> =((lent wir) 3)
|
||||
=/ who=ship (slav %p (snag 0 wir))
|
||||
=/ src=desk (snag 1 wir)
|
||||
=/ hax=@ud (slav %ud (snag 2 wir))
|
||||
?. =(hax (mug [kf (~(got by hxs) syd)]))
|
||||
:: If the hash in the wire doesn't match the current request
|
||||
:: this is a response for a previous fuse that we can ignore.
|
||||
..take
|
||||
?> ?=([?(%clay %behn) %writ *] sign-arvo)
|
||||
=/ gif +.sign-arvo
|
||||
?~ p.gif
|
||||
%- (slog leaf+"|fuse request failed for {<src>} on <who> - cancelling")
|
||||
delete
|
||||
=/ cas=cass:clay !<(cass:clay +.r.u.p.gif)
|
||||
=. mox (~(put by mox) [who src] ud.cas)
|
||||
fuse
|
||||
::
|
||||
:: utility functions below
|
||||
::
|
||||
:: +realize-fuse-source: convert a fuse-source to a
|
||||
:: fully realized beak.
|
||||
::
|
||||
++ realize-fuse-source
|
||||
|= [fs=fuse-source incr=flag]
|
||||
^- beak
|
||||
:+ who.fs
|
||||
des.fs
|
||||
?@ ver.fs
|
||||
(realize-case [who.fs des.fs incr])
|
||||
`case`ver.fs
|
||||
::
|
||||
++ realize-case
|
||||
|= [who=ship des=desk incr=flag]
|
||||
^- case
|
||||
=/ let=(unit @ud) (~(get by mox) [who des])
|
||||
^- case
|
||||
?~ let
|
||||
da+now
|
||||
:- %ud
|
||||
?: incr
|
||||
+(u.let)
|
||||
u.let
|
||||
--
|
||||
::
|
||||
++ auto
|
||||
|= kiln-sync
|
||||
|
@ -232,58 +232,76 @@
|
||||
:: +veri:dawn: validate keys, life, discontinuity, &c
|
||||
::
|
||||
++ veri
|
||||
|= [=seed:jael =point:azimuth =live]
|
||||
^- (unit error=term)
|
||||
=/ rac (clan:title who.seed)
|
||||
=/ cub (nol:nu:crub:crypto key.seed)
|
||||
?- rac
|
||||
%pawn
|
||||
:: a comet address is the fingerprint of the keypair
|
||||
::
|
||||
?. =(who.seed `@`fig:ex:cub)
|
||||
`%key-mismatch
|
||||
:: a comet can never be breached
|
||||
::
|
||||
?^ live
|
||||
`%already-booted
|
||||
:: a comet can never be re-keyed
|
||||
::
|
||||
?. ?=(%1 lyf.seed)
|
||||
`%invalid-life
|
||||
~
|
||||
|= [=ship =feed:jael =point:azimuth =live]
|
||||
^- (each seed:jael (lest error=term))
|
||||
|^ ?@ -.feed
|
||||
?^ err=(test feed) |+[u.err ~]
|
||||
&+feed
|
||||
?> ?=([%1 ~] -.feed)
|
||||
=| errs=(list term)
|
||||
|-
|
||||
?~ kyz.feed
|
||||
|+?~(errs [%no-key ~] errs)
|
||||
=/ =seed:jael [who [lyf key ~]:i.kyz]:feed
|
||||
?~ err=(test seed)
|
||||
&+seed
|
||||
=. errs (snoc errs u.err)
|
||||
$(kyz.feed t.kyz.feed)
|
||||
::
|
||||
%earl
|
||||
~
|
||||
::
|
||||
*
|
||||
:: on-chain ships must be launched
|
||||
++ test
|
||||
|= =seed:jael
|
||||
^- (unit error=term)
|
||||
?. =(ship who.seed) `%not-our-key
|
||||
=/ rac (clan:title who.seed)
|
||||
=/ cub (nol:nu:crub:crypto key.seed)
|
||||
?- rac
|
||||
%pawn
|
||||
:: a comet address is the fingerprint of the keypair
|
||||
::
|
||||
?. =(who.seed `@`fig:ex:cub)
|
||||
`%key-mismatch
|
||||
:: a comet can never be breached
|
||||
::
|
||||
?^ live
|
||||
`%already-booted
|
||||
:: a comet can never be re-keyed
|
||||
::
|
||||
?. ?=(%1 lyf.seed)
|
||||
`%invalid-life
|
||||
~
|
||||
::
|
||||
?~ net.point
|
||||
`%not-keyed
|
||||
=* net u.net.point
|
||||
:: boot keys must match the contract
|
||||
%earl
|
||||
~
|
||||
::
|
||||
?. =(pub:ex:cub pass.net)
|
||||
~& [%key-mismatch pub:ex:cub pass.net]
|
||||
`%key-mismatch
|
||||
:: life must match the contract
|
||||
::
|
||||
?. =(lyf.seed life.net)
|
||||
`%life-mismatch
|
||||
:: the boot life must be greater than and discontinuous with
|
||||
:: the last seen life (per the sponsor)
|
||||
::
|
||||
?: ?& ?=(^ live)
|
||||
?| ?=(%| breach.u.live)
|
||||
(lte life.net life.u.live)
|
||||
== ==
|
||||
`%already-booted
|
||||
:: produce the sponsor for vere
|
||||
::
|
||||
~? !has.sponsor.net
|
||||
[%no-sponsorship-guarantees-from who.sponsor.net]
|
||||
~
|
||||
==
|
||||
*
|
||||
:: on-chain ships must be launched
|
||||
::
|
||||
?~ net.point
|
||||
`%not-keyed
|
||||
=* net u.net.point
|
||||
:: boot keys must match the contract
|
||||
::
|
||||
?. =(pub:ex:cub pass.net)
|
||||
`%key-mismatch
|
||||
:: life must match the contract
|
||||
::
|
||||
?. =(lyf.seed life.net)
|
||||
`%life-mismatch
|
||||
:: the boot life must be greater than and discontinuous with
|
||||
:: the last seen life (per the sponsor)
|
||||
::
|
||||
?: ?& ?=(^ live)
|
||||
?| ?=(%| breach.u.live)
|
||||
(lte life.net life.u.live)
|
||||
== ==
|
||||
`%already-booted
|
||||
:: produce the sponsor for vere
|
||||
::
|
||||
~? !has.sponsor.net
|
||||
[%no-sponsorship-guarantees-from who.sponsor.net]
|
||||
~
|
||||
==
|
||||
--
|
||||
:: +sponsor:dawn: retreive sponsor from point
|
||||
::
|
||||
++ sponsor
|
||||
|
@ -1879,7 +1879,12 @@
|
||||
[%public-keys =public-keys-result] :: ethereum changes
|
||||
[%turf turf=(list turf)] :: domains
|
||||
== ::
|
||||
:: +seed: private boot parameters
|
||||
:: +feed: potential boot parameters
|
||||
::
|
||||
+$ feed
|
||||
$^ [[%1 ~] who=ship kyz=(list [lyf=life key=ring])]
|
||||
seed
|
||||
:: +seed: individual boot parameters
|
||||
::
|
||||
+$ seed [who=ship lyf=life key=ring sig=(unit oath:pki)]
|
||||
::
|
||||
|
@ -2096,7 +2096,7 @@
|
||||
|= [k=beak v=(unit dome:clay)]
|
||||
^- tank
|
||||
=/ received=tape ?~(v "missing" "received")
|
||||
leaf+"{<k>} {received}"
|
||||
leaf+"{<(en-beam k ~)>} {received}"
|
||||
:_ discarded
|
||||
leaf+"fusing into {<syd>} from {<bas>} {<con>} - overwriting prior fuse"
|
||||
=. fiz (make-melt bas con)
|
||||
@ -2113,8 +2113,11 @@
|
||||
:: responses we get for the merge will cause take-fuse to crash
|
||||
::
|
||||
=. fiz *melt
|
||||
((slog [leaf+"clay: fuse failed, missing {<bec>}"]~) ..take-fuse)
|
||||
?> (~(has by sto.fiz) bec)
|
||||
=/ msg=tape <(en-beam bec ~)>
|
||||
((slog [leaf+"clay: fuse failed, missing {msg}"]~) ..take-fuse)
|
||||
?. (~(has by sto.fiz) bec)
|
||||
=/ msg=tape <(en-beam bec ~)>
|
||||
((slog [leaf+"clay: got strange fuse response {<msg>}"]~) ..take-fuse)
|
||||
=. fiz
|
||||
:+ bas.fiz con.fiz
|
||||
(~(put by sto.fiz) bec `!<(dome:clay q.r.u.riot))
|
||||
@ -2135,7 +2138,6 @@
|
||||
|-
|
||||
^+ ..take-fuse
|
||||
?~ merges
|
||||
=/ t=tang [leaf+"{<syd>} fused from {<bas.fiz>} {<con.fiz>}" ~]
|
||||
=. ..take-fuse (done-fuse clean-state %& ~)
|
||||
(park | [%| continuation-yaki(p (flop parents))] rag)
|
||||
=/ [bec=beak g=germ] i.merges
|
||||
@ -2143,7 +2145,8 @@
|
||||
=/ result (merge-helper p.bec q.bec g ali-dom `continuation-yaki)
|
||||
?- -.result
|
||||
%|
|
||||
(done-fuse clean-state %| %fuse-merge-failed p.result)
|
||||
=/ failing-merge=tape "{<bec>} {<g>}"
|
||||
(done-fuse clean-state %| %fuse-merge-failed leaf+failing-merge p.result)
|
||||
::
|
||||
%&
|
||||
=/ merge-result=(unit merge-result) +.result
|
||||
|
@ -554,6 +554,7 @@
|
||||
:: +per-server-event: per-event server core
|
||||
::
|
||||
++ per-server-event
|
||||
~% %eyre-per-server-event ..part ~
|
||||
:: gate that produces the +per-server-event core from event information
|
||||
::
|
||||
|= [[eny=@ =duct now=@da rof=roof] state=server-state]
|
||||
@ -781,7 +782,7 @@
|
||||
:* duct %pass /run-app-request/[eyre-id]
|
||||
%g %deal [our our] app
|
||||
%poke %handle-http-request
|
||||
!>([eyre-id inbound-request])
|
||||
!>(`[@ta inbound-request:eyre]`[eyre-id inbound-request])
|
||||
==
|
||||
==
|
||||
:: +cancel-request: handles a request being externally aborted
|
||||
@ -1205,15 +1206,21 @@
|
||||
?~ maybe-channel=(~(get by session.channel-state.state) channel-id)
|
||||
%^ return-static-data-on-duct 404 'text/html'
|
||||
(error-page 404 %.y url.request ~)
|
||||
:: if there's already a duct listening to this channel, we must 400
|
||||
::
|
||||
?: ?=([%| *] state.u.maybe-channel)
|
||||
%^ return-static-data-on-duct 400 'text/html'
|
||||
(error-page 400 %.y url.request "channel already bound")
|
||||
:: when opening an event-stream, we must cancel our timeout timer
|
||||
:: if there's no duct already bound. Else, kill the old request
|
||||
:: and replace it
|
||||
::
|
||||
=. moves
|
||||
[(cancel-timeout-move channel-id p.state.u.maybe-channel) moves]
|
||||
=^ cancel-moves state
|
||||
?. ?=([%| *] state.u.maybe-channel)
|
||||
:_ state
|
||||
(cancel-timeout-move channel-id p.state.u.maybe-channel)^~
|
||||
=/ cancel-heartbeat
|
||||
?~ heartbeat.u.maybe-channel ~
|
||||
:_ ~
|
||||
%+ cancel-heartbeat-move channel-id
|
||||
[date duct]:u.heartbeat.u.maybe-channel
|
||||
=- [(weld cancel-heartbeat -<) ->]
|
||||
(handle-response(duct p.state.u.maybe-channel) [%cancel ~])
|
||||
:: the request may include a 'Last-Event-Id' header
|
||||
::
|
||||
=/ maybe-last-event-id=(unit @ud)
|
||||
@ -1282,7 +1289,7 @@
|
||||
|= =channel
|
||||
channel(events ~, state [%| duct], heartbeat (some [heartbeat-time duct]))
|
||||
::
|
||||
[[heartbeat (weld http-moves moves)] state]
|
||||
[[heartbeat :(weld http-moves cancel-moves moves)] state]
|
||||
:: +acknowledge-events: removes events before :last-event-id on :channel-id
|
||||
::
|
||||
++ acknowledge-events
|
||||
@ -1710,7 +1717,7 @@
|
||||
=/ res
|
||||
%- handle-response
|
||||
:* %continue
|
||||
data=(some (as-octs:mimes:html '\0a'))
|
||||
data=(some (as-octs:mimes:html ':\0a'))
|
||||
complete=%.n
|
||||
==
|
||||
=/ http-moves -.res
|
||||
|
@ -760,12 +760,10 @@
|
||||
mo-core
|
||||
=^ [=duct =routes blocker=(each deal sign:agent)] blocked
|
||||
~(get to blocked)
|
||||
?: ?=(%| -.blocker) $
|
||||
=/ =move
|
||||
=/ =sock [attributing.routes our]
|
||||
=/ card
|
||||
?: ?=(%& -.blocker)
|
||||
[%slip %g %deal sock dap p.blocker]
|
||||
[%pass /clear-huck %b %huck `sign-arvo`[%gall %unto p.blocker]]
|
||||
=/ card [%slip %g %deal sock dap p.blocker]
|
||||
[duct card]
|
||||
$(moves [move moves])
|
||||
:: +mo-filter-queue: remove all blocked tasks from ship.
|
||||
|
@ -434,7 +434,7 @@
|
||||
%- curd =< abet
|
||||
(private-keys:~(feel su hen now pki etn) life.tac ring.tac)
|
||||
::
|
||||
:: update private keys
|
||||
:: register moon keys
|
||||
::
|
||||
%moon
|
||||
?. =(%earl (clan:title ship.tac))
|
||||
@ -717,6 +717,14 @@
|
||||
=/ a-point=point (~(gut by pos.zim.pki) ship.i.udiffs *point)
|
||||
=/ a-diff=(unit diff:point) (udiff-to-diff:point udiff.i.udiffs a-point)
|
||||
=? this-su ?=(^ a-diff)
|
||||
:: if this about our keys, and we already know these, start using them
|
||||
::
|
||||
=? lyf.own
|
||||
?& =(our ship.i.udiffs)
|
||||
?=(%keys -.u.a-diff)
|
||||
(~(has by jaw.own) life.to.u.a-diff)
|
||||
==
|
||||
life.to.u.a-diff
|
||||
(public-keys:feel original-pos %diff ship.i.udiffs u.a-diff)
|
||||
$(udiffs t.udiffs)
|
||||
::
|
||||
@ -926,7 +934,16 @@
|
||||
^+ ..feel
|
||||
?: &(=(lyf.own life) =((~(get by jaw.own) life) `ring))
|
||||
..feel
|
||||
=. lyf.own life
|
||||
:: only eagerly update lyf if we were behind the chain life
|
||||
::
|
||||
=? lyf.own
|
||||
?& (gth life lyf.own)
|
||||
::
|
||||
=+ pon=(~(get by pos.zim) our)
|
||||
?~ pon |
|
||||
(lth lyf.own life.u.pon)
|
||||
==
|
||||
life
|
||||
=. jaw.own (~(put by jaw.own) life ring)
|
||||
(exec yen.own [%give %private-keys lyf.own jaw.own])
|
||||
::
|
||||
|
@ -11,7 +11,7 @@
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<(desks=(list desk) arg)
|
||||
=+ !<([~ desks=(list desk)] arg)
|
||||
=? desks =(~ desks) [%work]~
|
||||
|- ^- form:m
|
||||
=* loop $
|
||||
|
@ -188,37 +188,53 @@
|
||||
++ test-veri-good
|
||||
=/ sed [~zod 1 sec ~]
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> (veri:dawn sed pot ~)
|
||||
!> &+sed
|
||||
!> (veri:dawn ~zod sed pot ~)
|
||||
::
|
||||
++ test-veri-not-spawned
|
||||
=/ sed [~zod 1 sec ~]
|
||||
%+ expect-eq
|
||||
!> `%not-keyed
|
||||
!> (veri:dawn sed =>(pot .(net ~)) ~)
|
||||
!> |+[%not-keyed ~]
|
||||
!> (veri:dawn ~zod sed =>(pot .(net ~)) ~)
|
||||
::
|
||||
++ test-veri-wrong-key
|
||||
=/ sed [~zod 1 sec:ex:(pit:nu:crub:crypto 24 %foo) ~]
|
||||
%+ expect-eq
|
||||
!> `%key-mismatch
|
||||
!> (veri:dawn sed pot ~)
|
||||
!> |+[%key-mismatch ~]
|
||||
!> (veri:dawn ~zod sed pot ~)
|
||||
::
|
||||
++ test-veri-life-mismatch
|
||||
=/ sed [~zod 2 sec ~]
|
||||
%+ expect-eq
|
||||
!> `%life-mismatch
|
||||
!> (veri:dawn sed pot ~)
|
||||
!> |+[%life-mismatch ~]
|
||||
!> (veri:dawn ~zod sed pot ~)
|
||||
::
|
||||
++ test-veri-bad-multikey
|
||||
=/ fed=feed:jael
|
||||
:- [%1 ~]
|
||||
:- ~zod
|
||||
:~ [1 sec:ex:(pit:nu:crub:crypto 24 %foo)]
|
||||
[2 sec]
|
||||
==
|
||||
%+ expect-eq
|
||||
!> |+[%key-mismatch %life-mismatch ~]
|
||||
!> (veri:dawn ~zod fed pot ~)
|
||||
::
|
||||
++ test-veri-none-multikey
|
||||
%+ expect-eq
|
||||
!> |+[%no-key ~]
|
||||
!> (veri:dawn ~zod [[%1 ~] ~zod ~] pot ~)
|
||||
::
|
||||
++ test-veri-already-booted
|
||||
=/ sed [~zod 1 sec ~]
|
||||
;: weld
|
||||
%+ expect-eq
|
||||
!> `%already-booted
|
||||
!> (veri:dawn sed pot `[1 |])
|
||||
!> |+[%already-booted ~]
|
||||
!> (veri:dawn ~zod sed pot `[1 |])
|
||||
::
|
||||
%+ expect-eq
|
||||
!> `%already-booted
|
||||
!> (veri:dawn sed pot `[2 &])
|
||||
!> |+[%already-booted ~]
|
||||
!> (veri:dawn ~zod sed pot `[2 &])
|
||||
==
|
||||
::
|
||||
++ test-veri-earl-good
|
||||
@ -230,8 +246,8 @@
|
||||
(shaf %earl (sham who 1 pub:ex:cub))
|
||||
[who 1 sec:ex:cub `sig]
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> (veri:dawn sed pot ~)
|
||||
!> &+sed
|
||||
!> (veri:dawn who sed pot ~)
|
||||
::
|
||||
++ test-veri-earl-parent-not-keyed
|
||||
=/ cub (pit:nu:crub:crypto 24 %foo)
|
||||
@ -242,38 +258,38 @@
|
||||
(shaf %earl (sham who 1 pub:ex:cub))
|
||||
[who 1 sec:ex:cub `sig]
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> (veri:dawn sed =>(pot .(net ~)) ~)
|
||||
!> &+sed
|
||||
!> (veri:dawn who sed =>(pot .(net ~)) ~)
|
||||
::
|
||||
++ test-veri-pawn-good
|
||||
=/ cub (pit:nu:crub:crypto 24 %foo)
|
||||
=/ who=ship `@`fig:ex:cub
|
||||
=/ sed [who 1 sec:ex:cub ~]
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> (veri:dawn sed *point:azimuth-types ~)
|
||||
!> &+sed
|
||||
!> (veri:dawn who sed *point:azimuth-types ~)
|
||||
::
|
||||
++ test-veri-pawn-key-mismatch
|
||||
=/ cub (pit:nu:crub:crypto 24 %foo)
|
||||
=/ who=ship `@`fig:ex:cub
|
||||
=/ sed [who 1 sec:ex:(pit:nu:crub:crypto 24 %bar) ~]
|
||||
%+ expect-eq
|
||||
!> `%key-mismatch
|
||||
!> (veri:dawn sed *point:azimuth-types ~)
|
||||
!> |+[%key-mismatch ~]
|
||||
!> (veri:dawn who sed *point:azimuth-types ~)
|
||||
::
|
||||
++ test-veri-pawn-invalid-life
|
||||
=/ cub (pit:nu:crub:crypto 24 %foo)
|
||||
=/ who=ship `@`fig:ex:cub
|
||||
=/ sed [who 2 sec:ex:cub ~]
|
||||
%+ expect-eq
|
||||
!> `%invalid-life
|
||||
!> (veri:dawn sed *point:azimuth-types ~)
|
||||
!> |+[%invalid-life ~]
|
||||
!> (veri:dawn who sed *point:azimuth-types ~)
|
||||
::
|
||||
++ test-veri-pawn-already-booted
|
||||
=/ cub (pit:nu:crub:crypto 24 %foo)
|
||||
=/ who=ship `@`fig:ex:cub
|
||||
=/ sed [who 1 sec:ex:cub ~]
|
||||
%+ expect-eq
|
||||
!> `%already-booted
|
||||
!> (veri:dawn sed *point:azimuth-types `[1 |])
|
||||
!> |+[%already-booted ~]
|
||||
!> (veri:dawn who sed *point:azimuth-types `[1 |])
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user