Merge pull request #6551 from urbit/next/kelvin/412

zuse: kelvin 412
This commit is contained in:
Pyry Kovanen 2023-08-29 13:11:24 +03:00 committed by GitHub
commit e21f346ca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 4163 additions and 4107 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c0fb3cb223a884bb10dc2877c2dcbc597d7ba54392c8cdc73ac152626888cc9
size 6379473
oid sha256:feaae0eece54db3e92122263706c283674af581d14ffde8a29fb24e1873a35b1
size 6453015

View File

@ -615,7 +615,7 @@
::
?: fake.ae ~
=+ [%raw-poke %noun %refresh-rate ~s30]
[/g/aqua/reduce-refresh-rate %deal [. .]:who.ae %azimuth -]~
[/g/aqua/reduce-refresh-rate %deal [. . /]:who.ae %azimuth -]~
==
==
=. this

View File

@ -45,7 +45,6 @@
|= [=mark =vase]
^- (quip card _this)
|^
?> (team:title our.bowl src.bowl)
?+ mark (on-poke:def mark vase)
%handle-http-request
=+ !<([id=@ta req=inbound-request:eyre] vase)
@ -53,6 +52,7 @@
(handle-http-request id req)
::
%azimuth-action
?> (team:title our.bowl src.bowl)
=+ !<([%disconnect bind=binding:eyre] vase)
~& >>> "disconnecting at {<bind>}"
:_ this

View File

@ -361,16 +361,58 @@
::
[%eyre %authentication ~]
%- some
:- %a
%+ turn
%+ sort ~(tap by sessions:auth-state:v-eyre)
|= [[@uv a=session:eyre] [@uv b=session:eyre]]
(gth expiry-time.a expiry-time.b)
|= [cookie=@uv session:eyre]
=/ auth auth-state:v-eyre
%- pairs
:~ 'cookie'^s+(end [3 4] (rsh [3 2] (scot %x (shax cookie))))
'expiry'^(time expiry-time)
'channels'^(numb ~(wyt in channels))
:~ :- 'sessions'
:- %a
%+ turn
%+ sort ~(tap by sessions.auth)
|= [[@uv a=session:eyre] [@uv b=session:eyre]]
(gth expiry-time.a expiry-time.b)
|= [cookie=@uv session:eyre]
%- pairs
:~ 'cookie'^s+(scot %uv cookie)
'identity'^(render-identity:v-eyre identity)
'expiry'^(time expiry-time)
'channels'^(numb ~(wyt in channels))
==
::
:- 'visitors'
:- %a
%+ turn
%+ sort ~(tap by visitors.auth)
|= [[@uv a=visitor:eyre] [@uv b=visitor:eyre]]
?@ +.a &
?@ +.b |
(aor (scot %p ship.a) (scot %p ship.b))
|= [nonce=@uv v=visitor:eyre]
%- pairs
:+ 'nonce'^s+(scot %uv nonce)
'duct'^?~(duct.v ~ a+(turn u.duct.v path))
?@ +.v ['sesh' s+(scot %uv sesh.v)]~
:~ 'pend'^b+?=(^ pend.v)
'ship'^(ship ship.v)
'last'^s+last.v
'toke'^?~(toke.v ~ s+(scot %uv u.toke.v))
==
::
:- 'visiting'
:- %a
%- zing
%+ turn
%+ sort ~(tap by visiting.auth)
|= [[a=@p *] [b=@p *]]
(aor (scot %p a) (scot %p b))
|= [who=@p q=(qeu @uv) m=(map @uv portkey)]
%+ turn ~(tap by m)
|= [nonce=@uv p=portkey]
%- pairs
:+ 'who'^(ship who)
'nonce'^s+(scot %uv nonce)
?@ p ['made' (time made.p)]~
:~ ['pend' b+?=(^ pend.p)]
['toke' ?~(toke.p ~ s+(scot %uv u.toke.p))]
==
==
::
:: /eyre/channels.json
@ -383,6 +425,7 @@
|= [key=@t channel:eyre]
%- pairs
:~ 'session'^s+key
'identity'^(render-identity:v-eyre identity)
'connected'^b+!-.state
'expiry'^?-(-.state %& (time date.p.state), %| ~)
'next-id'^(numb next-id)
@ -992,6 +1035,16 @@
++ channel-state
(scry ^channel-state %e %channel-state ~)
::
++ render-identity
|= =identity
^- json
%- ship:enjs:format
?- -.identity
%ours our.bowl
%fake who.identity
%real who.identity
==
::
++ render-action
|= =action
^- json

File diff suppressed because one or more lines are too long

View File

@ -1,618 +0,0 @@
:: gaze: azimuth statistics
::
:: general flow:
:: - receive events
:: - process events whose timestamp is known
:: - request timestamps for unknown block numbers (if not already running)
:: - receive timestamps, process events
::
/- eth-watcher
/+ *ethereum, *azimuth, default-agent, verb
::
=> |%
+$ state-0
$: %0
:: qued: event logs waiting on block timestamp, oldest first
:: time: timstamps of block numbers
:: seen: events sorted by timestamp, newest first
:: days: stats by day, newest first
::
running=(unit @ta)
qued=loglist
time=(map @ud @da)
seen=(list [wen=@da wat=event])
days=(list [day=@da sat=stats])
==
::
+$ loglist loglist:eth-watcher
+$ event
$% [%azimuth who=ship dif=diff-point]
[%invite by=ship of=ship gift=ship to=address]
==
::
+$ stats
$: spawned=(list @p)
activated=(list @p)
transfer-p=(list @p)
transferred=(list @p)
configured=(list @p)
breached=(list @p)
request=(list @p)
sponsor=(list @p)
management-p=(list @p)
voting-p=(list @p)
spawn-p=(list @p)
invites-senders=(list @p)
==
::
+$ card card:agent:gall
::
++ node-url 'http://eth-mainnet.urbit.org:8545'
++ refresh-rate ~h1
++ timeout-time ~h2
--
::
=| state-0
=* state -
::
%+ verb |
^- agent:gall
=<
|_ =bowl:gall
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
bec byk.bowl(r da+now.bowl)
::
++ on-init
^- (quip card _this)
[setup-cards:do this]
::
++ on-save !>(state)
++ on-load
|= old=vase
^- (quip card _this)
[~ this(state !<(state-0 old))]
::
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?> ?=(%noun mark)
=/ =noun !<(noun vase)
|- ^- [cards=(list card) =_this]
?+ noun ~|([dap.bowl %unknown-poke noun] !!)
%reconnect
:_ this
:~ leave-eth-watcher:do
watch-eth-watcher:do
==
::
%reload
:- cards:$(noun %reconnect)
this(qued ~, seen ~, days ~)
::
%rewatch
:_ this:$(noun %reset)
:~ leave-eth-watcher:do
clear-eth-watcher:do
setup-eth-watcher:do
await-eth-watcher:do
==
::
%export
[export:do this]
::
%debug
~& latest=(turn (scag 5 seen) head)
~& oldest=(turn (slag (sub (max 5 (lent seen)) 5) seen) head)
~& :- 'order is'
=- ?:(sane 'sane' 'insane')
%+ roll seen
|= [[this=@da *] last=@da sane=?]
:- this
?: =(*@da last) &
(lte this last)
~& time=~(wyt by time)
~& qued=(lent qued)
~& days=(lent days)
[~ this]
==
::
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?+ -.sign (on-agent:def wire sign)
%kick
?. =(/watcher wire) [~ this]
[[watch-eth-watcher:do]~ this]
::
%fact
?+ wire (on-agent:def wire sign)
[%watcher ~]
?. ?=(%eth-watcher-diff p.cage.sign)
(on-agent:def wire sign)
=^ cards state
%- handle-eth-watcher-diff:do
!<(diff:eth-watcher q.cage.sign)
[cards this]
::
[%timestamps @ ~]
?+ p.cage.sign (on-agent:def wire sign)
%thread-fail
=+ !<([=term =tang] q.cage.sign)
=/ =tank leaf+"{(trip dap.bowl)} thread failed; will retry"
%- (slog tank leaf+<term> tang)
=^ cards state
request-timestamps:do
[cards this]
::
%thread-done
=^ cards state
%- save-timestamps:do
!<((list [@ud @da]) q.cage.sign)
[cards this]
==
==
==
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?+ +<.sign-arvo ~|([dap.bowl %strange-arvo-sign +<.sign-arvo] !!)
%wake
?: =(/export wire)
[[wait-export:do export:do] this]
?: =(/watch wire)
[[watch-eth-watcher:do]~ this]
~& [dap.bowl %strange-wake wire]
[~ this]
==
::
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-fail on-fail:def
--
::
|_ =bowl:gall
++ bec byk.bowl(r da+now.bowl)
++ setup-cards
^- (list card)
:~ wait-export
setup-eth-watcher
:: we punt on subscribing to the eth-watcher for a little while.
:: this way we get a %history diff containing all past events,
:: instead of so many individual %log diffs that we bail meme.
:: (to repro, replace this with `watch-eth-watcher`)
::
await-eth-watcher
==
::
++ wait
|= [=wire =@dr]
^- card
[%pass wire %arvo %b %wait (add now.bowl dr)]
::
++ wait-export (wait /export refresh-rate)
::
++ to-eth-watcher
|= [=wire =task:agent:gall]
^- card
[%pass wire %agent [our.bowl %eth-watcher] task]
::
++ setup-eth-watcher
%+ to-eth-watcher /setup
:+ %poke %eth-watcher-poke
!> ^- poke:eth-watcher
:+ %watch /[dap.bowl]
:* node-url
|
refresh-rate
timeout-time
public:mainnet-contracts
~
~[azimuth delegated-sending]:mainnet-contracts
~
~
==
::
:: see also comment in +setup-cards
++ await-eth-watcher (wait /watch ~m30)
::
++ watch-eth-watcher
%+ to-eth-watcher /watcher
[%watch /logs/[dap.bowl]]
::
++ leave-eth-watcher
%+ to-eth-watcher /watcher
[%leave ~]
::
++ clear-eth-watcher
%+ to-eth-watcher /clear
:+ %poke %eth-watcher-poke
!> ^- poke:eth-watcher
[%clear /logs/[dap.bowl]]
::
++ poke-spider
|= [=wire =cage]
^- card
[%pass wire %agent [our.bowl %spider] %poke cage]
::
++ watch-spider
|= [=wire =sub=path]
^- card
[%pass wire %agent [our.bowl %spider] %watch sub-path]
::
:: +handle-eth-watcher-diff: process new logs, clear state on rollback
::
:: processes logs for which we know the timestamp
:: adds timestamp-less logs to queue
::
++ handle-eth-watcher-diff
|= =diff:eth-watcher
^- (quip card _state)
=^ logs state
^- [loglist _state]
?- -.diff
%history ~& [%got-history (lent loglist.diff)]
[loglist.diff state(qued ~, seen ~)]
%logs ~& %got-log
[loglist.diff state]
%disavow ~& %disavow-unimplemented
[~ state]
==
%- process-logs
%+ skip logs
|= =event-log:rpc
%- is-lockup-block
block-number:(need mined.event-log)
::
:: +is-lockup-block: whether the block contains lockup/ignorable transactions
::
:: this is the stupid dumb equivalent to actually identifying lockup
:: transactions procedurally, which is still in git history, but didn't
:: work quite right for unidentified reasons
::
++ is-lockup-block
|= num=@ud
^- ?
%+ roll
^- (list [@ud @ud])
:~ [7.050.978 7.051.038]
==
|= [[start=@ud end=@ud] in=_|]
?: in &
&((gte num start) (lte num end))
::
:: +request-timestamps: request block timestamps for the logs as necessary
::
:: will come back as a thread result
::
++ request-timestamps
^- (quip card _state)
?~ qued [~ state]
?^ running [~ state]
=/ tid=@ta
%+ scot %ta
:((cury cat 3) dap.bowl '_' (scot %uv eny.bowl))
:_ state(running `tid)
:~ (watch-spider /timestamps/[tid] /thread-result/[tid])
::
%+ poke-spider /timestamps/[tid]
:- %spider-start
=- !>([~ `tid bec %eth-get-timestamps -])
!> ^- [@t (list @ud)]
:- node-url
=- ~(tap in -)
%- ~(gas in *(set @ud))
^- (list @ud)
%+ turn qued
|= log=event-log:rpc
block-number:(need mined.log)
==
::
:: +save-timestamps: store timestamps into state
::
++ save-timestamps
|= timestamps=(list [@ud @da])
^- (quip card _state)
=. time (~(gas by time) timestamps)
=. running ~
(process-logs ~)
::
:: +process-logs: handle new incoming logs
::
++ process-logs
|= new=loglist :: oldest first
^- (quip card _state)
=. qued (weld qued new)
?~ qued [~ state]
=- %_ request-timestamps
qued (flop rest) :: oldest first
seen (weld logs seen) :: newest first
days (count-events (flop logs)) :: oldest first
==
%+ roll `loglist`qued
|= [log=event-log:rpc [rest=loglist logs=(list [wen=@da wat=event])]]
:: to ensure logs are processed in sane order,
:: stop processing as soon as we skipped one
::
?^ rest [[log rest] logs]
=/ tim=(unit @da)
%- ~(get by time)
block-number:(need mined.log)
?~ tim [[log rest] logs]
:- rest
=+ ven=(event-log-to-event log)
?~ ven logs
[[u.tim u.ven] logs]
::
:: +event-log-to-event: turn raw log into gaze noun
::
++ event-log-to-event
|= log=event-log:rpc
^- (unit event)
?: =(azimuth:mainnet-contracts address.log)
=+ (event-log-to-point-diff log)
?~ - ~
`azimuth+u
?: =(delegated-sending:mainnet-contracts address.log)
?. .= i.topics.log
0x4763.8e3c.ddee.2204.81e4.c3f9.183d.639c.
0efe.a7f0.5fcd.2df4.1888.5572.9f71.5419
~
=/ [of=@ pool=@]
~| t.topics.log
%+ decode-topics:abi:ethereum t.topics.log
~[%uint %uint]
=/ [by=@ gift=@ to=@]
~| data.log
%+ decode-topics:abi:ethereum
%+ rash data.log
=- ;~(pfix (jest '0x') -)
%+ stun [3 3]
(bass 16 (stun [64 64] hit))
~[%uint %uint %address]
`invite+[by of gift to]
~
::
:: +count-events: add events to the daily stats
::
++ count-events
|= logs=_seen :: oldest first
^+ days
=/ head=[day=@da sat=stats]
?^ days i.days
*[@da stats]
=+ tail=?~(days ~ t.days)
|-
:: when done, store updated head, but only if it's set
::
?~ logs
?: =(*[@da stats] head) tail
[head tail]
=* log i.logs
:: calculate day for current event, set head if unset
::
=/ day=@da
(sub wen.log (mod wen.log ~d1))
=? day.head =(*@da day.head) day
:: same day as head, so add to it
::
?: =(day day.head)
%_ $
sat.head (count-event wat.log sat.head)
logs t.logs
==
~| [%weird-new-day old=day.head new=day]
?> (gth day day.head)
:: newer day than head of days, so start new head
::
%_ $
tail [head tail]
head [day *stats]
==
::
:: +count-event: add event to the stats, if it's relevant
::
++ count-event
|= [eve=event sat=stats]
^- stats
?- -.eve
%invite sat(invites-senders [by.eve invites-senders.sat])
::
%azimuth
?+ -.dif.eve sat
%spawned sat(spawned [who.dif.eve spawned.sat])
%activated sat(activated [who.eve activated.sat])
%transfer-proxy ?: =(0x0 new.dif.eve) sat
sat(transfer-p [who.eve transfer-p.sat])
%owner sat(transferred [who.eve transferred.sat])
%keys sat(configured [who.eve configured.sat])
%continuity sat(breached [who.eve breached.sat])
%escape ?~ new.dif.eve sat
sat(request [who.eve request.sat])
%sponsor ?. has.new.dif.eve sat
sat(sponsor [who.eve sponsor.sat])
%management-proxy sat(management-p [who.eve management-p.sat])
%voting-proxy sat(voting-p [who.eve voting-p.sat])
%spawn-proxy sat(spawn-p [who.eve spawn-p.sat])
==
==
::
::
:: +export: periodically export data
::
++ export
^- (list card)
:~ (export-move %days (export-days days))
(export-move %months (export-months days))
(export-move %events export-raw)
==
::
:: +export-move: %info move to write exported .txt
::
++ export-move
|= [nom=@t dat=(list @t)]
^- card
=- [%pass /export/[nom] %arvo %c %info -]
%+ foal:space:userlib
/(scot %p our.bowl)/base/(scot %da now.bowl)/gaze-exports/[nom]/txt
[%txt !>(dat)]
::
:: +peek-x: accept gall scry
::
:: %/days/txt: per day, digest stats
:: %/months/txt: per month, digest stats
:: %/raw/txt: all observed events
::
++ peek-x ::TODO
|= pax=path
^- (unit (unit (pair mark *)))
?~ pax ~
?: =(%days i.pax)
:^ ~ ~ %txt
(export-days days)
?: =(%months i.pax)
:^ ~ ~ %txt
(export-months days)
?: =(%raw i.pax)
``txt+export-raw
~
::
:: +export-months: generate a csv of stats per month
::
++ export-months
|= =_days
%- export-days
^+ days
%+ roll (flop days)
|= [[day=@da sat=stats] mos=(list [mod=@da sat=stats])]
^+ mos
=/ mod=@da
%- year
=+ (yore day)
-(d.t 1)
?~ mos [mod sat]~
?: !=(mod mod.i.mos)
[[mod sat] mos]
:_ t.mos
:- mod
::TODO this is hideous. can we make a wet gate do this?
:* (weld spawned.sat spawned.sat.i.mos)
(weld activated.sat activated.sat.i.mos)
(weld transfer-p.sat transfer-p.sat.i.mos)
(weld transferred.sat transferred.sat.i.mos)
(weld configured.sat configured.sat.i.mos)
(weld breached.sat breached.sat.i.mos)
(weld request.sat request.sat.i.mos)
(weld sponsor.sat sponsor.sat.i.mos)
(weld management-p.sat management-p.sat.i.mos)
(weld voting-p.sat voting-p.sat.i.mos)
(weld spawn-p.sat spawn-p.sat.i.mos)
(weld invites-senders.sat invites-senders.sat.i.mos)
==
::
:: +export-days: generate a csv of stats per day
::
++ export-days
|= =_days
:- %- crip
;: weld
"date,"
"spawned,"
"activated,"
"transfer proxy,"
"transferred,"
"transferred (unique),"
"configured,"
"configured (unique),"
"escape request,"
"sponsor change,"
"invites,"
"invites (unique senders)"
==
|^ ^- (list @t)
%+ turn days
|= [day=@da stats]
%- crip
;: weld
(scow %da day) ","
(count spawned) ","
(count activated) ","
(count transfer-p) ","
(unique transferred) ","
(unique configured) ","
(count request) ","
(count sponsor) ","
(unique invites-senders)
==
::
++ count
|* l=(list)
(num (lent l))
::
++ unique
|* l=(list)
;: weld
(count l)
","
(num ~(wyt in (~(gas in *(set)) l)))
==
::
++ num (d-co:co 1)
--
::
:: +export-raw: generate a csv of individual transactions
::
++ export-raw
:- %- crip
;: weld
"date,"
"point,"
"event,"
"field 1,field2,field3"
==
|^ ^- (list @t)
%+ turn seen
:: (cork tail event-to-row crip)
|= [wen=@da =event]
(crip "{(scow %da wen)},{(event-to-row event)}")
::
++ event-to-row
|= =event
?- -.event
%azimuth (point-diff-to-row +.event)
%invite (invite-to-row +.event)
==
::
++ point-diff-to-row
|= [who=ship dif=diff-point]
^- tape
%+ weld "{(pon who)},"
?- -.dif
%full "full,"
%owner "owner,{(adr new.dif)}"
%activated "activated,"
%spawned "spawned,{(pon who.dif)}"
%keys "keys,{(num life.dif)}"
%continuity "breached,{(num new.dif)}"
%sponsor "sponsor,{(spo has.new.dif)},{(pon who.new.dif)}"
%escape "escape-req,{(req new.dif)}"
%management-proxy "management-p,{(adr new.dif)}"
%voting-proxy "voting-p,{(adr new.dif)}"
%spawn-proxy "spawn-p,{(adr new.dif)}"
%transfer-proxy "transfer-p,{(adr new.dif)}"
==
::
++ invite-to-row
|= [by=ship of=ship ship to=address]
"{(pon by)},invite,{(pon of)},{(adr to)}"
::
++ num (d-co:co 1)
++ pon (cury scow %p)
++ adr |=(a=@ ['0' 'x' ((x-co:co (mul 2 20)) a)])
++ spo |=(h=? ?:(h "escaped to" "detached from"))
++ req |=(r=(unit @p) ?~(r "canceled" (pon u.r)))
--
--

View File

@ -89,7 +89,6 @@
++ on-watch
|= =path
^- (quip card _this)
?> (team:title our.bowl src.bowl)
?+ path (on-watch:def path)
[%http-response *] [~ this]
==

View File

@ -4,6 +4,88 @@
:: To actually close the flows, run with |close-flows, =dry |
::
:- %say
|= [^ arg=~ dry=?]
|= [[now=@da eny=@uvJ bec=beak] arg=~ peer=(unit @p) dry=? veb=?]
::
[%helm-ames-kroc dry]
=/ peers-map
.^((map ship ?(%alien %known)) %ax /(scot %p p.bec)//(scot %da now)/peers)
::
=/ peers=(list ship)
%+ murn ~(tap by peers-map)
|= [=ship val=?(%alien %known)]
?: =(ship p.bec)
~ :: this is weird, but we saw it
?- val
%alien ~
%known (some ship)
==
::
=; bones=(list [ship bone])
:- %helm-ames-kroc
~? dry "#{<(lent bones)>} flows can be closed"
dry^bones
::
%+ roll peers
|= [=ship bones=(list [ship bone])]
?: &(?=(^ peer) !=(u.peer ship))
bones
::
=+ .^ =ship-state:ames
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
==
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
|^
=/ subs=(jar path [bone sub-nonce=@]) resubscriptions
%+ roll ~(tap by subs)
|= [[=wire flows=(list [bone sub-nonce=@])] bones=_bones]
::
%- flop %- tail
%+ roll (sort flows |=([[@ n=@] [@ m=@]] (lte n m)))
|= [[=bone nonce=@] resubs=_(lent flows) bones=_bones]
=/ app=term ?>(?=([%gall %use sub=@ *] wire) i.t.t.wire)
=/ =path (slag 7 wire)
=/ log=tape "[bone={<bone>} agent={<app>} nonce={<nonce>}] {<path>}"
=; corkable=?
=? bones corkable [[ship bone] bones]
(dec resubs)^bones
:: checks if this is a stale re-subscription
::
?. =(resubs 1)
~? veb [ship (weld "stale %watch plea " log)]
&
:: the current subscription can be safely corked if there
:: is a flow with a naxplanation ack on a backward bone
::
=+ backward-bone=(mix 0b10 bone)
?. =(%2 (mod backward-bone 4))
|
?~ (~(get by rcv.peer-state) backward-bone)
|
~? veb [ship (weld "failed %watch plea " log)]
&
::
++ resubscriptions
%+ roll ~(tap by snd.peer-state)
|= $: [=forward=bone message-pump-state:ames]
subs=(jar path [bone sub-nonce=@])
==
?: (~(has in closing.peer-state) forward-bone)
~? veb
:- ship
%+ weld "stale flow bone={<forward-bone>} in closing, "
"#{<~(wyt in live:packet-pump-state)>} packets retrying"
subs
?~ duct=(~(get by by-bone.ossuary.peer-state) forward-bone)
subs
?. ?=([* [%gall %use sub=@ @ %out @ @ *] *] u.duct)
subs
=/ =wire i.t.u.duct
=/ nonce=(unit @) ?~((slag 7 wire) ~ (slaw %ud &8.wire))
%- ~(add ja subs)
:: 0 for old pre-nonce subscriptions
::
:_ [forward-bone ?~(nonce 0 u.nonce)]
?~ nonce wire
:: don't include the sub-nonce in the key
::
(weld (scag 7 wire) (slag 8 wire))
--

View File

@ -4,24 +4,26 @@
:: |stale-flows, =veb %2 :: stale flows that keep (re)trying to connect
:: |stale-flows, =veb %21 :: ... per app (only forward)
:: |stale-flows, =veb %3 :: stale resubscriptions
:: |stale-flows, =veb %4 :: print live naxplanation flows
::
=> |%
+$ subs (jar path [ship bone @])
+$ subs (jar path [ship bone @ close=?])
+$ pags (jar app=term [dst=term =ship =path]) :: per-agent
+$ naks (set [ship bone])
:: verbosity
::
+$ veb ?(%0 %1 %2 %21 %3 %31)
+$ veb ?(%0 %1 %2 %21 %3 %4 ~)
::
++ resubs
|= [=subs =veb]
^- @
::=/ sorted
:: %+ sort ~(tap by subs)
:: |=([a=(list *) b=(list *)] (lte (lent a) (lent b)))
%+ roll ~(tap by subs)::sorted
|= [[k=path v=(list [ship bone @])] num=@]
%+ roll ~(tap by subs)
|= [[k=path v=(list [ship bone @ close=?])] num=@]
=/ in-close=@
(roll v |=([[@ @ @ c=?] n=@] ?:(c +(n) n)))
~? &(=(%3 veb) (gth (lent v) 1))
%+ weld ?: =(in-close 0) ""
"[#{<in-close>} %close] "
"#{<(dec (lent v))>} stale resubs on {<k>}"
?. (gth (lent v) 1) num
(add (dec (lent v)) num)
@ -29,7 +31,7 @@
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=~ dry=? =veb]
[arg=~ peer=(unit @p) dry=? =veb]
==
::
=/ peers-map
@ -45,12 +47,14 @@
%known (some ship)
==
::
=; [[=subs =pags backward=@ forward=@] =naks]
=; [[=subs =pags close=@ incoming=@ outgoing=@ nax=@] =naks]
:- %tang %- flop
%+ weld
:~ leaf+"#{<~(wyt in naks)>} flows from %nacking %watches"
leaf+"#{<backward>} live backward flows with (keep retrying)"
leaf+"#{<forward>} live forward flows with (keep retrying)"
leaf+"#{<incoming>} live backward flows"
leaf+"#{<outgoing>} live forward flows"
leaf+"#{<nax>} live naxplanations"
leaf+"#{<close>} flows in closing"
leaf+"#{<(resubs subs veb)>} stale resubscriptions"
==
?. =(%21 veb) ~
@ -60,13 +64,17 @@
(gth (lent v) (lent w))
|= [app=term v=(list [dst=term =ship =path])]
:- %leaf
%+ weld "#{<(lent v)>} flows for {<app>} with >10 retries"
%+ weld "#{<(lent v)>} flows for {<app>}"
?. =(1 (lent v)) ~
?> ?=(^ v)
" on {<ship.i.v>} to {<dst.i.v>} at {<path.i.v>}"
::
%+ roll peers
|= [=ship [=subs p=pags b=@ f=@] n=naks]
|= [=ship [=subs p=pags cl=@ in=@ ou=@ na=@] =naks]
?: ?& ?=(^ peer)
!=(u.peer ship)
==
+<+
=+ .^ =ship-state:ames
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
==
@ -78,55 +86,63 @@
%+ roll ~(tap by snd.peer-state)
|= $: [=bone message-pump-state:ames]
subs=_subs pags=_p
backward=_b forward=_f
close=_cl
incoming=_in outgoing=_ou nax=_na
==
=, packet-pump-state
=+ closing=(~(has ^in closing.peer-state) bone)
:- ?~ duct=(~(get by by-bone.ossuary.peer-state) bone) subs
?. ?=([* [%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] *] u.duct)
?. ?=([* [%gall %use sub=@ @ %out @ @ *] *] u.duct)
subs
=/ =wire i.t.u.duct
=/ nonce=(unit @) (rush i.t.t.t.t.t.t.t.i.t.u.duct dem)
=/ =wire i.t.u.duct
=/ nonce=(unit @ud)
?~ (slag 7 wire) ~
(slaw %ud &8.wire)
%- ~(add ja subs)
:_ [ship bone ?~(nonce 0 u.nonce)] :: 0, 1?
?~ nonce wire
:_ [ship bone ?~(nonce 0 u.nonce) closing] :: 0 = pre-nonce subscriptions
?~ nonce
wire
:: don't include the sub-nonce in the key
::
(weld (scag 7 wire) (slag 8 wire))
%+ roll ~(tap in live)
|= $: [[msg=@ frag=@] [packet-state:ames *]]
pags=_pags
out=[b=_backward f=_forward]
==
::
?~ live [pags close incoming outgoing nax]
:: only forward flows
::
=? pags &(=(0 (end 0 bone)) (gth tries 10))
=? pags =(%0 (mod bone 4))
?~ duct=(~(get by by-bone.ossuary.peer-state) bone)
pags
?. ?=([* [%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] *] u.duct)
?. ?=([* [%gall %use sub=@ @ %out @ @ *] *] u.duct)
pags
=/ =wire i.t.u.duct
(~(add ja pags) (snag 2 wire) (snag 8 wire) ship (slag 9 wire))
(~(add ja pags) (snag 2 wire) (snag 6 wire) ship (slag 7 wire))
::
~? &(=(%2 veb) (gth tries 10))
=+ arrow=?:(=(0 (end 0 bone)) "<-" "->")
=+ closing=(~(has in closing.peer-state) bone)
%+ weld "{arrow} ({(cite:title ship)}) bone=#{<bone>} "
"closing={<closing>} msg=#{<msg>} frag=#{<frag>} #{<tries>}"
:- pags
=? out (gth tries 10)
?: =(0 (end 0 bone))
[b.out +(f.out)]
[+(b.out) f.out]
out
=? close closing +(close)
~? =(%2 veb)
=/ arrow=tape
?+ (mod bone 4) ~|([%odd-bone bone] !!)
%0 "<-"
%1 "->"
%3 "<-"
==
"{arrow} ({(cite:title ship)}) bone=#{<bone>} closing={<closing>}"
::
=/ is-nax=? =(%3 (mod bone 4))
~? &(=(%4 veb) is-nax)
"nax: ({(cite:title ship)}) bone=#{<bone>} closing={<closing>}"
:+ pags close
?+ (mod bone 4) ~|([%odd-bone bone] !!)
%0 [incoming +(outgoing) nax]
%1 [+(incoming) outgoing nax]
%3 [incoming outgoing +(nax)]
==
::
++ nacks
%+ roll ~(tap by rcv.peer-state)
|= [[=bone *] nacks=_n]
|= [[=bone *] n=_naks]
?. &(=(0 (end 0 bone)) =(1 (end 0 (rsh 0 bone))))
:: not a naxplanation ack bone
::
nacks
n
:: by only corking forward flows that have received
:: a nack we avoid corking the current subscription
::
@ -134,16 +150,18 @@
:: make sure that the nack bone has a forward flow
::
?~ duct=(~(get by by-bone.ossuary.peer-state) target)
nacks
n
?. ?=([* [%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] *] u.duct)
nacks
n
=/ =wire i.t.u.duct
=+ closing=(~(has ^in closing.peer-state) bone)
?> ?=([%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] wire)
=/ app=term i.t.t.wire
=/ nonce=@
=- ?~(- 0 u.-)
(rush i.t.t.t.t.t.t.t.wire dem)
=/ =path t.t.t.t.t.t.t.t.wire
~? =(%1 veb) "[bone={<target>} nonce={<nonce>} agent={<app>}] {<path>}"
(~(put in nacks) [ship target])
(slaw %ud &8.wire)
=/ =path |8.wire
~? =(%1 veb)
"[bone={<target>} nonce={<nonce>} agent={<app>} close={<closing>}] {<path>}"
(~(put ^in n) [ship target])
--

View File

@ -246,8 +246,9 @@
(emit %pass /helm %arvo %a %stir '')
::
++ poke-ames-kroc
|= dry=? =< abet
(emit %pass /helm %arvo %a %kroc dry)
|= [dry=? bones=(list [ship bone])] =< abet
?: dry this
(emit %pass /helm %arvo %a %kroc bones)
::
++ poke-ames-cong
|= cong=[msg=@ud mem=@ud] =< abet

View File

@ -795,7 +795,7 @@
%+ turn
%+ skim desks
|= dek=desk
?: (~(has in .^((set desk) %cd /(scot %p our)/base/(scot %da now))) dek)
?: (~(has in .^((set desk) %cd /(scot %p our)//(scot %da now))) dek)
&
~> %slog.(fmt "desk does not yet exist: {<dek>}") |
|=(=desk [%pass /kiln/suspend %arvo %c %zest desk %dead])
@ -821,10 +821,9 @@
=+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire)
?~ got=(~(get by rock) loc)
abet:(spam leaf+"desk does not exist: {<loc>}" ~)
?: =(+<:got %dead)
abet:(spam leaf+"desk not installed: {<loc>}" ~)
~> %slog.(fmt "uninstalling {<loc>}")
=. ..on-init (emit %pass /kiln/uninstall %arvo %c %zest loc %dead)
=? ..on-init !=(+<:got %dead)
(emit %pass /kiln/uninstall %arvo %c %zest loc %dead)
?~ sync=(~(get by sources) loc)
abet
(poke-unsync loc u.sync)
@ -1128,6 +1127,12 @@
=/ m (strand:rand ,vase)
;< =riot:clay bind:m (warp:strandio her sud ~ %sing %w ud+let /)
?> ?=(^ riot)
:: The syncs may have changed, so get the latest
::
;< zyx=(map kiln-sync sync-state) bind:m
(scry:strandio (map kiln-sync sync-state) /gx/hood/kiln/syncs/noun)
?. (~(has by zyx) syd her sud)
(pure:m !>(%done))
~> %slog.(fmt "downloading update for {here}")
;< =riot:clay bind:m (warp:strandio her sud ~ %sing %v ud+let /)
?> ?=(^ riot)

View File

@ -186,7 +186,7 @@
!< (list @ux)
=< q
%- need %- need
(scry:(ames-gate now eny roof) ~ %x beam)
(scry:(ames-gate now eny roof) ~ / %x beam)
::
=/ paz=(list have:ames)
%+ spun meows
@ -213,7 +213,7 @@
=< q
%- need %- need
%- scry:(ames-gate now eny roof)
[~ %x [[our %$ da+now] /peers/(scot %p her)]]
[~ / %x [[our %$ da+now] /peers/(scot %p her)]]
::
++ gall-scry-nonce
|= $: =gall-gate
@ -227,7 +227,7 @@
=< q
%- need %- need
%- scry:(gall-gate now eny roof)
[~ %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]]
[~ / %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]]
::
++ load-agent
|= [=ship =gall-gate =dude:gall =agent:gall]

View File

@ -13,7 +13,6 @@
=> v=.
|%
++ mime => v [/text/plain (as-octs (of-wain pem))]
++ elem => v ;pre: {(trip (of-wain pem))}
--
++ grad %mime
--

View File

@ -3,42 +3,6 @@
::
/? 310
=, html
|%
++ words 1
++ hedtal
=| met=marl
|= a=marl ^- [hed=marl tal=marl]
?~ a [~ ~]
?. ?=(%h1 n.g.i.a)
?: ?=(%meta n.g.i.a)
$(a t.a, met [i.a met])
=+ had=$(a c.i.a)
?^ -.had had
$(a t.a)
[c.i.a (weld (flop met) (limit words t.a))]
::
++ limit
|= [lim=@u mal=marl]
=< res
|- ^- [rem=@u res=marl]
?~ mal [lim ~]
?~ lim [0 ~]
=/ [lam=@u hed=manx]
?: ?=(_;/(**) i.mal)
[lim ;/(tay)]:(deword lim v.i.a.g.i.mal)
[rem ele(c res)]:[ele=i.mal $(mal c.i.mal)]
[rem - res]:[hed $(lim lam, mal t.mal)]
::
++ deword
|= [lim=@u tay=tape] ^- [lim=@u tay=tape]
?~ tay [lim tay]
?~ lim [0 ~]
=+ wer=(dot 1^1 tay)
?~ q.wer
[lim - tay]:[i.tay $(tay t.tay)]
=+ nex=$(lim (dec lim), tay q.q.u.q.wer)
[-.nex [(wonk wer) +.nex]]
--
::
::
=, mimes:html
@ -50,14 +14,18 @@
++ mime
=< mime
|%
++ elem ;div:(h1:"*{hed}" div:"*{tal}") :: convert to %elem
++ hymn ;html:(head:title:"snip" body:"+{elem}") :: convert to %hymn
++ hymn :: convert to %hymn
|^ html
++ div ;div:(h1:"*{hed}" div:"*{tal}")
++ html ;html:(head:title:"snip" body:"+{div}")
--
++ html (crip (en-xml hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ noun [hed tal]
--
++ grab |% :: convert from
++ noun ,[marl marl] :: clam from %noun
++ elem |=(a=manx (hedtal +.a))
-- --
++ grab :: convert from
|%
++ noun ,[marl marl] :: clam from %noun
--
--

View File

@ -1,12 +0,0 @@
|_ a=manx
++ grad %noun
++ grab
|%
++ noun manx
--
++ grow
|%
++ htm a
++ noun a
--
--

View File

@ -1,11 +0,0 @@
|_ a=manx
++ grad %noun
++ grab
|%
++ noun manx
--
++ grow
|%
++ noun a
--
--

1
pkg/arvo/mar/xhtml.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/xhtml.hoon

View File

@ -1 +1 @@
[%zuse 413]
[%zuse 412]

View File

@ -3,7 +3,7 @@
|%
+| %global
::
++ arvo %238
++ arvo %237
::
:: $arch: node identity
:: $axal: fundamental node, recursive (trie)
@ -111,6 +111,7 @@
|$ [a]
$~ =>(~ |~(* ~))
$- $: lyc=gang :: leakset
pov=path :: provenance
omen :: perspective, path
== ::
%- unit :: ~: unknown
@ -118,7 +119,7 @@
(cask a) ::
+$ roon :: partial namespace
$~ =>(~ |~(* ~))
$- [lyc=gang car=term bem=beam]
$- [lyc=gang pov=path car=term bem=beam]
(unit (unit cage))
+$ root $-(^ (unit (unit)))
+$ view $@(term [way=term car=term]) :: perspective
@ -207,9 +208,9 @@
==
+$ heir
$% $: %grub
$% [?(%240 %239 %238) =grub]
$% [?(%240 %239 %238 %237) =grub]
== ==
[?(%240 %239 %238) =debt =soul]
[?(%240 %239 %238 %237) =debt =soul]
==
+$ plan (pair germ (list move))
+$ soul
@ -342,13 +343,13 @@
::
++ look
~/ %look
|= [rof=roof lyc=gang]
|= [rof=roof lyc=gang pov=path]
^- root
~/ %in
|= [ref=* raw=*]
?~ pax=((soft path) raw) ~
?~ mon=(de-omen u.pax) ~
?~ dat=(rof lyc u.mon) ~
?~ dat=(rof lyc pov u.mon) ~
?~ u.dat [~ ~]
=* vax q.u.u.dat
?. ?& ?=(^ ref)
@ -1052,7 +1053,7 @@
++ smit
|= [cap=tape sub=vase pax=path txt=@t]
^- vase
~> %slog.[0 leaf/"{cap}: {(scow p+(mug txt))}"]
~> %slog.[0 leaf/"{cap}: {(scow uv+(mug txt))}"]
~> %bout
%- road |.
~_ leaf/"{cap}: build failed"
@ -1101,7 +1102,7 @@
++ peek
~/ %peek
^- rook
|= [lyc=gang omen]
|= [lyc=gang pov=path omen]
^- (unit (unit (cask meta)))
:: namespace reads receive no entropy
::
@ -1113,7 +1114,7 @@
~> %mean.'peek: pull failed'
(~(slap wa sac) rig [%limb %scry])
::
=/ mas=[gang view beam] [lyc vis bem]
=/ mas=[gang path view beam] [lyc pov vis bem]
::
=^ pro sac
~> %mean.'peek: call failed'
@ -1293,7 +1294,7 @@
:^ %pass [vane.gem vane]
?: ?=(?(%deal %deal-gall) +>-.task)
:- :- +>-.task
;;([[ship ship] term term] [+>+< +>+>- +>+>+<]:task)
;;([[ship ship path] term term] [+>+< +>+>- +>+>+<]:task)
wire
[(symp +>-.task) wire]
duct
@ -1373,7 +1374,7 @@
|= [nam=term =vane]
=; mas=(list mass)
nam^|+(welp mas [dot+&+q.vase typ+&+p.vase sac+&+worm ~]:vane)
?~ met=(peek [~ ~] [nam %x] bem) ~
?~ met=(peek [~ ~] / [nam %x] bem) ~
?~ u.met ~
~| mass+nam
;;((list mass) q.q.u.u.met)
@ -1381,7 +1382,7 @@
::
++ peek
^- rook
|= [lyc=gang omen]
|= [lyc=gang pov=path omen]
^- (unit (unit (cask meta)))
:: vane and care may be concatenated
::
@ -1392,12 +1393,12 @@
[(end 3 vis) (rsh 3 vis)]
::
?: ?=(%$ way)
(peek:pith lyc car bem)
(peek:pith lyc pov car bem)
::
=. way (grow way)
?~ van=(~(get by van.mod) way)
~
%. [lyc car bem]
%. [lyc pov car bem]
peek:spin:(~(plow va [vil u.van]) now peek)
:: +call: advance to target
::
@ -1552,11 +1553,11 @@
::
++ peek
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
?. ?| =(our p.bem)
?. ?& =(our p.bem)
?=(%$ q.bem)
=([%da now] p.r.bem)
=([%da now] r.bem)
==
~
?+ s.bem ~
@ -1741,6 +1742,7 @@
%i %iris
%j %jael
%k %khan
%l %lick
==
-- =>
::
@ -1764,7 +1766,7 @@
::
=. sol
?- -.hir
?(%240 %239 %238) soul.hir
?(%240 %239 %238 %237) soul.hir
==
:: clear compiler caches
::
@ -1805,7 +1807,7 @@
==
::
?~ hap ~
=/ pro (~(peek le:part [pit vil] sol) lyc [vis bem]:u.hap)
=/ pro (~(peek le:part [pit vil] sol) lyc / [vis bem]:u.hap)
?: |(?=(~ pro) ?=(~ u.pro)) ~
=/ dat=(cask) [p q.q]:u.u.pro
?. pat.u.hap `dat
@ -1879,7 +1881,7 @@
++ smit
|= [cap=tape sub=(trap vase) pax=path txt=@t]
^- (trap vase)
~> %slog.[0 leaf/"{cap}: {(scow p+(mug txt))}"]
~> %slog.[0 leaf/"{cap}: {(scow uv+(mug txt))}"]
%- road |.
~_ leaf/"{cap}: build failed"
(swat sub (rain pax txt))

View File

@ -4,7 +4,7 @@
=> ..part
~% %lull ..part ~
|%
++ lull %324
++ lull %323
:: :: ::
:::: :: :: (1) models
:: :: ::
@ -462,7 +462,8 @@
+$ rift @ud :: ship continuity
+$ mime (pair mite octs) :: mimetyped data
+$ octs (pair @ud @) :: octet-stream
+$ sock (pair ship ship) :: outgoing [our his]
+$ sock (pair ship ship) :: outgoing [src dest]
+$ sack (trel ship ship path) :: $sock /w provenance
+$ stub (list (pair stye (list @c))) :: styled unicode
+$ stye (pair (set deco) (pair tint tint)) :: decos/bg/fg
+$ styl %+ pair (unit deco) :: cascading style
@ -584,6 +585,7 @@
%'GET'
%'HEAD'
%'OPTIONS'
%'PATCH'
%'POST'
%'PUT'
%'TRACE'
@ -765,8 +767,10 @@
:: %heed: track peer's responsiveness; gives %clog if slow
:: %jilt: stop tracking peer's responsiveness
:: %cork: request to delete message flow
:: %kroc: request to delete stale message flows
:: %tame: request to delete route for ship
:: %kroc: request to delete specific message flows, from their bones
:: %plea: request to send message
:: %deep: deferred calls to %ames, from itself
::
:: Remote Scry Tasks
::
@ -788,12 +792,15 @@
:: %vega: kernel reload notification
::
+$ task
$+ ames-task
$% [%hear =lane =blob]
[%heed =ship]
[%jilt =ship]
[%cork =ship]
[%kroc dry=?]
[%tame =ship]
[%kroc bones=(list [ship bone])]
$>(%plea vane-task)
[%deep =deep]
::
[%keen spar]
[%yawn spar]
@ -901,7 +908,15 @@
:: life based on the ship.
::
+$ spar [=ship =path]
:: $deep: deferred %ames call, from self, to keep +abet cores pure
::
+$ deep
$% [%nack =ship =nack=bone =message-blob]
[%sink =ship =target=bone naxplanation=[=message-num =error]]
[%drop =ship =nack=bone =message-num]
[%cork =ship =bone]
[%kill =ship =bone]
==
:: +| %atomics
::
+$ bone @udbone
@ -960,6 +975,7 @@
:: %known: we know their life and public keys, so we have a channel
::
+$ ship-state
$+ ship-state
$% [%alien alien-agenda]
[%known peer-state]
==
@ -970,6 +986,7 @@
:: heeds: local tracking requests; passed through into $peer-state
::
+$ alien-agenda
$+ alien-agenda
$: messages=(list [=duct =plea])
packets=(set =blob)
heeds=(set duct)
@ -997,6 +1014,7 @@
:: corked: bones closed on both sender and receiver
::
+$ peer-state
$+ peer-state
$: $: =symmetric-key
=life
=rift
@ -1015,6 +1033,7 @@
keens=(map path keen-state)
==
+$ keen-state
$+ keen-state
$: wan=((mop @ud want) lte) :: request packets, sent
nex=(list want) :: request packets, unsent
hav=(list have) :: response packets, backward
@ -1133,6 +1152,7 @@
:: packet-pump-state: state of corresponding |packet-pump
::
+$ message-pump-state
$+ message-pump-state
$: current=_`message-num`1
next=_`message-num`1
unsent-messages=(qeu message-blob)
@ -1153,6 +1173,7 @@
:: metrics: congestion control information
::
+$ packet-pump-state
$+ packet-pump-state
$: next-wake=(unit @da)
live=((mop live-packet-key live-packet-val) lte-packets)
metrics=pump-metrics
@ -1190,7 +1211,6 @@
:: rto: retransmission timeout
:: rtt: roundtrip time estimate, low-passed using EWMA
:: rttvar: mean deviation of .rtt, also low-passed with EWMA
:: num-live: how many packets sent, awaiting ack
:: ssthresh: slow-start threshold
:: cwnd: congestion window; max unacked packets
::
@ -1200,7 +1220,6 @@
rttvar=_~s1
ssthresh=_10.000
cwnd=_1
num-live=@ud
counter=@ud
==
+$ live-packet
@ -1229,6 +1248,7 @@
:: live-messages: partially received messages
::
+$ message-sink-state
$+ message-sink-state
$: last-acked=message-num
last-heard=message-num
pending-vane-ack=(qeu [=message-num message=*])
@ -2065,7 +2085,10 @@
$% [%payload =simple-payload:http]
== ==
+$ gift
$% :: set-config: configures the external http server
$% :: ames responses
::
$>(?(%boon %done) gift:ames)
:: set-config: configures the external http server
::
:: TODO: We need to actually return a (map (unit @t) http-config)
:: so we can apply configurations on a per-site basis
@ -2096,6 +2119,9 @@
:: new unix process
::
$>(%born vane-task)
:: network request
::
$>(%plea vane-task)
:: trim state (in response to memory pressure)
::
$>(%trim vane-task)
@ -2108,6 +2134,11 @@
:: update http configuration
::
[%rule =http-rule]
:: set a base url for eauth, like `'https://sampel.com'
::
:: eyre will append /~/eauth to it internally to redirect into eauth
::
[%eauth-host host=(unit @t)]
:: starts handling an inbound http request
::
[%request secure=? =address =request:http]
@ -2168,6 +2199,14 @@
:: inbound-request: the original request which caused this connection
::
=inbound-request
:: session-id: the session associated with this connection
:: identity: the identity associated with this connection
::
::NOTE technically the identity is associated with the session (id),
:: but we may still need to know the identity that was used
:: after the session proper expires.
::
[session-id=@uv =identity]
:: response-header: set when we get our first %start
::
response-header=(unit response-header:http)
@ -2181,11 +2220,26 @@
$: :: sessions: a mapping of session cookies to session information
::
sessions=(map @uv session)
:: visitors: in-progress incoming eauth flows
::
visitors=(map @uv visitor)
:: visiting: outgoing eauth state per ship
::
visiting=(map ship logbook)
:: endpoint: hardcoded local eauth endpoint for %syn and %ack
::
:: user-configured or auth-o-detected, with last-updated timestamp.
:: both shaped like 'prot://host'
::
endpoint=[user=(unit @t) auth=(unit @t) =time]
==
:: +session: server side data about a session
::
+$ session
$: :: expiry-time: when this session expires
$: :: identity: authentication level & id of this session
::
=identity
:: expiry-time: when this session expires
::
:: We check this server side, too, so we aren't relying on the browser
:: to properly handle cookie expiration as a security mechanism.
@ -2199,6 +2253,73 @@
:: mint some sort of long lived cookie for mobile apps which only has
:: access to a single application path.
==
:: +visitor: completed or in-progress incoming eauth flow
::
:: duct: boon duct
:: and
:: sesh: login completed, session exists
:: or
:: pend: awaiting %tune for %keen sent at time, for initial eauth http req
:: ship: the @p attempting to log in
:: base: local protocol+hostname the attempt started on, if any
:: last: the url to redirect to after log-in
:: toke: authentication secret received over ames or offered by visitor
::
+$ visitor
$: duct=(unit duct)
$@ sesh=@uv
$: pend=(unit [http=duct keen=time])
ship=ship
base=(unit @t)
last=@t
toke=(unit @uv)
== ==
:: +logbook: record of outgoing eauth comms & state
::
:: qeu: a queue of nonces for to-be-n/acked pleas
:: map: per nonce, completed or pending eauth session
::
+$ logbook [=(qeu @uv) =(map @uv portkey)]
:: +portkey: completed or in-progress outgoing eauth flow
::
:: made: live since
:: or
:: duct: confirm request awaiting redirect
:: toke: secret to include in redirect, unless aborting
::
+$ portkey
$@ made=@da :: live since
$: pend=(unit duct) :: or await redir
toke=(unit @uv) :: with secret
==
:: +eauth-plea: client talking to host
::
+$ eauth-plea
$: %0
$% :: %open: client decided on an attempt, wants to return to url
:: %shut: client wants the attempt or session closed
::
[%open nonce=@uv token=(unit @uv)]
[%shut nonce=@uv]
== ==
:: +eauth-boon: host responding to client
::
+$ eauth-boon
$: %0
$% :: %okay: attempt heard, client to finish auth through url
:: %shut: host has expired the session
::
[%okay nonce=@uv url=@t]
[%shut nonce=@uv]
== ==
:: $identity: authentication method & @p
::
+$ identity
$~ [%ours ~]
$% [%ours ~] :: local, root
[%fake who=@p] :: guest id
[%real who=@p] :: authed cross-ship
==
:: channel-state: state used in the channel system
::
+$ channel-state
@ -2242,6 +2363,7 @@
::
+$ channel
$: mode=?(%json %jam)
=identity
:: channel-state: expiration time or the duct currently listening
::
:: For each channel, there is at most one open EventSource
@ -2314,6 +2436,9 @@
:: internal authentication page
::
[%authentication ~]
:: cross-ship authentication handling
::
[%eauth ~]
:: internal logout page
::
[%logout ~]
@ -2326,6 +2451,9 @@
:: respond with the @p the requester is authenticated as
::
[%name ~]
:: respond with the @p of the ship serving the response
::
[%host ~]
:: respond with the default file not found page
::
[%four-oh-four ~]
@ -2579,7 +2707,7 @@
== ::
+$ task :: incoming request
$~ [%vega ~] ::
$% [%deal p=sock q=term r=deal] :: full transmission
$% [%deal p=sack q=term r=deal] :: full transmission
[%sear =ship] :: clear pending queues
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
@ -2601,6 +2729,7 @@
$: $: our=ship :: host
src=ship :: guest
dap=term :: agent
sap=path :: provenance
== ::
$: wex=boat :: outgoing subs
sup=bitt :: incoming subs
@ -3076,6 +3205,30 @@
:: ::
+$ shed _*form:(strand:rand ,vase) :: compute vase
-- ::khan
:: ::::
:::: ++lick :: (1j) IPC
:: ::::
++ lick ^?
|%
+$ gift :: out result <-$
$% [%spin =name] :: open an IPC port
[%shut =name] :: close an IPC port
[%spit =name =mark =noun] :: spit a noun to the IPC port
[%soak =name =mark =noun] :: soak a noun from the IPC port
==
+$ task :: in request ->$
$~ [%vega ~] ::
$% $>(%born vane-task) :: new unix process
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
[%spin =name] :: open an IPC port
[%shut =name] :: close an IPC port
[%spit =name =mark =noun] :: spit a noun to the IPC port
[%soak =name =mark =noun] :: soak a noun from the IPC port
==
::
+$ name path
-- ::lick
::
++ rand :: computation
|%
@ -3278,6 +3431,7 @@
gift:iris
gift:jael
gift:khan
gift:lick
==
+$ task-arvo :: in request ->$
$% task:ames
@ -3289,6 +3443,7 @@
task:iris
task:jael
task:khan
task:lick
==
+$ note-arvo :: out request $->
$~ [%b %wake ~]
@ -3301,6 +3456,7 @@
[%i task:iris]
[%j task:jael]
[%k task:khan]
[%l task:lick]
[%$ %whiz ~]
[@tas %meta vase]
==
@ -3323,6 +3479,7 @@
[%iris gift:iris]
[%jael gift:jael]
[%khan gift:khan]
[%lick gift:lick]
==
:: $unix-task: input from unix
::

File diff suppressed because it is too large Load Diff

View File

@ -235,7 +235,7 @@
::
++ scry
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
=* ren car
=* why=shop &/p.bem

View File

@ -4475,7 +4475,7 @@
^- [(unit (unit cage)) _..park]
=/ q (read-q tak pax)
?~ q `..park
?~ u.q `..park
?~ u.q [[~ ~] ..park]
:: should convert any lobe to cage
::
=^ =cage ..park
@ -5897,7 +5897,7 @@
++ scry :: inspect
~/ %clay-scry
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
=* scry-loop $
|^

View File

@ -104,7 +104,7 @@
::
%seat
%^ pass /seat %g
:+ %deal [our our]
:+ %deal [our our /dill]
[%hood %poke %kiln-install !>([desk.kyz our desk.kyz])]
==
::
@ -129,7 +129,7 @@
::
++ deal :: pass to %gall
|= [=wire =deal:gall]
(pass wire [%g %deal [our our] ram deal])
(pass wire [%g %deal [our our /dill] ram deal])
::
++ pass :: pass note
|= [=wire =note]
@ -146,7 +146,7 @@
++ sponsor
^- ship
=/ dat=(unit (unit cage))
(rof `[our ~ ~] j/[[our sein/da/now] /(scot %p our)])
(rof `[our ~ ~] /dill j/[[our sein/da/now] /(scot %p our)])
;;(ship q.q:(need (need dat)))
::
++ init :: initialize
@ -479,7 +479,7 @@
::
++ scry
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
=* ren car
=* why=shop &/p.bem
@ -525,9 +525,10 @@
:: only the new-style subscription.
::
=/ hey (need hey.all.lax)
:* [hey %pass / %g %deal [our our] %hood %leave ~]
[hey %pass [%peer %$ ~] %g %deal [our our] %hood %leave ~]
[hey %pass [%peer %$ ~] %g %deal [our our] %hood %watch [%dill %$ ~]]
=/ =sack [our our /dill]
:* [hey %pass / %g %deal sack %hood %leave ~]
[hey %pass [%peer %$ ~] %g %deal sack %hood %leave ~]
[hey %pass [%peer %$ ~] %g %deal sack %hood %watch [%dill %$ ~]]
moz
==
=. egg.all.lax |

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
+$ move [=duct move=(wind note-arvo gift-arvo)]
:: $state-13: overall gall state, versioned
::
+$ state-13 [%13 state]
+$ state-14 [%14 state]
:: $state: overall gall state
::
:: system-duct: TODO document
@ -66,7 +66,7 @@
::
+$ routes
$: disclosing=(unit (set ship))
attributing=ship
attributing=[=ship =path]
==
:: $yoke: agent runner state
::
@ -162,7 +162,7 @@
:: $spore: structures for update, produced by +stay
::
+$ spore
$: %13
$: %14
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
@ -192,7 +192,7 @@
--
:: adult gall vane interface, for type compatibility with pupa
::
=| state=state-13
=| state=state-14
|= [now=@da eny=@uvJ rof=roof]
=* gall-payload .
~% %gall-top ..part ~
@ -249,7 +249,7 @@
:: +mo-doff: kill all outgoing subscriptions
::
++ mo-doff
|= [dude=(unit dude) ship=(unit ship)]
|= [prov=path dude=(unit dude) ship=(unit ship)]
^+ mo-core
=/ apps=(list (pair term yoke))
?~ dude ~(tap by yokes.state)
@ -257,12 +257,12 @@
|- ^+ mo-core
?~ apps mo-core
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our prov] q.i.apps)
$(apps t.apps, mo-core ap-abet:(ap-doff:ap-core ship))
:: +mo-rake: send %cork's for old subscriptions if needed
::
++ mo-rake
|= [dude=(unit dude) all=?]
|= [prov=path dude=(unit dude) all=?]
^+ mo-core
=/ apps=(list (pair term yoke))
?~ dude ~(tap by yokes.state)
@ -270,7 +270,7 @@
|- ^+ mo-core
?~ apps mo-core
?: ?=(%nuke -.q.i.apps) $(apps t.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our] q.i.apps)
=/ ap-core (ap-yoke:ap p.i.apps [~ our prov] q.i.apps)
$(apps t.apps, mo-core ap-abet:(ap-rake:ap-core all))
:: +mo-receive-core: receives an app core built by %ford.
::
@ -286,7 +286,7 @@
::
++ mo-receive-core
~/ %mo-receive-core
|= [dap=term bek=beak =agent]
|= [prov=path dap=term bek=beak =agent]
^+ mo-core
::
=/ yak (~(get by yokes.state) dap)
@ -309,7 +309,7 @@
::
=. yokes.state
(~(put by yokes.state) dap u.yak(beak bek, code agent))
=/ ap-core (ap-abed:ap dap `our)
=/ ap-core (ap-abed:ap dap [~ our prov])
=. ap-core (ap-reinstall:ap-core agent)
=. mo-core ap-abet:ap-core
(mo-clear-queue dap)
@ -329,7 +329,7 @@
::
=/ old mo-core
=/ wag
=/ ap-core (ap-abed:ap dap `our)
=/ ap-core (ap-abed:ap dap [~ our prov])
(ap-upgrade-state:ap-core ~)
::
=/ maybe-tang -.wag
@ -419,7 +419,7 @@
:: +mo-breach: ship breached, so forget about them
::
++ mo-breach
|= =ship
|= [prov=path =ship]
^+ mo-core
=. mo-core (mo-untrack-ship ship)
=. mo-core (mo-filter-queue ship)
@ -434,7 +434,7 @@
?~ agents
mo-core
=? mo-core ?=(%live -.yoke.i.agents)
=/ =routes [disclosing=~ attributing=ship]
=/ =routes [disclosing=~ attributing=[ship prov]]
=/ app (ap-abed:ap name.i.agents routes)
ap-abet:(ap-breach:app ship)
$(agents t.agents)
@ -464,7 +464,7 @@
?> ?=([%era ~] wire)
?. ?=(%breach -.public-keys-result.sign-arvo)
mo-core
(mo-breach who.public-keys-result.sign-arvo)
(mo-breach /jael who.public-keys-result.sign-arvo)
:: +mo-handle-sys-lag: handle an ames %clog notification
::
++ mo-handle-sys-lag
@ -479,7 +479,7 @@
?~ agents mo-core
::
=? mo-core ?=(%live -.yoke.i.agents)
=/ app (ap-abed:ap dude.i.agents `our)
=/ app (ap-abed:ap dude.i.agents [~ our /ames])
ap-abet:(ap-clog:app ship.sign-arvo)
::
$(agents t.agents)
@ -630,14 +630,16 @@
mo-core
=/ app
=/ =ship (slav %p i.t.t.wire)
=/ =routes [disclosing=~ attributing=ship]
=/ =routes [disclosing=~ attributing=[ship /[-.sign-arvo]]]
(ap-abed:ap dap routes)
::
=. app (ap-generic-take:app t.t.t.wire sign-arvo)
ap-abet:app
?> ?=([%out @ @ *] t.t.wire)
=/ =ship (slav %p i.t.t.t.wire)
=/ =routes [disclosing=~ attributing=ship]
=/ other-agent i.t.t.t.t.wire
=/ prov=path ?.(=(ship our) *path /gall/[other-agent])
=/ =routes [disclosing=~ attributing=[ship prov]]
=/ =unto +>.sign-arvo
?: ?=(%| -.agent.u.yoke)
=/ blocked=(qeu blocked-move)
@ -672,8 +674,8 @@
~(get to blocked)
?: ?=(%| -.blocker) $
=/ =move
=/ =sock [attributing.routes our]
=/ card [%slip %g %deal sock dap p.blocker]
=/ =sack [ship.attributing.routes our path.attributing.routes]
=/ card [%slip %g %deal sack dap p.blocker]
[duct card]
$(moves [move moves])
:: +mo-filter-queue: remove all blocked tasks from ship.
@ -696,30 +698,30 @@
new-agents (~(put by new-agents) name.i.agents new-blocked)
==
=^ mov=blocked-move blocked.i.agents ~(get to blocked.i.agents)
=? new-blocked !=(ship attributing.routes.mov)
=? new-blocked !=(ship ship.attributing.routes.mov)
(~(put to new-blocked) mov)
$
:: +mo-idle: put agent to sleep
::
++ mo-idle
|= dap=dude
|= [prov=path dap=dude]
^+ mo-core
=/ yoke=(unit yoke) (~(get by yokes.state) dap)
?: |(?=(~ yoke) ?=(%nuke -.u.yoke))
~> %slog.0^leaf/"gall: ignoring %idle for {<dap>}, not running"
mo-core
ap-abet:ap-idle:(ap-abed:ap dap `our)
ap-abet:ap-idle:(ap-abed:ap dap [~ our prov])
:: +mo-nuke: delete agent completely
::
++ mo-nuke
|= dap=dude
|= [prov=path dap=dude]
^+ mo-core
=/ yoke=(unit yoke) (~(get by yokes.state) dap)
?: |(?=(~ yoke) ?=(%nuke -.u.yoke))
~> %slog.0^leaf/"gall: ignoring %nuke for {<dap>}, not running"
mo-core
~> %slog.0^leaf/"gall: nuking {<dap>}"
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap [~ our prov])
=- mo-core(yokes.state -)
%+ ~(jab by yokes.state) dap
|= =^yoke
@ -731,13 +733,13 @@
:: +mo-load: install agents
::
++ mo-load
|= agents=(list [=dude =beak =agent])
|= [prov=path agents=(list [=dude =beak =agent])]
=. mo-core
|- ^+ mo-core
?~ agents mo-core
=/ [=dude =desk] [dude q.beak]:i.agents
:: ~> %slog.0^leaf/"gall: starting {<dude>} on {<desk>}"
$(agents t.agents, mo-core (mo-receive-core i.agents))
$(agents t.agents, mo-core (mo-receive-core prov i.agents))
::
=/ kil
=/ lol
@ -749,7 +751,7 @@
|- ^+ mo-core
?~ kil mo-core
~> %slog.0^leaf/"gall: stopping {<i.kil>}"
$(kil t.kil, mo-core (mo-idle i.kil))
$(kil t.kil, mo-core (mo-idle prov i.kil))
:: +mo-peek: call to +ap-peek (which is not accessible outside of +mo).
::
++ mo-peek
@ -776,7 +778,7 @@
=/ =case da+now
=/ yok (~(got by yokes.state) dap)
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
=/ sky (rof ~ %cb [our desk case] /[mark.deal])
=/ sky (rof ~ /gall %cb [our desk case] /[mark.deal])
?- sky
?(~ [~ ~])
=/ ror "gall: raw-poke fail :{(trip dap)} {<mark.deal>}"
@ -800,7 +802,7 @@
=/ mars-path /[a.mars]/[b.mars]
=/ yok (~(got by yokes.state) dap)
=/ =desk q.beak:?>(?=(%live -.yok) yok) ::TODO acceptable assertion?
=/ sky (rof ~ %cc [our desk case] mars-path)
=/ sky (rof ~ /gall %cc [our desk case] mars-path)
?- sky
?(~ [~ ~])
=/ ror "gall: poke cast fail :{(trip dap)} {<mars>}"
@ -831,10 +833,10 @@
:: +deal. Otherwise simply apply the action to the agent.
::
++ mo-handle-local
|= [=ship agent=term =deal]
|= [prov=path =ship agent=term =deal]
^+ mo-core
::
=/ =routes [disclosing=~ attributing=ship]
=/ =routes [disclosing=~ attributing=[ship prov]]
=/ running (~(get by yokes.state) agent)
=/ is-running &(?=([~ %live *] running) ?=(%& -.agent.u.running))
=/ is-blocked (~(has by blocked.state) agent)
@ -880,7 +882,7 @@
%s [%watch path.ames-request]
%u [%leave ~]
==
(mo-pass wire %g %deal [ship our] agent-name deal)
(mo-pass wire %g %deal [ship our /] agent-name deal)
:: +mo-spew: handle request to set verbosity toggles on debug output
::
++ mo-spew
@ -1119,7 +1121,7 @@
=/ =case da+now
=/ bek=beak [our q.beak.yoke case]
=/ mars-path /[a.mars]/[b.mars]
=/ sky (rof ~ %cc bek mars-path)
=/ sky (rof ~ /gall %cc bek mars-path)
?- sky
?(~ [~ ~])
%- (slog leaf+"watch-as fact conversion find-fail" >sky< ~)
@ -1153,14 +1155,21 @@
?- -.neet
%agent [%out (scot %p ship.neet) name.neet wire]
%huck [%out (scot %p ship.neet) name.neet wire]
%arvo [(scot %p attributing.agent-routes) wire]
%arvo [(scot %p ship.attributing.agent-routes) wire]
==
::
=/ =note-arvo
=/ prov=path /gall/[agent-name]
?- -.neet
%arvo +.neet
%arvo ?. ?=([%l *] +.neet)
+.neet
?+ +.neet
~|(%nope !!)
[%l ?(%spin %shut) *] +.neet(name [agent-name name.+.neet])
[%l %spit *] +.neet(name [agent-name name.+.neet])
==
%huck note-arvo.neet
%agent [%g %deal [our ship.neet] [name task]:neet]
%agent [%g %deal [our ship.neet prov] [name task]:neet]
==
[duct %pass wire note-arvo]~
==
@ -1292,7 +1301,7 @@
=/ tub=(unit tube:clay)
?: =(have want) `(bake same ^vase)
=/ tuc=(unit (unit cage))
(rof ~ %cc [our q.beak.yoke da+now] /[have]/[want])
(rof ~ /gall %cc [our q.beak.yoke da+now] /[have]/[want])
?. ?=([~ ~ *] tuc) ~
`!<(tube:clay q.u.u.tuc)
?~ tub
@ -1321,8 +1330,9 @@
++ ap-construct-bowl
^- bowl
:* :* our :: host
attributing.agent-routes :: guest
ship.attributing.agent-routes :: guest
agent-name :: agent
path.attributing.agent-routes :: provenance
== ::
:* wex=boat.yoke :: outgoing
sup=bitt.yoke :: incoming
@ -1367,7 +1377,7 @@
~/ %ap-subscribe
|= pax=path
^+ ap-core
=/ incoming [attributing.agent-routes pax]
=/ incoming [ship.attributing.agent-routes pax]
=. bitt.yoke (~(put by bitt.yoke) agent-duct incoming)
=^ maybe-tang ap-core
%+ ap-ingest %watch-ack |.
@ -1401,6 +1411,15 @@
~/ %ap-generic-take
|= [=wire =sign-arvo]
^+ ap-core
=? sign-arvo ?=([%lick *] sign-arvo)
?+ sign-arvo
~|(%nope !!)
::
[%lick %soak *]
=- sign-arvo(name -)
?> &(?=(^ name.sign-arvo) =(agent-name i.name.sign-arvo))
t.name.sign-arvo
==
=^ maybe-tang ap-core
%+ ap-ingest ~ |.
(on-arvo:ap-agent-core wire sign-arvo)
@ -1429,7 +1448,7 @@
?: ?=(%spider agent-name)
:- [%fact mark.unto !>(noun.unto)]
ap-core
=/ sky (rof ~ %cb [our q.beak.yoke case] /[mark.unto])
=/ sky (rof ~ /gall %cb [our q.beak.yoke case] /[mark.unto])
?. ?=([~ ~ *] sky)
(mean leaf+"gall: ames mark fail {<mark.unto>}" ~)
::
@ -1611,7 +1630,8 @@
|= =duct
^- (list move)
::
:~ [duct %slip %g %deal [our our] agent-name %leave ~]
=/ =sack [our our /gall/[agent-name]]
:~ [duct %slip %g %deal sack agent-name %leave ~]
[duct %give %unto %kick ~]
==
:: +ap-kill-down: 2-sided kill from subscriber side
@ -1683,7 +1703,7 @@
++ scry-peer-state
|= her=ship
~+ ^- (unit peer-state:ames)
=/ sky (rof [~ ~] %ax [our %$ da+now] /peers/(scot %p her))
=/ sky (rof [~ ~] /gall %ax [our %$ da+now] /peers/(scot %p her))
?: |(?=(~ sky) ?=(~ u.sky))
~
=/ sat !<(ship-state:ames q.u.u.sky)
@ -1700,7 +1720,7 @@
++ ap-mule
|= run=_^?(|.(*step:agent))
^- (each step:agent tang)
=/ res (mock [run %9 2 %0 1] (look rof ~))
=/ res (mock [run %9 2 %0 1] (look rof ~ /gall/[agent-name]))
?- -.res
%0 [%& !<(step:agent [-:!>(*step:agent) p.res])]
%1 [%| (smyt ;;(path p.res)) ~]
@ -1711,7 +1731,7 @@
++ ap-mule-peek
|= run=_^?(|.(*(unit (unit cage))))
^- (each (unit (unit cage)) tang)
=/ res (mock [run %9 2 %0 1] (look rof ~))
=/ res (mock [run %9 2 %0 1] (look rof ~ /gall/[agent-name]))
?- -.res
%0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])]
%1 [%| (smyt ;;(path p.res)) ~]
@ -1882,15 +1902,27 @@
::
~| [%gall-call-failed duct hic]
=/ =task ((harden task) hic)
=/ prov=path
?: ?=(%deal -.task)
?.(=(p.p.task our) *path r.p.task)
?. ?& ?=([^ *] duct)
?= $? %ames %behn %clay
%dill %eyre %gall
%iris %jael %khan
==
i.i.duct
==
*path
/[i.i.duct]
::
=/ mo-core (mo-abed:mo duct)
?- -.task
%deal
=/ [=sock =term =deal] [p q r]:task
?. =(q.sock our)
?> =(p.sock our)
mo-abet:(mo-send-foreign-request:mo-core q.sock term deal)
mo-abet:(mo-handle-local:mo-core p.sock term deal)
=/ [=sack =term =deal] [p q r]:task
?. =(q.sack our)
?> =(p.sack our)
mo-abet:(mo-send-foreign-request:mo-core q.sack term deal)
mo-abet:(mo-handle-local:mo-core prov p.sack term deal)
::
%init [~ gall-payload(system-duct.state duct)]
%plea
@ -1909,11 +1941,11 @@
::
%sear mo-abet:(mo-filter-queue:mo-core ship.task)
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
%idle mo-abet:(mo-idle:mo-core dude.task)
%load mo-abet:(mo-load:mo-core +.task)
%nuke mo-abet:(mo-nuke:mo-core dude.task)
%doff mo-abet:(mo-doff:mo-core +.task)
%rake mo-abet:(mo-rake:mo-core +.task)
%idle mo-abet:(mo-idle:mo-core prov dude.task)
%load mo-abet:(mo-load:mo-core prov +.task)
%nuke mo-abet:(mo-nuke:mo-core prov dude.task)
%doff mo-abet:(mo-doff:mo-core prov +.task)
%rake mo-abet:(mo-rake:mo-core prov +.task)
%spew mo-abet:(mo-spew:mo-core veb.task)
%sift mo-abet:(mo-sift:mo-core dudes.task)
%trim [~ gall-payload]
@ -1929,17 +1961,33 @@
=? old ?=(%10 -.old) (spore-10-to-11 old)
=? old ?=(%11 -.old) (spore-11-to-12 old)
=? old ?=(%12 -.old) (spore-12-to-13 old)
?> ?=(%13 -.old)
=? old ?=(%13 -.old) (spore-13-to-14 old)
?> ?=(%14 -.old)
gall-payload(state old)
::
+$ spore-any $%(spore spore-7 spore-8 spore-9 spore-10 spore-11 spore-12)
+$ spore-any
$%(spore spore-7 spore-8 spore-9 spore-10 spore-11 spore-12 spore-13)
+$ spore-13
$: %13
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg)
blocked=(map term (qeu blocked-move-13))
=bug
==
+$ blocked-move-13 [=duct routes=routes-13 move=(each deal unto)]
+$ routes-13
$: disclosing=(unit (set ship))
attributing=ship
==
+$ spore-12
$: %12
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg-12)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
=bug
==
+$ egg-12
@ -1964,7 +2012,7 @@
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg-11)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
=bug
==
+$ egg-11
@ -1986,7 +2034,7 @@
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
=bug
==
+$ egg-10
@ -2008,7 +2056,7 @@
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
=bug
==
::
@ -2020,7 +2068,7 @@
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
==
+$ egg-8
$: control-duct=duct
@ -2041,7 +2089,7 @@
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
blocked=(map term (qeu blocked-move-13))
==
::
++ spore-7-to-8
@ -2123,7 +2171,7 @@
::
++ spore-12-to-13
|= old=spore-12
^- spore
^- spore-13
%= old
- %13
eggs
@ -2133,13 +2181,32 @@
?: ?=(%nuke -.e) e
e(sky [sky.e ken:*$>(%live egg)])
==
:: added provenance path to routes
::
++ spore-13-to-14
|= old=spore-13
^- spore
%= old
- %14
blocked
^- (map term (qeu blocked-move))
%- ~(run by blocked.old)
|= q=(qeu blocked-move-13)
%- ~(gas to *(qeu blocked-move))
%+ turn ~(tap to q)
|= blocked=blocked-move-13
^- blocked-move
%= blocked
attributing.routes [ship=attributing.routes.blocked path=/]
==
==
--
:: +scry: standard scry
::
++ scry
~/ %gall-scry
^- roon
|= [lyc=gang care=term bem=beam]
|= [lyc=gang pov=path care=term bem=beam]
^- (unit (unit cage))
=* ship p.bem
=* dap q.bem
@ -2157,7 +2224,7 @@
== ~
?. (~(has by yokes.state) dap) [~ ~]
?. ?=(^ path) ~
=/ =routes [~ ship]
=/ =routes [~ ship pov]
(mo-peek:mo & dap routes care path)
::
=> .(path t.path)
@ -2248,7 +2315,7 @@
|= [dap=term =yoke]
^- mass
=/ met=(list mass)
=/ dat (mo-peek:mo | dap [~ ship] %x /whey/mass)
=/ dat (mo-peek:mo | dap [~ ship pov] %x /whey/mass)
?: ?=(?(~ [~ ~]) dat) ~
(fall ((soft (list mass)) q.q.u.u.dat) ~)
?~ met

View File

@ -385,7 +385,7 @@
::
++ scry
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
=* ren car
=* why=shop &/p.bem

View File

@ -199,7 +199,7 @@
/[app]/poke
%g
%deal
[our our]
[our our /jael]
app
%poke
%azimuth-poke
@ -635,7 +635,7 @@
[app path]
%g
%deal
[our our]
[our our /jael]
app
%watch
path
@ -1055,7 +1055,7 @@
:: :: ++scry
++ scry :: inspect
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
=* ren car
=* why=shop &/p.bem

View File

@ -43,7 +43,7 @@
=> |% :: %khan types
+$ move [p=duct q=(wite note gift)] ::
+$ note :: out request $->
$~ [%g %deal *sock *term *deal:gall] ::
$~ [%g %deal *sack *term *deal:gall] ::
$% $: %g :: to %gall
$>(%deal task:gall) :: full transmission
== ::
@ -72,7 +72,7 @@
++ get-dais
|= [=beak =mark rof=roof]
^- dais:clay
?~ ret=(rof ~ %cb beak /[mark])
?~ ret=(rof ~ /khan %cb beak /[mark])
~|(mark-unknown+mark !!)
?~ u.ret
~|(mark-invalid+mark !!)
@ -82,7 +82,7 @@
++ get-tube
|= [=beak =mark =out=mark rof=roof]
^- tube:clay
?~ ret=(rof ~ %cc beak /[mark]/[out-mark])
?~ ret=(rof ~ /khan %cc beak /[mark]/[out-mark])
~|(tube-unknown+[mark out-mark] !!)
?~ u.ret
~|(tube-invalid+[mark out-mark] !!)
@ -105,12 +105,12 @@
++ poke-spider
|= [hen=duct =cage]
^- move
[hen %pass //g %g %deal [our our] %spider %poke cage]
[hen %pass //g %g %deal [our our /khan] %spider %poke cage]
::
++ watch-spider
|= [hen=duct =path]
^- move
[hen %pass //g %g %deal [our our] %spider %watch path]
[hen %pass //g %g %deal [our our /khan] %spider %watch path]
--
=| khan-state
=* state -
@ -173,7 +173,7 @@
::
++ scry
^- roon
|= [lyc=gang car=term bem=beam]
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
~
++ stay state

133
pkg/arvo/sys/vane/lick.hoon Normal file
View File

@ -0,0 +1,133 @@
:: %lick
!:
!? 164
::
=, lick
|= our=ship
=> |%
+$ move [p=duct q=(wite note gift)]
+$ note ~ :: out request $->
+$ sign ~
::
+$ lick-state
$: %0
unix-duct=duct
owners=(map name duct)
==
::
+$ name path
--
::
~% %lick ..part ~
::
=| lick-state
=* state -
|= [now=@da eny=@uvJ rof=roof]
=* lick-gate .
^?
|%
:: +register: Create a move to register an agent with vere
::
++ register
|= =name
^- move
[unix-duct.state %give [%spin name]]
:: +disconnect: Create Move to send a disconnect soak to am agent
::
++ disconnect
|= =name
^- move
=/ =duct (~(get by owners) name)
[+.duct %give [%soak name %disconnect ~]]
:: +call: handle a +task:lick request
::
++ call
|= $: hen=duct
dud=(unit goof)
wrapped-task=(hobo task)
==
^- [(list move) _lick-gate]
::
=/ =task ((harden task) wrapped-task)
?+ -.task [~ lick-gate]
%born :: need to register devices with vere and send disconnect soak
:- %+ weld
(turn ~(tap in ~(key by owners.state)) register)
(turn ~(tap in ~(key by owners.state)) disconnect)
lick-gate(unix-duct hen)
::
%spin :: A gall agent wants to spin a communication line
:- ~[(register name.task)]
lick-gate(owners (~(put by owners) name.task hen))
::
%shut :: shut down a communication line
:- [unix-duct.state %give [%shut name.task]]~
lick-gate(owners (~(del by owners) name.task))
::
%soak :: push a soak to the ipc's owner
=/ ner=duct (~(get by owners.state) name.task)
:_ lick-gate
[+.ner %give [%soak name.task mark.task noun.task]]~
::
%spit :: push a spit to ipc
:_ lick-gate
[unix-duct.state %give [%spit name.task mark.task noun.task]]~
==
:: +load: migrate an old state to a new lick version
::
++ load
|= old=lick-state
^+ lick-gate
lick-gate(state old)
:: +scry: view state
::
:: %a scry out a list of all ipc ports
:: %d get the owner of an ipc port
++ scry
^- roon
|= [lyc=gang pov=path car=term bem=beam]
^- (unit (unit cage))
|^
:: only respond for the local identity, current timestamp
::
?. ?& =(our p.bem)
=(%$ q.bem)
=([%da now] r.bem)
==
~
?+ car ~
%a read-a
%d read-d
%u read-u
==
:: +read-a: scry our list of ports
::
++ read-a
^- (unit (unit cage))
=/ ports=(list name) ~(tap in ~(key by owners))
``[%noun !>(ports)]
:: +read d: get ports owner
::
++ read-d
^- (unit (unit cage))
=/ devs=(unit duct) (~(get by owners) s.bem)
?~ devs [~ ~]
``[%noun !>(devs)]
:: +read u: does a port exist
::
++ read-u
^- (unit (unit cage))
``[%noun !>((~(has by owners) s.bem))]
::
--
::
++ stay
state
++ take
|= [tea=wire hen=duct dud=(unit goof) hin=sign]
^- [(list move) _lick-gate]
?^ dud
~|(%lick-take-dud (mean tang.u.dud))
::
[~ lick-gate]
--

View File

@ -4,7 +4,7 @@
=> ..lull
~% %zuse ..part ~
|%
++ zuse %413
++ zuse %412
:: :: ::
:::: :: :: (2) engines
:: :: ::
@ -3319,6 +3319,7 @@
~% %leer ..part ~
|= txt=cord
^- wain
?~ txt ~
=/ len=@ (met 3 txt)
=/ cut =+(cut -(a 3, c 1, d txt))
=/ sub sub
@ -4695,22 +4696,6 @@
4
-- ::de
-- ::json
:: +en-json:html: encode json to tape
::
:: XX: deprecated; use +en:json:html
::
++ en-json
|= jon=^json
^- tape
(trip (en:json jon))
:: +de-json:html: parse cord to (unit json)
::
:: XX: deprecated; use +de:json:html
::
++ de-json
|= txt=cord
^- (unit ^json)
(de:json txt)
:: :: ++en-xml:html
++ en-xml :: xml printer
=< |=(a=manx `tape`(apex a ~))
@ -5265,10 +5250,10 @@
::
=> |%
++ sein
|= [rof=roof our=ship now=@da who=ship]
|= [rof=roof pov=path our=ship now=@da who=ship]
;; ship
=< q.q %- need %- need
(rof ~ %j `beam`[[our %sein %da now] /(scot %p who)])
(rof ~ pov %j `beam`[[our %sein %da now] /(scot %p who)])
--
:: middle core: stateless queries for default numeric sponsorship
::

View File

@ -1,390 +0,0 @@
:: naive-csv: produces csv file containing L2 transaction data
::
:: takes in the network to use and the ethereum node url to grab data from.
:: it starts with the azimuth snapshot and scries the logs from %azimuth.
:: it then produces a csv file containing the following data on L2
:: transactions:
::
:: - block number
:: - timestamp
:: - roller address
:: - roll hash
:: - tx hash
:: - sending ship
:: - sending proxy
:: - nonce
:: - gas price
:: - length of input data
:: - success or failure
:: - function name
:: - spawning ship (^sein:title)
::
:: A lot of the data-scrounging here is stuff that %roller already keeps track
:: of. We could just scry it from there, but then this thread needs to be run
:: on the roller ship. So we rebuild the list of historical transactions
:: ourselves so that this can run from any ship.
::
/- dice,
spider
::
/+ dice,
ethereum,
ethio,
naive,
naive-tx=naive-transactions,
*strandio
::
=, strand=strand:spider
=, jael
::
^- thread:spider
=< process-logs
=>
|%
:: imported logs is cast as $events
+$ events (list event-log:rpc:ethereum)
+$ address address:naive :: @ux
+$ keccak @ux :: used for transaction and roll hashes
+$ blocknum number:block :: @udblocknumber
+$ net net:dice :: ?(%mainnet %goerli %local %default)
+$ roll-dat :: all data required for each roll
[[gas=@ud sender=address] =effects:naive]
+$ block-dat :: all data required for each block
[timestamp=@da rolls=(map keccak roll-dat)]
+$ block-map (map blocknum block-dat)
+$ rolls-map (map blocknum (map keccak effects:naive))
::
+$ action
$? %transfer-point
%spawn
%configure-keys
%escape
%cancel-escape
%adopt
%reject
%detach
%set-management-proxy
%set-spawn-proxy
%set-transfer-proxy
==
::
+$ tx-data
$: =blocknum
timestamp=@da
roller=address
roll-hash=keccak
tx-hash=keccak
sender=ship
proxy=proxy:naive
nonce=nonce:naive
gas=@ud
length=@ux
suc=?
=action
parent=ship
==
--
::
|%
:: +process-logs is the main process. it grabs the azimuth snapshop, runs
:: +naive on the logs, grabs the timestamps and gas costs for each roll,
:: then flattens them into a list of $tx-data and saves them to disk.
::
++ process-logs
|= arg=vase
=+ !<([~ =net node-url=@t] arg)
=/ pax=path /naive-exports/csv :: data will be saved here
=/ m (strand ,vase)
^- form:m
;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ [naive-contract=address chain-id=@]
[naive chain-id]:(get-network:dice net)
;< =bowl:spider bind:m get-bowl
=/ snap=snap-state:dice
.^ snap-state:dice %gx
/(scot %p our.bowl)/azimuth/(scot %da now.bowl)/last-snap/noun
==
::
;< ~ bind:m
%- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs "
"with {<(lent events)>} events"
=/ =rolls-map
(compute-effects nas.snap events net naive-contract chain-id)
;< ~ bind:m (flog-text "naive-csv: getting timestamps")
;< tim=thread-result bind:m
%+ await-thread %eth-get-timestamps
!>([node-url ~(tap in ~(key by rolls-map))])
=/ timestamps %- ~(gas by *(map blocknum @da))
?- tim
[%.y *] ;;((list [@ud @da]) q.p.tim)
[%.n *]
=> (mean 'naive-csv: %eth-get-timestamps failed' p.tim)
!!
==
;< ~ bind:m (flog-text "naive-csv: got timestamps")
;< ~ bind:m (flog-text "naive-csv: getting tx receipts")
;< gaz=thread-result bind:m
%+ await-thread %eth-get-tx-receipts
!>([node-url (get-roll-hashes rolls-map)])
=/ gas-sender %- ~(gas by *(map keccak [gas=@ud sender=address]))
?- gaz
[%.y *] (parse-gas-sender ;;((list [@t json]) q.p.gaz))
[%.n *]
=> (mean 'naive-csv: %eth-tx-receipts failed' p.gaz)
!!
==
;< ~ bind:m (flog-text "naive-csv: got tx receipts")
=/ csv=(list cord)
(make-csv (flatten (collate-roll-data rolls-map timestamps gas-sender)))
;< ~ bind:m (export-csv csv pax)
;< ~ bind:m (flog-text :(weld "naive-csv: csv saved to %" (spud pax) "/"))
::
(pure:m !>(~))
:: +collate-roll-data throws naive:effects, timestamps, and gas costs into
:: one $block-map
::
++ collate-roll-data
|= $: =rolls-map
timestamps=(map blocknum @da)
roll-receipts=(map keccak [gas=@ud sender=address])
==
=/ blocknums=(list blocknum) ~(tap in ~(key by rolls-map))
=| =block-map
^+ block-map
|-
?~ blocknums block-map
=/ =blocknum i.blocknums
=/ rolls=(map keccak [[gas=@ud sender=address] =effects:naive])
%- ~(gas by *(map keccak [[gas=@ud sender=address] =effects:naive]))
%+ turn ~(tap in ~(key by (~(got by rolls-map) blocknum)))
|= txh=keccak
:+ txh
(~(got by roll-receipts) txh)
(~(got by (~(got by rolls-map) blocknum)) txh)
%= $
blocknums t.blocknums
block-map %+ ~(put by block-map)
blocknum
[(~(got by timestamps) blocknum) rolls]
==
:: +flatten takes a $block-map and creates a $tx-data for every transaction
:: in every roll, returned as a (list tx-data)
::
++ flatten
|= =block-map
=/ blocks=(list [blocknum block-dat]) ~(tap by block-map)
=| tx-list=(list tx-data)
^+ tx-list
:: recurse through the list of blocks, getting the rolls submitted in that
:: block, their timestamp, and the gas price of that roll
::
|-
=* block-loop $
?~ blocks tx-list
=/ block=[=blocknum =block-dat] i.blocks
=/ roll-list=(list [=keccak =roll-dat]) ~(tap by rolls.block-dat.block)
=| block-tx-list=(list tx-data)
:: recurse through each roll, getting the transaction data from the effects
::
|-
=* roll-loop $
?~ roll-list
%= block-loop
blocks t.blocks
tx-list (welp tx-list block-tx-list)
==
=/ roll=[=keccak =roll-dat] i.roll-list
:: recurse through the list of effects, building up transaction data as we
:: go. there's a choice here to use the effects, or the submitted
:: raw-tx. the effects include whether or not a transaction failed,
:: which is important data not a part of the submitted raw-tx. we
:: could determine this ourselves, but we build the effects anyways when
:: computing the state transitions, so we may as well use them.
::
:: an individual transaction results in up to 3 diffs: a %nonce, a %tx, and
:: a %point. they always appear in this order. successful transactions
:: always have all 3, while failed transactions only have %nonce and %tx.
:: note that the nonce listed is always the expected nonce - we can't know
:: what nonce was actually submitted without the private key of the signer.
::
=| roll-tx-list=(list tx-data)
=| =tx-data
=| nonce-and-tx=[_| _|]
|-
=* effect-loop $
:: if we are processing a new transaction, initialize the parts of tx-data
:: that are identical for every transaction in the roll
=? tx-data =([| |] nonce-and-tx)
:* blocknum.block timestamp.block-dat.block sender.roll-dat.roll
keccak.roll *keccak *ship *proxy:naive *nonce:naive
gas.roll-dat.roll *@ | *action *ship
==
:: if we've gotten both the %nonce and %tx diff from a transaction, add the
:: tx-data to the list of tx for the roll
::
?: =([& &] nonce-and-tx)
%= effect-loop
nonce-and-tx [| |]
roll-tx-list (snoc roll-tx-list tx-data)
==
:: if we've finished looping through the effects, add the tx list from the
:: roll to the list of tx for the block
::
?~ effects.roll-dat.roll
%= roll-loop
roll-list t.roll-list
block-tx-list (welp block-tx-list roll-tx-list)
==
::
=/ =diff:naive i.effects.roll-dat.roll
:: we ignore %operator, %dns, %point diffs
::
?+ diff
$(effects.roll-dat.roll t.effects.roll-dat.roll)
:: %nonce is always the first diff from a given transaction.
::
[%nonce *]
%= effect-loop
-.nonce-and-tx &
sender.tx-data ship.diff
nonce.tx-data nonce.diff
proxy.tx-data proxy.diff
parent.tx-data (^sein:title ship.diff)
effects.roll-dat.roll t.effects.roll-dat.roll
==
:: %tx is always the second diff from a given transaction.
::
[%tx *]
%= effect-loop
+.nonce-and-tx &
effects.roll-dat.roll t.effects.roll-dat.roll
action.tx-data +<.tx.raw-tx.diff
suc.tx-data ?~ err.diff & |
length.tx-data `@`-.raw.raw-tx.diff
tx-hash.tx-data (hash-raw-tx:naive-tx raw-tx.diff)
==
==
::
++ parse-gas-sender
|= res=(list [@t json])
^- (list [=keccak [gas=@ud sender=address]])
%+ turn res
|= [id=@t =json]
^- [=keccak [gas=@ud sender=address]]
:- (hex-to-num:ethereum id)
:- %- parse-hex-result:rpc:ethereum
~| json
?> ?=(%o -.json)
(~(got by p.json) 'effectiveGasPrice') :: gas used in wei
%- parse-hex-result:rpc:ethereum
~| json
?> ?=(%o -.json)
(~(got by p.json) 'from')
:: +get-roll-hashes makes a list of hashes of all transactions from $rolls-map
::
++ get-roll-hashes
|= =rolls-map ^- (list keccak)
%- zing
%+ turn ~(val by rolls-map)
|= a=(map keccak effects:naive)
~(tap in ~(key by a))
:: +compute-effects calls +naive to compute the state transitions for all
:: logs, but it returns a map that only has the effects for L2 transactions,
:: leaving out L1 transactions. we need to compute all of them in order to
:: determine whether the transactions were valid.
::
++ compute-effects
|= $: nas=^state:naive
=events
=net
naive-contract=address
chain-id=@ud
==
=| out=rolls-map
^+ out
::
|-
?~ events out
=/ log=event-log:rpc:ethereum i.events
?~ mined.log
~& >> 'naive-csv: empty log'
$(events t.events)
=/ =blocknum block-number.u.mined.log
=/ =^input:naive
:- blocknum
?. =(naive-contract address.log)
:- %log
[address.log (data-to-hex:dice data.log) topics.log]
?~ input.u.mined.log
~& >> 'naive-csv: empty L2 transaction'
[%bat *@]
[%bat u.input.u.mined.log]
=^ =effects:naive nas
(%*(. naive lac |) verifier:naive-tx chain-id nas input)
%= $
events t.events
out ?. =(%bat +<.input)
out :: skip L1 logs
=/ cur (~(get by out) blocknum)
?~ cur
%+ ~(put by out) blocknum
(my [[transaction-hash.u.mined.log effects]~])
%+ ~(put by out) blocknum
(~(put by u.cur) transaction-hash.u.mined.log effects)
==
:: +export-csv writes a (list cord) as csv to disk at .pax
::
++ export-csv
|= [in=(list cord) pax=path]
=/ m (strand ,~)
^- form:m
;< =bowl:spider bind:m get-bowl
=- (send-raw-card %pass / %arvo %c %info -)
%+ foal:space:userlib
;: weld
/(scot %p our.bowl)/base/(scot %da now.bowl)
pax
/(scot %da now.bowl)/txt
==
[%txt !>(in)]
:: +make-csv takes in a (list tx-data) and makes it into a (list cord) to be
:: saved as a csv file
::
++ make-csv
|= in=(list tx-data)
^- (list cord)
:- %- crip
;: weld
"block number,"
"timestamp,"
"roller address,"
"roll hash,"
"tx hash,"
"sending ship,"
"sending proxy,"
"nonce,"
"gas price,"
"length of input data,"
"success or failure,"
"function name,"
"parent"
==
%+ turn in
|= =tx-data
%- crip
;: weld
(scow %ud blocknum.tx-data) ","
(scow %da timestamp.tx-data) ","
(scow %ux roller.tx-data) ","
(scow %ux roll-hash.tx-data) ","
(scow %ux tx-hash.tx-data) ","
(scow %p sender.tx-data) ","
(scow %tas proxy.tx-data) ","
(scow %ud nonce.tx-data) ","
(scow %ud gas.tx-data) ","
(scow %ux length.tx-data) ","
(scow %f suc.tx-data) ","
(scow %tas action.tx-data) ","
(scow %p parent.tx-data)
==
--

View File

@ -4,18 +4,15 @@
|%
+$ vere-update [cur=vere next=(unit vere)]
::
:: parse out the commit suffix for people on pre-release vere
:: these revisions look like /vere/~.2.7-de2d39b
:: we will have better pre-release (pace) handling later
++ parse-current-pace
|= current=vere
^- @t
(snag 1 rev.current)
::
++ parse-current-version
|= current=vere
^- @t
=/ v
%+ rush
(slav %ta (rear rev.current))
;~((glue hep) (star ;~(pose nud dot)) (star aln))
?~ v (slav %ta (rear rev.current))
(crip -.u.v)
(rear rev.current)
::
++ is-equal-version
|= [latest=@t current=vere]
@ -25,14 +22,18 @@
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
;< latest=cord bind:m
(fetch-cord:strandio "https://bootstrap.urbit.org/vere/live/last")
;< =bowl:spider bind:m get-bowl:strandio
=/ cur=vere .^(vere %$ /(scot %p our.bowl)//(scot %da now.bowl)/zen/ver)
=/ pace=tape
?: =('once' (parse-current-pace cur))
"live"
(trip (parse-current-pace cur))
;< latest=cord bind:m
(fetch-cord:strandio "https://bootstrap.urbit.org/vere/{pace}/last")
=/ =vere-update
?: (is-equal-version latest cur)
[cur ~]
=| next=vere
[cur `next(rev /vere/(scot %ta latest))]
[cur `next(rev /vere/(crip pace)/(scot %ta latest))]
%- pure:m
!>(vere-update)

View File

@ -6,11 +6,15 @@
=, mimes:html
|_ mud=@t
++ grow :: convert to
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
++ elem ;style :: convert to %hymn
;- (trip mud)
==
++ hymn ;html:(head:"{elem}" body)
|%
++ mime [/text/css (as-octs mud)] :: convert to %mime
++ hymn :: convert to %hymn
|^ html
++ style ;style
;- (trip mud)
==
++ html ;html:(head:"{style}" body)
--
--
++ grab
|% :: convert from

View File

@ -8,20 +8,7 @@
++ grow :: convert to
|%
++ mime `^mime`[/text/x-hoon (as-octs:mimes:html own)] :: convert to %mime
++ elem :: convert to %html
;div:pre(urb_codemirror "", mode "hoon"):"{(trip own)}"
:: =+ gen-id="src-{<`@ui`(mug own)>}"
:: ;div
:: ;textarea(id "{gen-id}"):"{(trip own)}"
:: ;script:"""
:: CodeMirror.fromTextArea(
:: window[{<gen-id>}],
:: \{lineNumbers:true, readOnly:true}
:: )
:: """
:: ==
++ hymn
:: ;html:(head:title:"Source" "+{elem}")
;html
;head
;title:"Source"

View File

@ -2,14 +2,5 @@
:::: /hoon/htm/mar
::
/? 310
|_ own=manx
::
++ grad %noun
++ grow :: convert to
|%
++ noun own
++ hymn own
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --
/= htm /mar/html
htm

View File

@ -8,10 +8,13 @@
++ grow
|%
++ mime [/application/javascript (as-octs:mimes:html (@t mud))]
++ elem ;script
;- (trip (@t mud))
==
++ hymn ;html:(head:"+{elem}" body)
++ hymn :: convert to %hymn
|^ html
++ script ;script
;- (trip (@t mud))
==
++ html ;html:(head:"{script}" body)
--
--
++ grab
|% :: convert from

View File

@ -16,11 +16,6 @@
%& a+p.result
%| a+[a+[%s '[[output rendering error]]']~]~
==
::
++ elem
=- ;pre:code:"{(of-wall -)}"
^- wall %- zing ^- (list wall)
(turn (flop tan) |=(a=tank (wash 0^160 a)))
--
++ grab :: convert from
|%

View File

@ -18,7 +18,6 @@
=> v=.
|%
++ mime => v [/text/plain (as-octs (of-wain txt))]
++ elem => v ;pre: {(trip (of-wain txt))}
--
++ grad
|%

View File

@ -9,10 +9,6 @@
++ mime [/text/x-unmark (as-octs:mimes:html mud)]
++ txt
(to-wain:format mud)
++ elem
^- manx
=, cram
elm:(static (ream mud))
++ front :: XX performance, types
^- (map term knot)
%- ~(run by inf:(static:cram (ream mud)))

View File

@ -9,10 +9,6 @@
++ mime [/text/x-unmark (as-octs:mimes:html mud)]
++ txt
(to-wain:format mud)
++ elem
^- manx
=, cram
elm:(static (ream mud))
++ front :: XX performance, types
^- (map term knot)
%- ~(run by inf:(static:cram (ream mud)))

View File

@ -1,5 +1,5 @@
::
:::: /hoon/elem/urb/mar
:::: /hoon/urb/mar
::
/? 310
=, mimes:html

View File

@ -0,0 +1,5 @@
::
:::: /hoon/xhtml/mar
::
/= xhtml /mar/html
xhtml

View File

@ -12,7 +12,11 @@ class Store {
commits: [],
bindings: [],
connections: [],
authentication: [],
authentication: {
sessions: [],
visitors: [],
visiting: [],
},
channels: [],
sidebarShown: true
};

View File

@ -21,7 +21,7 @@ export class Eyre extends Component {
const { props } = this;
if (props.bindings.length === 0) this.loadBindings();
if (props.connections.length == 0) this.loadConnections();
if (props.authentication.length == 0) this.loadAuthenticationState();
if (props.authentication.sessions.length == 0) this.loadAuthenticationState();
if (props.channels.length == 0) this.loadChannels();
}
@ -98,6 +98,10 @@ export class Eyre extends Component {
const summary = (<>
{c.session}
<table style={{borderBottom: '1px solid black'}}><tbody>
<tr>
<td class="inter">identity</td>
<td>{c['identity']}</td>
</tr>
<tr>
<td class="inter">connected?</td>
<td>{c.connected
@ -151,10 +155,75 @@ export class Eyre extends Component {
)};
});
const sessionItems = props.authentication.map(s => {
return (<div>
{`${s.cookie} expires ${msToDa(s.expiry)}, uses ${s.channels} channel(s)`}
</div>);
//TODO also make sure column headings get rendered
const sessionItems = props.authentication.sessions.map(s => {
return ({key: s.identity, jsx: (<div class="flex">
<div class="flex-auto" style={{maxWidth: '5em'}}>
{s.cookie.slice(0,6)}
</div>
<div class="flex-auto" style={{width: '40%'}}>
~{s.identity}
</div>
<div class="flex-auto">
{msToDa(s.expiry)}
</div>
<div class="flex-auto">
{s.channels} channel(s)
</div>
<div class="flex-auto">
<form method="post" action="/~/logout?redirect=/~debug/eyre">
<input type="hidden" name="sid" value={s.cookie} />
<button type="submit" name="all">kick</button>
</form>
</div>
</div>)});
});
const visitingItems = props.authentication.visiting.map(v => {
return ({key: '~'+v.who+':'+v.nonce, jsx: (<div class="flex">
<div class="flex-auto">
~{v.who}
</div>
<div class="flex-auto">
{v.nonce}
</div>
<div class="flex-auto">
{ v.goal ? 'pending, will return to '+v.goal :
<form method="post" action="/~/logout?redirect=/~debug/eyre">
logged in since {msToDa(v.made)}
<input type="hidden" name="host" value={'~'+v.who} />
<input type="hidden" name="sid" value={v.nonce} />
<button type="submit" name="eauth">log out</button>
</form>
}
</div>
</div>)});
});
const visitorsItems = props.authentication.visitors.map(v => {
return ({key: v.nonce+':~'+v.ship, jsx: (<div class="flex">
<div class="flex-auto">
{v.nonce}
</div>
<div class="flex-auto">
{v.duct}
</div>
{ v.sesh ? <div class="flex-auto">session: {v.sesh.slice(0,6)}</div> :
<>
<div class="flex-auto">
{v.pend ? 'request pending' : 'no pending request'}
</div>
<div class="flex-auto">
{v.ship}
</div>
<div class="flex-auto">
redirect: {v.last}
</div>
<div class="flex-auto">
{v.toke ? 'token received' : 'no token yet'}
</div>
</> }
</div>)});
});
return (<>
@ -173,15 +242,24 @@ export class Eyre extends Component {
<button onClick={this.loadChannels}>refresh</button>
</SearchableList>
<h4>Cookies</h4>
<h4>Authentication</h4>
<form method="post" action="/~/logout">
<button type="submit">logout self</button>
</form>
<form method="post" action="/~/logout">
<button type="submit" name="all">logout all selves</button>
</form>
<br/>
<button onClick={this.loadAuthenticationState}>refresh</button>
<form method="post" action="/~/logout">
<button type="submit">logout</button>
</form>
<form method="post" action="/~/logout">
<button type="submit" name="all">logout all</button>
</form>
{sessionItems}
<h3>Sessions</h3>
<SearchableList placeholder="identity" items={sessionItems}>
</SearchableList>
<h3>Outgoing eauth</h3>
<SearchableList placeholder="host" items={visitingItems}>
</SearchableList>
<h3>Incoming eauth</h3>
<SearchableList placeholder="visitor" items={visitorsItems}>
</SearchableList>
</>);
}
}

View File

@ -1,21 +0,0 @@
::
:::: /hoon/css/mar
::
/? 310
=, eyre
=, mimes:html
|_ mud=@t
++ grow :: convert to
|% ++ mime [/text/css (as-octs mud)] :: convert to %mime
++ elem ;style :: convert to %hymn
;- (trip mud)
==
++ hymn ;html:(head:"{elem}" body)
--
++ grab
|% :: convert from
++ mime |=([p=mite q=octs] (@t q.q))
++ noun @t :: clam from %noun
--
++ grad %mime
--

1
pkg/landscape/mar/css.hoon Symbolic link
View File

@ -0,0 +1 @@
../../base-dev/mar/css.hoon

View File

@ -1,18 +0,0 @@
::
:::: /hoon/elem/mar
::
/? 310
=, mimes:html
=, html
|_ own=manx
::
++ grad %noun
++ grow :: convert to
|%
++ hymn ;html:(head body:"+{own}") :: convert to %hymn
++ html (crip (en-xml hymn)) :: convert to %html
++ mime [/text/html (as-octs html)] :: convert to %mime
--
++ grab |% :: convert from
++ noun manx :: clam from %noun
-- --

View File

@ -18,5 +18,4 @@
--
++ grab |% :: convert from
++ noun (map knot cord) :: clam from %noun
:: ++ elem ,~
-- --

View File

@ -1,12 +0,0 @@
|_ a=manx
++ grad %noun
++ grab
|%
++ noun manx
--
++ grow
|%
++ htm a
++ noun a
--
--

View File

@ -0,0 +1 @@
../../base-dev/mar/xhtml.hoon

View File

@ -6,7 +6,7 @@
++ kelvin-roof
^- roof
::
|= [lyc=gang vis=view bem=beam]
|= [lyc=gang pov=path vis=view bem=beam]
^- (unit (unit cage))
?> =(s.bem /sys/kelvin)
?+ vis ~
@ -20,7 +20,7 @@
::
++ bex-roof
^- roof
|= [lyc=gang vis=view bem=beam]
|= [lyc=gang pov=path vis=view bem=beam]
^- (unit (unit cage))
?> =(s.bem //some/data/atom)
?+ vis ~

View File

@ -13,7 +13,7 @@
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
:: poke %sub to tell it to subscribe
~& > 'poke %sub to tell it to subscribe'
=/ =task:gall [%deal [~nec ~nec] %sub %poke watch+!>(~bud)]
=/ =task:gall [%deal [~nec ~nec /] %sub %poke watch+!>(~bud)]
=^ t1 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.1 0xdead.beef *roof]
@ -21,7 +21,7 @@
:~ :- ~[/foo] [%give %unto %poke-ack ~]
:- ~[/init]
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud
[%g %deal [~nec ~bud] %pub %watch /foo]
[%g %deal [~nec ~bud /gall/sub] %pub %watch /foo]
== ==
==
:- t1 |. :- %|
@ -31,7 +31,7 @@
%: gall-check-call:v gall.nec
[~1111.1.1 0xdead.beef *roof]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
[%deal [~nec ~bud] %pub %watch /foo]
[%deal [~nec ~bud /] %pub %watch /foo]
:~ :- ~[/init] [%pass /sys/lag %a %heed ~bud]
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~bud ~)]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/1/sub-foo/~bud /init]
@ -86,7 +86,7 @@
:~ :- ~[/init] [%pass /sys/lag %a %heed ~nec]
:- ~[/init] [%pass /sys/era %j %public-keys (sy ~nec ~)]
:- ~[/bone/~nec/0/1 //unix]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud /] %pub %watch /foo]
==
==
:- t5 |. :- %|
@ -96,7 +96,7 @@
%: gall-check-call:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
:- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
[%deal [~nec ~bud] %pub %watch /foo]
[%deal [~nec ~bud /] %pub %watch /foo]
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/1 //unix]
[%give %unto %watch-ack ~]
==
@ -256,7 +256,7 @@
[%gall %unto %kick ~]
:~ :- ~[/init]
:* %pass /use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud
[%g %deal [~nec ~bud] %pub %watch /foo]
[%g %deal [~nec ~bud /gall/sub] %pub %watch /foo]
== ==
==
:- t17 |. :- %|
@ -266,7 +266,7 @@
%: gall-check-call:v gall.nec
[~1111.1.5 0xdead.beef *roof]
:- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
[%deal [~nec ~bud] %pub %watch /foo]
[%deal [~nec ~bud /] %pub %watch /foo]
:~ :- ~[/use/sub/0w1.d6Isf/out/~bud/pub/2/sub-foo/~bud /init]
[%pass /sys/way/~bud/pub %a %plea ~bud %g /ge/pub [%0 %s /foo]]
==
@ -306,7 +306,6 @@
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9000
==
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.5..00.02.00]
==
==
:: publisher ames hears %kick ack
@ -347,7 +346,7 @@
:- ~[/bone/~nec/0/5 //unix]
[%plea ~nec %g /ge/pub [%0 %s /foo]]
:~ :- ~[/bone/~nec/0/5 //unix]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud] %pub %watch /foo]
[%pass /sys/req/~nec/pub %g %deal [~nec ~bud /] %pub %watch /foo]
==
==
:: publisher gall runs :pub's +on-watch, gives ack to self
@ -357,7 +356,7 @@
%: gall-check-call:v gall.bud
[~1111.1.7 0xbeef.dead *roof]
:- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
[%deal [~nec ~bud] %pub %watch /foo]
[%deal [~nec ~bud /] %pub %watch /foo]
:~ :- ~[/sys/req/~nec/pub /bone/~nec/0/5 //unix]
[%give %unto %watch-ack ~]
==
@ -398,7 +397,7 @@
0xb.130c.ab37.ca24.49cd.aecb.23ba.70f1.6f1c.4d00.124e.c9a5.
3413.3843.d81c.47c4.7040.6e62.3700.0200.0132.e1ab.9004
==
:~ :- ~[//unix] [%pass /bone/~nec/0/1 %a %plea ~nec [%a /close ~]]
:~ :- ~[//unix] [%pass /bone/~nec/0/1 %a %deep %cork ~nec 1]
==
==
:- t27 |. :- %|
@ -408,12 +407,12 @@
%: ames-check-call:v ames.bud
[~1111.1.8 0xbeef.dead *roof]
:- ~[/bone/~nec/0/1 //unix]
[%plea ~nec [%a /close ~]]
[%deep %cork ~nec 1]
:~ :- ~[/bone/~nec/0/1 //unix] [%give %done ~]
==
==
:: publisher ames hears cork done from self, sends ack packet
~& > 'publisher ames hears cork done from self, sends ack packet'
:: publisher ames hears cork done from self, sends ack and $cork to self
~& > 'publisher ames hears cork done from self, sends ack and $cork to self'
:- t28 |. :- %|
=^ t29 ames.bud
%: ames-check-take:v ames.bud
@ -474,8 +473,8 @@
[%gall %unto %watch-ack ~]
~
==
:: subscriber ames hears %cork ack
~& > 'subscriber ames hears %cork ack'
:: subscriber ames hears %cork ack, sends $kill to self
~& > 'subscriber ames hears %cork ack, sends $kill to self'
:- t32 |. :- %|
=^ t33 ames.nec
%: ames-check-call:v ames.nec
@ -485,9 +484,24 @@
0x5f.f966.8e00.0449.bdec.9006.c7e5.1237.
1d87.53fe.d7bb.ad00.0100.0223.c6a8.5804
==
[~[/ames] [%pass /pump/~bud/0 %b %rest ~1111.1.5..00.02.00]]~
:~ :- ~[//unix]
[%pass /bone/~bud/0/0 %a %deep %kill ~bud 0]
::
:- ~[/ames]
[%pass /pump/~bud/0 %b %rest ~1111.1.5..00.02.00]
==
==
:- t33 |. :- %&
:: subscriber ames hears $kill from self, deletes the flow
~& > 'subscriber ames hears $kill from self, deletes the flow'
:- t33 |. :- %|
=^ t34 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.10 0xdead.beef *roof]
:- ~[/bone/~bud/0/0 //unix]
[%deep %kill ~bud 0]
~
==
:- t34 |. :- %&
;: weld
%+ expect-eq
!> (sy 0 ~)

View File

@ -205,7 +205,7 @@
:: custom scry handler for +test-fine-response.
:: could be refined further...
::
|= [lyc=gang vis=view bem=beam]
|= [lyc=gang pov=path vis=view bem=beam]
^- (unit (unit cage))
?+ vis ~
%cp
@ -222,7 +222,7 @@
``hoon+!>(dojo)
==
=/ vane-core (vane(rof roof))
(scry:vane-core ~ car bem)
(scry:vane-core ~ / car bem)
::
++ call
|= [vane=_nec =duct =task:ames]
@ -497,13 +497,25 @@
:: ~bud -> nack-trace -> ~nec
::
=^ moves5 nec (call nec ~[//unix] %hear (snag-packet 1 moves3))
:: ~nec -> naxplanation -> ~nec
::
=/ sink-naxplanation-plea
[%deep %sink ~bud bone=0 message-num=1 error]
=^ moves6 nec (call nec ~[//unix] sink-naxplanation-plea)
:: ~nec -> ack nack-trace -> ~bud
::
=^ moves6 bud (call bud ~[//unix] %hear (snag-packet 0 moves5))
=^ moves7 bud (call bud ~[//unix] %hear (snag-packet 0 moves5))
::
%+ expect-eq
!> [~[/g/talk] %give %done `error]
!> (snag 0 `(list move:ames)`moves5)
;: welp
%+ expect-eq
!> [~[/g/talk] %give %done `error]
!> (snag 0 `(list move:ames)`moves6)
::
%+ expect-eq
!> [~[//unix] %pass /bone/~bud/0/0 %a sink-naxplanation-plea]
!> (snag 0 `(list move:ames)`moves5)
::
==
::
++ test-boon-lost ^- tang
:: ~nec -> %plea -> ~bud

File diff suppressed because it is too large Load Diff

View File

@ -76,7 +76,7 @@
%+ expect-eq
!> :* ~[//khan/1/0vthat.ductt]
%pass //g %g %deal
[~nul ~nul] %spider %watch
[~nul ~nul /khan] %spider %watch
/thread-result/[expected-tid]
==
!> (head start-moves)
@ -87,7 +87,7 @@
=* not note.q.mev
=/ results-4 (expect-eq !>(%g) !>(-.not))
?> ?=(%deal +<.not)
=/ results-5 (expect-eq !>([~nul ~nul]) !>(p.not))
=/ results-5 (expect-eq !>([~nul ~nul /khan]) !>(p.not))
=/ results-6 (expect-eq !>(%spider) !>(q.not))
?> ?=(%poke -.r.not)
=* cag cage.r.not
@ -462,7 +462,7 @@
|= =vase
!>(!<(noun vase))
++ scry-provides-mark ^- roof
|= [gang =view =beam]
|= [gang pov=path =view =beam]
^- (unit (unit cage))
?: &(=(%cb view) =(/noun s.beam))
:^ ~ ~ %dais