mirror of
https://github.com/urbit/shrub.git
synced 2025-01-07 05:26:56 +03:00
Changes now always accompanied by their on-chain source. (ie event in block)
This commit is contained in:
parent
1e71f0ec43
commit
9faffde755
@ -46,7 +46,7 @@
|
|||||||
::
|
::
|
||||||
++ ta
|
++ ta
|
||||||
|_ $: moves=(list move) :: side-effects
|
|_ $: moves=(list move) :: side-effects
|
||||||
diffs=(list diff-constitution)
|
diffs=(jar [@ud @ud] diff-constitution) :: changes per event
|
||||||
reqs=(list (pair (unit @t) request)) :: rpc requests
|
reqs=(list (pair (unit @t) request)) :: rpc requests
|
||||||
wir=wire :: wire for reqs
|
wir=wire :: wire for reqs
|
||||||
==
|
==
|
||||||
@ -61,14 +61,17 @@
|
|||||||
=- [ost.bol -]~
|
=- [ost.bol -]~
|
||||||
%+ rpc-request:ca wir
|
%+ rpc-request:ca wir
|
||||||
a+(turn (flop reqs) request-to-json)
|
a+(turn (flop reqs) request-to-json)
|
||||||
?: =(0 (lent diffs)) ~ ::TODO this is a tmi workaround
|
^- (list move)
|
||||||
=. diffs (flop diffs)
|
%- zing
|
||||||
|
%+ turn ~(tap by diffs)
|
||||||
|
|= [cause=[@ud @ud] dis=(list diff-constitution)]
|
||||||
|
=. dis (flop dis)
|
||||||
^- (list move)
|
^- (list move)
|
||||||
%+ murn ~(tap by sup.bol)
|
%+ murn ~(tap by sup.bol)
|
||||||
|= [b=bone s=ship p=path]
|
|= [b=bone s=ship p=path]
|
||||||
^- (unit move)
|
^- (unit move)
|
||||||
?. ?=([%state *] p) ~
|
?. ?=([%state *] p) ~
|
||||||
`[b (updates:ca diffs)]
|
`[b (updates:ca cause dis)]
|
||||||
::
|
::
|
||||||
++ ta-move
|
++ ta-move
|
||||||
|= mov=move
|
|= mov=move
|
||||||
@ -92,12 +95,14 @@
|
|||||||
`[b %diff %constitution-update upd]
|
`[b %diff %constitution-update upd]
|
||||||
::
|
::
|
||||||
++ ta-change
|
++ ta-change
|
||||||
|= dif=diff-constitution
|
|= [cause=[@ud @ud] dif=diff-constitution]
|
||||||
(da(diffs [dif diffs]) [dif]~)
|
(da(diffs (~(add ja diffs) cause dif)) cause [dif]~)
|
||||||
::
|
::
|
||||||
++ ta-changes
|
++ ta-changes
|
||||||
|= dis=(list diff-constitution)
|
|= [cause=[@ud @ud] dis=(list diff-constitution)]
|
||||||
(da(diffs (weld (flop dis) diffs)) dis)
|
=- (da(diffs -) cause dis)
|
||||||
|
%+ ~(put by diffs) cause
|
||||||
|
(weld (flop dis) (~(get ja diffs) cause))
|
||||||
::
|
::
|
||||||
++ ta-request
|
++ ta-request
|
||||||
|= [id=(unit @t) req=request]
|
|= [id=(unit @t) req=request]
|
||||||
@ -185,9 +190,12 @@
|
|||||||
(ta-to-all(ships s, dns d, heard h) %full s d h)
|
(ta-to-all(ships s, dns d, heard h) %full s d h)
|
||||||
::
|
::
|
||||||
++ ta-accept
|
++ ta-accept
|
||||||
|= dis=(list diff-constitution)
|
|= [cause=[@ud @ud] dis=(list diff-constitution)]
|
||||||
|
?: &(!=([0 0] cause) (~(has in heard) cause))
|
||||||
|
~& %ta-accept-ignoring-duplicate-event
|
||||||
|
+>.$
|
||||||
~& [%ta-accept (lent dis)]
|
~& [%ta-accept (lent dis)]
|
||||||
(ta-changes dis)
|
(ta-changes cause dis)
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
++ ta-take-filter
|
++ ta-take-filter
|
||||||
@ -234,26 +242,22 @@
|
|||||||
?: (~(has in heard) block-number.place log-index.place)
|
?: (~(has in heard) block-number.place log-index.place)
|
||||||
~& %ignoring-duplicate-event
|
~& %ignoring-duplicate-event
|
||||||
+>
|
+>
|
||||||
=. +>.$
|
=+ cuz=[block-number.place log-index.place]
|
||||||
%+ ta-change %heard
|
|
||||||
[block-number.place log-index.place]
|
|
||||||
::
|
::
|
||||||
?: =(event.log changed-dns:ships-events)
|
?: =(event.log changed-dns:ships-events)
|
||||||
=+ ^- [pri=tape sec=tape ter=tape]
|
=+ ^- [pri=tape sec=tape ter=tape]
|
||||||
(decode-results data.log ~[%string %string %string])
|
(decode-results data.log ~[%string %string %string])
|
||||||
=? +>.$ !=(pri.dns (crip pri))
|
=? +>.$ !=(pri.dns (crip pri))
|
||||||
(ta-change %dns 0 (crip pri))
|
(ta-change cuz %dns 0 (crip pri))
|
||||||
=? +>.$ !=(sec.dns (crip sec))
|
=? +>.$ !=(sec.dns (crip sec))
|
||||||
(ta-change %dns 1 (crip sec))
|
(ta-change cuz %dns 1 (crip sec))
|
||||||
=? +>.$ !=(ter.dns (crip ter))
|
=? +>.$ !=(ter.dns (crip ter))
|
||||||
(ta-change %dns 2 (crip ter))
|
(ta-change cuz %dns 2 (crip ter))
|
||||||
+>.$
|
+>.$
|
||||||
::
|
::
|
||||||
=+ dis=(event-log-to-hull-diffs log)
|
=+ dis=(event-log-to-hull-diffs log)
|
||||||
|- ^+ +>.^$
|
?~ dis +>.$
|
||||||
?~ dis +>.^$
|
(ta-change cuz %hull i.dis)
|
||||||
=. +>.^$ (ta-change %hull i.dis)
|
|
||||||
$(dis t.dis)
|
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
++ ta-take-read-results
|
++ ta-take-read-results
|
||||||
@ -304,7 +308,7 @@
|
|||||||
~& [%completely-missing who.cal]
|
~& [%completely-missing who.cal]
|
||||||
?. save +>.$
|
?. save +>.$
|
||||||
~& [%storing-chain-version-of who.cal]
|
~& [%storing-chain-version-of who.cal]
|
||||||
(ta-change %hull who.cal %full hul)
|
(ta-change [0 0] %hull who.cal %full hul)
|
||||||
::
|
::
|
||||||
=* huv state.u.have
|
=* huv state.u.have
|
||||||
?: =(huv hul) +>.$
|
?: =(huv hul) +>.$
|
||||||
@ -345,7 +349,7 @@
|
|||||||
~& %$
|
~& %$
|
||||||
?. save +>.$
|
?. save +>.$
|
||||||
~& [%storing-chain-version-of who.cal]
|
~& [%storing-chain-version-of who.cal]
|
||||||
(ta-change %hull who.cal %full hul)
|
(ta-change [0 0] %hull who.cal %full hul)
|
||||||
::
|
::
|
||||||
=. checking (~(del by checking) who.cal)
|
=. checking (~(del by checking) who.cal)
|
||||||
(ta-read-ships kis)
|
(ta-read-ships kis)
|
||||||
@ -357,31 +361,32 @@
|
|||||||
?: =(pri.dns dom) +>.$
|
?: =(pri.dns dom) +>.$
|
||||||
~& [%primary-dns-differs pri.dns dom]
|
~& [%primary-dns-differs pri.dns dom]
|
||||||
?. save +>.$
|
?. save +>.$
|
||||||
(ta-change %dns 0 dom)
|
(ta-change [0 0] %dns 0 dom)
|
||||||
?: =(1 ind.cal)
|
?: =(1 ind.cal)
|
||||||
?: =(sec.dns dom) +>.$
|
?: =(sec.dns dom) +>.$
|
||||||
~& [%secondary-dns-differs sec.dns dom]
|
~& [%secondary-dns-differs sec.dns dom]
|
||||||
?. save +>.$
|
?. save +>.$
|
||||||
(ta-change %dns 1 dom)
|
(ta-change [0 0] %dns 1 dom)
|
||||||
?: =(2 ind.cal)
|
?: =(2 ind.cal)
|
||||||
?: =(ter.dns dom) +>.$
|
?: =(ter.dns dom) +>.$
|
||||||
~& [%tertiary-dns-differs ter.dns dom]
|
~& [%tertiary-dns-differs ter.dns dom]
|
||||||
?. save +>.$
|
?. save +>.$
|
||||||
(ta-change %dns 2 dom)
|
(ta-change [0 0] %dns 2 dom)
|
||||||
!!
|
!!
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
++ da
|
++ da
|
||||||
|= dis=(list diff-constitution)
|
|= [[block=@ud log=@ud] dis=(list diff-constitution)]
|
||||||
^+ +>
|
^+ +>
|
||||||
|
=. heard (~(put in heard) block log)
|
||||||
|
=. latest-block (max latest-block block)
|
||||||
|^ ?~ dis +>.^$
|
|^ ?~ dis +>.^$
|
||||||
=. ..da
|
=. ..da
|
||||||
=* dif i.dis
|
=* dif i.dis
|
||||||
?- -.dif
|
?- -.dif
|
||||||
%hull (da-hull +.dif)
|
%hull (da-hull +.dif)
|
||||||
%dns (da-dns +.dif)
|
%dns (da-dns +.dif)
|
||||||
%heard (da-heard +.dif)
|
|
||||||
==
|
==
|
||||||
$(dis t.dis)
|
$(dis t.dis)
|
||||||
::
|
::
|
||||||
@ -460,9 +465,9 @@
|
|||||||
[%full ships dns heard]
|
[%full ships dns heard]
|
||||||
::
|
::
|
||||||
++ updates
|
++ updates
|
||||||
|= dis=(list diff-constitution)
|
|= [cause=[@ud @ud] dis=(list diff-constitution)]
|
||||||
^- card
|
^- card
|
||||||
[%diff %constitution-update %diff dis]
|
[%diff %constitution-update %diff cause dis]
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ hull-from-eth
|
++ hull-from-eth
|
||||||
|
@ -76,14 +76,12 @@
|
|||||||
::
|
::
|
||||||
++ update
|
++ update
|
||||||
$% [%full ships=fleet dns=dnses heard=events]
|
$% [%full ships=fleet dns=dnses heard=events]
|
||||||
[%diff dis=(list diff-constitution)]
|
[%diff [block=@ud log=@ud] dis=(list diff-constitution)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
::TODO maybe just send the event logs over instead?
|
|
||||||
++ diff-constitution
|
++ diff-constitution
|
||||||
$% [%hull who=@p dif=diff-hull]
|
$% [%hull who=@p dif=diff-hull]
|
||||||
[%dns ind=@ud new=@t]
|
[%dns ind=@ud new=@t]
|
||||||
[%heard block=@ud log=@ud] ::TODO why is this separate from the changes?
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ diff-hull
|
++ diff-hull
|
||||||
|
Loading…
Reference in New Issue
Block a user