2017-04-23 06:13:14 +03:00
|
|
|
!: :: /van/jael
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: %reference/0
|
|
|
|
!? 150
|
|
|
|
::
|
|
|
|
::
|
|
|
|
:: %jael: secrets and promises.
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
:: todo:
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: - communication with other vanes:
|
|
|
|
:: - actually use %behn for expiring secrets
|
|
|
|
:: - report %ames propagation errors to user
|
|
|
|
::
|
|
|
|
:: - nice features:
|
|
|
|
:: - scry namespace
|
|
|
|
:: - task for converting invites to tickets
|
|
|
|
::
|
|
|
|
|= pit/vase
|
2016-12-07 06:13:33 +03:00
|
|
|
=, pki:jael
|
|
|
|
=, rights:jael
|
2016-12-10 03:47:21 +03:00
|
|
|
=, able:jael
|
2016-12-02 22:34:07 +03:00
|
|
|
=, title
|
|
|
|
=, crypto
|
2016-11-24 07:25:07 +03:00
|
|
|
=, jael
|
2018-05-16 00:16:29 +03:00
|
|
|
=, ethe
|
|
|
|
=, constitution:ethe
|
|
|
|
=, ethereum
|
|
|
|
=, constitution:ethereum
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::::
|
|
|
|
:::: # models :: data structures
|
|
|
|
:: ::::
|
|
|
|
:: the %jael state comes in two parts: absolute
|
|
|
|
:: and relative.
|
|
|
|
::
|
|
|
|
:: ++state-absolute is objective -- defined without
|
|
|
|
:: reference to our ship. if you steal someone else's
|
|
|
|
:: private keys, we have a place to put them. when
|
|
|
|
:: others make promises to us, we store them in the
|
|
|
|
:: same structures we use to make promises to others.
|
|
|
|
::
|
|
|
|
:: ++state-relative is subjective, denormalized and
|
|
|
|
:: derived. it consists of all the state we need to
|
|
|
|
:: manage subscriptions efficiently.
|
|
|
|
::
|
|
|
|
=> |%
|
|
|
|
++ state :: all vane state
|
2016-12-16 09:34:01 +03:00
|
|
|
$: ver/$0 :: vane version
|
2016-11-24 07:25:07 +03:00
|
|
|
yen/(set duct) :: raw observers
|
|
|
|
urb/state-absolute :: all absolute state
|
|
|
|
sub/state-relative :: all relative state
|
2018-05-29 00:04:33 +03:00
|
|
|
etn=state-eth-node :: eth connection state
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
++ state-relative :: urbit metadata
|
2018-05-30 01:40:00 +03:00
|
|
|
$: $= bal :: balance sheet (vest)
|
2016-11-24 07:25:07 +03:00
|
|
|
$: yen/(set duct) :: trackers
|
2016-12-16 09:34:01 +03:00
|
|
|
== ::
|
2018-05-30 01:40:00 +03:00
|
|
|
$= own :: vault (vein)
|
2016-11-24 07:25:07 +03:00
|
|
|
$: yen/(set duct) :: trackers
|
|
|
|
lyf/life :: version
|
2018-08-23 22:23:52 +03:00
|
|
|
jaw/(map life ring) :: private keys
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
2018-06-01 01:31:45 +03:00
|
|
|
$= puk :: public keys (pubs)
|
|
|
|
$: yen=(jug ship duct) :: trackers
|
2018-08-30 03:02:17 +03:00
|
|
|
kyz=(map ship public) :: public key state
|
2018-06-01 01:31:45 +03:00
|
|
|
== ::
|
2018-05-29 00:04:33 +03:00
|
|
|
$= eth :: ethereum (vent)
|
2018-06-01 01:34:21 +03:00
|
|
|
::TODO the subscribers here never hear dns or hul...
|
2018-05-29 00:04:33 +03:00
|
|
|
$: yen=(set duct) :: trackers
|
|
|
|
dns=dnses :: on-chain dns state
|
|
|
|
hul=(map ship hull) :: on-chain ship state
|
|
|
|
::TODO do we want (map ship diff-hull) too?
|
|
|
|
== ::
|
2016-12-16 09:34:01 +03:00
|
|
|
== ::
|
2016-11-24 07:25:07 +03:00
|
|
|
++ state-absolute :: absolute urbit
|
2018-05-23 02:35:16 +03:00
|
|
|
$: pry/(map ship (map ship safe)) :: promises
|
2018-06-01 18:30:14 +03:00
|
|
|
eve=logs :: on-chain events
|
2018-10-04 09:43:40 +03:00
|
|
|
:: XX reconcile with .dns.eth
|
|
|
|
tuf=(list turf) :: domains
|
2018-09-15 08:38:22 +03:00
|
|
|
fak/_| :: fake keys
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
2018-05-29 00:04:33 +03:00
|
|
|
++ state-eth-node :: node config + meta
|
|
|
|
$: source=(each ship node-src) :: learning from
|
|
|
|
heard=(set event-id) :: processed events
|
2018-05-16 00:16:29 +03:00
|
|
|
latest-block=@ud :: last heard block
|
|
|
|
== ::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ node-src :: ethereum node comms
|
|
|
|
$: node=purl:eyre :: node url
|
|
|
|
filter-id=@ud :: current filter
|
|
|
|
poll-timer=@da :: next filter poll
|
|
|
|
== ::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::
|
|
|
|
++ message :: p2p message
|
2018-05-23 16:53:41 +03:00
|
|
|
$% [%hail p=remote] :: reset rights
|
2018-05-17 22:48:17 +03:00
|
|
|
[%nuke ~] :: cancel trackers
|
2018-06-01 01:34:21 +03:00
|
|
|
[%vent ~] :: view ethereum events
|
2018-05-29 21:20:25 +03:00
|
|
|
[%vent-result p=chain] :: tmp workaround
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
++ card :: i/o action
|
2018-05-16 21:48:20 +03:00
|
|
|
(wind note:able gift) ::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::
|
|
|
|
++ move :: output
|
|
|
|
{p/duct q/card} ::
|
|
|
|
-- ::
|
|
|
|
:: ::::
|
|
|
|
:::: # light :: light cores
|
|
|
|
:: ::::
|
|
|
|
=> |%
|
|
|
|
:: :: ++py
|
|
|
|
:::: ## sparse/light :: sparse range
|
|
|
|
:: ::::
|
2016-12-16 09:34:01 +03:00
|
|
|
++ py
|
2016-11-24 07:25:07 +03:00
|
|
|
:: because when you're a star with 2^16 unissued
|
|
|
|
:: planets, a (set) is kind of lame...
|
|
|
|
::
|
|
|
|
|_ a/pile
|
|
|
|
:: :: ++dif:py
|
|
|
|
++ dif :: add/remove a->b
|
2016-12-16 09:34:01 +03:00
|
|
|
|= b/pile
|
2016-11-24 07:25:07 +03:00
|
|
|
^- (pair pile pile)
|
|
|
|
[(sub(a b) a) (sub b)]
|
|
|
|
:: :: ++div:py
|
|
|
|
++ div :: allocate
|
|
|
|
|= b/@ud
|
|
|
|
^- (unit (pair pile pile))
|
2018-03-19 06:54:47 +03:00
|
|
|
=< ?-(- %& [~ p], %| ~)
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ^- (each (pair pile pile) @u)
|
2016-12-16 09:34:01 +03:00
|
|
|
?: =(0 b)
|
2016-11-24 07:25:07 +03:00
|
|
|
[%& ~ a]
|
|
|
|
?~ a [%| 0]
|
|
|
|
=/ al $(a l.a)
|
|
|
|
?- -.al
|
2018-03-19 06:54:47 +03:00
|
|
|
%& [%& p.p.al a(l q.p.al)]
|
|
|
|
%|
|
2016-12-16 09:34:01 +03:00
|
|
|
=. b (^sub b p.al)
|
2016-11-24 07:25:07 +03:00
|
|
|
=/ top +((^sub q.n.a p.n.a))
|
|
|
|
?: =(b top)
|
|
|
|
[%& a(r ~) r.a]
|
|
|
|
?: (lth b top)
|
|
|
|
:+ %& a(r ~, q.n (add p.n.a (dec b)))
|
|
|
|
=. p.n.a (add p.n.a b)
|
|
|
|
(uni(a r.a) [n.a ~ ~])
|
|
|
|
=/ ar $(a r.a, b (^sub b top))
|
|
|
|
?- -.ar
|
2018-03-19 06:54:47 +03:00
|
|
|
%& [%& a(r p.p.ar) q.p.ar]
|
|
|
|
%| [%| :(add top p.al p.ar)]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ gas :: ++gas:py
|
2018-05-14 23:17:21 +03:00
|
|
|
|= b/(list @) ^- pile :: insert list
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ b a
|
|
|
|
$(b t.b, a (put i.b))
|
|
|
|
:: :: ++gud:py
|
|
|
|
++ gud :: validate
|
2018-05-14 23:17:21 +03:00
|
|
|
=| {bot/(unit @) top/(unit @)}
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ^- ?
|
|
|
|
?~ a &
|
|
|
|
?& (lte p.n.a q.n.a)
|
|
|
|
?~(top & (lth +(q.n.a) u.top))
|
|
|
|
?~(bot & (gth p.n.a +(u.bot)))
|
|
|
|
::
|
|
|
|
?~(l.a & (vor p.n.a p.n.l.a))
|
|
|
|
$(a l.a, top `p.n.a)
|
|
|
|
::
|
|
|
|
?~(l.a & (vor p.n.a p.n.l.a))
|
|
|
|
$(a r.a, bot `q.n.a)
|
|
|
|
==
|
|
|
|
:: :: ++int:py
|
|
|
|
++ int :: intersection
|
|
|
|
|= b/pile ^- pile
|
|
|
|
?~ a ~
|
|
|
|
?~ b ~
|
|
|
|
?. (vor p.n.a p.n.b) $(a b, b a)
|
2016-12-16 09:34:01 +03:00
|
|
|
?: (gth p.n.a q.n.b)
|
2016-11-24 07:25:07 +03:00
|
|
|
(uni(a $(b r.b)) $(a l.a, r.b ~))
|
|
|
|
?: (lth q.n.a p.n.b)
|
|
|
|
(uni(a $(b l.b)) $(a r.a, l.b ~))
|
|
|
|
?: (gte p.n.a p.n.b)
|
|
|
|
?: (lte q.n.a q.n.b)
|
|
|
|
[n.a $(a l.a, r.b ~) $(a r.a, l.b ~)]
|
|
|
|
[n.a(q q.n.b) $(a l.a, r.b ~) $(l.a ~, b r.b)]
|
|
|
|
%- uni(a $(r.a ~, b l.b))
|
|
|
|
?: (lte q.n.a q.n.b)
|
|
|
|
%- uni(a $(l.b ~, a r.a))
|
|
|
|
[n.b(q q.n.a) ~ ~]
|
|
|
|
%- uni(a $(l.a ~, b r.b))
|
|
|
|
[n.b ~ ~]
|
|
|
|
:: :: ++put:py
|
|
|
|
++ put :: insert
|
2018-05-14 23:17:21 +03:00
|
|
|
|= b/@ ^- pile
|
2016-11-24 07:25:07 +03:00
|
|
|
(uni [b b] ~ ~)
|
|
|
|
:: :: ++sub:py
|
|
|
|
++ sub :: subtract
|
|
|
|
|= b/pile ^- pile
|
|
|
|
?~ b a
|
|
|
|
?~ a a
|
|
|
|
?: (gth p.n.a q.n.b)
|
|
|
|
$(b r.b, l.a $(a l.a, r.b ~))
|
|
|
|
?: (lth q.n.a p.n.b)
|
|
|
|
$(b l.b, r.a $(a r.a, l.b ~))
|
|
|
|
%- uni(a $(a l.a, r.b ~))
|
|
|
|
%- uni(a $(a r.a, l.b ~))
|
|
|
|
?: (gte p.n.a p.n.b)
|
|
|
|
?: (lte q.n.a q.n.b)
|
|
|
|
~
|
|
|
|
$(b r.b, a [[+(q.n.b) q.n.a] ~ ~])
|
|
|
|
?: (lte q.n.a q.n.b)
|
|
|
|
$(b l.b, a [[n.a(q (min q.n.a (dec p.n.b)))] ~ ~])
|
|
|
|
%- uni(a $(b r.b, a [[+(q.n.b) q.n.a] ~ ~]))
|
|
|
|
$(b l.b, a [[n.a(q (min q.n.a (dec p.n.b)))] ~ ~])
|
2018-05-14 23:17:21 +03:00
|
|
|
:: :: ++tap:py
|
|
|
|
++ tap :: into full list
|
|
|
|
=| out/(list @)
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ^+ out
|
|
|
|
?~ a out
|
2018-05-14 23:17:21 +03:00
|
|
|
$(a l.a, out (welp (gulf n.a) $(a r.a)))
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++uni:py
|
|
|
|
++ uni :: merge two piles
|
2016-12-16 09:34:01 +03:00
|
|
|
|= b/pile
|
2016-11-24 07:25:07 +03:00
|
|
|
^- pile
|
|
|
|
?~ b a
|
|
|
|
?~ a b
|
|
|
|
?. (vor p.n.a p.n.b) $(a b, b a)
|
|
|
|
?: (lth +(q.n.b) p.n.a)
|
|
|
|
$(b r.b, l.a $(a l.a, r.b ~))
|
|
|
|
?: (lth +(q.n.a) p.n.b)
|
|
|
|
$(b l.b, r.a $(a r.a, l.b ~))
|
|
|
|
?: =(n.a n.b) [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
|
|
|
|
?: (lth p.n.a p.n.b)
|
|
|
|
?: (gth q.n.a q.n.b)
|
|
|
|
$(b l.b, a $(b r.b))
|
|
|
|
$(b l.b, a $(b r.b, a $(b r.a, r.a ~, q.n.a q.n.b)))
|
|
|
|
?: (gth q.n.a q.n.b)
|
|
|
|
$(a l.a, b $(a r.a, b $(a r.b, r.b ~, q.n.b q.n.a)))
|
|
|
|
$(a l.a, b $(a r.a))
|
|
|
|
-- ::py
|
|
|
|
:: :: ++ry
|
|
|
|
:::: ## rights/light :: rights algebra
|
|
|
|
:: ::::
|
|
|
|
++ ry
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
:: we need to be able to combine rights, and
|
|
|
|
:: track changes by taking differences between them.
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ++ry must always crash when you try to make it
|
2016-12-16 09:34:01 +03:00
|
|
|
:: do something that makes no sense.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
:: language compromises: the type system can't enforce
|
2016-11-24 07:25:07 +03:00
|
|
|
:: that lef and ryt match, hence the asserts.
|
|
|
|
::
|
2016-12-10 03:47:21 +03:00
|
|
|
=< |_ $: :: lef: old right
|
|
|
|
:: ryt: new right
|
|
|
|
::
|
|
|
|
lef/rite
|
|
|
|
ryt/rite
|
|
|
|
==
|
|
|
|
:: :: ++uni:ry
|
|
|
|
++ uni ~(sum +> lef ryt) :: add rights
|
|
|
|
:: :: ++dif:ry
|
|
|
|
++ dif :: r->l: {add remove}
|
|
|
|
^- (pair (unit rite) (unit rite))
|
|
|
|
[~(dif +> ryt lef) ~(dif +> lef ryt)]
|
|
|
|
:: :: ++sub:ry
|
|
|
|
++ sub :: l - r
|
|
|
|
^- (unit rite)
|
|
|
|
=/ vid dif
|
|
|
|
~| vid
|
|
|
|
?>(?=($~ q.vid) p.vid)
|
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
|_ $: :: lef: old right
|
|
|
|
:: ryt: new right
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
lef/rite
|
2016-11-24 07:25:07 +03:00
|
|
|
ryt/rite
|
|
|
|
==
|
2016-12-10 03:47:21 +03:00
|
|
|
:: :: ++sub-by:py
|
|
|
|
++ sub-by :: subtract elements
|
|
|
|
|* {new/(map) old/(map) sub/$-(^ *)} ^+ new
|
|
|
|
%- ~(rep by new)
|
|
|
|
|* {{key/* val/*} acc/_^+(new ~)}
|
|
|
|
=> .(+<- [key val]=+<-)
|
|
|
|
=/ var (~(get by old) key)
|
|
|
|
=. val ?~(var val (sub val u.var))
|
|
|
|
?~ val acc
|
|
|
|
(~(put by ,.acc) key val)
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++dif:ry
|
2016-12-10 03:47:21 +03:00
|
|
|
++ dif :: in r and not l
|
|
|
|
^- (unit rite)
|
2016-11-24 07:25:07 +03:00
|
|
|
|^ ?- -.lef
|
|
|
|
$apple ?>(?=($apple -.ryt) (table %apple p.lef p.ryt))
|
2016-12-10 03:47:21 +03:00
|
|
|
$block ?>(?=($block -.ryt) ~)
|
2016-11-24 07:25:07 +03:00
|
|
|
$email ?>(?=($email -.ryt) (sable %email p.lef p.ryt))
|
2017-10-26 23:59:49 +03:00
|
|
|
$final ?>(?=($final -.ryt) (table %final p.lef p.ryt))
|
2016-11-24 07:25:07 +03:00
|
|
|
$fungi ?>(?=($fungi -.ryt) (noble %fungi p.lef p.ryt))
|
2016-12-10 03:47:21 +03:00
|
|
|
$guest ?>(?=($guest -.ryt) ~)
|
2016-11-24 07:25:07 +03:00
|
|
|
$hotel ?>(?=($hotel -.ryt) (bible %hotel p.lef p.ryt))
|
|
|
|
$jewel ?>(?=($jewel -.ryt) (table %jewel p.lef p.ryt))
|
|
|
|
$login ?>(?=($login -.ryt) (sable %login p.lef p.ryt))
|
|
|
|
$pword ?>(?=($pword -.ryt) (ruble %pword p.lef p.ryt))
|
|
|
|
$token ?>(?=($token -.ryt) (ruble %token p.lef p.ryt))
|
|
|
|
$urban ?>(?=($urban -.ryt) (table %urban p.lef p.ryt))
|
|
|
|
==
|
2016-12-10 03:47:21 +03:00
|
|
|
:: :: ++cable:dif:ry
|
|
|
|
++ cable :: diff atom
|
|
|
|
|* {nut/@tas new/@ old/@}
|
|
|
|
^- (unit rite)
|
|
|
|
?: =(new old) ~
|
|
|
|
`[nut new]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++bible:dif:ry
|
|
|
|
++ bible :: diff pile
|
2016-12-10 03:47:21 +03:00
|
|
|
|* {nut/@tas old/(map dorm pile) new/(map dorm pile)}
|
|
|
|
^- (unit rite)
|
|
|
|
=; mor/_new
|
|
|
|
?~(mor ~ `[nut mor])
|
|
|
|
%^ sub-by new old
|
|
|
|
|=({a/pile b/pile} (~(sub py a) b))
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++noble:dif:ry
|
|
|
|
++ noble :: diff map of @ud
|
2016-12-10 03:47:21 +03:00
|
|
|
|* {nut/@tas old/(map * @ud) new/(map * @ud)}
|
|
|
|
^- (unit rite)
|
|
|
|
=; mor/_new
|
|
|
|
?~(mor ~ `[nut mor])
|
|
|
|
%^ sub-by new old
|
|
|
|
|=({a/@u b/@u} (sub a (min a b)))
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++ruble:dif:ry
|
|
|
|
++ ruble :: diff map of maps
|
2016-12-10 03:47:21 +03:00
|
|
|
|* {nut/@tas old/(map * (map)) new/(map * (map))}
|
|
|
|
^- (unit rite)
|
|
|
|
=; mor/_new
|
|
|
|
?~(mor ~ `[nut mor])
|
|
|
|
%^ sub-by new old
|
|
|
|
=* valu (~(got by new))
|
|
|
|
|= {a/_^+(valu ~) b/_^+(valu ~)} ^+ a
|
|
|
|
(sub-by a b |*({a2/* b2/*} a2))
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++sable:dif:ry
|
|
|
|
++ sable :: diff set
|
2016-12-10 03:47:21 +03:00
|
|
|
|* {nut/@tas old/(set) new/(set)}
|
|
|
|
^- (unit rite)
|
|
|
|
=; mor ?~(mor ~ `[nut mor])
|
|
|
|
(~(dif in new) old)
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++table:dif:ry
|
|
|
|
++ table :: diff map
|
2016-12-10 03:47:21 +03:00
|
|
|
|* {nut/@tas old/(map) new/(map)}
|
|
|
|
^- (unit rite)
|
|
|
|
=; mor ?~(mor ~ `[nut mor])
|
|
|
|
(sub-by new old |*({a/* b/*} a))
|
2016-11-24 07:25:07 +03:00
|
|
|
-- ::dif
|
2016-12-10 03:47:21 +03:00
|
|
|
:: :: ++sum:ry
|
|
|
|
++ sum :: lef new, ryt old
|
2016-11-24 07:25:07 +03:00
|
|
|
^- rite
|
|
|
|
|^ ?- -.lef
|
|
|
|
$apple ?>(?=($apple -.ryt) [%apple (table p.lef p.ryt)])
|
|
|
|
$block ?>(?=($block -.ryt) [%block ~])
|
|
|
|
$email ?>(?=($email -.ryt) [%email (sable p.lef p.ryt)])
|
2017-10-26 23:59:49 +03:00
|
|
|
$final ?>(?=($final -.ryt) [%final (table p.lef p.ryt)])
|
2016-11-24 07:25:07 +03:00
|
|
|
$fungi ?>(?=($fungi -.ryt) [%fungi (noble p.lef p.ryt)])
|
|
|
|
$guest ?>(?=($guest -.ryt) [%guest ~])
|
|
|
|
$hotel ?>(?=($hotel -.ryt) [%hotel (bible p.lef p.ryt)])
|
|
|
|
$jewel ?>(?=($jewel -.ryt) [%jewel (table p.lef p.ryt)])
|
|
|
|
$login ?>(?=($login -.ryt) [%login (sable p.lef p.ryt)])
|
|
|
|
$pword ?>(?=($pword -.ryt) [%pword (ruble p.lef p.ryt)])
|
|
|
|
$token ?>(?=($token -.ryt) [%token (ruble p.lef p.ryt)])
|
|
|
|
$urban ?>(?=($urban -.ryt) [%urban (table p.lef p.ryt)])
|
|
|
|
==
|
|
|
|
:: :: ++bible:uni:ry
|
|
|
|
++ bible :: union pile
|
|
|
|
|= {new/(map dorm pile) old/(map dorm pile)}
|
|
|
|
^+ new
|
|
|
|
%- (~(uno by old) new)
|
|
|
|
|= (trel dorm pile pile)
|
|
|
|
(~(uni py q) r)
|
|
|
|
:: :: ++noble:uni:ry
|
|
|
|
++ noble :: union map of @ud
|
|
|
|
|= {new/(map term @ud) old/(map term @ud)}
|
|
|
|
^+ new
|
|
|
|
%- (~(uno by old) new)
|
|
|
|
|= (trel term @ud @ud)
|
|
|
|
(add q r)
|
|
|
|
:: :: ++ruble:uni:ry
|
|
|
|
++ ruble :: union map of maps
|
|
|
|
|= {new/(map site (map @t @t)) old/(map site (map @t @t))}
|
|
|
|
^+ new
|
|
|
|
%- (~(uno by old) new)
|
|
|
|
|= (trel site (map @t @t) (map @t @t))
|
|
|
|
%- (~(uno by q) r)
|
|
|
|
|= (trel @t @t @t)
|
|
|
|
?>(=(q r) r)
|
|
|
|
:: :: ++sable:uni:ry
|
|
|
|
++ sable :: union set
|
|
|
|
|* {new/(set) old/(set)}
|
|
|
|
^+ new
|
|
|
|
(~(uni in old) new)
|
|
|
|
:: :: ++table:uni:ry
|
|
|
|
++ table :: union map
|
2018-05-10 02:42:37 +03:00
|
|
|
|* {new/(map) old/(map)}
|
|
|
|
^+ new
|
|
|
|
%- (~(uno by old) new)
|
|
|
|
|= (trel _p.-<.new _q.->.new _q.->.new)
|
|
|
|
?>(=(q r) r)
|
2016-11-24 07:25:07 +03:00
|
|
|
-- ::uni
|
|
|
|
-- ::ry
|
|
|
|
:: :: ++up
|
|
|
|
:::: ## wallet^light :: wallet algebra
|
|
|
|
:: ::::
|
|
|
|
++ up
|
|
|
|
:: a set of rites is stored as a tree (++safe), sorted
|
|
|
|
:: by ++gor on the stem, balanced by ++vor on the stem.
|
|
|
|
:: (this is essentially a ++map with stem as key, but
|
|
|
|
:: ++map doesn't know how to link stem and bulb types.)
|
|
|
|
:: the goal of the design is to make it easy to add new
|
|
|
|
:: kinds of rite without a state adapter.
|
|
|
|
::
|
|
|
|
:: wallet operations always crash if impossible;
|
|
|
|
:: %jael has no concept of negative rights.
|
|
|
|
::
|
|
|
|
:: performance issues: ++differ and ++splice, naive.
|
2016-12-16 09:34:01 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: external issues: much copy and paste from ++by. it
|
|
|
|
:: would be nice to resolve this somehow, but not urgent.
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
:: language issues: if hoon had an equality test
|
|
|
|
:: that informed inference, ++expose could be
|
2016-11-24 07:25:07 +03:00
|
|
|
:: properly inferred, eliminating the ?>.
|
|
|
|
::
|
|
|
|
|_ pig/safe
|
|
|
|
:: :: ++delete:up
|
|
|
|
++ delete :: delete right
|
|
|
|
|= ryt/rite
|
|
|
|
^- safe
|
|
|
|
?~ pig
|
2017-10-26 23:59:49 +03:00
|
|
|
~
|
2016-11-24 07:25:07 +03:00
|
|
|
?. =(-.ryt -.n.pig)
|
|
|
|
?: (gor -.ryt -.n.pig)
|
|
|
|
[n.pig $(pig l.pig) r.pig]
|
|
|
|
[n.pig l.pig $(pig r.pig)]
|
|
|
|
=/ dub ~(sub ry n.pig ryt)
|
|
|
|
?^ dub [u.dub l.pig r.pig]
|
|
|
|
|- ^- safe
|
|
|
|
?~ l.pig r.pig
|
|
|
|
?~ r.pig l.pig
|
|
|
|
?: (vor -.n.l.pig -.n.r.pig)
|
|
|
|
[n.l.pig l.l.pig $(l.pig r.l.pig)]
|
|
|
|
[n.r.pig $(r.pig l.r.pig) r.r.pig]
|
|
|
|
:: :: ++differ:up
|
|
|
|
++ differ :: delta pig->gob
|
|
|
|
|= gob/safe
|
|
|
|
^- bump
|
|
|
|
|^ [way way(pig gob, gob pig)]
|
|
|
|
++ way
|
2016-12-16 09:34:01 +03:00
|
|
|
%- intern(pig ~)
|
|
|
|
%+ skip linear(pig gob)
|
2016-11-24 07:25:07 +03:00
|
|
|
|=(rite (~(has in pig) +<))
|
|
|
|
--
|
|
|
|
:: :: ++exists:up
|
|
|
|
++ exists :: test presence
|
|
|
|
|= tag/@tas
|
|
|
|
!=(~ (expose tag))
|
|
|
|
:: :: ++expose:up
|
|
|
|
++ expose :: typed extract
|
|
|
|
|= tag/@tas
|
|
|
|
^- (unit rite)
|
|
|
|
?~ pig ~
|
|
|
|
?: =(tag -.n.pig)
|
|
|
|
[~ u=n.pig]
|
|
|
|
?:((gor tag -.n.pig) $(pig l.pig) $(pig r.pig))
|
|
|
|
:: :: ++insert:up
|
|
|
|
++ insert :: insert item
|
|
|
|
|= ryt/rite
|
|
|
|
^- safe
|
|
|
|
?~ pig
|
|
|
|
[ryt ~ ~]
|
|
|
|
?: =(-.ryt -.n.pig)
|
|
|
|
[~(uni ry ryt n.pig) l.pig r.pig]
|
|
|
|
?: (gor -.ryt -.n.pig)
|
2016-12-13 23:22:21 +03:00
|
|
|
=. l.pig $(pig l.pig)
|
2016-11-24 07:25:07 +03:00
|
|
|
?> ?=(^ l.pig)
|
|
|
|
?: (vor -.n.pig -.n.l.pig)
|
|
|
|
[n.pig l.pig r.pig]
|
|
|
|
[n.l.pig l.l.pig [n.pig r.l.pig r.pig]]
|
2016-12-13 23:22:21 +03:00
|
|
|
=. r.pig $(pig r.pig)
|
2016-11-24 07:25:07 +03:00
|
|
|
?> ?=(^ r.pig)
|
|
|
|
?: (vor -.n.pig -.n.r.pig)
|
|
|
|
[n.pig l.pig r.pig]
|
|
|
|
[n.r.pig [n.pig l.pig l.r.pig] r.r.pig]
|
|
|
|
:: :: ++intern:up
|
|
|
|
++ intern :: insert list
|
|
|
|
|= lin/(list rite)
|
|
|
|
^- safe
|
|
|
|
?~ lin pig
|
|
|
|
=. pig $(lin t.lin)
|
|
|
|
(insert i.lin)
|
|
|
|
:: :: ++linear:up
|
|
|
|
++ linear :: convert to list
|
|
|
|
=| lin/(list rite)
|
|
|
|
|- ^+ lin
|
|
|
|
?~ pig ~
|
|
|
|
$(pig r.pig, lin [n.pig $(pig l.pig)])
|
|
|
|
:: :: ++redact:up
|
|
|
|
++ redact :: conceal secrets
|
|
|
|
|- ^- safe
|
|
|
|
?~ pig ~
|
|
|
|
:_ [$(pig l.pig) $(pig r.pig)]
|
|
|
|
=* rys n.pig
|
|
|
|
^- rite
|
|
|
|
?+ -.rys rys
|
|
|
|
$apple
|
2018-05-24 00:24:37 +03:00
|
|
|
[%apple (~(run by p.rys) |=(@ (shax +<)))]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
$final
|
2018-05-24 00:24:37 +03:00
|
|
|
[%final (~(run by p.rys) |=(@ (shax +<)))]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
$login
|
|
|
|
[%login ~]
|
|
|
|
::
|
|
|
|
$pword
|
2016-12-16 09:34:01 +03:00
|
|
|
:- %pword
|
|
|
|
%- ~(run by p.rys)
|
|
|
|
|= (map @ta @t)
|
2016-11-24 07:25:07 +03:00
|
|
|
(~(run by +<) |=(@t (fil 3 (met 3 +<) '*')))
|
|
|
|
::
|
|
|
|
$jewel
|
2018-05-24 00:24:37 +03:00
|
|
|
[%jewel (~(run by p.rys) |=(@ (shax +<)))]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
$token
|
2016-12-16 09:34:01 +03:00
|
|
|
:- %token
|
|
|
|
%- ~(run by p.rys)
|
2018-05-24 00:24:37 +03:00
|
|
|
|=((map @ta @) (~(run by +<) |=(@ (shax +<))))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
$urban
|
2018-05-24 00:24:37 +03:00
|
|
|
[%urban (~(run by p.rys) |=({@da code:ames} [+<- (shax +<+)]))]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
:: :: ++remove:up
|
|
|
|
++ remove :: pig minus gob
|
|
|
|
|= gob/safe
|
|
|
|
^- safe
|
2017-02-13 23:43:18 +03:00
|
|
|
=/ buv ~(tap by gob)
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ?~ buv pig
|
|
|
|
$(buv t.buv, pig (delete i.buv))
|
|
|
|
:: :: ++splice:up
|
|
|
|
++ splice :: pig plus gob
|
|
|
|
|= gob/safe
|
|
|
|
^- safe
|
2017-02-13 23:43:18 +03:00
|
|
|
=/ buv ~(tap by gob)
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ?~ buv pig
|
|
|
|
$(buv t.buv, pig (insert i.buv))
|
|
|
|
:: :: ++update:up
|
|
|
|
++ update :: arbitrary change
|
|
|
|
|= del/bump
|
|
|
|
^- safe
|
|
|
|
(splice(pig (remove les.del)) mor.del)
|
2016-12-16 09:34:01 +03:00
|
|
|
--
|
2018-05-29 00:04:33 +03:00
|
|
|
:: :: ++ez
|
|
|
|
:::: ## ethereum^light :: wallet algebra
|
|
|
|
:: ::::
|
|
|
|
++ ez
|
|
|
|
:: simple ethereum-related utility arms.
|
|
|
|
::
|
|
|
|
|%
|
2018-05-30 01:40:00 +03:00
|
|
|
::
|
|
|
|
:: +order-events: sort changes by block and log numbers
|
|
|
|
::
|
2018-05-29 00:04:33 +03:00
|
|
|
++ order-events
|
2018-06-01 18:14:35 +03:00
|
|
|
|= loz=(list (pair event-id diff-constitution))
|
2018-05-29 00:04:33 +03:00
|
|
|
^+ loz
|
|
|
|
%+ sort loz
|
|
|
|
:: sort by block number, then by event log number,
|
|
|
|
::TODO then by diff priority.
|
|
|
|
|= [[[b1=@ud l1=@ud] *] [[b2=@ud l2=@ud] *]]
|
|
|
|
?. =(b1 b2) (lth b1 b2)
|
|
|
|
?. =(l1 l2) (lth l1 l2)
|
|
|
|
&
|
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
:: ::::
|
|
|
|
:::: # heavy :: heavy engines
|
|
|
|
:: ::::
|
|
|
|
=> |%
|
|
|
|
:: :: ++of
|
|
|
|
:::: ## main^heavy :: main engine
|
|
|
|
:: ::::
|
|
|
|
++ of
|
|
|
|
:: this core handles all top-level %jael semantics,
|
|
|
|
:: changing state and recording moves.
|
|
|
|
::
|
|
|
|
:: logically we could nest the ++su and ++ur cores
|
|
|
|
:: within it, but we keep them separated for clarity.
|
|
|
|
:: the ++curd and ++cure arms complete relative and
|
|
|
|
:: absolute effects, respectively, at the top level.
|
|
|
|
::
|
|
|
|
:: a general pattern here is that we use the ++ur core
|
2016-12-16 09:34:01 +03:00
|
|
|
:: to generate absolute effects (++change), then invoke
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ++su to calculate the derived effect of these changes.
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: for ethereum-related events, this is preceded by
|
|
|
|
:: invocation of ++et, which produces ethereum-level
|
|
|
|
:: changes (++chain). these get turned into absolute
|
|
|
|
:: effects by ++cute.
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: arvo issues: should be merged with the top-level
|
|
|
|
:: vane interface when that gets cleaned up a bit.
|
|
|
|
::
|
|
|
|
=| moz/(list move)
|
|
|
|
=| $: :: sys: system context
|
|
|
|
::
|
|
|
|
$= sys
|
|
|
|
$: :: now: current time
|
|
|
|
:: eny: unique entropy
|
|
|
|
::
|
|
|
|
now/@da
|
|
|
|
eny/@e
|
|
|
|
==
|
|
|
|
:: all vane state
|
|
|
|
::
|
|
|
|
state
|
|
|
|
==
|
|
|
|
:: lex: all durable state
|
|
|
|
:: moz: pending actions
|
|
|
|
::
|
|
|
|
=* lex ->
|
|
|
|
|%
|
|
|
|
:: :: ++abet:of
|
|
|
|
++ abet :: resolve
|
|
|
|
[(flop moz) lex]
|
|
|
|
:: :: ++burb:of
|
|
|
|
++ burb :: per ship
|
|
|
|
|= who/ship
|
|
|
|
~(able ~(ex ur urb) who)
|
2016-12-13 22:02:38 +03:00
|
|
|
:: :: ++scry:of
|
|
|
|
++ scry :: read
|
|
|
|
|= {syd/@tas pax/path} ^- (unit gilt)
|
|
|
|
=^ mar pax =/(a (flop pax) [-.a (flop t.+.a)])
|
|
|
|
?> ?=(_-:*gilt mar)
|
|
|
|
=- (biff - (flit |=(a/gilt =(-.a mar))))
|
|
|
|
~ ::TODO
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++call:of
|
|
|
|
++ call :: invoke
|
|
|
|
|= $: :: hen: event cause
|
|
|
|
:: tac: event data
|
|
|
|
::
|
|
|
|
hen/duct
|
|
|
|
tac/task
|
|
|
|
==
|
|
|
|
^+ +>
|
|
|
|
?- -.tac
|
|
|
|
::
|
|
|
|
:: destroy promises
|
2017-12-22 00:44:17 +03:00
|
|
|
:: {$burn p/ship q/safe}
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2017-12-22 00:44:17 +03:00
|
|
|
$burn
|
2018-05-09 18:23:25 +03:00
|
|
|
%+ cure our.tac
|
|
|
|
abet:abet:(deal:(burb our.tac) p.tac [~ q.tac])
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-09-07 04:41:16 +03:00
|
|
|
:: boot from keys
|
2018-10-04 09:43:40 +03:00
|
|
|
:: {$dawn =seed spon=(unit ship) czar=(map ship [=life =pass]) turf=(list turf)}
|
2018-09-07 04:41:16 +03:00
|
|
|
::
|
|
|
|
%dawn
|
|
|
|
=* our who.seed.tac
|
|
|
|
:: our initial private key, as a +tree of +rite
|
|
|
|
::
|
|
|
|
=/ rit (sy [%jewel (my [lyf.seed.tac key.seed.tac] ~)] ~)
|
|
|
|
=. +>.$ $(tac [%mint our our rit])
|
|
|
|
:: our initial galaxy table as a +map from +life to +public
|
|
|
|
::
|
|
|
|
=/ kyz
|
|
|
|
%- ~(run by czar.tac)
|
|
|
|
|=([=life =pass] `public`[live=| life (my [life pass] ~)])
|
|
|
|
=. +>.$
|
|
|
|
%- curd =< abet
|
|
|
|
(pubs:~(feel su our urb sub etn) kyz)
|
|
|
|
:: XX sponsor
|
2018-10-04 09:43:40 +03:00
|
|
|
:: XX reconcile with .dns.eth
|
|
|
|
:: set initial domains
|
|
|
|
::
|
|
|
|
=. tuf.urb turf.tac
|
|
|
|
::
|
2018-09-07 04:41:16 +03:00
|
|
|
=. moz
|
|
|
|
%+ weld moz
|
|
|
|
:: order is crucial!
|
|
|
|
::
|
|
|
|
:: %dill must init after %gall (and after %give intended for unix)
|
|
|
|
:: %jael init must be deferred post %eyre init
|
|
|
|
::
|
|
|
|
^- (list move)
|
|
|
|
:~ [hen %pass /(scot %p our)/init %b %wait +(now.sys)]
|
|
|
|
[hen %slip %d %init our]
|
|
|
|
[hen %give %init our]
|
|
|
|
[hen %slip %g %init our]
|
|
|
|
[hen %slip %e %init our]
|
|
|
|
[hen %slip %c %init our]
|
|
|
|
[hen %slip %a %init our]
|
|
|
|
==
|
|
|
|
+>.$
|
|
|
|
::
|
2018-09-15 08:38:22 +03:00
|
|
|
:: boot fake
|
|
|
|
:: {$fake our/ship}
|
|
|
|
::
|
|
|
|
%fake
|
|
|
|
=* our our.tac
|
|
|
|
:: our private key, as a +tree of +rite
|
|
|
|
::
|
|
|
|
:: Private key updates are disallowed for fake ships,
|
|
|
|
:: so we do this first.
|
|
|
|
::
|
|
|
|
=/ cub (pit:nu:crub:crypto 512 our)
|
|
|
|
=/ rit (sy [%jewel (my [1 sec:ex:cub] ~)] ~)
|
|
|
|
=. +>.$ $(tac [%mint our our rit])
|
|
|
|
:: set the fake bit
|
|
|
|
::
|
|
|
|
=. fak.urb &
|
|
|
|
:: initialize other vanes per the usual procedure
|
|
|
|
::
|
|
|
|
:: Except for ourselves!
|
|
|
|
::
|
|
|
|
=. moz
|
|
|
|
%+ weld moz
|
|
|
|
^- (list move)
|
|
|
|
:~ [hen %slip %d %init our]
|
|
|
|
[hen %give %init our]
|
|
|
|
[hen %slip %g %init our]
|
|
|
|
[hen %slip %e %init our]
|
|
|
|
[hen %slip %c %init our]
|
|
|
|
[hen %slip %a %init our]
|
|
|
|
==
|
|
|
|
+>.$
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: remote update
|
|
|
|
:: {$hail p/ship q/remote}
|
|
|
|
::
|
|
|
|
$hail
|
2018-05-09 18:23:25 +03:00
|
|
|
%+ cure our.tac
|
2018-05-23 16:53:41 +03:00
|
|
|
abet:abet:(hail:(burb our.tac) p.tac q.tac)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
:: set ethereum source
|
|
|
|
:: [%look p=(each ship purl)]
|
|
|
|
::
|
|
|
|
%look
|
2018-05-29 00:04:33 +03:00
|
|
|
%+ cute our.tac =< abet
|
2018-05-31 17:23:39 +03:00
|
|
|
(~(look et our.tac now.sys etn.lex) src.tac)
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: create promises
|
|
|
|
:: {$mint p/ship q/safe}
|
|
|
|
::
|
|
|
|
$mint
|
2018-09-15 08:38:22 +03:00
|
|
|
~| %fake-jael
|
|
|
|
?< fak.urb
|
2018-05-09 18:23:25 +03:00
|
|
|
%+ cure our.tac
|
|
|
|
abet:abet:(deal:(burb our.tac) p.tac [q.tac ~])
|
2018-05-23 02:35:16 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: move promises
|
|
|
|
:: {$move p/ship q/ship r/safe}
|
|
|
|
::
|
|
|
|
$move
|
2018-05-09 18:23:25 +03:00
|
|
|
=. +>
|
|
|
|
%+ cure our.tac
|
|
|
|
abet:abet:(deal:(burb our.tac) p.tac [~ r.tac])
|
|
|
|
=. +>
|
|
|
|
%+ cure our.tac
|
|
|
|
abet:abet:(deal:(burb our.tac) q.tac [r.tac ~])
|
2016-11-24 07:25:07 +03:00
|
|
|
+>
|
|
|
|
::
|
|
|
|
:: cancel all trackers from duct
|
|
|
|
:: {$nuke $~}
|
|
|
|
::
|
|
|
|
$nuke
|
|
|
|
%_ +>
|
|
|
|
yen (~(del in yen) hen)
|
|
|
|
yen.bal.sub (~(del in yen.bal.sub) hen)
|
|
|
|
yen.own.sub (~(del in yen.own.sub) hen)
|
2018-05-29 00:04:33 +03:00
|
|
|
yen.eth.sub (~(del in yen.eth.sub) hen)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
::
|
2018-06-01 01:31:45 +03:00
|
|
|
:: watch public keys
|
|
|
|
:: [%pubs our=ship who=ship]
|
|
|
|
::
|
|
|
|
%pubs
|
|
|
|
%- curd =< abet
|
|
|
|
(~(pubs ~(feed su our.tac urb sub etn) hen) who.tac)
|
|
|
|
::
|
2018-08-30 03:05:34 +03:00
|
|
|
:: seen after breach
|
|
|
|
:: [%meet our=ship who=ship]
|
|
|
|
::
|
|
|
|
%meet
|
|
|
|
%+ cure our.tac
|
|
|
|
[[%meet who.tac]~ urb]
|
|
|
|
::
|
2018-10-04 09:43:40 +03:00
|
|
|
:: XX should be a subscription
|
|
|
|
:: XX reconcile with .dns.eth
|
|
|
|
:: request domains
|
|
|
|
:: [%turf ~]
|
|
|
|
::
|
|
|
|
%turf
|
|
|
|
+>.$(moz [[hen %give %turf tuf.urb] moz])
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: watch private keys
|
|
|
|
:: {$vein $~}
|
|
|
|
::
|
|
|
|
$vein
|
2018-05-29 00:04:33 +03:00
|
|
|
(curd abet:~(vein ~(feed su our.tac urb sub etn) hen))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-06-01 01:34:21 +03:00
|
|
|
:: watch ethereum events
|
2018-05-17 22:48:17 +03:00
|
|
|
:: [%vent ~]
|
|
|
|
::
|
|
|
|
%vent
|
2018-05-29 00:04:33 +03:00
|
|
|
=. moz [[hen %give %mack ~] moz]
|
|
|
|
(curd abet:~(vent ~(feed su our.tac urb sub etn) hen))
|
2018-05-17 22:48:17 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: monitor assets
|
|
|
|
:: {$vest $~}
|
|
|
|
::
|
|
|
|
$vest
|
2018-05-29 00:04:33 +03:00
|
|
|
(curd abet:~(vest ~(feed su our.tac urb sub etn) hen))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
:: monitor all
|
2016-11-24 07:25:07 +03:00
|
|
|
:: {$vine $~}
|
|
|
|
::
|
|
|
|
$vine
|
|
|
|
+>(yen (~(put in yen) hen))
|
|
|
|
::
|
|
|
|
:: authenticated remote request
|
|
|
|
:: {$west p/ship q/path r/*}
|
|
|
|
::
|
|
|
|
$west
|
|
|
|
=+ mes=((hard message) r.tac)
|
2018-05-29 23:02:41 +03:00
|
|
|
=* our p.p.tac
|
|
|
|
=* dem q.p.tac
|
2016-11-24 07:25:07 +03:00
|
|
|
?- -.mes
|
|
|
|
::
|
|
|
|
:: reset remote rights
|
2018-05-23 16:53:41 +03:00
|
|
|
:: [%hail p=remote]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-05-23 16:53:41 +03:00
|
|
|
%hail
|
2018-05-29 23:02:41 +03:00
|
|
|
%+ cure our
|
|
|
|
abet:abet:(hail:(burb our) dem p.mes)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-05-17 22:48:17 +03:00
|
|
|
:: cancel trackers
|
|
|
|
:: [%nuke ~]
|
|
|
|
::
|
|
|
|
%nuke
|
|
|
|
$(tac mes)
|
|
|
|
::
|
2018-06-01 01:34:21 +03:00
|
|
|
:: view ethereum events
|
2018-05-17 22:48:17 +03:00
|
|
|
:: [%vent ~]
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
|
|
|
%vent
|
2018-05-29 23:02:41 +03:00
|
|
|
~& %west-vent
|
|
|
|
$(tac [%vent our])
|
2018-05-22 00:10:27 +03:00
|
|
|
::
|
|
|
|
::
|
|
|
|
%vent-result
|
2018-05-29 00:04:33 +03:00
|
|
|
:: ignore if not from currently configured source.
|
2018-05-29 23:02:41 +03:00
|
|
|
?. &(-.source.etn =(dem p.source.etn))
|
2018-05-25 03:11:21 +03:00
|
|
|
+>.$
|
2018-05-29 00:04:33 +03:00
|
|
|
=. moz [[hen %give %mack ~] moz]
|
2018-05-29 23:02:41 +03:00
|
|
|
%+ cute our =< abet
|
2018-05-31 17:23:39 +03:00
|
|
|
(~(hear-vent et our now.sys etn.lex) p.mes)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ take
|
|
|
|
|= [tea=wire hen=duct hin=sign]
|
|
|
|
^+ +>
|
|
|
|
?> ?=([@ *] tea)
|
|
|
|
=+ our=(slav %p i.tea)
|
|
|
|
=* wir t.tea
|
|
|
|
?- hin
|
|
|
|
[%a %woot *]
|
|
|
|
?~ q.hin ~&(%coop-fine +>.$)
|
|
|
|
?~ u.q.hin ~&(%ares-fine +>.$)
|
|
|
|
~& [%woot-bad p.u.u.q.hin]
|
|
|
|
~_ q.u.u.q.hin
|
|
|
|
::TODO fail:et
|
|
|
|
+>.$
|
|
|
|
::
|
|
|
|
[%e %sigh *]
|
|
|
|
%+ cute our =< abet
|
2018-05-31 17:23:39 +03:00
|
|
|
(~(sigh et our now.sys etn.lex) wir p.hin)
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
[%b %wake ~]
|
2018-09-07 04:41:16 +03:00
|
|
|
%+ cute our
|
|
|
|
:: XX cleanup
|
|
|
|
::
|
|
|
|
?: ?=([%init ~] wir)
|
|
|
|
abet:(~(init et our now.sys etn.lex) our)
|
|
|
|
abet:~(wake et our now.sys etn.lex)
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
[%j %vent *]
|
|
|
|
%+ cute our =< abet
|
2018-05-31 17:23:39 +03:00
|
|
|
(~(hear-vent et our now.sys etn.lex) p.hin)
|
2018-05-29 00:04:33 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++curd:of
|
|
|
|
++ curd :: relative moves
|
|
|
|
|= {moz/(list move) sub/state-relative}
|
|
|
|
+>(sub sub, moz (weld (flop moz) ^moz))
|
|
|
|
:: :: ++cure:of
|
|
|
|
++ cure :: absolute edits
|
2018-05-09 18:23:25 +03:00
|
|
|
|= {our/ship hab/(list change) urb/state-absolute}
|
2016-11-24 07:25:07 +03:00
|
|
|
^+ +>
|
2018-05-29 00:04:33 +03:00
|
|
|
(curd(urb urb) abet:(~(apex su our urb sub etn) hab))
|
|
|
|
:: :: ++cute:of
|
|
|
|
++ cute :: ethereum changes
|
|
|
|
|= $: our=ship
|
|
|
|
mos=(list move)
|
2018-05-29 21:20:25 +03:00
|
|
|
ven=chain
|
2018-05-29 00:04:33 +03:00
|
|
|
net=state-eth-node
|
|
|
|
==
|
|
|
|
^+ +>
|
|
|
|
%- cure(etn net, moz (weld (flop mos) moz))
|
2018-05-29 21:20:25 +03:00
|
|
|
[our abet:(link:(burb our) ven)]
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
:: :: ++su
|
|
|
|
:::: ## relative^heavy :: subjective engine
|
|
|
|
:: ::::
|
|
|
|
++ su
|
2016-12-16 09:34:01 +03:00
|
|
|
:: the ++su core handles all derived state,
|
2016-11-24 07:25:07 +03:00
|
|
|
:: subscriptions, and actions.
|
|
|
|
::
|
2018-05-24 17:54:35 +03:00
|
|
|
:: ++feed:su registers subscriptions.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: ++feel:su checks if a ++change should notify
|
|
|
|
:: any subscribers.
|
|
|
|
::
|
|
|
|
:: ++fire:su generates outgoing network messages.
|
|
|
|
::
|
|
|
|
:: ++form:su generates the actual report data.
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
=| moz/(list move)
|
2018-06-01 18:30:14 +03:00
|
|
|
=| evs=logs
|
2018-05-09 18:23:25 +03:00
|
|
|
=| $: our/ship
|
|
|
|
state-absolute
|
2016-11-24 07:25:07 +03:00
|
|
|
state-relative
|
2018-05-29 00:04:33 +03:00
|
|
|
state-eth-node
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
:: moz: moves in reverse order
|
|
|
|
:: urb: absolute urbit state
|
|
|
|
:: sub: relative urbit state
|
|
|
|
::
|
2018-05-09 18:23:25 +03:00
|
|
|
=* urb ->-
|
2018-05-29 00:04:33 +03:00
|
|
|
=* sub ->+<
|
|
|
|
=* etn ->+>
|
2016-11-24 07:25:07 +03:00
|
|
|
|%
|
|
|
|
:: :: ++abet:su
|
|
|
|
++ abet :: resolve
|
2018-05-29 21:20:25 +03:00
|
|
|
::TODO we really want to just send the %give, but ames is being a pain.
|
|
|
|
:: => (exec yen.eth [%give %vent |+evs])
|
|
|
|
=> ?~ evs .
|
|
|
|
(vent-pass yen.eth |+evs)
|
2016-11-24 07:25:07 +03:00
|
|
|
[(flop moz) sub]
|
|
|
|
:: :: ++apex:su
|
|
|
|
++ apex :: apply changes
|
|
|
|
|= hab/(list change)
|
|
|
|
^+ +>
|
|
|
|
?~ hab +>
|
|
|
|
%= $
|
|
|
|
hab t.hab
|
|
|
|
+>
|
|
|
|
?- -.i.hab
|
2018-05-29 21:20:25 +03:00
|
|
|
%ethe (file can.i.hab)
|
2018-08-30 03:05:34 +03:00
|
|
|
%meet (meet +.i.hab)
|
2018-05-29 00:04:33 +03:00
|
|
|
%rite (paid +.i.hab)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
:: :: ++exec:su
|
|
|
|
++ exec :: mass gift
|
|
|
|
|= {yen/(set duct) cad/card}
|
2017-02-13 22:58:49 +03:00
|
|
|
=/ noy ~(tap in yen)
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ^+ ..exec
|
|
|
|
?~ noy ..exec
|
|
|
|
$(noy t.noy, moz [[i.noy cad] moz])
|
2018-05-29 21:20:25 +03:00
|
|
|
::
|
|
|
|
++ vent-pass
|
|
|
|
|= [yen=(set duct) res=chain]
|
|
|
|
=+ yez=~(tap in yen)
|
|
|
|
|- ^+ ..vent-pass
|
|
|
|
?~ yez ..vent-pass
|
|
|
|
=* d i.yez
|
|
|
|
?> ?=([[%a @ @ *] *] d)
|
|
|
|
=+ our=(slav %p i.t.i.d)
|
|
|
|
=+ who=(slav %p i.t.t.i.d)
|
|
|
|
%+ exec [d ~ ~]
|
|
|
|
:+ %pass
|
|
|
|
/(scot %p our)/vent-result
|
|
|
|
^- note:able
|
|
|
|
[%a %want [our who] /j/(scot %p our)/vent-result %vent-result res]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++feed:su
|
|
|
|
++ feed :: subscribe to view
|
|
|
|
|_ :: hen: subscription source
|
|
|
|
::
|
|
|
|
hen/duct
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
++ pubs
|
|
|
|
|= who=ship
|
2018-09-15 08:38:22 +03:00
|
|
|
?: fak.urb
|
|
|
|
(pubs:fake who)
|
2018-06-01 01:31:45 +03:00
|
|
|
%_ ..feed
|
2018-08-30 03:02:17 +03:00
|
|
|
moz =/ pub (~(get by kyz.puk) who)
|
|
|
|
?~ pub moz
|
|
|
|
?: =(0 life.u.pub) moz
|
|
|
|
[[hen %give %pubs u.pub] moz]
|
2018-06-01 01:31:45 +03:00
|
|
|
yen.puk (~(put ju yen.puk) who hen)
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++vein:feed:su
|
|
|
|
++ vein :: private keys
|
|
|
|
%_ ..feed
|
|
|
|
moz [[hen %give %vein [lyf jaw]:own] moz]
|
|
|
|
yen.own (~(put in yen.own) hen)
|
|
|
|
==
|
|
|
|
:: :: ++vest:feed:su
|
|
|
|
++ vest :: balance
|
|
|
|
%_ ..feed
|
|
|
|
moz [[hen %give %vest %& vest:form] moz]
|
|
|
|
yen.bal (~(put in yen.bal) hen)
|
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ vent
|
2018-05-29 21:20:25 +03:00
|
|
|
%. [[hen ~ ~] &+eve]
|
|
|
|
%_ vent-pass
|
|
|
|
:: %_ ..feed ::TODO see ++abet
|
2018-06-01 01:34:21 +03:00
|
|
|
:: moz [[hen %give %vent &+eve] moz]
|
2018-05-29 00:04:33 +03:00
|
|
|
yen.eth (~(put in yen.eth) hen)
|
|
|
|
==
|
2018-09-15 08:38:22 +03:00
|
|
|
:: :: ++fake:feed:su
|
|
|
|
++ fake :: fake subs and state
|
|
|
|
?> fak.urb
|
|
|
|
|%
|
|
|
|
++ pubs
|
|
|
|
|= who=ship
|
|
|
|
=/ cub (pit:nu:crub:crypto 512 who)
|
|
|
|
=/ pub [live=| life=1 (my [1 pub:ex:cub] ~)]
|
|
|
|
=. moz [[hen %give %pubs pub] moz]
|
|
|
|
(pubs:feel (my [who pub] ~))
|
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
:: :: ++feel:su
|
|
|
|
++ feel :: update tracker
|
2016-12-16 09:34:01 +03:00
|
|
|
|%
|
2018-06-01 01:31:45 +03:00
|
|
|
:: :: ++pubs:feel:su
|
|
|
|
++ pubs :: kick public keys
|
2018-08-30 03:02:17 +03:00
|
|
|
:: puz: new public key states
|
|
|
|
|= puz=(map ship public)
|
|
|
|
=/ pus ~(tap by puz)
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
:: process change for each ship separately
|
|
|
|
::
|
|
|
|
|- ^+ ..feel
|
2018-08-30 03:02:17 +03:00
|
|
|
?~ pus ..feel
|
|
|
|
=; fel $(pus t.pus, ..feel fel)
|
|
|
|
=* who p.i.pus
|
|
|
|
=* pub q.i.pus
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
:: update public key store and notify subscribers
|
2018-08-30 03:02:17 +03:00
|
|
|
:: of the new state
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
2018-08-30 03:02:17 +03:00
|
|
|
~& [%sending-pubs-about who]
|
|
|
|
%+ exec(kyz.puk (~(put by kyz.puk) who pub))
|
2018-06-01 01:31:45 +03:00
|
|
|
(~(get ju yen.puk) who)
|
2018-08-30 03:02:17 +03:00
|
|
|
[%give %pubs pub]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++vein:feel:su
|
|
|
|
++ vein :: kick private keys
|
|
|
|
^+ ..feel
|
|
|
|
=/ yam vein:form
|
|
|
|
?: =(yam +.own) ..feel
|
|
|
|
(exec(+.own yam) yen.own [%give %vein +.own])
|
|
|
|
:: :: ++vest:feel:su
|
|
|
|
++ vest :: kick balance
|
|
|
|
|= hug/action
|
|
|
|
^+ ..feel
|
|
|
|
?: =([~ ~] +.q.hug) ..feel
|
|
|
|
::
|
|
|
|
:: notify all local listeners
|
|
|
|
::
|
|
|
|
=. ..feel (exec yen.bal [%give %vest %| p.hug q.hug])
|
|
|
|
::
|
|
|
|
:: pig: purse report for partner
|
|
|
|
::
|
2018-03-19 06:54:47 +03:00
|
|
|
?. ?=(%| -.q.hug) ..feel
|
2016-11-24 07:25:07 +03:00
|
|
|
=* pig (~(lawn ur urb) our p.hug)
|
|
|
|
%_ ..feel
|
|
|
|
moz
|
|
|
|
:_ moz
|
2018-05-23 16:53:41 +03:00
|
|
|
:^ *duct %pass /vest/(scot %p p.hug)
|
|
|
|
:+ %a %want
|
|
|
|
:+ [our p.hug] /j
|
|
|
|
^- message
|
|
|
|
[%hail |+pig]
|
2016-12-16 09:34:01 +03:00
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ vent
|
2018-05-29 21:20:25 +03:00
|
|
|
|= can=chain
|
|
|
|
^+ ..feel
|
|
|
|
::TODO see ++abet
|
|
|
|
:: (exec yen.eth [%give %vent can])
|
|
|
|
(vent-pass yen.eth can)
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
:: :: ++form:su
|
|
|
|
++ form :: generate reports
|
|
|
|
|%
|
|
|
|
:: :: ++vein:form:su
|
|
|
|
++ vein :: private key report
|
|
|
|
^- (pair life (map life ring))
|
|
|
|
(~(lean ur urb) our)
|
|
|
|
:: :: ++vest:form:su
|
|
|
|
++ vest :: balance report
|
|
|
|
^- balance
|
|
|
|
:- ::
|
|
|
|
:: raw: all our liabilities by ship
|
|
|
|
:: dud: delete liabilities to self
|
|
|
|
:: cul: mask secrets
|
|
|
|
::
|
|
|
|
=* raw =-(?~(- ~ u.-) (~(get by pry.urb) our))
|
|
|
|
=* dud (~(del by raw) our)
|
|
|
|
=* cul (~(run by dud) |=(safe ~(redact up +<)))
|
|
|
|
cul
|
|
|
|
::
|
|
|
|
:: fub: all assets by ship
|
|
|
|
:: veg: all nontrivial assets, secrets masked
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
=/ fub
|
2016-11-24 07:25:07 +03:00
|
|
|
^- (list (pair ship (unit safe)))
|
|
|
|
%+ turn
|
2017-02-13 23:43:18 +03:00
|
|
|
~(tap by pry.urb)
|
2016-11-24 07:25:07 +03:00
|
|
|
|= (pair ship (map ship safe))
|
|
|
|
[p (~(get by q) our)]
|
|
|
|
=* veg
|
|
|
|
|- ^- (list (pair ship safe))
|
|
|
|
?~ fub ~
|
|
|
|
=+ $(fub t.fub)
|
|
|
|
?~(q.i.fub - [[p.i.fub ~(redact up u.q.i.fub)] -])
|
|
|
|
::
|
|
|
|
(~(gas by *(map ship safe)) veg)
|
|
|
|
--
|
|
|
|
:: :: ++paid:su
|
|
|
|
++ paid :: track asset change
|
|
|
|
|= $: :: rex: promise from
|
|
|
|
:: pal: promise to
|
|
|
|
:: del: change to existing
|
|
|
|
::
|
|
|
|
rex/ship
|
|
|
|
pal/ship
|
|
|
|
del/bump
|
|
|
|
==
|
|
|
|
^+ +>
|
|
|
|
:: ignore empty delta; keep secrets out of metadata
|
|
|
|
::
|
|
|
|
?: =([~ ~] del) +>
|
|
|
|
=. del [~(redact up mor.del) ~(redact up les.del)]
|
|
|
|
?. =(our pal)
|
|
|
|
::
|
|
|
|
:: track promises we made to others
|
|
|
|
::
|
|
|
|
?. =(our rex) +>
|
|
|
|
::
|
|
|
|
:: track liabilities
|
|
|
|
::
|
2018-05-24 17:54:35 +03:00
|
|
|
(vest:feel pal %& del)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: track private keys
|
|
|
|
::
|
2018-05-24 17:54:35 +03:00
|
|
|
?. (~(exists up mor.del) %jewel) +>
|
|
|
|
vein:feel
|
2018-08-30 03:05:34 +03:00
|
|
|
:: :: ++meet:su
|
|
|
|
++ meet :: seen after breach
|
|
|
|
|= who=ship
|
|
|
|
^+ +>
|
|
|
|
=+ ~| [%met-unknown-ship who]
|
|
|
|
(~(got by kyz.puk) who)
|
|
|
|
(pubs:feel [[who -(live &)] ~ ~])
|
|
|
|
:: :: ++file:su
|
|
|
|
++ file :: process event logs
|
2018-06-01 01:31:45 +03:00
|
|
|
::TODO whenever we add subscriptions for data,
|
|
|
|
:: outsource the updating of relevant state
|
|
|
|
:: to a ++feel arm.
|
2018-06-01 18:30:14 +03:00
|
|
|
|= [new=? evs=logs]
|
2018-05-29 00:04:33 +03:00
|
|
|
^+ +>
|
2018-05-29 21:20:25 +03:00
|
|
|
=? +> new
|
2018-08-30 03:06:20 +03:00
|
|
|
::TODO should we be mutating state here,
|
|
|
|
:: or better to move this into ++vent:feel?
|
2018-06-01 01:31:45 +03:00
|
|
|
+>(dns.eth *dnses, hul.eth ~, kyz.puk ~)
|
2018-05-29 21:20:25 +03:00
|
|
|
=? +> |(new !=(0 ~(wyt by evs)))
|
|
|
|
%- vent:feel
|
|
|
|
?:(new &+evs |+evs)
|
2018-06-01 18:14:35 +03:00
|
|
|
::
|
2018-05-29 00:04:33 +03:00
|
|
|
=+ vez=(order-events:ez ~(tap by evs))
|
2018-08-30 03:02:17 +03:00
|
|
|
=| kyz=(map ship public)
|
2018-06-01 18:14:35 +03:00
|
|
|
|^ ?~ vez (pubs:feel kyz)
|
|
|
|
=^ kyn ..file (file-event i.vez)
|
|
|
|
$(vez t.vez, kyz kyn)
|
|
|
|
::
|
2018-08-30 03:02:17 +03:00
|
|
|
++ get-public
|
|
|
|
|= who=ship
|
|
|
|
^- public
|
|
|
|
%+ fall (~(get by kyz) who)
|
|
|
|
::NOTE we can only do this because ++pubs:feel
|
|
|
|
:: sends out entire new state, rather than
|
|
|
|
:: just the processed changes.
|
|
|
|
%+ fall (~(get by kyz.puk) who)
|
|
|
|
%*(. *public live |)
|
|
|
|
::
|
2018-06-01 18:14:35 +03:00
|
|
|
++ file-keys
|
2018-08-23 22:23:52 +03:00
|
|
|
|= [who=ship =life =pass]
|
2018-06-01 18:14:35 +03:00
|
|
|
^+ kyz
|
2018-08-30 03:02:17 +03:00
|
|
|
=/ pub (get-public who)
|
|
|
|
=/ puk (~(get by pubs.pub) life)
|
|
|
|
?^ puk
|
|
|
|
:: key known, nothing changes
|
|
|
|
~| [%key-mismatch who life]
|
|
|
|
?>(=(u.puk pass) kyz)
|
|
|
|
%+ ~(put by kyz) who
|
|
|
|
:+ live.pub
|
|
|
|
(max life life.pub)
|
|
|
|
(~(put by pubs.pub) life pass)
|
|
|
|
::
|
|
|
|
++ file-discontinuity
|
|
|
|
|= who=ship
|
|
|
|
=+ (get-public who)
|
|
|
|
(~(put by kyz) who -(live |))
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ file-event
|
2018-06-01 18:14:35 +03:00
|
|
|
|= [wer=event-id dif=diff-constitution]
|
|
|
|
^+ [kyz ..file]
|
2018-05-29 00:04:33 +03:00
|
|
|
?: (~(has in heard) wer)
|
|
|
|
~& %ignoring-already-heard-event
|
2018-06-01 18:14:35 +03:00
|
|
|
[kyz ..file]
|
|
|
|
::
|
|
|
|
:: sanity check, should never fail if we operate correctly
|
|
|
|
::
|
|
|
|
?> (gte block.wer latest-block)
|
|
|
|
=: evs (~(put by evs) wer dif)
|
|
|
|
heard (~(put in heard) wer)
|
|
|
|
latest-block (max latest-block block.wer)
|
|
|
|
==
|
|
|
|
?- -.dif
|
|
|
|
%hull (file-hull +.dif)
|
|
|
|
%dns [kyz (file-dns +.dif)]
|
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ file-hull
|
2018-06-01 18:14:35 +03:00
|
|
|
|= [who=ship dif=diff-hull]
|
|
|
|
^+ [kyz ..file]
|
2018-05-29 00:04:33 +03:00
|
|
|
=- ::TODO =; with just the type
|
2018-08-30 03:02:17 +03:00
|
|
|
:- ?: ?=(%& -.new)
|
|
|
|
(file-keys who p.new)
|
|
|
|
?: p.new kyz
|
|
|
|
(file-discontinuity who)
|
2018-06-01 18:14:35 +03:00
|
|
|
..file(hul.eth (~(put by hul.eth) who hel))
|
2018-08-30 03:02:17 +03:00
|
|
|
:: hel: updated hull
|
|
|
|
:: new: new keypair or "kept continuity?" (yes is no-op)
|
|
|
|
^- [hel=hull new=(each (pair life pass) ?)]
|
2018-06-01 18:14:35 +03:00
|
|
|
=+ hul=(fall (~(get by hul.eth) who) *hull)
|
|
|
|
::
|
|
|
|
:: sanity checks, should never fail if we operate correctly
|
|
|
|
::
|
2018-10-03 03:56:25 +03:00
|
|
|
~| [%diff-order-insanity -.dif]
|
2018-06-01 18:14:35 +03:00
|
|
|
?> ?+ -.dif &
|
2018-06-20 15:17:22 +03:00
|
|
|
%spawned ?> ?=(^ kid.hul)
|
|
|
|
!(~(has in spawned.u.kid.hul) who.dif)
|
|
|
|
%keys ?> ?=(^ net.hul)
|
2018-08-23 22:23:52 +03:00
|
|
|
=(life.dif +(life.u.net.hul))
|
2018-06-20 15:17:22 +03:00
|
|
|
%continuity ?> ?=(^ net.hul)
|
|
|
|
=(new.dif +(continuity-number.u.net.hul))
|
2018-06-01 18:14:35 +03:00
|
|
|
==
|
|
|
|
::
|
2018-08-30 03:02:17 +03:00
|
|
|
:: apply hull changes, catch continuity and key changes
|
2018-06-01 18:14:35 +03:00
|
|
|
::
|
|
|
|
:- (apply-hull-diff hul dif)
|
2018-08-30 03:02:17 +03:00
|
|
|
=* nop |+& :: no-op
|
|
|
|
?+ -.dif nop
|
|
|
|
%continuity |+|
|
|
|
|
%keys &+[life pass]:dif
|
|
|
|
%full ?~ net.new.dif nop
|
|
|
|
::TODO do we want/need to do a diff-check
|
|
|
|
&+[life pass]:u.net.new.dif
|
2018-05-29 00:04:33 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ file-dns
|
2018-05-31 17:23:39 +03:00
|
|
|
|= dns=dnses
|
|
|
|
..file(dns.eth dns)
|
2018-05-29 00:04:33 +03:00
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
:: :: ++ur
|
|
|
|
:::: ## absolute^heavy :: objective engine
|
|
|
|
:: ::::
|
|
|
|
++ ur
|
|
|
|
:: the ++ur core handles primary, absolute state.
|
|
|
|
:: it is the best reference for the semantics of
|
|
|
|
:: the urbit pki.
|
|
|
|
::
|
|
|
|
:: it is absolutely verboten to use [our] in ++ur.
|
|
|
|
::
|
|
|
|
=| hab/(list change)
|
2016-12-16 09:34:01 +03:00
|
|
|
=| state-absolute
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: hab: side effects, reversed
|
|
|
|
:: urb: all urbit state
|
|
|
|
::
|
|
|
|
=* urb -
|
|
|
|
|%
|
|
|
|
:: :: ++abet:ur
|
|
|
|
++ abet :: resolve
|
|
|
|
[(flop hab) `state-absolute`urb]
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ link
|
2018-05-29 21:20:25 +03:00
|
|
|
|= ven=chain
|
2018-05-29 00:04:33 +03:00
|
|
|
%_ +>
|
2018-05-29 21:20:25 +03:00
|
|
|
hab [[%ethe ven] hab]
|
|
|
|
eve ?: ?=(%& -.ven) p.ven
|
|
|
|
(~(uni by eve) p.ven)
|
2018-05-29 00:04:33 +03:00
|
|
|
==
|
2018-05-23 02:35:16 +03:00
|
|
|
:: :: ++lawn:ur
|
|
|
|
++ lawn :: debts, rex to pal
|
|
|
|
|= {rex/ship pal/ship}
|
2016-11-24 07:25:07 +03:00
|
|
|
^- safe
|
|
|
|
(lawn:~(able ex rex) pal)
|
|
|
|
:: :: ++lean:ur
|
|
|
|
++ lean :: private keys
|
|
|
|
|= rex/ship
|
|
|
|
^- (pair life (map life ring))
|
|
|
|
lean:~(able ex rex)
|
|
|
|
:: :: ++ex:ur
|
|
|
|
++ ex :: server engine
|
|
|
|
:: shy: private state
|
|
|
|
:: rug: domestic will
|
|
|
|
::
|
|
|
|
=| $: shy/(map ship safe)
|
|
|
|
==
|
|
|
|
=| :: rex: server ship
|
|
|
|
::
|
|
|
|
rex/ship
|
|
|
|
|%
|
|
|
|
:: :: ++abet:ex:ur
|
|
|
|
++ abet :: resolve
|
|
|
|
%_ ..ex
|
|
|
|
pry (~(put by pry) rex shy)
|
|
|
|
==
|
|
|
|
:: :: ++able:ex:ur
|
|
|
|
++ able :: initialize
|
|
|
|
%_ .
|
|
|
|
shy (fall (~(get by pry) rex) *(map ship safe))
|
|
|
|
==
|
|
|
|
:: :: ++deal:ex:ur
|
|
|
|
++ deal :: alter rights
|
|
|
|
|= {pal/ship del/bump}
|
|
|
|
^+ +>
|
|
|
|
=/ gob (fall (~(get by shy) pal) *safe)
|
|
|
|
=* hep (~(update up gob) del)
|
|
|
|
%_ +>.$
|
|
|
|
shy (~(put by shy) pal hep)
|
|
|
|
hab [[%rite rex pal del] hab]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ hail :: ++hail:ex:ur
|
|
|
|
|= {pal/ship rem/remote} :: report rights
|
|
|
|
^+ +>
|
|
|
|
=/ gob (fall (~(get by shy) pal) *safe)
|
2018-05-29 23:02:41 +03:00
|
|
|
:: yer: pair of change and updated safe.
|
2016-11-24 07:25:07 +03:00
|
|
|
=/ yer ^- (pair bump safe)
|
|
|
|
?- -.rem
|
2018-05-29 23:02:41 +03:00
|
|
|
:: change: add rem. result: old + rem.
|
2018-03-19 06:54:47 +03:00
|
|
|
%& [[p.rem ~] (~(splice up gob) p.rem)]
|
2018-05-29 23:02:41 +03:00
|
|
|
:: change: difference. result: rem.
|
2018-03-19 06:54:47 +03:00
|
|
|
%| [(~(differ up gob) p.rem) p.rem]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
%_ +>.$
|
|
|
|
shy (~(put by shy) pal q.yer)
|
|
|
|
hab [[%rite rex pal p.yer] hab]
|
|
|
|
==
|
|
|
|
:: :: ++lean:ex:ur
|
|
|
|
++ lean :: private keys
|
|
|
|
^- (pair life (map life ring))
|
|
|
|
::
|
|
|
|
:: par: promises by rex, to rex
|
|
|
|
:: jel: %jewel rights
|
2018-05-29 23:02:41 +03:00
|
|
|
:: lyf: latest life of
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-05-29 23:02:41 +03:00
|
|
|
=* par (~(got by shy) rex)
|
|
|
|
=/ jel=rite (need (~(expose up par) %jewel))
|
|
|
|
?> ?=($jewel -.jel)
|
|
|
|
=; lyf=life
|
|
|
|
[lyf p.jel]
|
|
|
|
%+ roll ~(tap in ~(key by p.jel))
|
|
|
|
|= [liv=life max=life]
|
|
|
|
?:((gth liv max) liv max)
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++lawn:ex:ur
|
|
|
|
++ lawn :: liabilities to pal
|
|
|
|
|= pal/ship
|
|
|
|
^- safe
|
|
|
|
=-(?~(- ~ u.-) (~(get by shy) pal))
|
2017-04-23 06:13:14 +03:00
|
|
|
--
|
2018-05-23 02:35:16 +03:00
|
|
|
--
|
2018-05-16 00:16:29 +03:00
|
|
|
:: :: ++et
|
|
|
|
:::: ## ethereum^heavy :: ethereum engine
|
|
|
|
:: ::::
|
|
|
|
++ et
|
2018-06-01 01:34:21 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: the ++et core handles all logic necessary to maintain the
|
|
|
|
:: absolute record of on-chain state changes, "events".
|
|
|
|
::
|
|
|
|
:: we either subscribe to a parent ship's existing record, or
|
|
|
|
:: communicate directly with an ethereum node.
|
|
|
|
::
|
|
|
|
:: moves: effects; either behn timers, subscriptions,
|
|
|
|
:: or ethereum node rpc requests.
|
|
|
|
:: reset: whether the found changes assume a fresh state.
|
|
|
|
:: changes: on-chain changes heard from our source.
|
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
=| moves=(list move)
|
2018-05-29 21:20:25 +03:00
|
|
|
=+ reset=|
|
2018-06-01 18:30:14 +03:00
|
|
|
=| changes=logs
|
2018-05-29 00:04:33 +03:00
|
|
|
|_ $: our=ship
|
2018-05-16 21:48:20 +03:00
|
|
|
now=@da
|
2018-05-29 00:04:33 +03:00
|
|
|
state-eth-node
|
2018-05-16 00:16:29 +03:00
|
|
|
==
|
2018-05-31 17:23:39 +03:00
|
|
|
+* etn +<+>
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| outward
|
|
|
|
::
|
|
|
|
:: +abet: produce results
|
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
++ abet
|
2018-05-29 21:20:25 +03:00
|
|
|
^- [(list move) chain state-eth-node]
|
|
|
|
[(flop moves) ?:(reset &+changes |+changes) etn]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +put-move: store side-effect
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ put-move
|
|
|
|
|= mov=move
|
|
|
|
%_(+> moves [mov moves])
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +put-request: store rpc request to ethereum node
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-29 00:04:33 +03:00
|
|
|
++ put-request
|
|
|
|
|= [wir=wire id=(unit @t) req=request]
|
|
|
|
(put-move (rpc-hiss wir (request-to-json id req)))
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +put-change: store change made by event
|
|
|
|
::
|
|
|
|
++ put-change
|
2018-05-29 00:04:33 +03:00
|
|
|
|= [cause=event-id dif=diff-constitution]
|
2018-06-01 18:14:35 +03:00
|
|
|
?< (~(has by changes) cause) :: one diff per event
|
|
|
|
+>(changes (~(put by changes) cause dif))
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| move-generation
|
|
|
|
::
|
|
|
|
:: +wrap-note: %pass a note using a made-up duct
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
|
|
|
++ wrap-note
|
|
|
|
|= [wir=wire not=note:able]
|
2018-05-16 00:16:29 +03:00
|
|
|
^- move
|
2018-05-30 01:40:00 +03:00
|
|
|
:- [/jael/eth-logic ~ ~]
|
|
|
|
[%pass (weld /(scot %p our) wir) not]
|
|
|
|
::
|
|
|
|
:: +rpc-hiss: make an http request to our ethereum rpc source
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ rpc-hiss
|
|
|
|
|= [wir=wire jon=json]
|
|
|
|
^- move
|
|
|
|
%+ wrap-note wir
|
2018-05-16 00:16:29 +03:00
|
|
|
:^ %e %hiss ~
|
2018-05-16 21:48:20 +03:00
|
|
|
:+ %json-rpc-response %hiss
|
2018-05-25 03:11:21 +03:00
|
|
|
?> ?=(%| -.source)
|
|
|
|
!> (json-request node.p.source jon)
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| source-operations
|
|
|
|
::
|
|
|
|
:: +listen-to-ship: depend on who for ethereum events
|
2018-05-25 03:11:21 +03:00
|
|
|
::
|
|
|
|
++ listen-to-ship
|
2018-05-18 22:12:46 +03:00
|
|
|
|= [our=ship who=ship]
|
2018-05-25 03:11:21 +03:00
|
|
|
%- put-move(source &+who)
|
2018-05-17 22:48:17 +03:00
|
|
|
%+ wrap-note /vent/(scot %p who)
|
2018-05-29 00:04:33 +03:00
|
|
|
[%a %want [our who] /j/(scot %p our)/vent `*`[%vent ~]]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +unsubscribe-from-source: stop listening to current source ship
|
|
|
|
::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ unsubscribe-from-source
|
|
|
|
|= our=ship
|
|
|
|
%- put-move
|
|
|
|
?> ?=(%& -.source)
|
|
|
|
%+ wrap-note /vent/(scot %p p.source)
|
2018-05-29 00:04:33 +03:00
|
|
|
::TODO should we maybe have a %nuke-vent,
|
|
|
|
:: or do we have a unique duct here?
|
|
|
|
[%a %want [our p.source] /j/(scot %p our)/vent `*`[%nuke ~]]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ listen-to-node
|
|
|
|
|= url=purl:eyre
|
|
|
|
new-filter(source |+%*(. *node-src node url))
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| filter-operations
|
|
|
|
::
|
|
|
|
:: +new-filter: request a new polling filter
|
|
|
|
::
|
|
|
|
:: Listens only to the Ships state contract, and only from
|
|
|
|
:: the last-heard block onward.
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ new-filter
|
2018-05-29 00:04:33 +03:00
|
|
|
%- put-request
|
2018-05-16 21:48:20 +03:00
|
|
|
:+ /filter/new `'new filter'
|
|
|
|
:* %eth-new-filter
|
|
|
|
`[%number +(latest-block)] ::TODO or Ships origin block when 0
|
|
|
|
~ ::TODO we should probably chunck these, maybe?
|
|
|
|
:: https://stackoverflow.com/q/49339489
|
|
|
|
~[ships:contracts]
|
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +read-filter: get all events the filter captures
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ read-filter
|
2018-05-25 03:11:21 +03:00
|
|
|
?> ?=(%| -.source)
|
2018-05-29 00:04:33 +03:00
|
|
|
%- put-request
|
2018-05-17 17:40:55 +03:00
|
|
|
:+ /filter/logs `'filter logs'
|
2018-05-25 03:11:21 +03:00
|
|
|
[%eth-get-filter-logs filter-id.p.source]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +poll-filter: get all new events since the last poll (or filter creation)
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ poll-filter
|
2018-05-25 03:11:21 +03:00
|
|
|
?> ?=(%| -.source)
|
2018-05-29 00:04:33 +03:00
|
|
|
%- put-request
|
2018-05-17 17:40:55 +03:00
|
|
|
:+ /filter/changes `'poll filter'
|
2018-05-25 03:11:21 +03:00
|
|
|
[%eth-get-filter-changes filter-id.p.source]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +wait-poll: remind us to poll in four minutes
|
|
|
|
::
|
|
|
|
:: Four minutes because Ethereum RPC filters time out after five.
|
|
|
|
:: We don't check for an existing timer or clear an old one here,
|
|
|
|
:: sane flows shouldn't see this being called superfluously.
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ wait-poll
|
2018-05-25 03:11:21 +03:00
|
|
|
?> ?=(%| -.source)
|
|
|
|
=+ wen=(add now ~m4)
|
|
|
|
%- put-move(poll-timer.p.source wen)
|
2018-05-29 14:50:02 +03:00
|
|
|
(wrap-note /poll %b %wait wen)
|
2018-05-25 03:11:21 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +cancel-wait-poll: remove poll reminder
|
|
|
|
::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ cancel-wait-poll
|
|
|
|
?> ?=(%| -.source)
|
|
|
|
%- put-move(poll-timer.p.source *@da)
|
2018-05-29 14:50:02 +03:00
|
|
|
%+ wrap-note /poll/cancel
|
2018-05-25 03:11:21 +03:00
|
|
|
[%b %rest poll-timer.p.source]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| configuration
|
|
|
|
::
|
|
|
|
:: +init: initialize with default ethereum connection
|
|
|
|
::
|
|
|
|
:: for galaxies, we default to a localhost geth node.
|
|
|
|
:: for stars and under, we default to the parent ship.
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
|
|
|
++ init
|
2018-05-18 00:09:20 +03:00
|
|
|
|= our=ship
|
2018-05-25 03:11:21 +03:00
|
|
|
^+ +>
|
2018-05-18 00:09:20 +03:00
|
|
|
::TODO ship or node as sample?
|
|
|
|
=+ bos=(sein:title our)
|
|
|
|
?. =(our bos)
|
2018-05-25 03:11:21 +03:00
|
|
|
(listen-to-ship our bos)
|
|
|
|
=+ (need (de-purl:html 'http://localhost:8545'))
|
|
|
|
(listen-to-node -(p.p |))
|
|
|
|
::
|
2018-06-01 01:34:21 +03:00
|
|
|
:: +look: configure the source of ethereum events
|
2018-05-30 01:40:00 +03:00
|
|
|
::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ look
|
2018-05-29 00:04:33 +03:00
|
|
|
|= src=(each ship purl:eyre)
|
2018-05-25 03:11:21 +03:00
|
|
|
^+ +>
|
|
|
|
=. +>
|
2018-05-30 01:36:13 +03:00
|
|
|
?: ?=(%| -.source)
|
2018-05-25 03:11:21 +03:00
|
|
|
cancel-wait-poll
|
|
|
|
(unsubscribe-from-source our)
|
|
|
|
?: ?=(%| -.src)
|
|
|
|
(listen-to-node p.src)
|
|
|
|
(listen-to-ship our p.src)
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| subscription-results
|
|
|
|
::
|
|
|
|
:: +hear-vent: process incoming events
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
|
|
|
++ hear-vent
|
2018-05-29 21:20:25 +03:00
|
|
|
|= can=chain
|
2018-05-18 00:49:20 +03:00
|
|
|
^+ +>
|
2018-05-29 21:20:25 +03:00
|
|
|
?- -.can
|
|
|
|
%& (assume p.can)
|
2018-05-22 20:32:22 +03:00
|
|
|
::
|
2018-05-29 21:20:25 +03:00
|
|
|
%|
|
2018-06-01 18:14:35 +03:00
|
|
|
=+ evs=~(tap by p.can)
|
2018-05-22 20:32:22 +03:00
|
|
|
|-
|
2018-06-01 18:14:35 +03:00
|
|
|
?~ evs +>.^$
|
|
|
|
=. +>.^$ (accept i.evs)
|
|
|
|
$(evs t.evs)
|
2018-05-16 21:48:20 +03:00
|
|
|
==
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +assume: clear state and process events
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ assume
|
2018-06-01 18:30:14 +03:00
|
|
|
|= evs=logs
|
2018-05-18 00:49:20 +03:00
|
|
|
^+ +>
|
2018-05-29 21:20:25 +03:00
|
|
|
%. |+evs
|
|
|
|
%_ hear-vent
|
|
|
|
heard ~
|
|
|
|
latest-block 0
|
|
|
|
reset &
|
|
|
|
==
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +accept: process single event
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ accept
|
2018-06-01 18:14:35 +03:00
|
|
|
|= [cause=event-id dif=diff-constitution]
|
2018-05-18 00:49:20 +03:00
|
|
|
^+ +>
|
2018-05-29 00:04:33 +03:00
|
|
|
?: (~(has in heard) cause)
|
2018-05-16 21:48:20 +03:00
|
|
|
~& %accept-ignoring-duplicate-event
|
|
|
|
+>.$
|
2018-06-01 18:14:35 +03:00
|
|
|
(put-change cause dif)
|
2018-05-30 01:40:00 +03:00
|
|
|
::
|
|
|
|
:: +| filter-results
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-08-30 03:06:20 +03:00
|
|
|
:: +wake: kick polling, unless we changed source
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
2018-08-30 03:06:20 +03:00
|
|
|
++ wake
|
|
|
|
?. ?=(%| -.source) .
|
|
|
|
poll-filter
|
2018-05-18 00:09:20 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +sigh: parse rpc response and process it
|
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
++ sigh
|
2018-05-29 00:04:33 +03:00
|
|
|
|= [cuz=wire mar=mark res=vase]
|
2018-05-16 00:16:29 +03:00
|
|
|
^+ +>
|
2018-05-25 03:11:21 +03:00
|
|
|
?: ?=(%& -.source) +>
|
2018-05-29 00:04:33 +03:00
|
|
|
?: ?=(%tang mar)
|
|
|
|
::TODO proper error handling
|
|
|
|
~& %yikes
|
|
|
|
~_ q.res
|
|
|
|
+>
|
2018-05-17 17:40:55 +03:00
|
|
|
?> ?=(%json-rpc-response mar)
|
|
|
|
~| res
|
|
|
|
=+ rep=((hard response:rpc:jstd) q.res)
|
2018-05-29 00:04:33 +03:00
|
|
|
?+ cuz ~|([%weird-sigh-wire cuz] !!)
|
2018-05-17 17:40:55 +03:00
|
|
|
[%filter %new *]
|
|
|
|
(take-new-filter rep)
|
|
|
|
::
|
|
|
|
[%filter *]
|
|
|
|
(take-filter-results rep)
|
2018-05-16 00:16:29 +03:00
|
|
|
==
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +take-new-filter: store filter-id and read it
|
|
|
|
::
|
2018-05-17 17:40:55 +03:00
|
|
|
++ take-new-filter
|
2018-05-16 21:48:20 +03:00
|
|
|
|= rep=response:rpc:jstd
|
|
|
|
^+ +>
|
|
|
|
~| rep
|
|
|
|
?< ?=(%batch -.rep)
|
|
|
|
?: ?=(%error -.rep)
|
|
|
|
~& [%filter-error--retrying message.rep]
|
|
|
|
new-filter
|
2018-05-25 03:11:21 +03:00
|
|
|
?> ?=(%| -.source)
|
|
|
|
=- read-filter(filter-id.p.source -)
|
2018-05-16 21:48:20 +03:00
|
|
|
(parse-eth-new-filter-res res.rep)
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +take-filter-results: parse results into event-logs and process them
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ take-filter-results
|
|
|
|
|= rep=response:rpc:jstd
|
|
|
|
^+ +>
|
|
|
|
?< ?=(%batch -.rep)
|
|
|
|
?: ?=(%error -.rep)
|
|
|
|
?. =('filter not found' message.rep)
|
|
|
|
~& [%unhandled-filter-error message.rep]
|
|
|
|
+>
|
|
|
|
~& %filter-timed-out--recreating
|
|
|
|
new-filter
|
2018-05-25 03:11:21 +03:00
|
|
|
:: kick polling timer, only if it hasn't already been.
|
|
|
|
=? +> ?& ?=(%| -.source)
|
|
|
|
(gth now poll-timer.p.source)
|
|
|
|
==
|
|
|
|
wait-poll
|
2018-05-16 21:48:20 +03:00
|
|
|
?> ?=(%a -.res.rep)
|
|
|
|
=* changes p.res.rep
|
|
|
|
~& [%filter-changes (lent changes)]
|
|
|
|
|- ^+ +>.^$
|
|
|
|
?~ changes +>.^$
|
|
|
|
=. +>.^$
|
|
|
|
(take-event-log (parse-event-log i.changes))
|
|
|
|
$(changes t.changes)
|
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +take-event-log: obtain changes from event-log
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
++ take-event-log
|
|
|
|
|= log=event-log
|
|
|
|
^+ +>
|
|
|
|
?~ mined.log
|
|
|
|
~& %ignoring-unmined-event
|
|
|
|
+>
|
2018-05-29 23:02:41 +03:00
|
|
|
=* place u.mined.log
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
|
|
|
::TODO if the block number is less than latest, that means we got
|
|
|
|
:: events out of order somehow and should probably reset.
|
2018-05-29 23:02:41 +03:00
|
|
|
?> (gth block-number.place latest-block)
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
|
|
|
?: (~(has in heard) block-number.place log-index.place)
|
|
|
|
~& %ignoring-duplicate-event
|
|
|
|
+>
|
|
|
|
=+ cuz=[block-number.place log-index.place]
|
|
|
|
::
|
|
|
|
?: =(event.log changed-dns:ships-events)
|
|
|
|
=+ ^- [pri=tape sec=tape ter=tape]
|
2018-05-31 17:23:39 +03:00
|
|
|
%+ decode-results data.log
|
|
|
|
~[%string %string %string]
|
|
|
|
%+ put-change cuz
|
|
|
|
[%dns (crip pri) (crip sec) (crip ter)]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-06-01 18:14:35 +03:00
|
|
|
=+ dif=(event-log-to-hull-diff log)
|
|
|
|
?~ dif +>.$
|
|
|
|
(put-change cuz %hull u.dif)
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
--
|
2017-04-23 06:13:14 +03:00
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::::
|
|
|
|
:::: # vane :: interface
|
|
|
|
:: ::::
|
|
|
|
::
|
|
|
|
:: lex: all durable %jael state
|
|
|
|
::
|
|
|
|
=| lex/state
|
2016-12-16 09:34:01 +03:00
|
|
|
|= $: ::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: now: current time
|
|
|
|
:: eny: unique entropy
|
|
|
|
:: ski: namespace resolver
|
|
|
|
::
|
|
|
|
now/@da
|
2016-12-16 09:34:01 +03:00
|
|
|
eny/@e
|
2016-11-24 07:25:07 +03:00
|
|
|
ski/sley
|
|
|
|
==
|
|
|
|
|%
|
|
|
|
:: :: ++call
|
|
|
|
++ call :: request
|
|
|
|
|= $: :: hen: cause of this event
|
|
|
|
:: hic: event data
|
|
|
|
::
|
|
|
|
hen/duct
|
2018-05-22 00:10:27 +03:00
|
|
|
hic/(hypo (hobo task:able))
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
^- {p/(list move) q/_..^$}
|
2018-05-29 23:02:41 +03:00
|
|
|
=^ did lex
|
|
|
|
=- abet:(~(call of [now eny] lex) hen -)
|
|
|
|
?. ?=($soft -.q.hic) q.hic
|
|
|
|
((hard task:able) p.q.hic)
|
2016-11-24 07:25:07 +03:00
|
|
|
[did ..^$]
|
|
|
|
:: :: ++load
|
|
|
|
++ load :: upgrade
|
|
|
|
|= $: :: old: previous state
|
|
|
|
::
|
|
|
|
old/state
|
|
|
|
==
|
|
|
|
^+ ..^$
|
|
|
|
..^$(lex old)
|
|
|
|
:: :: ++scry
|
|
|
|
++ scry :: inspect
|
|
|
|
|= $: :: fur: event security
|
|
|
|
:: ren: access mode
|
|
|
|
:: why: owner
|
|
|
|
:: syd: desk (branch)
|
|
|
|
:: lot: case (version)
|
|
|
|
:: tyl: rest of path
|
|
|
|
::
|
|
|
|
fur/(unit (set monk))
|
2016-12-16 09:34:01 +03:00
|
|
|
ren/@tas
|
|
|
|
why/shop
|
|
|
|
syd/desk
|
|
|
|
lot/coin
|
2016-11-24 07:25:07 +03:00
|
|
|
tyl/spur
|
|
|
|
==
|
|
|
|
^- (unit (unit cage))
|
2016-12-13 22:02:38 +03:00
|
|
|
:: XX security
|
|
|
|
?. =(lot [%$ %da now]) ~
|
|
|
|
%- some
|
|
|
|
?. =(%$ ren) ~
|
|
|
|
%+ bind (~(scry of [now eny] lex) syd tyl)
|
|
|
|
=- ~! - -
|
|
|
|
|=(a/gilt [-.a (slot `@`3 !>(a))])
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++stay
|
|
|
|
++ stay :: preserve
|
|
|
|
lex
|
|
|
|
:: :: ++take
|
|
|
|
++ take :: accept
|
|
|
|
|= $: :: tea: order
|
|
|
|
:: hen: cause
|
|
|
|
:: hin: result
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
tea/wire
|
|
|
|
hen/duct
|
2018-05-16 00:16:29 +03:00
|
|
|
hin/(hypo sign)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
^- {p/(list move) q/_..^$}
|
2018-05-29 00:04:33 +03:00
|
|
|
=^ did lex abet:(~(take of [now eny] lex) tea hen q.hin)
|
|
|
|
[did ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|