2019-02-06 02:52:50 +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
|
2016-12-10 03:47:21 +03:00
|
|
|
=, able:jael
|
2016-12-02 22:34:07 +03:00
|
|
|
=, crypto
|
2016-11-24 07:25:07 +03:00
|
|
|
=, jael
|
2018-05-16 00:16:29 +03:00
|
|
|
=, ethereum
|
2018-12-18 01:38:24 +03:00
|
|
|
=, rpc
|
|
|
|
=, azimuth
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::::
|
|
|
|
:::: # models :: data structures
|
|
|
|
:: ::::
|
|
|
|
:: the %jael state comes in two parts: absolute
|
|
|
|
:: and relative.
|
|
|
|
::
|
|
|
|
:: ++state-relative is subjective, denormalized and
|
|
|
|
:: derived. it consists of all the state we need to
|
|
|
|
:: manage subscriptions efficiently.
|
|
|
|
::
|
|
|
|
=> |%
|
|
|
|
++ state :: all vane state
|
2019-06-21 21:03:53 +03:00
|
|
|
$: ver=$0 :: vane version
|
|
|
|
yen=(set duct) :: raw observers
|
|
|
|
sub=state-relative :: all relative state
|
2018-05-29 00:04:33 +03:00
|
|
|
etn=state-eth-node :: eth connection state
|
2018-10-26 00:37:04 +03:00
|
|
|
sap=state-snapshots :: state snapshots
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
++ state-relative :: urbit metadata
|
2019-06-22 00:45:00 +03:00
|
|
|
$: $= own :: vault (vein)
|
2019-06-21 21:03:53 +03:00
|
|
|
$: yen=(set duct) :: trackers
|
2018-10-16 03:39:55 +03:00
|
|
|
sig=(unit oath) :: for a moon
|
2018-10-15 22:51:53 +03:00
|
|
|
:: XX reconcile with .dns.eth ::
|
|
|
|
tuf=(list turf) :: domains
|
2018-10-29 22:38:14 +03:00
|
|
|
:: XX use for eth replay ::
|
|
|
|
boq=@ud :: boot block
|
|
|
|
nod=(unit purl:eyre) :: eth gateway
|
2019-06-21 21:03:53 +03:00
|
|
|
fak=_| :: fake keys
|
|
|
|
lyf=life :: version
|
|
|
|
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-12-14 00:23:17 +03:00
|
|
|
::TODO the subscribers here never hear dns or pos...
|
2018-05-29 00:04:33 +03:00
|
|
|
$: yen=(set duct) :: trackers
|
|
|
|
dns=dnses :: on-chain dns state
|
2018-12-14 00:23:17 +03:00
|
|
|
pos=(map ship point) :: on-chain ship state
|
|
|
|
::TODO do we want (map ship diff-point) too?
|
2018-05-29 00:04:33 +03:00
|
|
|
== ::
|
2016-12-16 09:34:01 +03:00
|
|
|
== ::
|
2018-10-26 00:37:04 +03:00
|
|
|
++ state-snapshots :: rewind points
|
|
|
|
$: interval=_100 :: block interval
|
|
|
|
max-count=_10 :: max snaps
|
|
|
|
count=@ud :: length of snaps
|
|
|
|
last-block=@ud :: number of last snap
|
|
|
|
snaps=(qeu [block-number=@ud snap=snapshot]) :: old states
|
2018-10-31 03:05:05 +03:00
|
|
|
== ::
|
2019-06-21 21:03:53 +03:00
|
|
|
++ message :: message to her jael
|
2019-06-22 00:45:00 +03:00
|
|
|
$% [%nuke ~] :: cancel trackers
|
2018-06-01 01:34:21 +03:00
|
|
|
[%vent ~] :: view ethereum events
|
2018-11-02 00:19:44 +03:00
|
|
|
[%vent-result p=vent-result] :: tmp workaround
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
++ card :: i/o action
|
2019-05-25 11:43:13 +03:00
|
|
|
(wind note gift) ::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ::
|
2019-06-22 00:45:00 +03:00
|
|
|
+$ move :: output
|
2019-06-21 21:03:53 +03:00
|
|
|
[p=duct q=card] ::
|
2019-05-25 11:43:13 +03:00
|
|
|
:: ::
|
|
|
|
+$ note :: out request $->
|
|
|
|
$~ [%b %wait *@da] ::
|
|
|
|
$% $: %b :: to %behn
|
|
|
|
$> $? %rest :: cancel timer
|
|
|
|
%wait :: set timer
|
|
|
|
== ::
|
|
|
|
task:able:behn ::
|
|
|
|
== ::
|
|
|
|
$: %a :: to %ames
|
|
|
|
$>(%want task:able:ames) :: send message
|
|
|
|
== ::
|
|
|
|
$: %j :: to self
|
|
|
|
$>(%look task) :: set ethereum source
|
|
|
|
== ::
|
2019-06-19 21:09:53 +03:00
|
|
|
$: %l :: to %lient
|
|
|
|
$>(%request task:able:http-client) :: http request
|
|
|
|
== ::
|
2019-05-25 11:43:13 +03:00
|
|
|
$: @tas ::
|
2019-05-27 10:41:03 +03:00
|
|
|
$% $>(%init vane-task) :: report install
|
|
|
|
$>(%sunk vane-task) :: report death
|
2019-05-25 11:43:13 +03:00
|
|
|
== == == ::
|
|
|
|
:: ::
|
|
|
|
+$ sign :: in result $<-
|
|
|
|
$~ [%b %wake ~] ::
|
|
|
|
$% [%b $>(%wake gift:able:behn)] :: wakeup
|
|
|
|
[%j $>(%vent gift)] :: ethereum changes
|
|
|
|
[%a $>(%woot gift:able:ames)] :: message result
|
2019-06-19 21:09:53 +03:00
|
|
|
[%l $>(%http-response gift:able:http-client)] :: http response
|
2019-05-25 11:43:13 +03:00
|
|
|
== ::
|
2016-11-24 07:25:07 +03:00
|
|
|
-- ::
|
|
|
|
:: ::::
|
|
|
|
:::: # light :: light cores
|
|
|
|
:: ::::
|
|
|
|
=> |%
|
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-12-14 00:23:17 +03:00
|
|
|
|= loz=(list (pair event-id diff-azimuth))
|
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.
|
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
:: logically we could nest the ++su core within it, but
|
|
|
|
:: we keep them separated for clarity. the ++curd and
|
|
|
|
:: ++cure arms complete relative and absolute effects,
|
|
|
|
:: respectively, at the top level.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
:: a general pattern here is that we use the ++et 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)
|
2018-12-12 11:34:05 +03:00
|
|
|
=| $: $: :: our: identity
|
|
|
|
:: now: current time
|
2016-11-24 07:25:07 +03:00
|
|
|
:: eny: unique entropy
|
|
|
|
::
|
2018-12-12 11:34:05 +03:00
|
|
|
our=ship
|
2018-12-06 00:41:21 +03:00
|
|
|
now=@da
|
|
|
|
eny=@uvJ
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
:: all vane state
|
|
|
|
::
|
|
|
|
state
|
|
|
|
==
|
|
|
|
:: lex: all durable state
|
|
|
|
:: moz: pending actions
|
|
|
|
::
|
|
|
|
=* lex ->
|
|
|
|
|%
|
|
|
|
:: :: ++abet:of
|
|
|
|
++ abet :: resolve
|
|
|
|
[(flop moz) lex]
|
2016-12-13 22:02:38 +03:00
|
|
|
:: :: ++scry:of
|
|
|
|
++ scry :: read
|
2018-10-12 19:48:52 +03:00
|
|
|
|= {syd/@tas pax/path}
|
|
|
|
~| %jael-scry-of-stub
|
2016-12-13 22:02:38 +03:00
|
|
|
=^ mar pax =/(a (flop pax) [-.a (flop t.+.a)])
|
2018-10-12 19:48:52 +03:00
|
|
|
!!
|
|
|
|
:: :: ++sein:of
|
|
|
|
++ sein :: sponsor
|
|
|
|
|= who=ship
|
|
|
|
^- ship
|
|
|
|
:: XX save %dawn sponsor in .own.sub, check there
|
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
=/ pot (~(get by pos.eth.sub) who)
|
|
|
|
?: ?& ?=(^ pot)
|
|
|
|
?=(^ net.u.pot)
|
2018-10-12 19:48:52 +03:00
|
|
|
==
|
2018-12-21 17:59:12 +03:00
|
|
|
who.sponsor.u.net.u.pot
|
2018-10-15 09:23:34 +03:00
|
|
|
(^sein:title who)
|
2018-10-12 19:48:52 +03:00
|
|
|
:: :: ++saxo:of
|
|
|
|
++ saxo :: sponsorship chain
|
|
|
|
|= who/ship
|
|
|
|
^- (list ship)
|
|
|
|
=/ dad (sein who)
|
|
|
|
[who ?:(=(who dad) ~ $(who dad))]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++call:of
|
|
|
|
++ call :: invoke
|
|
|
|
|= $: :: hen: event cause
|
|
|
|
:: tac: event data
|
|
|
|
::
|
|
|
|
hen/duct
|
|
|
|
tac/task
|
|
|
|
==
|
|
|
|
^+ +>
|
|
|
|
?- -.tac
|
|
|
|
::
|
2018-09-07 04:41:16 +03:00
|
|
|
:: boot from keys
|
2018-10-29 22:38:14 +03:00
|
|
|
:: $: $dawn
|
|
|
|
:: =seed
|
2018-12-21 17:59:12 +03:00
|
|
|
:: spon=ship
|
2018-10-29 22:38:14 +03:00
|
|
|
:: czar=(map ship [=life =pass])
|
|
|
|
:: turf=(list turf)}
|
|
|
|
:: bloq=@ud
|
|
|
|
:: node=purl
|
|
|
|
:: ==
|
2018-09-07 04:41:16 +03:00
|
|
|
::
|
|
|
|
%dawn
|
2018-12-12 11:34:05 +03:00
|
|
|
:: single-homed
|
2018-10-15 22:51:53 +03:00
|
|
|
::
|
2018-12-12 11:34:05 +03:00
|
|
|
?> =(our who.seed.tac)
|
2018-10-29 22:38:14 +03:00
|
|
|
:: save our boot block
|
|
|
|
::
|
|
|
|
=. boq.own.sub bloq.tac
|
|
|
|
:: save our ethereum gateway (required for galaxies)
|
|
|
|
::
|
|
|
|
=. nod.own.sub node.tac
|
2018-10-16 03:39:55 +03:00
|
|
|
:: save our parent signature (only for moons)
|
|
|
|
::
|
|
|
|
=. sig.own.sub sig.seed.tac
|
2019-01-16 02:09:50 +03:00
|
|
|
:: if we're given a snapshot, restore it
|
|
|
|
::
|
|
|
|
=. +>.$
|
|
|
|
?~ snap.tac +>.$
|
|
|
|
(restore-snap hen u.snap.tac |)
|
2019-01-16 02:55:06 +03:00
|
|
|
:: load our initial public key, overriding snapshot
|
2018-10-16 03:39:55 +03:00
|
|
|
::
|
|
|
|
=. kyz.puk.sub
|
|
|
|
=/ cub (nol:nu:crub:crypto key.seed.tac)
|
|
|
|
%+ ~(put by kyz.puk.sub)
|
|
|
|
our
|
2018-12-06 03:26:32 +03:00
|
|
|
[lyf.seed.tac (my [lyf.seed.tac pub:ex:cub] ~)]
|
2019-06-22 00:45:00 +03:00
|
|
|
:: our initial private key
|
2018-09-07 04:41:16 +03:00
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
=. lyf.own.sub lyf.seed.tac
|
|
|
|
=. jaw.own.sub (my [lyf.seed.tac key.seed.tac] ~)
|
2018-09-07 04:41:16 +03:00
|
|
|
:: our initial galaxy table as a +map from +life to +public
|
|
|
|
::
|
|
|
|
=/ kyz
|
|
|
|
%- ~(run by czar.tac)
|
2018-12-06 03:26:32 +03:00
|
|
|
|=([=life =pass] `public`[life (my [life pass] ~)])
|
2018-09-07 04:41:16 +03:00
|
|
|
=. +>.$
|
|
|
|
%- curd =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(pubs:~(feel su hen our sub etn sap) kyz)
|
2018-10-12 19:48:52 +03:00
|
|
|
:: XX save sponsor in .own.sub
|
2018-10-04 09:43:40 +03:00
|
|
|
:: XX reconcile with .dns.eth
|
|
|
|
:: set initial domains
|
|
|
|
::
|
2018-10-15 22:51:53 +03:00
|
|
|
=. tuf.own.sub turf.tac
|
2018-10-04 09:43:40 +03:00
|
|
|
::
|
2018-09-07 04:41:16 +03:00
|
|
|
=. moz
|
|
|
|
%+ weld moz
|
|
|
|
:: order is crucial!
|
|
|
|
::
|
2018-10-18 08:27:24 +03:00
|
|
|
:: %dill must init after %gall
|
|
|
|
:: the %give init (for unix) must be after %dill init
|
|
|
|
:: %jael init must be deferred (makes http requests)
|
2018-09-07 04:41:16 +03:00
|
|
|
::
|
|
|
|
^- (list move)
|
2018-12-12 11:34:05 +03:00
|
|
|
:~ [hen %pass /(scot %p our)/init %b %wait +(now)]
|
2018-09-07 04:41:16 +03:00
|
|
|
[hen %give %init our]
|
2019-02-11 22:44:56 +03:00
|
|
|
[hen %slip %r %init our]
|
2018-10-18 08:27:24 +03:00
|
|
|
[hen %slip %d %init our]
|
|
|
|
[hen %slip %g %init our]
|
2018-09-07 04:41:16 +03:00
|
|
|
[hen %slip %c %init our]
|
|
|
|
[hen %slip %a %init our]
|
|
|
|
==
|
|
|
|
+>.$
|
|
|
|
::
|
2018-09-15 08:38:22 +03:00
|
|
|
:: boot fake
|
2018-12-12 11:50:40 +03:00
|
|
|
:: [%fake =ship]
|
2018-09-15 08:38:22 +03:00
|
|
|
::
|
|
|
|
%fake
|
2018-12-12 11:34:05 +03:00
|
|
|
:: single-homed
|
2018-10-15 22:51:53 +03:00
|
|
|
::
|
2018-12-12 11:50:40 +03:00
|
|
|
?> =(our ship.tac)
|
2018-10-16 03:39:55 +03:00
|
|
|
:: fake keys are deterministically derived from the ship
|
|
|
|
::
|
|
|
|
=/ cub (pit:nu:crub:crypto 512 our)
|
|
|
|
:: save our parent signature (only for moons)
|
|
|
|
::
|
|
|
|
:: XX move logic to zuse
|
|
|
|
::
|
|
|
|
=. sig.own.sub
|
|
|
|
?. ?=(%earl (clan:title our))
|
|
|
|
~
|
2018-10-15 09:23:34 +03:00
|
|
|
=/ yig (pit:nu:crub:crypto 512 (^sein:title our))
|
2018-10-16 03:39:55 +03:00
|
|
|
[~ (sign:as:yig (shaf %earl (sham our 1 pub:ex:cub)))]
|
|
|
|
:: our initial public key
|
|
|
|
::
|
|
|
|
=. kyz.puk.sub
|
2018-12-06 03:26:32 +03:00
|
|
|
(~(put by kyz.puk.sub) our [1 (my [1 pub:ex:cub] ~)])
|
2019-06-22 00:45:00 +03:00
|
|
|
:: our private key
|
2018-09-15 08:38:22 +03:00
|
|
|
::
|
|
|
|
:: Private key updates are disallowed for fake ships,
|
|
|
|
:: so we do this first.
|
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
=. lyf.own.sub 1
|
|
|
|
=. jaw.own.sub (my [1 sec:ex:cub] ~)
|
2018-09-15 08:38:22 +03:00
|
|
|
:: set the fake bit
|
|
|
|
::
|
2018-10-15 22:51:53 +03:00
|
|
|
=. fak.own.sub &
|
2018-09-15 08:38:22 +03:00
|
|
|
:: initialize other vanes per the usual procedure
|
|
|
|
::
|
|
|
|
:: Except for ourselves!
|
|
|
|
::
|
|
|
|
=. moz
|
|
|
|
%+ weld moz
|
|
|
|
^- (list move)
|
2018-10-18 08:27:24 +03:00
|
|
|
:~ [hen %give %init our]
|
2019-02-11 22:44:56 +03:00
|
|
|
[hen %slip %r %init our]
|
2018-10-18 08:27:24 +03:00
|
|
|
[hen %slip %d %init our]
|
|
|
|
[hen %slip %g %init our]
|
2018-09-15 08:38:22 +03:00
|
|
|
[hen %slip %c %init our]
|
|
|
|
[hen %slip %a %init our]
|
|
|
|
==
|
|
|
|
+>.$
|
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
:: set ethereum source
|
|
|
|
:: [%look p=(each ship purl)]
|
|
|
|
::
|
|
|
|
%look
|
2018-12-12 11:34:05 +03:00
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(~(look et hen our now sub.lex etn.lex sap.lex) src.tac)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: cancel all trackers from duct
|
|
|
|
:: {$nuke $~}
|
|
|
|
::
|
|
|
|
$nuke
|
|
|
|
%_ +>
|
|
|
|
yen (~(del in yen) 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
|
2018-12-12 11:50:40 +03:00
|
|
|
:: [%pubs =ship]
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
%pubs
|
|
|
|
%- curd =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(~(pubs ~(feed su hen our sub etn sap) hen) ship.tac)
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
2018-08-30 03:05:34 +03:00
|
|
|
:: seen after breach
|
|
|
|
:: [%meet our=ship who=ship]
|
|
|
|
::
|
|
|
|
%meet
|
2018-12-12 11:34:05 +03:00
|
|
|
%+ cure hen
|
2019-06-22 00:45:00 +03:00
|
|
|
[%meet ship.tac life.tac pass.tac]~
|
2018-08-30 03:05:34 +03:00
|
|
|
::
|
2019-01-16 03:33:17 +03:00
|
|
|
:: restore snapshot
|
|
|
|
:: [%snap snap=snapshot kick=?]
|
|
|
|
%snap
|
|
|
|
(restore-snap hen snap.tac kick.tac)
|
|
|
|
::
|
2018-10-04 09:43:40 +03:00
|
|
|
:: XX should be a subscription
|
|
|
|
:: XX reconcile with .dns.eth
|
|
|
|
:: request domains
|
|
|
|
:: [%turf ~]
|
|
|
|
::
|
|
|
|
%turf
|
2018-10-17 19:42:53 +03:00
|
|
|
:: ships with real keys must have domains,
|
|
|
|
:: those with fake keys must not
|
|
|
|
::
|
2018-10-15 22:51:53 +03:00
|
|
|
?< =(fak.own.sub ?=(^ tuf.own.sub))
|
|
|
|
+>.$(moz [[hen %give %turf tuf.own.sub] moz])
|
2018-10-04 09:43:40 +03:00
|
|
|
::
|
2019-02-01 10:37:00 +03:00
|
|
|
:: learn of kernel upgrade
|
|
|
|
:: [%vega ~]
|
|
|
|
::
|
|
|
|
%vega
|
|
|
|
+>.$
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: watch private keys
|
|
|
|
:: {$vein $~}
|
|
|
|
::
|
|
|
|
$vein
|
2019-06-22 00:45:00 +03:00
|
|
|
(curd abet:~(vein ~(feed su hen our sub etn sap) 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]
|
2019-06-22 00:45:00 +03:00
|
|
|
(curd abet:~(vent ~(feed su hen our sub etn sap) 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))
|
2019-01-30 01:41:55 +03:00
|
|
|
::
|
|
|
|
%wegh
|
|
|
|
%_ +>
|
|
|
|
moz
|
|
|
|
:_ moz
|
|
|
|
^- move
|
|
|
|
:^ hen %give %mass
|
|
|
|
^- mass
|
|
|
|
:+ %jael %|
|
|
|
|
:~ yen+&+yen
|
|
|
|
sub+&+sub
|
|
|
|
etn+&+etn
|
|
|
|
sap+&+sap
|
2019-01-30 03:38:27 +03:00
|
|
|
dot+&+lex
|
2019-01-30 01:41:55 +03:00
|
|
|
==
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: authenticated remote request
|
|
|
|
:: {$west p/ship q/path r/*}
|
|
|
|
::
|
|
|
|
$west
|
2018-12-13 01:02:37 +03:00
|
|
|
=* her p.tac
|
2019-01-15 01:04:13 +03:00
|
|
|
=/ mes (message r.tac)
|
2016-11-24 07:25:07 +03:00
|
|
|
?- -.mes
|
|
|
|
::
|
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-12-12 11:50:40 +03:00
|
|
|
$(tac [%vent ~])
|
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-12-13 01:02:37 +03:00
|
|
|
?. &(-.source.etn =(her 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-12-12 11:34:05 +03:00
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(~(hear-vent et hen our now sub.lex etn.lex sap.lex) p.mes)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2018-10-30 21:41:35 +03:00
|
|
|
::
|
|
|
|
:: rewind to snapshot
|
|
|
|
:: {$wind p/@ud}
|
|
|
|
::
|
|
|
|
%wind
|
2018-12-12 11:34:05 +03:00
|
|
|
(wind hen p.tac)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ take
|
|
|
|
|= [tea=wire hen=duct hin=sign]
|
|
|
|
^+ +>
|
|
|
|
?> ?=([@ *] tea)
|
|
|
|
=* wir t.tea
|
|
|
|
?- hin
|
|
|
|
[%a %woot *]
|
2018-11-07 09:40:07 +03:00
|
|
|
?~ q.hin +>.$
|
2018-05-29 00:04:33 +03:00
|
|
|
?~ u.q.hin ~&(%ares-fine +>.$)
|
|
|
|
~& [%woot-bad p.u.u.q.hin]
|
|
|
|
~_ q.u.u.q.hin
|
|
|
|
::TODO fail:et
|
|
|
|
+>.$
|
|
|
|
::
|
2019-02-16 02:44:00 +03:00
|
|
|
[%l %http-response *]
|
|
|
|
?. ?=(%finished -.client-response.hin)
|
|
|
|
+>.$
|
|
|
|
~! hin
|
2018-12-12 11:34:05 +03:00
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
%^ ~(finished et hen our now sub.lex etn.lex sap.lex) wir
|
2019-02-16 02:44:00 +03:00
|
|
|
response-header.client-response.hin
|
|
|
|
full-file.client-response.hin
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
[%b %wake ~]
|
2018-12-12 11:34:05 +03:00
|
|
|
%+ cute hen
|
2018-09-07 04:41:16 +03:00
|
|
|
:: XX cleanup
|
|
|
|
::
|
2018-10-12 19:48:52 +03:00
|
|
|
?. ?=([%init ~] wir)
|
2019-06-22 00:45:00 +03:00
|
|
|
abet:~(wake et hen our now sub.lex etn.lex sap.lex)
|
|
|
|
abet:(~(init et hen our now [sub etn sap]:lex) our (sein our))
|
2019-04-10 06:15:37 +03:00
|
|
|
::
|
|
|
|
[%b %wake ^]
|
|
|
|
:: TODO: handle behn error
|
|
|
|
::
|
|
|
|
~& %jael-wake-bad^u.error.hin
|
|
|
|
+>.$
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
[%j %vent *]
|
2018-12-12 11:34:05 +03:00
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(~(hear-vent et hen our now sub.lex etn.lex sap.lex) p.hin)
|
2018-05-29 00:04:33 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++curd:of
|
|
|
|
++ curd :: relative moves
|
2018-10-26 00:37:04 +03:00
|
|
|
|= $: moz/(list move)
|
|
|
|
sub/state-relative
|
|
|
|
etn/state-eth-node
|
|
|
|
sap/state-snapshots
|
|
|
|
==
|
|
|
|
+>(sub sub, etn etn, sap sap, moz (weld (flop moz) ^moz))
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++cure:of
|
|
|
|
++ cure :: absolute edits
|
2019-06-22 00:45:00 +03:00
|
|
|
|= [hen=duct hab=(list change)]
|
2016-11-24 07:25:07 +03:00
|
|
|
^+ +>
|
2019-06-22 00:45:00 +03:00
|
|
|
(curd abet:(~(apex su hen our sub etn sap) hab))
|
2018-05-29 00:04:33 +03:00
|
|
|
:: :: ++cute:of
|
|
|
|
++ cute :: ethereum changes
|
2018-10-10 04:24:25 +03:00
|
|
|
|= $: hen=duct
|
2018-05-29 00:04:33 +03:00
|
|
|
mos=(list move)
|
2018-05-29 21:20:25 +03:00
|
|
|
ven=chain
|
2018-10-26 00:37:04 +03:00
|
|
|
sub=state-relative
|
|
|
|
etn=state-eth-node
|
|
|
|
sap=state-snapshots
|
2018-05-29 00:04:33 +03:00
|
|
|
==
|
|
|
|
^+ +>
|
2019-06-22 00:45:00 +03:00
|
|
|
=: ^sub sub
|
2018-11-02 00:19:44 +03:00
|
|
|
^etn etn
|
|
|
|
^sap sap
|
|
|
|
==
|
|
|
|
%- cure(moz (weld (flop mos) moz))
|
2019-06-22 00:45:00 +03:00
|
|
|
[hen [%ethe ven]~]
|
2018-10-30 21:41:35 +03:00
|
|
|
:: :: ++wind:of
|
|
|
|
++ wind :: rewind to snap
|
2018-12-12 11:34:05 +03:00
|
|
|
|= [hen=duct block=@ud]
|
2018-10-30 21:41:35 +03:00
|
|
|
^+ +>
|
2018-12-12 11:34:05 +03:00
|
|
|
=. +>.$ (restore-block hen block)
|
2018-11-01 00:34:21 +03:00
|
|
|
%= +>.$
|
|
|
|
moz
|
2018-12-12 11:50:40 +03:00
|
|
|
=- [[hen %pass /wind/look %j %look -] moz]
|
2018-11-01 00:34:21 +03:00
|
|
|
?- -.source.etn
|
|
|
|
%& &+p.source.etn
|
|
|
|
%| |+node.p.source.etn
|
|
|
|
==
|
|
|
|
==
|
2018-11-03 01:31:31 +03:00
|
|
|
:: :: ++restore-block:of
|
|
|
|
++ restore-block :: rewind before block
|
2018-12-12 11:34:05 +03:00
|
|
|
|= [hen=duct block=@ud]
|
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
(~(restore-block et hen our now sub.lex etn.lex sap.lex) block)
|
2018-11-01 00:34:21 +03:00
|
|
|
:: :: ++restore-snap:of
|
|
|
|
++ restore-snap :: restore snapshot
|
2018-12-12 11:34:05 +03:00
|
|
|
|= [hen=duct snap=snapshot look=?]
|
|
|
|
%+ cute hen =< abet
|
2019-06-22 00:45:00 +03:00
|
|
|
%- ~(restore-snap et hen our now sub.lex etn.lex sap.lex)
|
2018-11-03 01:31:31 +03:00
|
|
|
[snap look]
|
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.
|
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
=| moz=(list move)
|
2018-06-01 18:30:14 +03:00
|
|
|
=| evs=logs
|
2018-10-10 04:24:25 +03:00
|
|
|
=| $: hen/duct
|
|
|
|
our/ship
|
2016-11-24 07:25:07 +03:00
|
|
|
state-relative
|
2018-05-29 00:04:33 +03:00
|
|
|
state-eth-node
|
2018-10-26 00:37:04 +03:00
|
|
|
state-snapshots
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
:: moz: moves in reverse order
|
|
|
|
:: sub: relative urbit state
|
|
|
|
::
|
2019-06-22 00:45:00 +03:00
|
|
|
=* sub ->+<
|
|
|
|
=* etn ->+>-
|
|
|
|
=* sap ->+>+
|
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 .
|
2018-11-02 00:19:44 +03:00
|
|
|
(vent-pass yen.eth chain+|+evs)
|
2018-10-26 00:37:04 +03:00
|
|
|
[(flop moz) sub etn sap]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: ++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)
|
2019-06-22 00:45:00 +03:00
|
|
|
%priv !! :: update private key
|
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
|
2018-11-02 00:19:44 +03:00
|
|
|
|= [yen=(set duct) res=vent-result]
|
2018-05-29 21:20:25 +03:00
|
|
|
=+ 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
|
2019-05-25 11:43:13 +03:00
|
|
|
^- note
|
2018-12-12 23:34:18 +03:00
|
|
|
[%a %want who /j/(scot %p our)/vent-result %vent-result res]
|
2018-11-03 03:05:41 +03:00
|
|
|
::
|
|
|
|
++ extract-snap :: extract rewind point
|
|
|
|
^- snapshot
|
2018-12-06 03:26:32 +03:00
|
|
|
:* kyz.puk.sub
|
2018-12-14 00:23:17 +03:00
|
|
|
[dns pos]:eth.sub
|
2018-12-06 03:26:32 +03:00
|
|
|
heard.etn
|
|
|
|
latest-block.etn
|
2018-11-03 03:05:41 +03:00
|
|
|
==
|
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-10-15 22:51:53 +03:00
|
|
|
?: fak.own.sub
|
2018-09-15 08:38:22 +03:00
|
|
|
(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)
|
|
|
|
==
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ vent
|
2018-11-03 03:05:41 +03:00
|
|
|
=/ last-snap extract-snap
|
2018-11-02 00:53:32 +03:00
|
|
|
%. [[hen ~ ~] snap+last-snap]
|
2018-05-29 21:20:25 +03:00
|
|
|
%_ vent-pass
|
|
|
|
:: %_ ..feed ::TODO see ++abet
|
2018-12-06 03:26:32 +03:00
|
|
|
:: moz [[hen %give %vent] 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
|
2018-10-15 22:51:53 +03:00
|
|
|
?> fak.own.sub
|
2018-09-15 08:38:22 +03:00
|
|
|
|%
|
|
|
|
++ pubs
|
|
|
|
|= who=ship
|
|
|
|
=/ cub (pit:nu:crub:crypto 512 who)
|
2018-12-06 03:26:32 +03:00
|
|
|
=/ pub [life=1 (my [1 pub:ex:cub] ~)]
|
2018-09-15 08:38:22 +03:00
|
|
|
=. 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
|
2018-09-15 03:29:23 +03:00
|
|
|
::
|
2018-08-30 03:02:17 +03:00
|
|
|
|= puz=(map ship public)
|
|
|
|
=/ pus ~(tap by puz)
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
:: process change for each ship separately
|
2018-09-15 03:29:23 +03:00
|
|
|
:: XX check for diffs before sending?
|
2018-06-01 01:31:45 +03:00
|
|
|
::
|
|
|
|
|- ^+ ..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-12-06 03:26:32 +03:00
|
|
|
:: ~& [%sending-pubs-about who life.pub]
|
2018-08-30 03:02:17 +03:00
|
|
|
%+ 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
|
2018-10-15 22:51:53 +03:00
|
|
|
?: &(=(lyf.own p.yam) =(jaw.own q.yam))
|
|
|
|
..feel
|
|
|
|
=. lyf.own p.yam
|
|
|
|
=. jaw.own q.yam
|
|
|
|
(exec yen.own [%give %vein lyf.own jaw.own])
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ vent
|
2018-11-02 00:19:44 +03:00
|
|
|
|= ver=vent-result
|
2018-05-29 21:20:25 +03:00
|
|
|
^+ ..feel
|
|
|
|
::TODO see ++abet
|
|
|
|
:: (exec yen.eth [%give %vent can])
|
2018-11-02 00:19:44 +03:00
|
|
|
(vent-pass yen.eth ver)
|
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))
|
2019-06-22 00:45:00 +03:00
|
|
|
!!
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
2018-08-30 03:05:34 +03:00
|
|
|
:: :: ++meet:su
|
|
|
|
++ meet :: seen after breach
|
2018-09-15 03:29:23 +03:00
|
|
|
|= [who=ship =life =pass]
|
2018-08-30 03:05:34 +03:00
|
|
|
^+ +>
|
2018-09-15 03:29:23 +03:00
|
|
|
=; new=public
|
|
|
|
(pubs:feel (my [who new] ~))
|
|
|
|
::
|
|
|
|
=/ old=(unit public)
|
|
|
|
(~(get by kyz.puk) who)
|
|
|
|
?: ?| ?=(?(%earl %pawn) (clan:title who))
|
2018-10-15 09:23:34 +03:00
|
|
|
:: XX save %dawn sponsor in .own.sub, check there
|
|
|
|
:: XX or move sein:of to sein:su?
|
2018-09-15 03:29:23 +03:00
|
|
|
:: XX full saxo chain?
|
|
|
|
::
|
2018-10-15 09:23:34 +03:00
|
|
|
=(who (^sein:title our))
|
2018-09-15 03:29:23 +03:00
|
|
|
==
|
|
|
|
?~ old
|
2018-12-06 03:26:32 +03:00
|
|
|
[life (my [life pass] ~)]
|
2018-09-15 03:29:23 +03:00
|
|
|
=/ fyl life.u.old
|
|
|
|
=/ sap (~(got by pubs.u.old) fyl)
|
|
|
|
~| [%met-mismatch who life=[old=fyl new=life] pass=[old=sap new=pass]]
|
|
|
|
?> ?: =(fyl life)
|
|
|
|
=(sap pass)
|
|
|
|
=(+(fyl) life)
|
2018-12-06 03:26:32 +03:00
|
|
|
[life (~(put by pubs.u.old) life pass)]
|
2018-09-15 03:29:23 +03:00
|
|
|
?. ?=(^ old)
|
|
|
|
~| [%met-unknown-ship who] !!
|
|
|
|
=/ fyl life.u.old
|
|
|
|
=/ sap (~(got by pubs.u.old) fyl)
|
|
|
|
~| [%met-mismatch who life=[old=fyl new=life] pass=[old=sap new=pass]]
|
|
|
|
?> &(=(fyl life) =(sap pass))
|
2018-12-06 03:26:32 +03:00
|
|
|
[life pubs.u.old]
|
2018-08-30 03:05:34 +03:00
|
|
|
:: :: ++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-12-14 00:23:17 +03:00
|
|
|
+>(dns.eth *dnses, pos.eth ~, kyz.puk ~)
|
2018-05-29 21:20:25 +03:00
|
|
|
=? +> |(new !=(0 ~(wyt by evs)))
|
|
|
|
%- vent:feel
|
2018-11-02 00:19:44 +03:00
|
|
|
:- %chain
|
2018-05-29 21:20:25 +03:00
|
|
|
?:(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)
|
2018-12-06 03:26:32 +03:00
|
|
|
*public
|
2018-08-30 03:02:17 +03:00
|
|
|
::
|
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
|
2018-10-30 21:41:35 +03:00
|
|
|
~| [%key-mismatch who life `@ux`u.puk `@ux`pass (get-public ~zod)]
|
2018-08-30 03:02:17 +03:00
|
|
|
?>(=(u.puk pass) kyz)
|
|
|
|
%+ ~(put by kyz) who
|
2018-12-06 03:26:32 +03:00
|
|
|
:- (max life life.pub)
|
2018-08-30 03:02:17 +03:00
|
|
|
(~(put by pubs.pub) life pass)
|
|
|
|
::
|
|
|
|
++ file-discontinuity
|
|
|
|
|= who=ship
|
2018-10-10 04:24:25 +03:00
|
|
|
^+ kyz
|
2018-08-30 03:02:17 +03:00
|
|
|
=+ (get-public who)
|
2018-12-06 03:26:32 +03:00
|
|
|
(~(put by kyz) who -)
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
|
|
|
++ file-event
|
2018-12-14 00:23:17 +03:00
|
|
|
|= [wer=event-id dif=diff-azimuth]
|
2018-06-01 18:14:35 +03:00
|
|
|
^+ [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
|
|
|
|
::
|
2018-11-01 20:27:17 +03:00
|
|
|
?> (gte block.wer latest-block)
|
2018-06-01 18:14:35 +03:00
|
|
|
=: evs (~(put by evs) wer dif)
|
|
|
|
heard (~(put in heard) wer)
|
|
|
|
latest-block (max latest-block block.wer)
|
|
|
|
==
|
2018-10-26 00:37:04 +03:00
|
|
|
=^ kyz ..file
|
|
|
|
?- -.dif
|
2018-12-14 00:23:17 +03:00
|
|
|
%point ~|(wer=wer (file-point +.dif))
|
2018-10-26 00:37:04 +03:00
|
|
|
%dns [kyz (file-dns +.dif)]
|
|
|
|
==
|
|
|
|
[kyz (file-snap wer)]
|
2018-05-29 00:04:33 +03:00
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
++ file-point
|
|
|
|
|= [who=ship dif=diff-point]
|
2018-06-01 18:14:35 +03:00
|
|
|
^+ [kyz ..file]
|
2018-05-29 00:04:33 +03:00
|
|
|
=- ::TODO =; with just the type
|
2018-12-14 00:23:17 +03:00
|
|
|
=. pos.eth (~(put by pos.eth) who pon)
|
2018-11-01 07:02:17 +03:00
|
|
|
:: new keys
|
|
|
|
::
|
2018-10-10 04:24:25 +03:00
|
|
|
?: ?=(%& -.new)
|
2018-11-01 07:02:17 +03:00
|
|
|
[(file-keys who p.new) ..file]
|
|
|
|
:: kept continuity (no-op)
|
|
|
|
::
|
2018-10-10 04:24:25 +03:00
|
|
|
?: p.new
|
2018-11-01 07:02:17 +03:00
|
|
|
[kyz ..file]
|
|
|
|
:: discontinuity
|
|
|
|
::
|
2018-10-10 04:24:25 +03:00
|
|
|
:- (file-discontinuity who)
|
|
|
|
%= ..file
|
2019-02-02 00:46:09 +03:00
|
|
|
moz =/ rit=rift
|
2018-10-26 00:41:05 +03:00
|
|
|
~| sunk-unknown+who
|
2019-02-02 00:46:09 +03:00
|
|
|
=< continuity-number
|
|
|
|
%+ fall
|
|
|
|
net:(fall (~(get by pos.eth) who) *point)
|
|
|
|
*[life pass continuity-number=@ud [? @p] (unit @p)]
|
|
|
|
%+ weld
|
2019-05-02 04:21:32 +03:00
|
|
|
:: %- flop
|
2019-02-02 00:46:09 +03:00
|
|
|
^- (list move)
|
|
|
|
:~ [hen %slip %a %sunk who rit]
|
|
|
|
[hen %slip %c %sunk who rit]
|
|
|
|
[hen %slip %d %sunk who rit]
|
|
|
|
[hen %slip %f %sunk who rit]
|
|
|
|
[hen %slip %g %sunk who rit]
|
|
|
|
==
|
|
|
|
moz
|
2018-10-10 04:24:25 +03:00
|
|
|
==
|
2018-12-14 00:23:17 +03:00
|
|
|
:: pon: updated point
|
2018-08-30 03:02:17 +03:00
|
|
|
:: new: new keypair or "kept continuity?" (yes is no-op)
|
2018-12-14 00:23:17 +03:00
|
|
|
^- [pon=point new=(each (pair life pass) ?)]
|
|
|
|
=+ pot=(fall (~(get by pos.eth) who) *point)
|
2018-06-01 18:14:35 +03:00
|
|
|
::
|
|
|
|
:: sanity checks, should never fail if we operate correctly
|
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
~| [%diff-order-insanity -.dif who (~(get by pos.eth) who)]
|
2018-06-01 18:14:35 +03:00
|
|
|
?> ?+ -.dif &
|
2018-12-14 00:23:17 +03:00
|
|
|
%spawned ?> ?=(^ kid.pot)
|
|
|
|
!(~(has in spawned.u.kid.pot) who.dif)
|
|
|
|
%keys ?> ?=(^ net.pot)
|
|
|
|
=(life.dif +(life.u.net.pot))
|
|
|
|
%continuity ?> ?=(^ net.pot)
|
|
|
|
=(new.dif +(continuity-number.u.net.pot))
|
2018-06-01 18:14:35 +03:00
|
|
|
==
|
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
:: apply point changes, catch continuity and key changes
|
2018-06-01 18:14:35 +03:00
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
:- (apply-point-diff pot 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-10-26 00:37:04 +03:00
|
|
|
::
|
|
|
|
++ file-snap :: save snapshot
|
|
|
|
|= wer=event-id
|
|
|
|
^+ ..file
|
|
|
|
=? sap
|
|
|
|
%+ lth 2
|
|
|
|
%+ sub.add
|
|
|
|
(div block.wer interval.sap)
|
|
|
|
(div last-block.sap interval.sap)
|
2019-01-15 01:29:04 +03:00
|
|
|
:: ~& :* %snap
|
|
|
|
:: count=count.sap
|
|
|
|
:: max-count=max-count.sap
|
|
|
|
:: last-block=last-block.sap
|
|
|
|
:: interval=interval.sap
|
|
|
|
:: lent=(lent ~(tap to snaps.sap))
|
|
|
|
:: ==
|
2018-10-26 00:37:04 +03:00
|
|
|
%= sap
|
|
|
|
snaps (~(put to snaps.sap) block.wer extract-snap)
|
|
|
|
count +(count.sap)
|
|
|
|
last-block block.wer
|
|
|
|
==
|
|
|
|
=? sap (gth count.sap max-count.sap)
|
2018-11-02 20:22:30 +03:00
|
|
|
~& :* %dump
|
|
|
|
count=count.sap
|
|
|
|
max-count=max-count.sap
|
2018-10-26 00:37:04 +03:00
|
|
|
lent=(lent ~(tap to snaps.sap))
|
|
|
|
==
|
|
|
|
%= sap
|
|
|
|
snaps +:~(get to snaps.sap)
|
|
|
|
count (dec count)
|
|
|
|
==
|
|
|
|
..file
|
2018-05-29 00:04:33 +03:00
|
|
|
--
|
2016-11-24 07:25:07 +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-11-03 01:31:31 +03:00
|
|
|
=| rewind-block=(unit @ud)
|
|
|
|
=| $: hen=duct
|
|
|
|
our=ship
|
2018-05-16 21:48:20 +03:00
|
|
|
now=@da
|
2018-10-26 00:37:04 +03:00
|
|
|
state-relative
|
2018-05-29 00:04:33 +03:00
|
|
|
state-eth-node
|
2018-10-26 00:37:04 +03:00
|
|
|
state-snapshots
|
2018-05-16 00:16:29 +03:00
|
|
|
==
|
2019-06-22 00:45:00 +03:00
|
|
|
=* sub ->+>-
|
|
|
|
=* etn ->+>+<
|
|
|
|
=* sap ->+>+>
|
2018-05-16 00:16:29 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| outward
|
2018-10-26 00:37:04 +03:00
|
|
|
|%
|
2018-05-30 01:40:00 +03:00
|
|
|
::
|
|
|
|
:: +abet: produce results
|
|
|
|
::
|
2018-05-16 00:16:29 +03:00
|
|
|
++ abet
|
2019-06-22 00:45:00 +03:00
|
|
|
^- $: (list move) chain state-relative
|
2018-10-26 00:37:04 +03:00
|
|
|
state-eth-node state-snapshots
|
|
|
|
==
|
2018-11-03 01:31:31 +03:00
|
|
|
=. .
|
|
|
|
?~ rewind-block
|
|
|
|
.
|
|
|
|
:: if we're rewinding to a block, then we throw away any moves
|
|
|
|
:: and changes we were going to make.
|
|
|
|
::
|
|
|
|
=: moves *(list move)
|
|
|
|
changes *logs
|
|
|
|
==
|
|
|
|
(restore-block u.rewind-block)
|
2019-06-22 00:45:00 +03:00
|
|
|
[(flop moves) ?:(reset &+changes |+changes) sub etn sap]
|
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-12-14 00:23:17 +03:00
|
|
|
|= [cause=event-id dif=diff-azimuth]
|
2018-10-26 02:15:42 +03:00
|
|
|
?: (~(has by changes) cause) :: one diff per event
|
|
|
|
~& [%duplicate-cause cause]
|
|
|
|
!!
|
2018-06-01 18:14:35 +03:00
|
|
|
+>(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
|
2019-05-25 11:43:13 +03:00
|
|
|
|= [wir=wire not=note]
|
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]
|
|
|
|
::
|
2019-02-15 01:25:33 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +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
|
2019-02-15 01:25:33 +03:00
|
|
|
:^ %l %request
|
|
|
|
?> ?=(%| -.source)
|
|
|
|
(light-json-request node.p.source jon)
|
|
|
|
*outbound-config:http-client
|
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-12-12 23:34:18 +03:00
|
|
|
[%a %want 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?
|
2018-12-12 23:34:18 +03:00
|
|
|
[%a %want p.source /j/(scot %p our)/vent `*`[%nuke ~]]
|
2018-05-16 21:48:20 +03:00
|
|
|
::
|
2018-10-26 00:37:04 +03:00
|
|
|
:: +listen-to-node: start syncing from a node
|
|
|
|
::
|
|
|
|
:: Get latest block from eth node and compare to our own latest block.
|
|
|
|
:: Get intervening blocks in chunks until we're caught up, then set
|
|
|
|
:: up a filter going forward.
|
|
|
|
::
|
2018-05-25 03:11:21 +03:00
|
|
|
++ listen-to-node
|
|
|
|
|= url=purl:eyre
|
2018-10-26 00:37:04 +03:00
|
|
|
get-latest-block(source |+%*(. *node-src node url))
|
|
|
|
::
|
|
|
|
:: +| catch-up-operations
|
|
|
|
::
|
|
|
|
:: +get-latest-block
|
|
|
|
::
|
|
|
|
:: Get latest known block number from eth node.
|
|
|
|
::
|
|
|
|
++ get-latest-block
|
|
|
|
(put-request /catch-up/block-number `'block number' %eth-block-number ~)
|
|
|
|
::
|
|
|
|
:: +catch-up: get next chunk
|
|
|
|
::
|
|
|
|
++ catch-up
|
2018-10-30 21:41:35 +03:00
|
|
|
|= from-block=@ud
|
|
|
|
?: (gte from-block foreign-block)
|
2018-10-26 00:37:04 +03:00
|
|
|
new-filter
|
2018-10-30 21:41:35 +03:00
|
|
|
=/ next-block (min foreign-block (add from-block 5.760)) :: ~d1
|
|
|
|
~& [%catching-up from=from-block to=foreign-block]
|
2018-10-26 00:37:04 +03:00
|
|
|
%- put-request
|
2018-10-30 21:41:35 +03:00
|
|
|
:+ /catch-up/step/(scot %ud from-block)/(scot %ud next-block)
|
|
|
|
`'catch up'
|
2018-10-26 00:37:04 +03:00
|
|
|
:* %eth-get-logs
|
2018-10-30 21:41:35 +03:00
|
|
|
`number+from-block
|
2018-10-26 00:37:04 +03:00
|
|
|
`number+next-block
|
2018-12-14 00:23:17 +03:00
|
|
|
~[azimuth:contracts]
|
2018-10-26 00:37:04 +03:00
|
|
|
~
|
|
|
|
==
|
2018-05-25 03:11:21 +03:00
|
|
|
::
|
2018-05-30 01:40:00 +03:00
|
|
|
:: +| filter-operations
|
|
|
|
::
|
|
|
|
:: +new-filter: request a new polling filter
|
|
|
|
::
|
2018-12-14 00:23:17 +03:00
|
|
|
:: Listens only to the Azimuth state contract, and only from
|
2018-05-30 01:40:00 +03:00
|
|
|
:: 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
|
2018-10-26 00:37:04 +03:00
|
|
|
`number+latest-block
|
|
|
|
:: XX We want to load from a snapshot at least 40 blocks behind, then
|
|
|
|
:: replay to the present
|
|
|
|
:: `[%number ?:((lte latest-block 40) 0 (sub.add latest-block 40))]
|
2018-12-14 00:23:17 +03:00
|
|
|
::TODO or Azimuth origin block when 0
|
2018-05-16 21:48:20 +03:00
|
|
|
~ ::TODO we should probably chunck these, maybe?
|
|
|
|
:: https://stackoverflow.com/q/49339489
|
2018-12-14 00:23:17 +03:00
|
|
|
~[azimuth:contracts]
|
2018-05-16 21:48:20 +03:00
|
|
|
~
|
|
|
|
==
|
|
|
|
::
|
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-10-31 02:18:54 +03:00
|
|
|
?: =(0 filter-id.p.source)
|
|
|
|
~& %no-filter-bad-poll
|
|
|
|
.
|
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-10-12 19:48:52 +03:00
|
|
|
|= [our=ship bos=ship]
|
2018-05-25 03:11:21 +03:00
|
|
|
^+ +>
|
2018-10-12 19:48:52 +03:00
|
|
|
:: TODO: ship or node as sample?
|
|
|
|
::
|
2018-11-01 00:34:21 +03:00
|
|
|
=. latest-block (max latest-block launch:contracts)
|
2018-10-29 22:38:14 +03:00
|
|
|
?: |(=(our bos) ?=(^ nod.own))
|
|
|
|
~| %jael-init-node
|
|
|
|
(listen-to-node (need nod.own))
|
|
|
|
(listen-to-ship our bos)
|
2018-05-25 03:11:21 +03:00
|
|
|
::
|
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-11-02 00:19:44 +03:00
|
|
|
|= =vent-result
|
2018-05-18 00:49:20 +03:00
|
|
|
^+ +>
|
2018-11-02 00:19:44 +03:00
|
|
|
?- -.vent-result
|
2018-11-03 01:31:31 +03:00
|
|
|
:: `look` can be | because we know we're listening to a ship
|
|
|
|
:: rather than a node, so the subscription was never broken
|
|
|
|
::
|
|
|
|
%snap (restore-snap snap.vent-result |)
|
2018-11-02 00:19:44 +03:00
|
|
|
%chain
|
|
|
|
?- -.can.vent-result
|
|
|
|
%& (assume p.can.vent-result)
|
|
|
|
::
|
|
|
|
%|
|
|
|
|
=+ evs=~(tap by p.can.vent-result)
|
|
|
|
|-
|
|
|
|
?~ 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-11-02 00:19:44 +03:00
|
|
|
%. chain+|+evs
|
2018-05-29 21:20:25 +03:00
|
|
|
%_ 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-12-14 00:23:17 +03:00
|
|
|
|= [cause=event-id dif=diff-azimuth]
|
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
|
|
|
|
~_ q.res
|
2018-10-30 21:41:35 +03:00
|
|
|
~& [%yikes cuz]
|
|
|
|
+>.$
|
2019-01-11 03:17:03 +03:00
|
|
|
?> ?=(%httr mar)
|
2019-05-09 22:46:19 +03:00
|
|
|
=+ raw-rep=~|(res ;;(httr:eyre q.res))
|
2019-01-11 03:17:03 +03:00
|
|
|
=+ rep=(httr-to-rpc-response raw-rep)
|
2019-02-15 01:25:33 +03:00
|
|
|
(complete-with-rpc-response cuz rep)
|
|
|
|
::
|
|
|
|
++ finished
|
|
|
|
|= [cuz=wire =response-header:http full-file=(unit mime-data:http-client)]
|
|
|
|
^+ +>
|
|
|
|
?: ?=(%& -.source) +>
|
|
|
|
::
|
|
|
|
=+ rep=(httr-to-rpc-response (to-httr:http-client response-header full-file))
|
|
|
|
(complete-with-rpc-response cuz rep)
|
|
|
|
::
|
|
|
|
++ complete-with-rpc-response
|
|
|
|
|= [cuz=wire rep=response:rpc:jstd]
|
|
|
|
^+ +>
|
|
|
|
::
|
2018-10-30 21:41:35 +03:00
|
|
|
?: ?=(%fail -.rep)
|
|
|
|
?: =(405 p.hit.rep)
|
|
|
|
~& 'HTTP 405 error (expected if using infura)'
|
|
|
|
+>.$
|
|
|
|
?. =(5 (div p.hit.rep 100))
|
|
|
|
~& [%http-error hit.rep]
|
|
|
|
+>.$
|
2018-10-26 02:15:42 +03:00
|
|
|
?+ cuz
|
2019-02-15 01:25:33 +03:00
|
|
|
:: ~& [%retrying-node ((soft tang) q.res)]
|
2018-10-26 02:15:42 +03:00
|
|
|
wait-poll
|
2018-10-30 21:41:35 +03:00
|
|
|
[%catch-up %step @ta @ta ~]
|
2018-10-26 02:15:42 +03:00
|
|
|
~& %retrying-catch-up
|
2018-10-30 21:41:35 +03:00
|
|
|
(catch-up (slav %ud `@ta`i.t.t.cuz))
|
2018-10-26 02:15:42 +03:00
|
|
|
==
|
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-10-26 00:37:04 +03:00
|
|
|
::
|
|
|
|
[%catch-up %block-number ~]
|
|
|
|
(take-block-number rep)
|
|
|
|
::
|
2018-10-30 21:41:35 +03:00
|
|
|
[%catch-up %step @ta @ta ~]
|
|
|
|
=/ from-block (slav %ud `@ta`i.t.t.cuz)
|
2018-10-31 02:18:54 +03:00
|
|
|
=/ next-block (slav %ud `@ta`i.t.t.t.cuz)
|
2018-10-30 21:41:35 +03:00
|
|
|
(take-catch-up-step rep from-block next-block)
|
2018-05-16 00:16:29 +03:00
|
|
|
==
|
|
|
|
::
|
2019-01-11 03:17:03 +03:00
|
|
|
:: httr-to-rpc-response
|
|
|
|
::
|
|
|
|
++ httr-to-rpc-response
|
|
|
|
|= hit/httr:eyre
|
|
|
|
^- response:rpc:jstd
|
|
|
|
~| hit
|
|
|
|
?. ?=($2 (div p.hit 100))
|
|
|
|
fail+hit
|
|
|
|
=/ a=json (need (de-json:html q:(need r.hit)))
|
|
|
|
=, dejs-soft:format
|
|
|
|
^- response:rpc:jstd
|
|
|
|
=; dere
|
|
|
|
=+ res=((ar dere) a)
|
|
|
|
?~ res (need (dere a))
|
|
|
|
[%batch u.res]
|
|
|
|
|= a=json
|
|
|
|
^- (unit response:rpc:jstd)
|
|
|
|
=/ res=(unit [@t json])
|
|
|
|
::TODO breaks when no id present
|
|
|
|
((ot id+so result+some ~) a)
|
|
|
|
?^ res `[%result u.res]
|
|
|
|
~| a
|
|
|
|
:+ ~ %error %- need
|
|
|
|
((ot id+so error+(ot code+no message+so ~) ~) a)
|
|
|
|
::
|
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)
|
2018-10-30 21:41:35 +03:00
|
|
|
?< ?=(%fail -.rep)
|
2018-05-16 21:48:20 +03:00
|
|
|
?: ?=(%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)
|
2018-10-30 21:41:35 +03:00
|
|
|
?< ?=(%fail -.rep)
|
2018-05-16 21:48:20 +03:00
|
|
|
?: ?=(%error -.rep)
|
2018-10-31 02:18:54 +03:00
|
|
|
?. ?| =('filter not found' message.rep) :: geth
|
|
|
|
=('Filter not found' message.rep) :: parity
|
|
|
|
==
|
|
|
|
~& [%unhandled-filter-error +.rep]
|
2018-05-16 21:48:20 +03:00
|
|
|
+>
|
2019-01-15 01:29:04 +03:00
|
|
|
::~& [%filter-timed-out--recreating block=latest-block +.rep]
|
2018-11-03 01:53:59 +03:00
|
|
|
:: arguably should rewind 40 blocks on the off chance the chain reorganized
|
|
|
|
:: when we blinked. this will also restart the filter.
|
|
|
|
::
|
|
|
|
:: (restore-block ?:((lth latest-block 40) 0 (sub.add latest-block 40)))
|
|
|
|
::
|
|
|
|
:: counter-argument: it's a royal pain to restore from a snapshot
|
|
|
|
:: every time you can't ping the node for 5 minutes. this is likely
|
|
|
|
:: to destabilize the network. better to manually restore if we
|
|
|
|
:: notice an anomaly.
|
|
|
|
::
|
|
|
|
:: third way: don't trust anything that doesn't have 40 confirmations
|
|
|
|
::
|
2018-05-16 21:48:20 +03:00
|
|
|
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-10-26 00:37:04 +03:00
|
|
|
(take-events rep)
|
|
|
|
::
|
|
|
|
:: +take-block-number: take block number and start catching up
|
|
|
|
::
|
|
|
|
++ take-block-number
|
|
|
|
|= rep=response:rpc:jstd
|
|
|
|
^+ +>
|
|
|
|
?< ?=(%batch -.rep)
|
2018-10-30 21:41:35 +03:00
|
|
|
?< ?=(%fail -.rep)
|
2018-10-26 00:37:04 +03:00
|
|
|
?: ?=(%error -.rep)
|
|
|
|
~& [%take-block-number-error--retrying message.rep]
|
|
|
|
get-latest-block
|
|
|
|
=. foreign-block (parse-eth-block-number res.rep)
|
|
|
|
~& [%setting-foreign-block foreign-block]
|
2018-10-30 21:41:35 +03:00
|
|
|
(catch-up latest-block)
|
2018-10-26 00:37:04 +03:00
|
|
|
::
|
|
|
|
:: +take-catch-up-step: process chunk
|
|
|
|
::
|
|
|
|
++ take-catch-up-step
|
2018-10-30 21:41:35 +03:00
|
|
|
|= [rep=response:rpc:jstd from-block=@ud next-block=@ud]
|
2018-10-26 00:37:04 +03:00
|
|
|
^+ +>
|
|
|
|
?< ?=(%batch -.rep)
|
2018-10-30 21:41:35 +03:00
|
|
|
?< ?=(%fail -.rep)
|
2018-10-26 00:37:04 +03:00
|
|
|
?: ?=(%error -.rep)
|
|
|
|
~& [%catch-up-step-error--retrying message.rep]
|
2018-10-30 21:41:35 +03:00
|
|
|
(catch-up from-block)
|
2018-10-26 00:37:04 +03:00
|
|
|
=. +>.$ (take-events rep)
|
2018-10-30 21:41:35 +03:00
|
|
|
(catch-up next-block)
|
2018-10-26 00:37:04 +03:00
|
|
|
::
|
|
|
|
:: +take-events: process events
|
|
|
|
::
|
|
|
|
++ take-events
|
|
|
|
|= rep=response:rpc:jstd
|
|
|
|
^+ +>
|
|
|
|
?< ?=(%batch -.rep)
|
2018-10-30 21:41:35 +03:00
|
|
|
?< ?=(%fail -.rep)
|
2018-10-26 00:37:04 +03:00
|
|
|
?< ?=(%error -.rep)
|
|
|
|
?. ?=(%a -.res.rep)
|
|
|
|
~& [%events-not-array rep]
|
|
|
|
!!
|
2018-05-16 21:48:20 +03:00
|
|
|
=* changes p.res.rep
|
2018-10-30 21:41:35 +03:00
|
|
|
~? (gth (lent changes) 0)
|
|
|
|
:* %processing-changes
|
|
|
|
changes=(lent changes)
|
|
|
|
block=latest-block
|
|
|
|
id=?.(?=(%| -.source) ~ `@ux`filter-id.p.source)
|
|
|
|
==
|
2018-05-16 21:48:20 +03:00
|
|
|
|- ^+ +>.^$
|
|
|
|
?~ 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
|
|
|
?: (~(has in heard) block-number.place log-index.place)
|
2018-10-24 23:20:49 +03:00
|
|
|
?. removed.u.mined.log
|
|
|
|
:: ~& [%ignoring-duplicate-event tx=transaction-hash.u.mined.log]
|
|
|
|
+>
|
2018-11-03 01:32:02 +03:00
|
|
|
:: block was reorganized away, so rewind to this block and
|
|
|
|
:: start syncing again.
|
|
|
|
::
|
2018-10-24 23:20:49 +03:00
|
|
|
~& :* 'removed event! Perhaps chain has reorganized?'
|
|
|
|
tx-hash=transaction-hash.u.mined.log
|
|
|
|
block-number=block-number.u.mined.log
|
|
|
|
block-hash=block-hash.u.mined.log
|
|
|
|
==
|
2018-11-03 01:32:02 +03:00
|
|
|
%= +>
|
|
|
|
rewind-block
|
|
|
|
:- ~
|
|
|
|
?~ rewind-block
|
|
|
|
block-number.place
|
|
|
|
(min block-number.place u.rewind-block)
|
|
|
|
==
|
2018-05-16 21:48:20 +03:00
|
|
|
=+ cuz=[block-number.place log-index.place]
|
|
|
|
::
|
2019-02-22 00:28:57 +03:00
|
|
|
?: =(i.topics.log changed-dns:azimuth-events)
|
2018-05-16 21:48:20 +03:00
|
|
|
=+ ^- [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-12-14 00:23:17 +03:00
|
|
|
=+ dif=(event-log-to-point-diff log)
|
2018-06-01 18:14:35 +03:00
|
|
|
?~ dif +>.$
|
2018-12-14 00:23:17 +03:00
|
|
|
(put-change cuz %point u.dif)
|
2018-11-03 01:31:31 +03:00
|
|
|
:: :: ++restore-block:et
|
|
|
|
++ restore-block :: rewind before block
|
|
|
|
|= block=@ud
|
|
|
|
^+ +>
|
|
|
|
=/ old-qeu snaps.sap
|
|
|
|
=: snaps.sap ~
|
|
|
|
count.sap 0
|
|
|
|
last-block.sap 0
|
|
|
|
==
|
|
|
|
=^ snap=snapshot +>.$
|
|
|
|
?: |(=(~ old-qeu) (lth block block-number:(need ~(top to old-qeu))))
|
2018-12-06 03:26:32 +03:00
|
|
|
[%*(. *snapshot latest-block launch:contracts) +>.$]
|
2018-11-03 01:31:31 +03:00
|
|
|
|- ^- [snapshot _+>.^$]
|
|
|
|
=^ snap=[block-number=@ud snap=snapshot] old-qeu
|
|
|
|
~(get to old-qeu)
|
|
|
|
=: count.sap +(count.sap)
|
|
|
|
last-block.sap block-number.snap
|
|
|
|
snaps.sap (~(put to snaps.sap) snap)
|
|
|
|
==
|
|
|
|
?: |(=(~ old-qeu) (lth block block-number:(need ~(top to old-qeu))))
|
|
|
|
[snap.snap +>.^$]
|
|
|
|
$
|
2018-12-14 00:23:17 +03:00
|
|
|
~& [%restoring-block block latest-block.snap ~(wyt by pos.eth.snap)]
|
2018-11-03 01:31:31 +03:00
|
|
|
(restore-snap snap &)
|
2018-11-02 00:19:44 +03:00
|
|
|
:: :: ++restore-snap:et
|
|
|
|
++ restore-snap :: restore snapshot
|
2018-11-03 01:31:31 +03:00
|
|
|
|= [snap=snapshot look=?]
|
|
|
|
^+ +>
|
2018-11-02 04:10:46 +03:00
|
|
|
:: update pub subscribers
|
|
|
|
::
|
|
|
|
=. +>.$
|
|
|
|
=/ subs=(list (pair ship (set duct)))
|
|
|
|
~(tap by yen.puk.sub)
|
|
|
|
|- ^+ +>.^$
|
|
|
|
?~ subs +>.^$
|
2018-12-06 03:26:32 +03:00
|
|
|
=/ pub (fall (~(get by kyz.snap) p.i.subs) *public)
|
2018-11-02 04:10:46 +03:00
|
|
|
=. +>.^$ (exec q.i.subs [%give %pubs pub])
|
|
|
|
$(subs t.subs)
|
|
|
|
:: update vent subscribers
|
|
|
|
::
|
|
|
|
=. +>.$ (vent-pass yen.eth snap+snap)
|
2018-11-02 00:19:44 +03:00
|
|
|
:: keep the following in sync with ++extract-snap:file:su
|
2018-11-02 04:10:46 +03:00
|
|
|
::
|
2018-11-03 01:31:31 +03:00
|
|
|
%= +>.$
|
2018-12-06 03:26:32 +03:00
|
|
|
heard.etn heard.snap
|
|
|
|
latest-block.etn latest-block.snap
|
|
|
|
kyz.puk.sub kyz.snap
|
|
|
|
dns.eth.sub dns.eth.snap
|
2018-12-14 00:23:17 +03:00
|
|
|
pos.eth.sub pos.eth.snap
|
2018-12-06 03:26:32 +03:00
|
|
|
sap sap(last-block 0)
|
2018-11-03 01:31:31 +03:00
|
|
|
moves
|
|
|
|
?. look moves
|
2018-12-12 11:50:40 +03:00
|
|
|
=- [[hen %pass /wind/look %j %look -] moves]
|
2018-11-03 01:31:31 +03:00
|
|
|
?- -.source.etn
|
|
|
|
%& &+p.source.etn
|
|
|
|
%| |+node.p.source.etn
|
|
|
|
==
|
2018-11-02 00:19:44 +03:00
|
|
|
==
|
2018-11-02 04:10:46 +03:00
|
|
|
:: :: ++exec:et
|
|
|
|
++ exec :: mass gift
|
|
|
|
|= {yen/(set duct) cad/card}
|
|
|
|
=/ noy ~(tap in yen)
|
|
|
|
|- ^+ ..exec
|
|
|
|
?~ noy ..exec
|
|
|
|
$(noy t.noy, moves [[i.noy cad] moves])
|
|
|
|
:: :: ++vent-pass:et
|
|
|
|
++ vent-pass :: "give" vent
|
|
|
|
|= [yen=(set duct) res=vent-result]
|
|
|
|
=+ 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
|
2019-05-25 11:43:13 +03:00
|
|
|
^- note
|
2018-12-12 23:34:18 +03:00
|
|
|
[%a %want who /j/(scot %p our)/vent-result %vent-result res]
|
2018-11-02 04:10:46 +03:00
|
|
|
:: :: ++feed:su
|
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
|
|
|
|= $: ::
|
2018-12-06 00:41:21 +03:00
|
|
|
:: our: identity
|
2016-11-24 07:25:07 +03:00
|
|
|
:: now: current time
|
|
|
|
:: eny: unique entropy
|
|
|
|
:: ski: namespace resolver
|
|
|
|
::
|
2018-12-06 00:41:21 +03:00
|
|
|
our=ship
|
|
|
|
now=@da
|
|
|
|
eny=@uvJ
|
|
|
|
ski=sley
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-04-11 04:49:20 +03:00
|
|
|
^?
|
2016-11-24 07:25:07 +03:00
|
|
|
|%
|
|
|
|
:: :: ++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
|
|
|
==
|
2018-12-01 22:31:54 +03:00
|
|
|
^- [(list move) _..^$]
|
2018-12-12 11:34:05 +03:00
|
|
|
=/ =task:able
|
|
|
|
?. ?=($soft -.q.hic)
|
|
|
|
q.hic
|
2019-01-15 01:04:13 +03:00
|
|
|
(task:able p.q.hic)
|
2018-12-12 11:34:05 +03:00
|
|
|
=^ did lex
|
|
|
|
abet:(~(call of [our now eny] lex) hen task)
|
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))
|
2018-11-01 06:46:55 +03:00
|
|
|
:: XX review for security, stability, cases other than now
|
2018-10-12 19:48:52 +03:00
|
|
|
::
|
2016-12-13 22:02:38 +03:00
|
|
|
?. =(lot [%$ %da now]) ~
|
2018-10-12 19:48:52 +03:00
|
|
|
?. =(%$ ren) [~ ~]
|
|
|
|
?+ syd
|
|
|
|
~
|
2018-11-01 06:46:55 +03:00
|
|
|
::
|
|
|
|
%code
|
|
|
|
?. ?=([@ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2018-11-01 06:46:55 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
=/ sec (~(got by jaw.own.sub.lex) lyf.own.sub.lex)
|
|
|
|
=/ cub (nol:nu:crub:crypto sec)
|
|
|
|
:: XX use pac:ex:cub?
|
|
|
|
::
|
|
|
|
``[%noun !>((end 6 1 (shaf %pass (shax sec:ex:cub))))]
|
2018-10-12 19:48:52 +03:00
|
|
|
::
|
|
|
|
%life
|
|
|
|
?. ?=([@ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2018-10-12 19:48:52 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
:: fake ships always have life=1
|
|
|
|
::
|
|
|
|
?: fak.own.sub.lex
|
|
|
|
``[%atom !>(1)]
|
|
|
|
?: =(u.who p.why)
|
|
|
|
``[%atom !>(lyf.own.sub.lex)]
|
|
|
|
=/ pub (~(get by kyz.puk.sub.lex) u.who)
|
|
|
|
?~ pub ~
|
|
|
|
``[%atom !>(life.u.pub)]
|
2019-02-02 00:46:09 +03:00
|
|
|
::
|
|
|
|
%rift
|
|
|
|
?. ?=([@ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2019-02-02 00:46:09 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
:: fake ships always have rift=1
|
|
|
|
::
|
|
|
|
?: fak.own.sub.lex
|
|
|
|
``[%atom !>(1)]
|
|
|
|
=/ pos (~(get by pos.eth.sub.lex) u.who)
|
|
|
|
?~ pos ~
|
|
|
|
?~ net.u.pos ~
|
|
|
|
``[%atom !>(continuity-number.u.net.u.pos)]
|
2018-10-16 02:55:13 +03:00
|
|
|
::
|
|
|
|
%deed
|
|
|
|
?. ?=([@ @ ~] tyl) [~ ~]
|
2018-12-12 11:34:05 +03:00
|
|
|
?. &(?=(%& -.why) =(p.why our))
|
2018-10-16 02:55:13 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
=/ lyf (slaw %ud i.t.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
?~ lyf [~ ~]
|
2018-10-18 01:56:41 +03:00
|
|
|
=/ rac (clan:title u.who)
|
|
|
|
::
|
|
|
|
?: ?=(%pawn rac)
|
|
|
|
?. =(u.who p.why)
|
|
|
|
[~ ~]
|
|
|
|
?. =(1 u.lyf)
|
|
|
|
[~ ~]
|
|
|
|
=/ sec (~(got by jaw.own.sub.lex) u.lyf)
|
|
|
|
=/ cub (nol:nu:crub:crypto sec)
|
|
|
|
=/ sig (sign:as:cub (shaf %self (sham [u.who 1 pub:ex:cub])))
|
|
|
|
:^ ~ ~ %noun
|
|
|
|
!> ^- deed:ames
|
|
|
|
[1 pub:ex:cub `sig]
|
|
|
|
::
|
|
|
|
?: ?=(%earl rac)
|
2018-10-16 02:55:13 +03:00
|
|
|
?. =(u.who p.why)
|
|
|
|
[~ ~]
|
|
|
|
?: (gth u.lyf lyf.own.sub.lex)
|
|
|
|
~
|
|
|
|
?: (lth u.lyf lyf.own.sub.lex)
|
|
|
|
[~ ~]
|
|
|
|
=/ sec (~(got by jaw.own.sub.lex) u.lyf)
|
|
|
|
=/ cub (nol:nu:crub:crypto sec)
|
|
|
|
:^ ~ ~ %noun
|
|
|
|
!> ^- deed:ames
|
|
|
|
[u.lyf pub:ex:cub sig.own.sub.lex]
|
2018-10-18 01:56:41 +03:00
|
|
|
::
|
2018-10-16 02:55:13 +03:00
|
|
|
=/ pub (~(get by kyz.puk.sub.lex) u.who)
|
2018-12-19 22:36:05 +03:00
|
|
|
?~ pub
|
|
|
|
~
|
|
|
|
?: (gth u.lyf life.u.pub)
|
|
|
|
~
|
|
|
|
=/ pas (~(get by pubs.u.pub) u.lyf)
|
|
|
|
?~ pas
|
|
|
|
~
|
2018-10-16 02:55:13 +03:00
|
|
|
:^ ~ ~ %noun
|
2018-12-19 22:36:05 +03:00
|
|
|
!> `deed:ames`[u.lyf u.pas ~]
|
2018-10-12 19:48:52 +03:00
|
|
|
::
|
|
|
|
%earl
|
|
|
|
?. ?=([@ @ @ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2018-10-12 19:48:52 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
=/ lyf (slaw %ud i.t.tyl)
|
|
|
|
=/ pub (slaw %ux i.t.t.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
?~ lyf [~ ~]
|
|
|
|
?~ pub [~ ~]
|
|
|
|
?: (gth u.lyf lyf.own.sub.lex)
|
|
|
|
~
|
|
|
|
?: (lth u.lyf lyf.own.sub.lex)
|
|
|
|
[~ ~]
|
|
|
|
:: XX check that who/lyf hasn't been booted
|
|
|
|
::
|
|
|
|
=/ sec (~(got by jaw.own.sub.lex) u.lyf)
|
|
|
|
=/ cub (nol:nu:crub:crypto sec)
|
|
|
|
=/ sig (sign:as:cub (shaf %earl (sham u.who u.lyf u.pub)))
|
|
|
|
``[%atom !>(sig)]
|
|
|
|
::
|
|
|
|
%sein
|
|
|
|
?. ?=([@ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2018-10-12 19:48:52 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
:^ ~ ~ %atom
|
|
|
|
!> ^- ship
|
2018-12-12 11:34:05 +03:00
|
|
|
(~(sein of [our now eny] lex) u.who)
|
2018-10-12 19:48:52 +03:00
|
|
|
::
|
|
|
|
%saxo
|
|
|
|
?. ?=([@ ~] tyl) [~ ~]
|
2019-06-22 00:45:00 +03:00
|
|
|
?. =([%& our] why)
|
2018-10-12 19:48:52 +03:00
|
|
|
[~ ~]
|
|
|
|
=/ who (slaw %p i.tyl)
|
|
|
|
?~ who [~ ~]
|
|
|
|
:^ ~ ~ %noun
|
|
|
|
!> ^- (list ship)
|
2018-12-12 11:34:05 +03:00
|
|
|
(~(saxo of [our now eny] lex) u.who)
|
2019-01-16 02:50:51 +03:00
|
|
|
::
|
|
|
|
%eth-status
|
|
|
|
?. ?=(~ tyl) [~ ~]
|
|
|
|
:^ ~ ~ %noun !>
|
|
|
|
^- [latest-block=@ud source=(each ship node-src)]
|
|
|
|
[latest-block.etn.lex source.etn.lex]
|
2018-10-30 21:41:35 +03:00
|
|
|
::
|
|
|
|
%snap
|
|
|
|
?. ?=(~ tyl) [~ ~]
|
|
|
|
?: =(~ snaps.sap.lex)
|
|
|
|
`~
|
|
|
|
:^ ~ ~ %noun !>
|
2018-11-01 00:34:21 +03:00
|
|
|
|- ^- snapshot
|
|
|
|
=^ snap=[@ud snap=snapshot] snaps.sap.lex
|
|
|
|
~(get to snaps.sap.lex)
|
|
|
|
?: =(~ snaps.sap.lex)
|
|
|
|
snap.snap
|
|
|
|
$
|
2019-03-28 21:51:48 +03:00
|
|
|
::
|
|
|
|
%turf
|
|
|
|
?. ?=(~ tyl) [~ ~]
|
|
|
|
[~ ~ %noun !>(tuf.own.sub.lex)]
|
2018-10-12 19:48:52 +03:00
|
|
|
==
|
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
|
|
|
==
|
2018-12-01 22:31:54 +03:00
|
|
|
^- [(list move) _..^$]
|
2018-12-12 11:34:05 +03:00
|
|
|
=^ did lex abet:(~(take of [our now eny] lex) tea hen q.hin)
|
2018-05-29 00:04:33 +03:00
|
|
|
[did ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|