Merge branch 'master' into m/uplink

This commit is contained in:
Fang 2020-01-07 13:30:55 -08:00
commit 879e45c377
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
152 changed files with 1777 additions and 1990 deletions

View File

@ -1,5 +1,6 @@
b <benjamin@tlon.io>
b <benjamin@tlon.io> <42358674+benjamin-tlon@users.noreply.github.com>
b <benjamin@tlon.io> <benjamin@bsummers.me>
BernardoDeLaPlaz <BernardoDeLaPlaz@users.noreply.github.com> <40804016+BernardoDeLaPlaz@users.noreply.github.com>
BernardoDeLaPlaz <BernardoDeLaPlaz@users.noreply.github.com> <tjic_BernardoDeLaPlaz_github@tjic.com>
Elliot Glaysher <elliot@tlon.io> <glaysher@umich.edu>

View File

@ -5,6 +5,7 @@ install:
- nix-env -iA cachix -f https://cachix.org/api/v1/install
before_install:
- ./sh/test-whitespace
- git lfs pull
script:

View File

@ -281,6 +281,6 @@ Questions or other communications about contributing to Urbit can go to
[mail]: mailto:support@urbit.org
[list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev
[repo]: https://github.com/urbit/urbit
[reba]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing
[reba]: https://git-rebase.io/
[issu]: https://github.com/urbit/urbit/issues
[hoon]: https://urbit.org/docs/learn/hoon/style/

178
MAINTAINERS.md Normal file
View File

@ -0,0 +1,178 @@
# Maintainers' Guide
## Hotfixes
Here lies an informal guide for making hotfix releases and deploying them to
the network.
Take [this recent PR][1], as an example. This constituted a great hotfix.
It's a single commit, targeting a problem that existed on the network at the
time. Here's it should be released and deployed OTA.
[1]: https://github.com/urbit/urbit/pull/2025
### If the thing is acceptable to merge, merge it to master
Unless it's very trivial, it should probably have a single "credible looking"
review from somebody else on it.
You can just merge the PR in GitHub. As I, `~nidsut-tomdun`, am a l33t
h4x0r, I use a custom merge commit format, gotten by:
```
git merge --no-ff --signoff --log BRANCH
```
with the commit message:
```
Merge branch FOO (#PR_NUM)
* FOO:
bar: ...
baz: ...
Signed-off-by: Jared Tobin <jared@tlon.io>
```
All this extra wankery is hardly required, but IMO it's nice to have the
commit log information in the merge commit, which GitHub's "Merge PR" button
doesn't do (at least by default).
The script at `sh/merge-with-custom-message` can be used to make this simple(r)
to do. I use `git mu` as an alias for it, locally.
### Apply the changes to this era's release branch
This corresponds to the 'vx.y' part of the most recent 'urbit vx.y.z' release.
At the time of writing, we're on v0.10 (and I'll use this branch as a running
example):
If the branch doesn't yet exist, just create it via:
```
git checkout -b v0.10 master
```
If you can get away with merging master to v0.10 without pulling in any
superfluous commits, feel free to do that. Otherwise, you'll want to cherry
pick the commits like so:
```
git cherry-pick -x TARGET_COMMITS
```
Use the `-x` flag to `git-cherry-pick`, because this will indicate in the
commit message where the things originally came from.
Create Landscape or alternative pill builds, if or as appropriate (i.e., if
anything in Landscape changed -- don't trust the compiled JS/CSS that's
included in the commit).
You may also want to create a brass pill, in particular, as it's convenient for
tooling to be able to boot directly from a given release.
### Tag the resulting commit
What you should do here depends on the type of release being made.
First, for Arvo releases:
If it's a very trivial hotfix that you know isn't going to break
anything, tag it as `arvo.yyyy.mm.dd`. Use an annotated tag, i.e.
```
git tag -a arvo.yyyy.mm.dd
```
The tag format should look something like this:
```
arvo.yyyy.mm.dd
This release contains Arvo changes that will be pushed to the live
network as an over-the-air update.
Release notes:
[..]
Contributions:
[..]
```
You can get the "contributions" section by the shortlog between the
last release and this release:
```
git log --pretty=short --no-merges \
LAST_RELEASE..v0.10 | git shortlog
```
I originally tried to curate this list somewhat, but now just paste it
verbatim. If it's too noisy, yell at your colleagues to improve their commit
messages.
Try to include a high-level summary of the changes in the "release notes"
section. You should be able to do this by simply looking at the git log and
skimming the commit descriptions (or perhaps copying some of them in verbatim).
If the commit descriptions are too poor to easily do this, then again, yell at
your fellow contributors to make them better in the future.
If it's *not* a trivial hotfix, you should probably make any number of release
candidate tags (e.g. `arvo.yyyy.mm.dd.rc-1`, `arvo.yyyy.mm.dd.rc-2`, ..), test
them, and after you confirm one of them is good, tag the release as
`arvo.yyyy.mm.dd`.
For Vere releases:
Tag the release as `vx.y.z`. The tag format should look something
like this:
```
urbit vx.y.z
This release contains Vere changes, so users should update their
binaries.
This is not a breaching release, so users should not create new
piers.
Release notes:
[..]
Contributions:
[..]
```
The same schpeel re: release candidates applies here.
You should probably avoid putting both Arvo and Vere changes into Vere
releases.
### Deploy the update
For Arvo updates, this means copying the files into ~zod's %base desk. For
consistency, I download the release tarball and then rsync the files in:
```
$ wget https://github.com/urbit/urbit/archive/arvo.yyyy.mm.dd.tar.gz
$ tar xzf arvo.yyyy.mm.dd.tar.gz
$ herb zod -p hood -d "+hood/mount /=base="
$ rsync -zr --delete urbit-arvo.yyyy.mm.dd/pkg/arvo/ zod/base
$ herb zod -p hood -d "+hood/commit %base"
```
For Vere updates, this means shutting down each desired ship, installing the
new binary, and restarting the pier with it.
### Announce the update
Post an announcement to urbit-dev. The tag annotation, basically, is fine here
-- I usually add the %base hash (for Arvo releases) and the release binary URLs
(for Vere releaes). Check the urbit-dev archives for examples of these
announcements.

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:18d492d912068e7fefef48006105d39c1c8f56aa756b7aeae48387c2254c1b91
size 7153239
oid sha256:407a763f44eb91db0dd4a1ec2dbd12ed4332b48decefd3999c4313844daa2c0b
size 7226043

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:04735cc4764f9a3e6c4fb5b046a6b9590664fe9f644578c58f3bc6acc911b723
size 9606039
oid sha256:db17380940f4f10dab139b385cf5f752282e069b290cdb5255c8510e5cc36ea7
size 14122439

View File

@ -74,8 +74,13 @@ rec {
};
image = import ./image {
inherit pkgs urbit;
pill = bootsolid;
inherit pkgs herb urbit solid;
};
image-ropsten = import ./image {
inherit pkgs herb urbit;
brass = brass-ropsten;
ivory = ivory-ropsten;
};
}

View File

@ -1,6 +1,17 @@
{ pkgs, urbit, pill }:
{ pkgs
, herb
, urbit
, solid ? null
, brass ? null
, ivory ? null
}:
pkgs.dockerTools.buildImage {
let
link = pill: path:
if pill == null then ""
else "${pkgs.coreutils}/bin/ln -sf ${pill} ${path}";
in pkgs.dockerTools.buildImage {
name = urbit.meta.name;
runAsRoot = ''
@ -8,23 +19,22 @@ pkgs.dockerTools.buildImage {
set -euo pipefail
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
${pkgs.dockerTools.shadowSetup}
mkdir -p /bin /share /data /tmp
mkdir -p /share /data /tmp
${pkgs.coreutils}/bin/ln -sf ${pill} /share/urbit.pill
${pkgs.coreutils}/bin/ln -sf ${entrypoint} /bin/urbit
${link solid "/share/solid.pill"}
${link brass "/share/brass.pill"}
${link ivory "/share/ivory.pill"}
'';
contents = [ urbit herb ];
config = {
Entrypoint = [ "urbit" ];
Entrypoint = [ urbit.meta.name ];
WorkingDir = "/data";
Env = [ "PATH=/bin" ];
Volumes = {
"/data" = {};
};

View File

@ -256,8 +256,8 @@
%- zing
%+ turn ufs
|= uf=unix-effect
:~ [%give %fact `/effect %aqua-effect !>(`aqua-effect`[ship uf])]
[%give %fact `/effect/[-.q.uf] %aqua-effect !>(`aqua-effect`[ship uf])]
:~ [%give %fact ~[/effect] %aqua-effect !>(`aqua-effect`[ship uf])]
[%give %fact ~[/effect/[-.q.uf]] %aqua-effect !>(`aqua-effect`[ship uf])]
==
::
=. this
@ -265,7 +265,7 @@
%- emit-cards
%+ turn ~(tap by unix-effects)
|= [=ship ufs=(list unix-effect)]
[%give %fact `path %aqua-effects !>(`aqua-effects`[ship (flop ufs)])]
[%give %fact ~[path] %aqua-effects !>(`aqua-effects`[ship (flop ufs)])]
::
=. this
%- emit-cards
@ -275,28 +275,28 @@
=/ =path /effect/(scot %p ship)
%+ turn ufs
|= uf=unix-effect
[%give %fact `path %aqua-effect !>(`aqua-effect`[ship uf])]
[%give %fact ~[path] %aqua-effect !>(`aqua-effect`[ship uf])]
::
=. this
%- emit-cards
%+ turn ~(tap by unix-effects)
|= [=ship ufs=(list unix-effect)]
=/ =path /effects/(scot %p ship)
[%give %fact `path %aqua-effects !>(`aqua-effects`[ship (flop ufs)])]
[%give %fact ~[path] %aqua-effects !>(`aqua-effects`[ship (flop ufs)])]
::
=. this
%- emit-cards
%+ turn ~(tap by unix-events)
|= [=ship ve=(list unix-timed-event)]
=/ =path /events/(scot %p ship)
[%give %fact `path %aqua-events !>(`aqua-events`[ship (flop ve)])]
[%give %fact ~[path] %aqua-events !>(`aqua-events`[ship (flop ve)])]
::
=. this
%- emit-cards
%+ turn ~(tap by unix-boths)
|= [=ship bo=(list unix-both)]
=/ =path /boths/(scot %p ship)
[%give %fact `path %aqua-boths !>(`aqua-boths`[ship (flop bo)])]
[%give %fact ~[path] %aqua-boths !>(`aqua-boths`[ship (flop bo)])]
::
[(flop cards) all-state]
::

View File

@ -57,16 +57,16 @@
`[who id %rift num]
?: =(changed-keys i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=+ ^- [enc=octs aut=octs sut=@ud rev=@ud]
=/ [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.event-log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who id %keys rev sut (pass-from-eth:azimuth enc aut sut)]
?: =(lost-sponsor i.topics.event-log)
=+ ^- [who=@ pos=@]
=/ [who=@ pos=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon ~]
?: =(escape-accepted i.topics.event-log)
=+ ^- [who=@ wer=@]
=/ [who=@ wer=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon `wer]
~& [%bad-topic event-log]
@ -78,8 +78,8 @@
?~ udiffs
~
=/ =path /(scot %p ship.i.udiffs)
:* [%give %fact `/ %azimuth-udiff !>(i.udiffs)]
[%give %fact `path %azimuth-udiff !>(i.udiffs)]
:* [%give %fact ~[/] %azimuth-udiff !>(i.udiffs)]
[%give %fact ~[path] %azimuth-udiff !>(i.udiffs)]
$(udiffs t.udiffs)
==
::
@ -88,7 +88,8 @@
^- card:agent:gall
=/ args=vase !>
:* %watch /[dap]
url.state ~m5 launch:contracts:azimuth
url.state =(%czar (clan:title our)) ~m5
launch:contracts:azimuth
~[azimuth:contracts:azimuth]
(topics whos.state)
==

View File

@ -102,7 +102,7 @@
^- (quip card _this)
=^ cards all-state
?+ mark (on-poke:def mark vase)
%noun (poke-noun:tc mark !<(* vase))
%noun (poke-noun:tc !<(* vase))
%sole-action (poke-sole-action:tc !<(sole-action:sole-sur vase))
==
[cards this]
@ -122,7 +122,7 @@
?- -.sign
%poke-ack [- all-state]:(on-agent:def wire sign)
%watch-ack [- all-state]:(on-agent:def wire sign)
%kick ~& %chat-cli-kicked `all-state
%kick [?:(?=([%chat-store ~] wire) ~[connect:tc] ~) all-state]
%fact
?+ p.cage.sign ~|([%chat-cli-bad-sub-mark wire p.cage.sign] !!)
%chat-update (diff-chat-update:tc wire !<(chat-update q.cage.sign))
@ -141,7 +141,10 @@
|= old=(unit state)
^- (quip card state)
?^ old
[~ u.old]
:_ u.old
?: (~(has by wex.bowl) [/chat-store our-self %chat-store])
~
~[connect]
=^ cards all-state
%_ catch-up
audience [[our-self /] ~ ~]
@ -1041,7 +1044,7 @@
|= fec=sole-effect:sole-sur
^- card
::TODO don't hard-code session id 'drum' here
[%give %fact `/sole/drum %sole-effect !>(fec)]
[%give %fact ~[/sole/drum] %sole-effect !>(fec)]
:: +tab: print tab-complete list
::
++ tab
@ -1352,6 +1355,7 @@
~(glyph tr source)
=/ lis=(list tape)
%+ simple-wrap
~| [%weird-text `@`+.letter]
`tape``(list @)`(tuba (trip +.letter))
(sub wyd (min (div wyd 2) (lent pef)))
=+ lef=(lent pef)
@ -1383,7 +1387,7 @@
|= [txt=tape wid=@ud]
^- (list tape)
?~ txt ~
=+ ^- [end=@ud nex=?]
=/ [end=@ud nex=?]
?: (lte (lent txt) wid) [(lent txt) &]
=+ ace=(find " " (flop (scag +(wid) `tape`txt)))
?~ ace [wid |]

View File

@ -77,7 +77,7 @@
?+ -.sign (on-agent:def wire sign)
%watch-ack
=^ cards state
(watch-ack:cc wire p.sign)
(watch-ack:cc wire p.sign)
[cards this]
::
%kick
@ -186,7 +186,7 @@
:~ (pull-wire [%backlog (weld path.act /0)])
(pull-wire [%mailbox path.act])
(delete-permission [%chat path.act])
[%give %kick `[%mailbox path.act] ~]~
[%give %kick [%mailbox path.act]~ ~]~
==
?. |(=(u.ship src.bol) (team:title our.bol src.bol))
:: if neither ship = source or source = us, do nothing
@ -229,7 +229,7 @@
?: ?&(?=(^ backlog-start) (~(got by allow-history) pas))
(paginate-messages pas u.box u.backlog-start)
~
[%give %kick `[%backlog pax] `src.bol]~
[%give %kick [%backlog pax]~ `src.bol]~
==
::
++ paginate-messages
@ -302,7 +302,7 @@
:: if ship is not permitted, kick their subscription
=/ mail-path
(oust [(dec (lent t.pax)) (lent t.pax)] `(list @t)`t.pax)
[%give %kick `[%mailbox mail-path] `ship]~
[%give %kick [%mailbox mail-path]~ `ship]~
::
++ fact-chat-update
|= [wir=wire fact=chat-update]
@ -327,11 +327,11 @@
::
%message
:_ state
[%give %fact `[%mailbox path.fact] %chat-update !>(fact)]~
[%give %fact [%mailbox path.fact]~ %chat-update !>(fact)]~
::
%messages
:_ state
[%give %fact `[%mailbox path.fact] %chat-update !>(fact)]~
[%give %fact [%mailbox path.fact]~ %chat-update !>(fact)]~
==
::
++ handle-foreign

View File

@ -245,7 +245,7 @@
++ update-subscribers
|= [pax=path update=chat-update]
^- (list card)
[%give %fact `pax %chat-update !>(update)]~
[%give %fact ~[pax] %chat-update !>(update)]~
::
++ send-diff
|= [pax=path upd=chat-update]

View File

@ -137,7 +137,7 @@
==
==
::
++ on-arvo
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=(%bound +<.sign-arvo)
@ -176,7 +176,7 @@
=/ pax t.t.t.t.site.url
=/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax])
%- json-response:gen
%- json-to-octs
%- json-to-octs
%- update-to-json
[%messages pax start end envelopes]
::
@ -239,8 +239,8 @@
^- (list card)
=/ updates-json (update-to-json upd)
=/ configs-json (configs-to-json configs-scry)
:~ [%give %fact `/primary %json !>(updates-json)]
[%give %fact `/configs %json !>(configs-json)]
:~ [%give %fact ~[/primary] %json !>(updates-json)]
[%give %fact ~[/configs] %json !>(configs-json)]
==
::
:: +utilities

View File

@ -12,12 +12,12 @@
<link rel="stylesheet" href="/~chat/css/index.css" />
<link rel="icon" type="image/png" href="/~launch/img/Favicon.png">
<link rel="manifest"
href='data:application/manifest+json,{
"name": "Chat",
"short_name": "Chat",
"description": "A%20Chat%20application%20for%20your%20Urbit%20ship.",
"display": "standalone",
"background_color": "%23FFFFFF",
href='data:application/manifest+json,{
"name": "Chat",
"short_name": "Chat",
"description": "A%20Chat%20application%20for%20your%20Urbit%20ship.",
"display": "standalone",
"background_color": "%23FFFFFF",
"theme_color": "%23000000"}' />
</head>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@
++ give-result
|= [=the=path =cage]
^- card
[%give %fact `the-path cage]
[%give %fact ~[the-path] cage]
--
::
^- agent:gall

View File

@ -538,7 +538,7 @@
$poke
%- he-card(poy ~)
:* %pass
/poke
/poke
%agent
p.p.mad
%poke
@ -830,7 +830,7 @@
++ he-diff :: emit update
|= fec/sole-effect
^+ +>
(he-card %give %fact `/sole/[id] %sole-effect !>(fec))
(he-card %give %fact ~[/sole/[id]] %sole-effect !>(fec))
::
++ he-stop :: abort work
^+ .
@ -968,7 +968,7 @@
++ he-lens
|= com/command:lens
^+ +>
=+ ^- source/dojo-source
=/ source=dojo-source
=| num/@
=- ?. ?=($send-api -.sink.com) :: XX num is incorrect
sor
@ -1109,7 +1109,7 @@
|= pos=@ud
^+ +>
=* res +>
=+ ^- [back-pos=@ud fore-pos=@ud txt=tape]
=/ [back-pos=@ud fore-pos=@ud txt=tape]
(insert-magic:auto (add (lent buf) pos) :(weld buf (tufa buf.say)))
=/ id-len (sub fore-pos back-pos)
=/ fore-pos-diff (sub fore-pos pos)
@ -1141,11 +1141,11 @@
:: If couldn't search (eg cursor not in appropriate position), do
:: nothing.
::
?: ?=(~ tl)
?: ?=(~ tl)
res
:: If no options, ring the bell
::
?: =([~ ~] tl)
?: =([~ ~] tl)
(he-diff %bel ~)
:: If only one option, don't print unless the option is already
:: typed in.

View File

@ -0,0 +1,297 @@
:: eth-sender: utility for signing & sending eth-txs
::
:: usage:
::
:: sign txs for gasses of 2 and 11 gwei; (~ for default gwei set)
:: store at path
:: :eth-sender [%sign %/txs %/txs/eth-txs %/pk/txt ~[2 0]]
::
:: read nonce range from signed transactions at path
:: :eth-sender [%read %txs/txt]
::
:: send all but first 50 txs from path to mainnet,
:: waiting for confirms every 4 txs
:: :eth-sender [%send %/txs/txt 4 `index+50 ~]
::
/+ default-agent, verb
::
|%
++ state-0
$: %0
~
==
::
+$ tx-range
$: how=?(%nonce %index) :: tx nonce / index in file
wat=$@(@ud [start=@ud end=@ud]) :: inclusive. end optional
==
::
+$ command
$% [%sign out=path in=path key=path gweis=(list @ud)]
[%read =path]
::
$: %send
txs=path
step-size=@ud
range=(unit tx-range)
nodes=(list [id=@tas url=@t])
==
==
::
+$ card card:agent:gall
--
::
=| state-0
=* state -
%+ verb |
=<
|_ =bowl:gall
+* this .
do ~(. +> bowl)
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
++ on-save !>(state)
++ on-load on-load:def
::
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?. ?=(%noun mark) [~ this]
=/ =command !<(command vase)
?- -.command
%read
~& (read-transactions:do +.command)
[~ this]
::
%sign
:_ this
(sign-transactions:do +.command)
::
%send
:_ this
(send-transactions:do +.command)
==
::
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?. ?=([%send *] wire)
(on-agent:def wire sign)
?- -.sign
%poke-ack
?~ p.sign
[~ this]
%- (slog leaf+"{(trip dap.bowl)} couldn't start thread" u.p.sign)
:_ this
[(leave-spider:do wire our.bowl)]~
::
%watch-ack
?~ p.sign
[~ this]
=/ =tank leaf+"{(trip dap.bowl)} couldn't start listen to thread"
%- (slog tank u.p.sign)
[~ this]
::
%kick
[~ this]
::
%fact
?+ p.cage.sign (on-agent:def wire sign)
%thread-fail
=+ !<([=term =tang] q.cage.sign)
%- (slog leaf+"{(trip dap.bowl)} failed" leaf+<term> tang)
[~ this]
::
%thread-done
~& ['all submitted to' t.wire]
[~ this]
==
==
::
++ on-peek on-peek:def
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--
::
|_ =bowl:gall
++ poke-spider
|= [=path our=@p =cage]
^- card
[%pass path %agent [our %spider] %poke cage]
::
++ watch-spider
|= [=path our=@p =sub=path]
^- card
[%pass path %agent [our %spider] %watch sub-path]
::
++ leave-spider
|= [=path our=@p]
^- card
[%pass path %agent [our %spider] %leave ~]
::
++ start-txs-send
|= [[node-id=@tas node=@t] step=@ud txs=(list @ux)]
^- (list card)
=/ tid=@ta
:((cury cat 3) dap.bowl '--' node-id '--' (scot %uv eny.bowl))
=/ args
:^ ~ `tid %eth-send-txs
!>([node step txs])
:~ (watch-spider /send/[tid] our.bowl /thread-result/[tid])
(poke-spider /send/[tid] our.bowl %spider-start !>(args))
==
::
::
++ get-file
|= =path
~| path
.^ (list cord)
%cx
(scot %p our.bowl)
%home
(scot %da now.bowl)
path
==
::
++ write-file-wain
|= [=path tox=(list cord)]
^- card
?> ?=([@ desk @ *] path)
=- [%pass [%write path] %arvo %c %info -]
:- i.t.path
=- &+[t.t.t.path -]~
=/ y .^(arch %cy path)
?~ fil.y
ins+txt+!>(tox)
mut+txt+!>(tox)
::
++ write-file-transactions
|= [=path tox=(list transaction:rpc:ethereum)]
^- card
?> ?=([@ desk @ *] path)
=- [%pass [%write path] %arvo %c %info -]
:- i.t.path
=- &+[t.t.t.path -]~
=/ y .^(arch %cy path)
?~ fil.y
ins+eth-txs+!>(tox)
mut+eth-txs+!>(tox)
::
::
++ read-transactions
|= =path
^- tape
=+ tox=.^((list cord) %cx path)
=+ [first last]=(read-nonces tox)
%+ weld
"Found nonces {(scow %ud first)} through {(scow %ud last)}"
" in {(scow %ud (lent tox))} transactions."
::
++ read-nonces
|= tox=(list cord)
|^ ^- [@ud @ud]
?: =(~ tox) ::NOTE tmi
[0 0]
:- (read-nonce (snag 0 tox))
(read-nonce (snag (dec (lent tox)) tox))
::
++ read-nonce
|= tex=cord
^- @ud
%+ snag 0
%- decode-atoms:rlp:ethereum
(tape-to-ux (trip tex))
--
::
::
++ sign-transactions
|= [out=path in=path key=path gasses=(list @ud)]
^- (list card)
%+ turn
?. =(~ gasses) gasses
:: default gwei set
~[4 8 12 20 32]
|= gas=@ud
%+ write-file-wain
:: add gas amount to path
=+ end=(dec (lent out))
=- (weld (scag end out) -)
?: =(0 gas) [(snag end out) /txt]
:_ /txt
(cat 3 (snag end out) (crip '-' ((d-co:co 1) gas)))
::
%- sign
:+ in key
:: modify tx gas if non-zero gwei specified
?: =(0 gas) ~
`(mul gas 1.000.000.000)
::
++ sign
=, rpc:ethereum
|= [in=path key=path gas=(unit @ud)]
^- (list cord)
?> ?=([@ @ @ *] key)
=/ pkf (get-file t.t.t.key)
?> ?=(^ pkf)
=/ pk (rash i.pkf ;~(pfix (jest '0x') hex))
=/ txs .^((list transaction) %cx in)
=/ enumerated
=/ n 1
|- ^- (list [@ud transaction])
?~ txs
~
[[n i.txs] $(n +(n), txs t.txs)]
%+ turn enumerated
|= [n=@ud tx=transaction]
~? =(0 (mod n 100)) [%signing n]
=? gas-price.tx ?=(^ gas) u.gas
(crip '0' 'x' ((x-co:co 0) (sign-transaction:key:ethereum tx pk)))
::
++ send-transactions
|= [=path step=@ud range=(unit tx-range) nodes=(list [id=@tas url=@t])]
^- (list card)
=? nodes =(~ nodes)
:~ geth+'http://eth-mainnet.urbit.org:8545'
==
~& 'loading txs...'
=/ tox=(list cord) .^((list cord) %cx path)
=? tox ?=(^ range)
(txs-in-range tox u.range)
=/ txs=(list @ux)
%+ turn tox
(cork trip tape-to-ux)
~& ['sending txs:' (lent txs)]
%- zing
%+ turn nodes
|= node=[@tas @t]
(start-txs-send node step txs)
::
++ txs-in-range
|= [tox=(list cord) =tx-range]
^+ tox
=* ran wat.tx-range
?- how.tx-range
%index
?@ ran
(slag ran tox)
%+ slag start.ran
(scag end.ran tox)
::
%nonce
=+ [first last]=(read-nonces tox)
?: !=((lent tox) +((sub last first)))
~| ['probably non-contiguous set of transactions' -]
!!
?@ ran
(slag (sub ran first) tox)
%+ slag (sub start.ran first)
(scag (sub +(end.ran) first) tox)
==
::
++ tape-to-ux
|= t=tape
(scan t ;~(pfix (jest '0x') hex))
--

View File

@ -8,7 +8,7 @@
=> |%
+$ card card:agent:gall
+$ app-state
$: %2
$: %3
dogs=(map path watchdog)
==
::
@ -92,17 +92,52 @@
%- (slog leaf+"upgrading eth-watcher from %1" ~)
:_ old-state(- %2)
%+ turn ~(tap by dogs.old-state)
|= [=path dog=watchdog]
|= [=path dog=watchdog-1]
(wait-shortcut path now.bowl)
::
[cards-1 this(state ?>(?=(%2 -.old-state) old-state))]
=? old-state ?=(%2 -.old-state)
%- (slog leaf+"upgrading eth-watcher from %2" ~)
^- app-state
%= old-state
- %3
dogs
%- ~(run by dogs.old-state)
|= dog=watchdog-1
%= dog
-> [| ->.dog]
==
==
::
[cards-1 this(state ?>(?=(%3 -.old-state) old-state))]
::
+$ app-states
$%(app-state-0 app-state-1 app-state)
$%(app-state-0 app-state-1 app-state-2 app-state)
::
+$ app-state-2
$: %2
dogs=(map path watchdog-1)
==
::
+$ app-state-1
$: %1
dogs=(map path watchdog)
dogs=(map path watchdog-1)
==
::
+$ watchdog-1
$: config-1
running=(unit =tid:spider)
=number:block
=pending-logs
=history
blocks=(list block)
==
::
+$ config-1
$: url=@ta
refresh-rate=@dr
from=number:block
contracts=(list address:ethereum)
=topics
==
::
+$ app-state-0
@ -149,12 +184,12 @@
=/ already (~(has by dogs.state) path.poke)
~? &(already restart)
[dap.bowl 'overwriting existing watchdog on' path.poke]
=/ wait-cards
=/ wait-cards=(list card)
?: already
~
[(wait-shortcut path.poke now.bowl) ~]
::
=/ restart-cards
=/ restart-cards=(list card)
=/ dog (~(get by dogs.state) path.poke)
?. ?& restart
?=(^ dog)
@ -162,7 +197,8 @@
==
~
=/ =cage [%spider-stop !>([u.running.u.dog &])]
[%pass [%starting path] %agent [our.bowl %spider] %poke cage]
:_ ~
`card`[%pass [%starting path.poke] %agent [our.bowl %spider] %poke cage]
=/ new-dog
=/ dog=watchdog
?: restart *watchdog
@ -172,7 +208,7 @@
number from.config.poke
==
=. dogs.state (~(put by dogs.state) path.poke new-dog)
[wait-cards this]
[(weld wait-cards restart-cards) this]
::
%clear
=. dogs.state (~(del by dogs.state) path.poke)
@ -217,6 +253,9 @@
::
[%x %dogs ~]
``noun+!>(~(key by dogs.state))
::
[%x %dogs %configs ~]
``noun+!>((~(run by dogs.state) |=(=watchdog -.watchdog)))
==
::
++ on-agent
@ -298,7 +337,7 @@
:_ dog(history actual-history)
%+ turn actual-vows
|= =id:block
[%give %fact `[%logs path] %eth-watcher-diff !>([%disavow id])]
[%give %fact [%logs path]~ %eth-watcher-diff !>([%disavow id])]
::
++ release-logs
|= [=path dog=watchdog]
@ -323,7 +362,7 @@
%+ turn loglist
|= =event-log:rpc:ethereum
^- card
[%give %fact `[%logs path] %eth-watcher-diff !>([%log event-log])]
[%give %fact [%logs path]~ %eth-watcher-diff !>([%log event-log])]
=^ cards-2 dog $(numbers t.numbers)
[(weld cards-1 cards-2) dog]
--

View File

@ -205,6 +205,7 @@
!> ^- poke:eth-watcher
:+ %watch /[dap.bowl]
:* node-url
|
refresh-rate
public:mainnet-contracts
~[azimuth delegated-sending]:mainnet-contracts
@ -356,11 +357,11 @@
0x4763.8e3c.ddee.2204.81e4.c3f9.183d.639c.
0efe.a7f0.5fcd.2df4.1888.5572.9f71.5419
~
=+ ^- [of=@ pool=@] ::TODO =/
=/ [of=@ pool=@]
~| t.topics.log
%+ decode-topics:abi:ethereum t.topics.log
~[%uint %uint]
=+ ^- [by=@ gift=@ to=@] ::TODO =/
=/ [by=@ gift=@ to=@]
~| data.log
%+ decode-topics:abi:ethereum
%+ rash data.log

View File

@ -126,7 +126,7 @@
:_ state(synced (~(del by synced.state) path.act))
%+ snoc
(pull-wire group-wire path.act)
[%give %kick `[%group path.act] ~]
[%give %kick [%group path.act]~ ~]
?: |(=(u.ship src.bol) (team:title our.bol src.bol))
:: delete a foreign ship's path
=/ group-wire [(scot %p u.ship) %group path.act]
@ -150,7 +150,7 @@
:_ state(synced (~(del by synced.state) pax.diff))
%+ snoc
(update-subscribers [%group pax.diff] diff)
[%give %kick `[%group pax.diff] ~]
[%give %kick [%group pax.diff]~ ~]
==
::
++ handle-foreign
@ -212,7 +212,7 @@
++ update-subscribers
|= [pax=path diff=group-update]
^- (list card)
[%give %fact `pax %group-update !>(diff)]~
[%give %fact ~[pax] %group-update !>(diff)]~
::
++ pull-wire
|= [wir=wire pax=path]

View File

@ -1,4 +1,4 @@
:: group-store: data store for groups of ships
:: group-store: data store for groups of ships
::
/- *group-store
/+ default-agent
@ -27,7 +27,7 @@
|_ =bowl:gall
+* this .
group-core +>
gc ~(. group-core bowl)
gc ~(. group-core bowl)
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
@ -75,9 +75,9 @@
[%x *] ``noun+!>((~(get by groups) t.path))
==
::
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def
--
::
|_ bol=bowl:gall
@ -148,7 +148,7 @@
++ update-subscribers
|= [pax=path act=group-action]
^- (list card)
[%give %fact `pax %group-update !>(act)]~
[%give %fact ~[pax] %group-update !>(act)]~
::
++ send-diff
|= [pax=path act=group-action]

View File

@ -169,7 +169,7 @@
++ update-subscribers
|= [pax=path upd=invite-update]
^- card
[%give %fact `pax %invite-update !>(upd)]
[%give %fact ~[pax] %invite-update !>(upd)]
::
++ send-diff
|= [pax=path upd=invite-update]

View File

@ -59,7 +59,7 @@
?> ?=(%invite-update p.cage.sign)
:~ :*
%give %fact
`/primary %json
~[/primary] %json
!>((update-to-json !<(invite-update q.cage.sign)))
== ==
==

View File

@ -153,7 +153,7 @@
=/ dat=(unit [json url=@t]) (~(get by data) name)
?~ dat [~ this]
:_ this(data (~(put by data) name [jon url.u.dat]))
[%give %fact `/main %json !>((frond:enjs:format name jon))]~
[%give %fact ~[/main] %json !>((frond:enjs:format name jon))]~
::
++ on-arvo
|= [wir=wire sin=sign-arvo]

View File

@ -83,7 +83,7 @@
%+ give-simple-payload:app eyre-id.u.job.state
[[200 ~] `(as-octt:mimes:html "\"Imported data\"")]
::
[%export ~]
[%export ~]
?+ -.sign (on-agent:def wire sign)
%watch-ack
?~ p.sign

View File

@ -171,14 +171,14 @@
++ kick-proxy
|= [who=ship =path]
^- card
[%give %kick `path `who]
[%give %kick ~[path] `who]
::
++ handle-proxy-sign
|= [=wire =sign:agent:gall]
^- (quip card _state)
?- -.sign
%poke-ack ~|([dap.bowl %unexpected-poke-ack wire] !!)
%fact [[%give %fact `wire cage.sign]~ state]
%fact [[%give %fact ~[wire] cage.sign]~ state]
%kick [[(proxy-pass-link-store wire %watch wire)]~ state]
::
%watch-ack

View File

@ -119,10 +119,9 @@
%- parse-request-line
url.request.inbound-request
=* req-head header-list.request.inbound-request
=- ::TODO =;
=; [cards=(list card) =simple-payload:http]
%+ weld cards
(give-simple-payload:app eyre-id simple-payload)
^- [cards=(list card) =simple-payload:http]
?+ method.request.inbound-request [~ not-found:gen]
%'OPTIONS'
[~ (include-cors-headers req-head [[200 ~] ~])]
@ -137,15 +136,14 @@
++ handle-post
|= [request-headers=header-list:http =request-line body=(unit octs)]
^- [(list card) simple-payload:http]
=- ::TODO =;
=; [success=? cards=(list card)]
:- cards
%+ include-cors-headers
request-headers
::TODO it would be more correct to wait for the %poke-ack instead of
:: sending this response right away... but link-store pokes can't
:: actually fail right now, so it's fine.
[[?:(success 200 400) ~] ~]
^- [success=? cards=(list card)]
[[?:(success 200 400) ~] `*octs]
?~ body [| ~]
?+ request-line [| ~]
[[~ [%'~link' %add ^]] ~]

View File

@ -169,7 +169,7 @@
:_ state
:_ cards
:+ %give %fact
:+ `[%local-pages path]
:+ [%local-pages path]~
%link-update
!>([%local-pages path [page]~])
:: +note-note: save a note for a url
@ -196,8 +196,8 @@
=/ fact
:- %link-update
!>([%annotations path url [note]~])
:* [%give %fact `[%annotations (snoc path url)] fact]
[%give %fact `[%annotations path] fact]
:* [%give %fact [%annotations (snoc path url)]~ fact]
[%give %fact [%annotations path]~ fact]
cards
==
:: +hear-submission: record page someone else saved
@ -220,7 +220,7 @@
:_ state
:_ ~
:+ %give %fact
:+ `[%submissions path]
:+ [%submissions path]~
%link-update
!>([%submissions path [submission]~])
:: +read-comment: record a comment someone else made
@ -242,8 +242,8 @@
=/ fact
:- %link-update
!>([%discussions path url [comment]~])
:~ [%give %fact `[%discussions (snoc path url)] fact]
[%give %fact `[%discussions path] fact]
:~ [%give %fact [%discussions (snoc path url)]~ fact]
[%give %fact [%discussions path]~ fact]
==
::
:: reading

View File

@ -140,7 +140,7 @@
==
:: delete the permission path and its subscriptions from this hook.
::
:- :- [%give %kick `[%permission path.act] ~]
:- :- [%give %kick [%permission path.act]~ ~]
(leave-permission path.act)
%_ state
synced (~(del by synced) path.act)
@ -278,7 +278,7 @@
^- (list card)
%+ turn ~(tap in access-paths)
|= access-path=path
[%give %kick `[%permission access-path] `check-ship]
[%give %kick [%permission access-path]~ `check-ship]
::
++ permission-scry
|= pax=path
@ -313,7 +313,7 @@
++ update-subscribers
|= [=path upd=permission-update]
^- card
[%give %fact `path %permission-update !>(upd)]
[%give %fact ~[path] %permission-update !>(upd)]
::
++ leave-permission
|= =path

View File

@ -184,7 +184,7 @@
++ update-subscribers
|= [pax=path upd=permission-update]
^- (list card)
[%give %fact `pax %permission-update !>(upd)]~
[%give %fact ~[pax] %permission-update !>(upd)]~
::
++ send-diff
|= [pax=path upd=permission-update]

View File

@ -243,7 +243,7 @@
++ write-file
=, space:userlib
|= [pax=path cay=cage]
^- card
^- card
=. pax (weld our-beak pax)
[%pass (weld /write-file pax) %arvo %c %info (foal pax cay)]
::
@ -730,15 +730,15 @@
++ affection-primary
|= del=delta
^- (list card)
[%give %fact `/primary %publish-rumor !>(del)]~
[%give %fact ~[/primary] %publish-rumor !>(del)]~
:: +affection: rumors to interested
::
++ affection
|= del=delta
^- (list card)
=/ wir=wire /collection/[col.del]
:~ [%give %fact `/primary %publish-rumor !>(del)]
[%give %fact `wir %publish-rumor !>(del)]
:~ [%give %fact ~[/primary] %publish-rumor !>(del)]
[%give %fact ~[wir] %publish-rumor !>(del)]
==
::
++ get-post-by-index
@ -1263,7 +1263,7 @@
=/ upd=update [%invite %.y src.bol coll.act title.act]
:_ state
%+ welp make-tile-moves
[%give %fact `/primary %publish-update !>(upd)]~
[%give %fact ~[/primary] %publish-update !>(upd)]~
::
:: %reject-invite: remove invite from list, acceptance is handled by
:: %subscribe action
@ -1276,7 +1276,7 @@
=/ upd=update [%invite %.n who.act coll.act u.title]
:_ state
%+ welp make-tile-moves
[%give %fact `/primary %publish-update !>(upd)]~
[%give %fact ~[/primary] %publish-update !>(upd)]~
::
:: %serve:
::
@ -1406,7 +1406,7 @@
[%pass wir %agent [who.act %publish] %watch wir]~
?~ title ~
=/ upd=update [%invite %.n who.act coll.act u.title]
[%give %fact `/primary %publish-update !>(upd)]~
[%give %fact ~[/primary] %publish-update !>(upd)]~
==
::
:: %unsubscribe: unsub from a foreign blog, delete all state related to it
@ -1435,7 +1435,7 @@
:- [%pass wir %agent [who.act %publish] %leave ~]
%+ welp make-tile-moves
=/ rum=rumor [%remove who.act coll.act ~]
[%give %fact `/primary %publish-rumor !>(rum)]~
[%give %fact ~[/primary] %publish-rumor !>(rum)]~
::
:: %read: notify that we've seen a post
::
@ -1445,7 +1445,7 @@
%+ welp make-tile-moves
::
=/ upd=update [%unread %.n (sy [who.act coll.act post.act] ~)]
[%give %fact `/primary %publish-update !>(upd)]~
[%give %fact ~[/primary] %publish-update !>(upd)]~
::
==
::
@ -1597,7 +1597,7 @@
::
++ make-tile-moves
^- (list card)
[%give %fact `/publishtile %json !>(make-tile-json)]~
[%give %fact ~[/publishtile] %json !>(make-tile-json)]~
::
++ make-tile-json
^- json

View File

@ -1,5 +1,3 @@
:: Thread manager
::
/- spider
/+ libstrand=strand, default-agent, verb
=, strand=strand:libstrand
@ -127,9 +125,6 @@
|- ^- (quip card _this)
?~ yarns
`this
?. ?=([@ ~] i.yarns)
$(yarns t.yarns)
~| killing=i.yarns
=^ cards-1 state
(handle-stop-thread:sc (yarn-to-tid i.yarns) |)
=^ cards-2 this
@ -139,8 +134,6 @@
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?: ?=(%spider-kill mark)
(on-load on-save)
=^ cards state
?+ mark (on-poke:def mark vase)
%spider-input (on-poke-input:sc !<(input vase))
@ -357,15 +350,12 @@
^- ^card
?+ card card
[%pass * *] [%pass [%thread tid p.card] q.card]
[%give %fact *]
?~ path.p.card
card
card(path.p `[%thread tid u.path.p.card])
::
[%give %kick *]
?~ path.p.card
card
card(path.p `[%thread tid u.path.p.card])
[%give ?(%fact %kick) *]
=- card(paths.p -)
%+ turn paths.p.card
|= =path
^- ^path
[%thread tid path]
==
=. cards (weld cards cards.r)
=^ final-cards=(list card) state
@ -391,13 +381,14 @@
++ thread-say-fail
|= [=tid =term =tang]
^- (list card)
:~ [%give %fact `/thread-result/[tid] %thread-fail !>([term tang])]
[%give %kick `/thread-result/[tid] ~]
:~ [%give %fact ~[/thread-result/[tid]] %thread-fail !>([term tang])]
[%give %kick ~[/thread-result/[tid]] ~]
==
::
++ thread-fail
|= [=yarn =term =tang]
^- (quip card ^state)
%- (slog leaf+"strand {<yarn>} failed" leaf+<term> tang)
=/ =tid (yarn-to-tid yarn)
=/ fail-cards (thread-say-fail tid term tang)
=^ cards state (thread-clean yarn)
@ -409,8 +400,8 @@
:: %- (slog leaf+"strand {<yarn>} finished" (sell vase) ~)
=/ =tid (yarn-to-tid yarn)
=/ done-cards=(list card)
:~ [%give %fact `/thread-result/[tid] %thread-done vase]
[%give %kick `/thread-result/[tid] ~]
:~ [%give %fact ~[/thread-result/[tid]] %thread-done vase]
[%give %kick ~[/thread-result/[tid]] ~]
==
=^ cards state (thread-clean yarn)
[(weld done-cards cards) state]

View File

@ -101,7 +101,7 @@
=/ lismov [%pass /[(scot %da now.bol)] %arvo %i %request req out]~
?~ timer
:- [[%pass /timer %arvo %b %wait (add now.bol ~h3)] lismov]
%= state
%= state
location str
timer `(add now.bol ~h3)
==
@ -135,7 +135,7 @@
currently+(~(got by p.u.ujon) 'currently')
daily+(~(got by p.u.ujon) 'daily')
==
:- [%give %fact `/weathertile %json !>(jon)]~
:- [%give %fact ~[/weathertile] %json !>(jon)]~
%= state
data jon
time now.bol

View File

@ -0,0 +1,4 @@
:- %say
|= [[now=@da *] *]
:- %noun
.^(state-eth-node:jael j//=sources/(scot %da now))

View File

@ -15,7 +15,7 @@
~(tap by dir:.^(arch %cy (welp top /sys/vane)))
?. =(1 (met 3 tam))
tam
=+ ^- zaz=(list [p=knot ~])
=/ zaz=(list [p=knot ~])
(skim van |=([a=term ~] =(tam (end 3 1 a))))
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz

View File

@ -59,7 +59,7 @@
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
::
|^ |= bs=octs ^- cord
=+ ^- [padding=@ blocks=(list word24)]
=/ [padding=@ blocks=(list word24)]
(octs-to-blocks bs)
(crip (flop (unpad padding (encode-blocks blocks))))
::

View File

@ -114,7 +114,7 @@
~| %know-no-private-key
!!
:: derive child at i
=+ ^- [left=@ right=@] ::TODO =/ w/o face
=/ [left=@ right=@]
=- [(cut 3 [32 32] -) (cut 3 [0 32] -)]
%+ hmac-sha512l [32 cad]
:- 37
@ -143,7 +143,7 @@
~| %cant-derive-hardened-public-key
!!
:: derive child at i
=+ ^- [left=@ right=@] ::TODO =/ w/o face
=/ [left=@ right=@]
=- [(cut 3 [32 32] -) (cut 3 [0 32] -)]
%+ hmac-sha512l [32 cad]
37^(can 3 ~[4^i 33^(ser-p pub)])

View File

@ -185,7 +185,7 @@
:: nex: offset of value bytes from fuz
:: len: length of value bytes
::
=+ ^- [nex=@ len=@]
=/ [nex=@ len=@]
:: faz: meaningful bits in fuz
::
=/ faz (end 0 7 fuz)

View File

@ -21,7 +21,7 @@
%+ strand-fail:strandio
%unexpected-multiple-results
[>(lent res)< ~]
:: +request-batch-rpc-strict: send rpc request, with retry
:: +request-batch-rpc-strict: send rpc requests, with retry
::
:: sends a batch request. produces results for all requests in the batch,
:: but only if all of them are successful.
@ -32,8 +32,39 @@
`10
attempt-request
::
+$ result [id=@t =json]
+$ results (list result)
+$ results (list [id=@t =json])
::
++ attempt-request
=/ m (strand:strandio ,(unit results))
^- form:m
;< responses=(list response:rpc:jstd) bind:m
(request-batch-rpc-loose url reqs)
=- ?~ err
(pure:m `res)
(pure:m ~)
%+ roll responses
|= $: rpc=response:rpc:jstd
[res=results err=(list [id=@t code=@t message=@t])]
==
?: ?=(%error -.rpc)
[res [+.rpc err]]
?. ?=(%result -.rpc)
[res [['' 'ethio-rpc-fail' (crip <rpc>)] err]]
[[+.rpc res] err]
--
:: +request-batch-rpc-loose: send rpc requests, with retry
::
:: sends a batch request. produces results for all requests in the batch,
:: including the ones that are unsuccessful.
::
++ request-batch-rpc-loose
|= [url=@ta reqs=(list [id=(unit @t) req=request:rpc:ethereum])]
|^ %+ (retry:strandio results)
`10
attempt-request
::
+$ result response:rpc:jstd
+$ results (list response:rpc:jstd)
::
++ attempt-request
=/ m (strand:strandio ,(unit results))
@ -71,18 +102,7 @@
((ar:dejs-soft:format parse-one-response) u.jon)
?~ array
(strand-fail:strandio %rpc-result-incomplete-batch >u.jon< ~)
=- ?~ err
(pure:m `res)
(pure:m ~)
%+ roll u.array
|= $: rpc=response:rpc:jstd
[res=results err=(list [id=@t code=@t message=@t])]
==
?: ?=(%error -.rpc)
[res [+.rpc err]]
?. ?=(%result -.rpc)
[res [['' 'ethio-rpc-fail' (crip <rpc>)] err]]
[[+.rpc res] err]
(pure:m array)
::
++ parse-one-response
|= =json
@ -98,6 +118,7 @@
=, dejs-soft:format
(ot id+so error+(ot code+no message+so ~) ~)
--
::
:: +read-contract: calls a read function on a contract, produces result hex
::
++ read-contract

View File

@ -291,7 +291,7 @@
?~ biz (flop moz)
:_ (flop moz)
=/ =dill-blit:dill ?~(t.biz i.biz [%mor (flop biz)])
[%give %fact `/drum %dill-blit !>(dill-blit)]
[%give %fact ~[/drum] %dill-blit !>(dill-blit)]
::
++ se-adit :: update servers
^+ .
@ -478,7 +478,7 @@
::
++ se-blit-sys :: output to system
|= bil/dill-blit:dill ^+ +>
(se-emit %give %fact `/drum %dill-blit !>(bil))
(se-emit %give %fact ~[/drum] %dill-blit !>(bil))
::
++ se-show :: show buffer, raw
|= lin/(pair @ud stub)

View File

@ -146,7 +146,7 @@
=. nam
?. =(1 (met 3 nam))
nam
=+ ^- zaz/(list {p/knot ~})
=/ zaz/(list {p/knot ~})
(skim van |=({a/term ~} =(nam (end 3 1 a))))
?> ?=({{@ ~} ~} zaz)
`term`p.i.zaz

View File

@ -312,11 +312,11 @@
++ take-agent
|= [=wire =sign:agent:gall]
?+ wire ~|([%kiln-bad-take-agent wire -.sign] !!)
[%kiln %fancy *] ?> ?=(%poke-ack -.sign)
[%kiln %fancy *] ?> ?=(%poke-ack -.sign)
(take-coup-fancy t.t.wire p.sign)
[%kiln %reload *] ?> ?=(%poke-ack -.sign)
(take-coup-reload t.t.wire p.sign)
[%kiln %spam *] ?> ?=(%poke-ack -.sign)
[%kiln %spam *] ?> ?=(%poke-ack -.sign)
(take-coup-spam t.t.wire p.sign)
==
::
@ -378,7 +378,7 @@
++ take-mere-sync ::
|= {way/wire mes/(each (set path) (pair term tang))}
?> ?=({@ @ @ *} way)
=+ ^- hos/kiln-sync
=/ hos/kiln-sync
:* syd=(slav %tas i.way)
her=(slav %p i.t.way)
sud=(slav %tas i.t.t.way)
@ -388,7 +388,7 @@
++ take-writ-find-ship ::
|= {way/wire rot/riot}
?> ?=({@ @ @ *} way)
=+ ^- hos/kiln-sync
=/ hos/kiln-sync
:* syd=(slav %tas i.way)
her=(slav %p i.t.way)
sud=(slav %tas i.t.t.way)
@ -398,7 +398,7 @@
++ take-writ-sync ::
|= {way/wire rot/riot}
?> ?=({@ @ @ *} way)
=+ ^- hos/kiln-sync
=/ hos/kiln-sync
:* syd=(slav %tas i.way)
her=(slav %p i.t.way)
sud=(slav %tas i.t.t.way)
@ -549,7 +549,7 @@
::
++ work :: state machine
|= syd/desk
=+ ^- per-desk
=/ ,per-desk
%+ ~(gut by rem) syd
=+ *per-desk
%_(- cas [%da now])
@ -644,7 +644,7 @@
[%scry %c %x [[our syd] (flop pax)]]
=/ dali=schematic [%diff [our syd] base alis]
=/ dbob=schematic [%diff [our syd] base bobs]
=+ ^- for/mark
=/ for=mark
=+ (slag (dec (lent pax)) pax)
?~(- %$ i.-)
^- schematic
@ -713,7 +713,7 @@
=+ "failed to mash"
lose:(spam leaf+- message.build-result.result)
?> ?=([%complete %success %list *] result)
=+ ^- can/(list (pair path (unit miso)))
=/ can=(list (pair path (unit miso)))
%+ turn results.build-result.result
|= res=build-result:ford
^- (pair path (unit miso))
@ -731,7 +731,7 @@
=+ annotated=(turn `(list (pair path *))`-.notated head)
=+ unnotated=(turn `(list (pair path *))`+.notated head)
=+ `desk`(cat 3 syd '-scratch')
=+ ^- tan/(list tank)
=/ tan=(list tank)
%- zing
^- (list (list tank))
:~ %- tape-to-tanks

View File

@ -117,7 +117,7 @@
:- "%_"
"""
$\{1:target}
$\{2:wing} $\{3:new-value}
$\{2:wing} $\{3:new-value}
==
"""
:- "%."
@ -139,7 +139,7 @@
:- "%*"
"""
$\{1:target-wing} $\{2:from}
$\{3:wing} $\{4:new-value}
$\{3:wing} $\{4:new-value}
==
"""
:- "%^"
@ -164,7 +164,7 @@
:- "%="
"""
$\{1:target}
$\{2:wing} $\{3:new-value}
$\{2:wing} $\{3:new-value}
==
"""
::
@ -422,7 +422,7 @@
:- "?-"
"""
$\{1:case}
$\{2:type} $\{3:value}
$\{2:type} $\{3:value}
==
"""
:- "?:"
@ -455,8 +455,8 @@
"""
:- "?+"
"""
$\{1:case} $\{2:else}
$\{3:type} $\{4:value}
$\{1:case} $\{2:else}
$\{3:type} $\{4:value}
==
"""
:- "?&"

View File

@ -49,9 +49,9 @@
[%http-response-header !>(response-header.simple-payload)]
=/ data-cage
[%http-response-data !>(data.simple-payload)]
:~ [%give %fact `/http-response/[eyre-id] header-cage]
[%give %fact `/http-response/[eyre-id] data-cage]
[%give %kick `/http-response/[eyre-id] ~]
:~ [%give %fact ~[/http-response/[eyre-id]] header-cage]
[%give %fact ~[/http-response/[eyre-id]] data-cage]
[%give %kick ~[/http-response/[eyre-id]] ~]
==
--
++ gen

View File

@ -83,7 +83,7 @@
++ wush
|= [wid=@u tan=tang]
^- tape
%- of-wall:format
%- of-wall:format
%+ turn (flop tan)
|= =tank
~! wid

View File

@ -4,7 +4,7 @@
++ grab
|%
++ noun chat-action
++ json
++ json
|= jon=^json
(json-to-action jon)
--

View File

@ -19,7 +19,7 @@
++ add-owned
%- ot
:~ [%path pa]
[%security sec]
[%security sec]
[%allow-history bo]
==
::

View File

@ -4,7 +4,7 @@
++ grab
|%
++ noun chat-view-action
++ json
++ json
|= jon=^json
(json-to-view-action jon)
--

View File

@ -4,7 +4,7 @@
++ grab
|%
++ noun invite-action
++ json
++ json
|= jon=^json
(json-to-action jon)
--

View File

@ -4,7 +4,7 @@
++ grab
|%
++ noun permission-action
++ json
++ json
|= jon=^json
=< (parse-permission-action jon)
|%

View File

@ -4,7 +4,7 @@
++ grab
|%
++ noun permission-group-hook-action
++ json
++ json
|= jon=^json
(json-to-perm-group-hook-action jon)
--

View File

@ -43,10 +43,10 @@
:* %+ rash creator.txs
;~(pfix (jest 'creator: ~') fed:ag)
::
%+ rash collection.txs
%+ rash collection.txs
;~(pfix (jest 'collection: ') (cook crip (star next)))
::
%+ rash post.txs
%+ rash post.txs
;~(pfix (jest 'post: ') (cook crip (star next)))
::
%+ rash date-created.txs

View File

@ -46,10 +46,10 @@
:* %+ rash owner.txs
;~(pfix (jest 'owner: ~') fed:ag)
::
%+ rash title.txs
%+ rash title.txs
;~(pfix (jest 'title: ') (cook crip (star next)))
::
%+ rash filename.txs
%+ rash filename.txs
;~(pfix (jest 'filename: ') (cook crip (star next)))
::
%+ rash comments.txs

View File

@ -13,14 +13,14 @@
%+ frond -.rum
?- -.rum
%collection
%- pairs
%- pairs
:~ [%coll s+col.rum]
[%who (ship who.rum)]
[%data (collection-build-to-json dat.rum)]
==
::
%post
%- pairs
%- pairs
:~ [%coll s+col.rum]
[%post s+pos.rum]
[%who (ship who.rum)]
@ -28,7 +28,7 @@
==
::
%comments
%- pairs
%- pairs
:~ [%coll s+col.rum]
[%post s+pos.rum]
[%who (ship who.rum)]

View File

@ -23,7 +23,7 @@
|- ^- {rem/@u res/marl}
?~ mal [lim ~]
?~ lim [0 ~]
=+ ^- {lam/@u hed/manx}
=/ {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)]

View File

@ -119,7 +119,7 @@
[i.bob $(ali t.ali, bob t.bob)]
?: (gth p.i.ali (lent p.i.bob))
[i.bob $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)]
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
=/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
(resolve ali bob)
[fic $(ali ali, bob bob)]
:: ~ :: here, alice is good for a while, but not for the whole
@ -128,7 +128,7 @@
%|
?- -.i.bob
%|
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
=/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
(resolve ali bob)
[fic $(ali ali, bob bob)]
::
@ -137,7 +137,7 @@
[i.ali $(ali t.ali, bob t.bob)]
?: (gth p.i.bob (lent p.i.ali))
[i.ali $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))]
=+ ^- {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
=/ {fic/(unce cord) ali/(urge cord) bob/(urge cord)}
(resolve ali bob)
[fic $(ali ali, bob bob)]
==

View File

@ -2,7 +2,7 @@
/+ publish
/= result
/^ (list comment:publish)
/;
/;
|= comments=(map knot comment:publish)
^- (list [comment-info:publish @t])
%+ sort ~(val by comments)

View File

@ -3,7 +3,7 @@
/= args /$ ,[beam *]
/= result
/^ [post-info:publish manx @t]
/;
/;
|= $: post-front=(map knot cord)
post-content=manx
post-raw=wain

View File

@ -4,6 +4,7 @@
|%
+$ config
$: url=@ta
eager=?
refresh-rate=@dr
from=number:block
contracts=(list address:ethereum)

View File

@ -5,7 +5,7 @@
:: if ship is foreign, delete any local
:: group at that path and mirror the
:: foreign group at our local path
::
::
[%remove =path] :: remove the path.
==
--

View File

@ -2238,7 +2238,7 @@
::
::
++ fl :: arb. precision fp
=+ ^- {{p/@u v/@s w/@u} r/$?($n $u $d $z $a) d/$?($d $f $i)}
=/ {{p/@u v/@s w/@u} r/$?($n $u $d $z $a) d/$?($d $f $i)}
[[113 -16.494 32.765] %n %d]
:: p=precision: number of bits in arithmetic form; must be at least 2
:: v=min exponent: minimum value of e
@ -4108,7 +4108,7 @@
::
++ fa :: base58check
=+ key='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
=+ ^- yek/@ux ~+
=/ yek/@ux ~+
=- yek:(roll (rip 3 key) -)
=+ [a=*char b=*@ yek=`@ux`(fil 3 256 0xff)]
|.
@ -7897,7 +7897,7 @@
::
|= gen/hoon
^- hoon
=+ ^- wing
=/ ,wing
?: =(1 dom)
hay
(weld hay `wing`[[%& dom] ~])
@ -9869,7 +9869,7 @@
?~ fid ~
?: ?=({%| %& *} fid)
$(q.zot t.q.zot, p.heg p.p.fid)
=+ ^- vat/(pair type nock)
=/ vat/(pair type nock)
?- -.fid
%& (fine %& p.fid)
%| (fine %| p.p.fid)
@ -14254,6 +14254,7 @@
[%name term %spec spec %base %noun]
wyde
==
::
%+ cook
|= [=term =(unit spec)]
^- skin
@ -14265,6 +14266,12 @@
::
(punt ;~(pfix ;~(pose net tis) wyde))
==
::
%+ cook
|= =spec
^- skin
[%spec spec %base %noun]
wyde
==
++ tall :: full tall form
%+ knee *hoon

View File

@ -1,55 +1,89 @@
:: Ames extends Arvo's %pass/%give move semantics across the network.
::
:: A "forward flow" message, which is like a request, is passed to
:: Ames from a local vane. Ames transmits the message to the peer's
:: Ames, which passes the message to the destination vane.
:: Ames receives packets as Arvo events and emits packets as Arvo
:: effects. The runtime is responsible for transferring the bytes in
:: an Ames packet across a physical network to another ship.
::
:: Once the peer has processed the "forward flow" message, it sends a
:: message acknowledgment over the wire back to the local Ames. This
:: ack can either be positive or negative, in which case we call it a
:: "nack". (Don't confuse Ames nacks with TCP nacks, which are a
:: different concept).
:: The runtime tells Ames which physical address a packet came from,
:: represented as an opaque atom. Ames can emit a packet effect to
:: one of those opaque atoms or to the Urbit address of a galaxy
:: (root node), which the runtime is responsible for translating to a
:: physical address. One runtime implementation sends UDP packets
:: using IPv4 addresses for ships and DNS lookups for galaxies, but
:: other implementations may overlay over other kinds of networks.
::
:: When the local Ames receives either a positive message ack or a
:: combination of a nack and nack-trace (explained in more detail
:: A local vane can pass Ames a %plea request message. Ames
:: transmits the message over the wire to the peer ship's Ames, which
:: passes the message to the destination vane.
::
:: Once the peer has processed the %plea message, it sends a
:: message-acknowledgment packet over the wire back to the local
:: Ames. This ack can either be positive to indicate the request was
:: processed, or negative to indicate the request failed, in which
:: case it's called a "nack". (Don't confuse Ames nacks with TCP
:: nacks, which are a different concept).
::
:: When the local Ames receives either a positive message-ack or a
:: combination of a nack and naxplanation (explained in more detail
:: below), it gives an %done move to the local vane that had
:: requested the original "forward flow" message be sent.
:: requested the original %plea message be sent.
::
:: A "backward flow" message, which is similar to a response or a
:: subscription update, is given to Ames from a local vane. Ames
:: transmits the message to the peer's Ames, which gives the message
:: to the destination vane.
:: A local vane can give Ames zero or more %boon response messages in
:: response to a %plea, on the same duct that Ames used to pass the
:: %plea to the vane. Ames transmits a %boon over the wire to the
:: peer's Ames, which gives it to the destination vane on the same
:: duct the vane had used to pass the original %plea to Ames.
::
:: Ames will give a %memo to a vane upon hearing the message from a
:: remote. This message is a "backward flow" message, forming one of
:: potentially many responses to a "forward flow" message that a
:: local vane had passed to our local Ames, and which local Ames had
:: relayed to the remote. Ames gives the %memo on the same duct the
:: local vane had originally used to pass Ames the "forward flow"
:: message.
:: %boon messages are acked automatically by the receiver Ames. They
:: cannot be nacked, and Ames only uses the ack internally, without
:: notifying the client vane that gave Ames the %boon.
::
:: Backward flow messages are acked automatically by the receiver.
:: They cannot be nacked, and Ames only uses the ack internally,
:: without notifying the client vane.
:: If the Arvo event that completed receipt of a %boon message
:: crashes, Ames instead sends the client vane a %lost message
:: indicating the %boon was missed.
::
:: Forward flow messages can be nacked, in which case the peer will
:: send both a message-nack packet and a nack-trace message, which is
:: sent on a special diagnostic flow so as not to interfere with
:: normal operation. The nack-trace is sent as a full Ames message,
:: instead of just a packet, because the contained error information
:: can be arbitrarily large.
:: %plea messages can be nacked, in which case the peer will send
:: both a message-nack packet and a naxplanation message, which is
:: sent in a way that does not interfere with normal operation. The
:: naxplanation is sent as a full Ames message, instead of just a
:: packet, because the contained error information can be arbitrarily
:: large. A naxplanation can only give rise to a positive ack --
:: never ack an ack, and never nack a naxplanation.
::
:: Once the local Ames has received the nack-trace, it knows the peer
:: has received the full message and failed to process it. This
:: means if we later hear an ack packet on the failed message, we can
:: ignore it.
:: Ames guarantees a total ordering of messages within a "flow",
:: identified in other vanes by a duct and over the wire by a "bone":
:: an opaque number. Each flow has a FIFO queue of %plea requests
:: from the requesting ship to the responding ship and a FIFO queue
:: of %boon's in the other direction.
::
:: Also, due to Ames's exactly-once delivery semantics, we know that
:: when we receive a nack-trace for message n, we know the peer has
:: positively acked all messages m+1 through n-1, where m is the last
:: message for which we heard a nack-trace. If we haven't heard acks
:: on all those messages, we apply positive acks when we hear the
:: nack-trace.
:: Message order across flows is not specified and may vary based on
:: network conditions.
::
:: Ames guarantees that a message will only be delivered once to the
:: destination vane.
::
:: Ames encrypts every message using symmetric-key encryption by
:: performing an elliptic curve Diffie-Hellman using our private key
:: and the public key of the peer. For ships in the Jael PKI
:: (public-key infrastructure), Ames looks up the peer's public key
:: from Jael. Comets (128-bit ephemeral addresses) are not
:: cryptographic assets and must self-attest over Ames by sending a
:: single self-signed packet containing their public key.
::
:: When a peer suffers a continuity breach, Ames removes all
:: messaging state related to it. Ames does not guarantee that all
:: messages will be fully delivered to the now-stale peer. From
:: Ames's perspective, the newly restarted peer is a new ship.
:: Ames's guarantees are not maintained across a breach.
::
:: A vane can pass Ames a %heed $task to request Ames track a peer's
:: responsiveness. If our %boon's to it start backing up locally,
:: Ames will give a %clog back to the requesting vane containing the
:: unresponsive peer's urbit address. This interaction does not use
:: ducts as unique keys. Stop tracking a peer by sending Ames a
:: %jilt $task.
::
:: Debug output can be adjusted using %sift and %spew $task's.
::
:: protocol-version: current version of the ames wire protocol
::
@ -530,7 +564,15 @@
:: The first bone is 0. They increment by 4, since each flow includes
:: a bit for each message determining forward vs. backward and a
:: second bit for whether the message is on the normal flow or the
:: associated diagnostic flow (for nack-traces).
:: associated diagnostic flow (for naxplanations).
::
:: The least significant bit of a $bone is:
:: 1 if "forward", i.e. we send %plea's on this flow, or
:: 0 if "backward", i.e. we receive %plea's on this flow.
::
:: The second-least significant bit is 1 if the bone is a
:: naxplanation bone, and 0 otherwise. Only naxplanation
:: messages can be sent on a naxplanation bone, as %boon's.
::
+$ ossuary
$: =next=bone
@ -542,43 +584,40 @@
:: Messages queue up in |message-pump's .unsent-messages until they
:: can be packetized and fed into |packet-pump for sending. When we
:: pop a message off .unsent-messages, we push as many fragments as
:: we can into |packet-pump, then place the remaining in
:: .unsent-fragments.
:: we can into |packet-pump, which sends every packet it eats.
:: Packets rejected by |packet-pump are placed in .unsent-fragments.
::
:: When we hear a packet ack, we send it to |packet-pump. If we
:: haven't seen it before, |packet-pump reports the fresh ack.
:: When we hear a packet ack, we send it to |packet-pump to be
:: removed from its queue of unacked packets.
::
:: When we hear a message ack (positive or negative), we treat that
:: as though all fragments have been acked. If this message is not
:: .current, then it's a future message and .current has not yet been
:: acked, so we place the ack in .queued-message-acks.
:: .current, then this ack is for a future message and .current has
:: not yet been acked, so we place the ack in .queued-message-acks.
::
:: If we hear a message ack before we've sent all the
:: fragments for that message, clear .unsent-fragments. If the
:: message ack was positive, print it out because it indicates the
:: peer is not behaving properly.
:: If we hear a message ack before we've sent all the fragments for
:: that message, clear .unsent-fragments and have |packet-pump delete
:: all sent fragments from the message. If this early message ack was
:: positive, print it out because it indicates the peer is not
:: behaving properly.
::
:: If the ack is for the current message, emit the message ack,
:: increment .current, and check if this next message is in
:: .queued-message-acks. If it is, emit the message (n)ack,
:: increment .current, and check the next message. Repeat until
:: .current is not fully acked.
::
:: When we hear a message nack, we send it to |packet-pump, which
:: deletes all packets from that message. If .current gets nacked,
:: clear .unsent-fragments and go into the same flow as when we hear
:: the last packet ack on a message.
:: If the ack is for the current message, have |packet-pump delete
:: all packets from the message, give the message ack back
:: to the client vane, increment .current, and check if this next
:: message is in .queued-message-acks. If it is, emit the message
:: (n)ack, increment .current, and check the next message. Repeat
:: until .current is not fully acked.
::
:: The following equation is always true:
:: .next - .current == number of messages in flight
::
:: At the end of a task, |message-pump sends a %halt task to
:: |packet-pump, which can trigger a timer to be set or cleared based
:: on congestion control calculations. When it fires, the timer will
:: generally cause one or more packets to be resent.
:: on congestion control calculations. When the timer fires, it will
:: generally cause a packet to be re-sent.
::
:: Message sequence numbers start at 1 so the first message will be
:: greater than .last-acked.message-sink-state on the receiver.
:: Message sequence numbers start at 1 so that the first message will
:: be greater than .last-acked.message-sink-state on the receiver.
::
:: current: sequence number of earliest message sent or being sent
:: next: sequence number of next message to send
@ -618,7 +657,14 @@
:: algorithm. The information signals and their responses are
:: identical to those of the "NewReno" variant of Reno; the
:: implementation differs because Ames acknowledgments differ from
:: TCP's and because we're using functional data structures.
:: TCP's, because this code uses functional data structures, and
:: because TCP's sequence numbers reset when a peer becomes
:: unresponsive, whereas Ames sequence numbers only change when a
:: ship breaches.
::
:: A deviation from Reno is +fast-resend-after-ack, which re-sends
:: timed-out packets when a peer starts responding again after a
:: period of unresponsiveness.
::
:: If .skips reaches 3, we perform a fast retransmit and fast
:: recovery. This corresponds to Reno's handling of "three duplicate
@ -697,8 +743,6 @@
==
:: $note: request to other vane
::
:: TODO: specialize gall interface for subscription management
::
:: Ames passes a %plea note to another vane when it receives a
:: message on a "forward flow" from a peer, originally passed from
:: one of the peer's vanes to the peer's Ames.
@ -729,13 +773,6 @@
== == ==
:: $sign: response from other vane
::
:: A vane gives a %boon sign to Ames on a duct on which it had
:: previously received a message on a "forward flow". Ames will
:: transmit the message to the peer that had originally sent the
:: message on the forward flow. The peer's Ames will then give the
:: message to the remote vane from which the forward flow message
:: originated.
::
+$ sign
$~ [%b %wake ~]
$% $: %b
@ -1512,6 +1549,7 @@
::
:: Abandon all pretense of continuity and delete all messaging state
:: associated with .ship, including sent and unsent messages.
:: Also cancel all timers related to .ship.
::
++ on-publ-breach
|= =ship
@ -2053,7 +2091,11 @@
++ send-shut-packet
|= =shut-packet
^+ peer-core
:: swizzle bone just before sending; TODO document
:: swizzle last bone bit before sending
::
:: The peer has the opposite perspective from ours about what
:: kind of flow this is (forward/backward), so flip the bit
:: here.
::
=. bone.shut-packet (mix 1 bone.shut-packet)
::
@ -2201,7 +2243,7 @@
:: +on-sink-boon: handle response message received by |message-sink
::
:: .bone must be mapped in .ossuary.peer-state, or we crash.
:: This means a malformed message will kill a channel. We
:: This means a malformed message will kill a flow. We
:: could change this to a no-op if we had some sort of security
:: reporting.
::
@ -2217,17 +2259,29 @@
^+ peer-core
:: send ack unconditionally
::
=. peer-core (emit (got-duct bone) %give %boon message)
=. peer-core (run-message-sink bone %done ok=%.y)
::
?. ?=([%hear * * ok=%.n] task)
:: fresh boon; give message to client vane
::
%- (trace msg.veb |.("boon {<her.channel^bone>}"))
(emit (got-duct bone) %give %boon message)
%- (trace msg.veb |.("boon {<her.channel^bone -.task>}"))
peer-core
:: we previously crashed on this message; notify client vane
::
%- (trace msg.veb |.("crashed on boon {<her.channel^bone>}"))
(emit (got-duct bone) %give %lost ~)
%- (trace msg.veb |.("crashed on boon {<her.channel^bone -.task>}"))
boon-to-lost
:: +boon-to-lost: convert all boons to losts
::
++ boon-to-lost
^+ peer-core
=. moves
%+ turn moves
|= =move
?. ?=([* %give %boon *] move)
move
[duct.move %give %lost ~]
peer-core
:: +on-sink-nack-trace: handle nack-trace received by |message-sink
::
++ on-sink-nack-trace
@ -2642,7 +2696,7 @@
:: +on-hear: handle ack on a live packet
::
:: If the packet was in our queue, delete it and update our
:: metrics. Otherwise, no-op.
:: metrics, possibly re-sending skipped packets. Otherwise, no-op.
::
++ on-hear
|= [=message-num =fragment-num]
@ -3009,7 +3063,9 @@
::
?: already-heard-fragment
?: is-last-fragment
%- (trace rcv.veb |.("hear last dupe {<her.channel^seq>}"))
%- %+ trace rcv.veb |.
=/ data [her.channel seq last-heard.state last-acked.state]
"hear last dupe {<data>}"
message-sink
%- (trace rcv.veb |.("send dupe ack {<her.channel^seq^fragment-num>}"))
(give %send seq %& fragment-num)

View File

@ -879,7 +879,7 @@
;< res=made-result:ford bind:m expect-ford
;< hashes=(map path lobe) bind:m
|= clad-input
=+ ^- cat/(list (pair path cage))
=/ cat=(list (pair path cage))
%+ turn (made-result-to-cages:util res)
|= {pax/cage cay/cage}
?. ?=($path p.pax)
@ -924,7 +924,7 @@
|= [wen=@da =dork]
=/ m (clad ,[=suba _this-cor])
^- form:m
=+ ^- sim=(list (pair path misu))
=/ sim=(list (pair path misu))
;: weld
^- (list (pair path misu))
(turn del.dork |=(pax/path [pax %del ~]))
@ -972,7 +972,7 @@
=/ message (made-result-as-error:ford res)
(clad-fail %checkout-fail leaf+"clay patch failed" message)
::
=+ ^- cat/(list (trel path lobe cage))
=/ cat/(list (trel path lobe cage))
%+ turn (made-result-to-cages:util res)
|= {pax/cage cay/cage}
?. ?=($path-hash p.pax)
@ -992,7 +992,7 @@
=+ must=(must-ergo:util our syd mon (turn suba head))
?: =(~ must)
(pure:m mim)
=+ ^- all-paths/(set path)
=/ all-paths/(set path)
%+ roll
(turn ~(tap by must) (corl tail tail))
|= {pak/(set path) acc/(set path)}
@ -2295,7 +2295,7 @@
|= [local=? disc=disc:ford pax=path lob=lobe]
^- schematic:ford
::
=+ ^- hat/(map path lobe)
=/ hat/(map path lobe)
?: =(let.dom 0)
~
q:(aeon-to-yaki let.dom)
@ -2631,7 +2631,7 @@
::
=* ruf |4.+6.^$
::
=+ ^- [mow=(list move) hun=(unit duct) rede]
=/ [mow=(list move) hun=(unit duct) rede]
?. =(our her)
:: no duct, foreign +rede or default
::
@ -2993,7 +2993,7 @@
++ start-request
|= [for=(unit ship) rav=rave]
^+ ..start-request
=+ ^- [new-sub=(unit rove) sub-results=(list sub-result)]
=/ [new-sub=(unit rove) sub-results=(list sub-result)]
(try-fill-sub for (rave-to-rove rav))
=. ..start-request (send-sub-results sub-results [hen ~ ~])
?~ new-sub
@ -3392,7 +3392,7 @@
:: drop forgotten roves
::
$(old-subs t.old-subs)
=+ ^- [new-sub=(unit rove) sub-results=(list sub-result)]
=/ [new-sub=(unit rove) sub-results=(list sub-result)]
(try-fill-sub wove.i.old-subs)
=. ..wake (send-sub-results sub-results ducts.i.old-subs)
=. new-subs
@ -3752,7 +3752,7 @@
|= {a/(unit tako) b/tako}
^- {(set yaki) (set plop)}
=+ old=?~(a ~ (reachable-takos:util u.a))
=+ ^- yal/(set tako)
=/ yal/(set tako)
%- silt
%+ skip
~(tap in (reachable-takos:util b))
@ -3890,12 +3890,18 @@
:: at any of its children.
::
++ read-u
|= {yon/aeon pax/path}
^- (unit (unit (each {$null (hypo ~)} lobe)))
=+ tak=(~(get by hit.dom) yon)
?~ tak
|= [yon=aeon pax=path]
^- (unit (unit (each [%flag (hypo ?)] lobe)))
:: if asked for a future version, we don't have an answer
::
?~ tak=(~(get by hit.dom) yon)
~
``[%& %null [%atom %n ~] ~]
:: look up the yaki snapshot based on the version
::
=/ yak=yaki (tako-to-yaki u.tak)
:: produce the result based on whether or not there's a file at :pax
::
``[%& %flag -:!>(*?) (~(has by q.yak) pax)]
::
:: Gets the dome (desk state) at a particular aeon.
::
@ -3977,7 +3983,7 @@
=+ yak=(tako-to-yaki u.tak)
=+ len=(lent pax)
:: ~& read-z+[yon=yon qyt=~(wyt by q.yak) pax=pax]
=+ ^- descendants/(list (pair path lobe))
=/ descendants/(list (pair path lobe))
:: ~& %turning
:: =- ~& %turned -
%+ turn
@ -4199,7 +4205,7 @@
=+ bem=(~(get by mon.ruf) des.req)
?: &(?=(~ bem) !=(%$ des.req))
~|([%bad-mount-point-from-unix des.req] !!)
=+ ^- bem/beam
=/ bem/beam
?^ bem
u.bem
[[our %base %ud 1] ~]
@ -4208,7 +4214,7 @@
!! :: fire next in queue
?: =(0 let.dom.u.dos)
=+ cos=(mode-to-soba ~ s.bem all.req fis.req)
=+ ^- [one=soba two=soba]
=/ [one=soba two=soba]
%+ skid cos
|= [a=path b=miso]
?& ?=(%ins -.b)
@ -4601,7 +4607,7 @@
~
=+ mad=(malt mod)
=+ len=(lent pax)
=+ ^- descendants/(list path)
=/ descendants/(list path)
%+ turn
%+ skim ~(tap by hat)
|= {paf/path lob/lobe}

View File

@ -637,7 +637,7 @@
this.outstandingSubscriptions.set(
id,
{
err: connectionErrFunc,
err: connectionErrFunc,
event: eventFunc,
quit: quitFunc
}
@ -1590,8 +1590,8 @@
=/ channel=(unit channel)
(~(get by session.channel-state.state) channel-id)
?~ channel
~& [%received-event-for-nonexistent-channel channel-id]
[~ state]
:_ state :_ ~
[duct %pass /flog %d %flog %crud %eyre-no-channel >id=channel-id< ~]
::
=/ event-id next-id.u.channel
::

View File

@ -6108,6 +6108,7 @@
:: and a namespace function
::
|= [our=ship now=@da eny=@uvJ scry-gate=sley]
=* ford-gate .
:: allow jets to be registered within this core
::
~% %ford ..is ~
@ -6332,12 +6333,16 @@
--
:: +load: migrate old state to new state (called on vane reload)
::
:: Trim builds completely in case a change to our code invalidated an
:: old build result.
::
++ load
|= old=axle
^+ ..^$
^+ ford-gate
::
~! %loading
..^$(ax old)
=. ax old
=. ford-gate +:(call ~[/ford-load-self] *type %trim 0)
ford-gate
:: +stay: produce current state
::
++ stay `axle`ax
@ -6346,9 +6351,4 @@
++ scry
|= *
[~ ~]
:: %utilities
::
::+|
::
++ ford-gate ..$
--

View File

@ -54,7 +54,7 @@
++ state
$: :: state version
::
%2
%3
:: agents by ship
::
=agents
@ -904,7 +904,7 @@
%give
=/ =gift:agent p.card
?: ?=(%kick -.gift)
=/ ducts=(list duct) (ap-ducts-from-path path.gift ship.gift)
=/ ducts=(list duct) (ap-ducts-from-paths paths.gift ship.gift)
%+ turn ducts
|= =duct
~? &(=(duct system-duct.agents.state) !=(agent-name %hood))
@ -914,7 +914,7 @@
?. ?=(%fact -.gift)
[agent-duct %give %unto gift]~
::
=/ ducts=(list duct) (ap-ducts-from-path path.gift ~)
=/ ducts=(list duct) (ap-ducts-from-paths paths.gift ~)
=/ =cage cage.gift
%+ turn ducts
|= =duct
@ -1010,6 +1010,17 @@
::
++ ap-agent-core
~(. agent.current-agent ap-construct-bowl)
:: +ap-ducts-from-paths: get ducts subscribed to paths
::
++ ap-ducts-from-paths
|= [target-paths=(list path) target-ship=(unit ship)]
^- (list duct)
?: &(?=(~ target-paths) ?=(~ target-ship))
~[agent-duct]
%- zing
%+ turn target-paths
|= =path
(ap-ducts-from-path `path target-ship)
:: +ap-ducts-from-path: get ducts subscribed to path
::
++ ap-ducts-from-path
@ -1567,16 +1578,177 @@
=? all-state ?=(%1 -.all-state)
(state-1-to-2 all-state)
::
?> ?=(%2 -.all-state)
=? all-state ?=(%2 -.all-state)
(state-2-to-3 all-state)
::
?> ?=(%3 -.all-state)
gall-payload(state all-state)
::
:: +all-state: upgrade path
::
++ all-state $%(state-0 state-1 ^state)
++ all-state $%(state-0 state-1 state-2 ^state)
::
++ state-2-to-3
|= =state-2
^- ^state
%= state-2
- %3
running.agents-2
%- ~(run by running.agents-2.state-2)
|= =running-agent-2
^- running-agent
%= running-agent-2
agent-2 (agent-2-to-3 agent-2.running-agent-2)
==
==
::
++ agent-2-to-3
|= =agent-2
^- agent
=> |%
++ cards-2-to-3
|= cards=(list card:^agent-2)
^- (list card:agent)
%+ turn cards
|= =card:^agent-2
^- card:agent
?. ?=([%give ?(%fact %kick) *] card) card
%=(card path.p (drop path.p.card))
--
|_ =bowl:gall
+* this .
pass ~(. agent-2 bowl)
++ on-init
=^ cards agent-2 on-init:pass
[(cards-2-to-3 cards) this]
::
++ on-save
on-save:pass
::
++ on-load
|= old-state=vase
=^ cards agent-2 (on-load:pass old-state)
[(cards-2-to-3 cards) this]
::
++ on-poke
|= [=mark =vase]
=^ cards agent-2 (on-poke:pass mark vase)
[(cards-2-to-3 cards) this]
::
++ on-watch
|= =path
=^ cards agent-2 (on-watch:pass path)
[(cards-2-to-3 cards) this]
::
++ on-leave
|= =path
=^ cards agent-2 (on-leave:pass path)
[(cards-2-to-3 cards) this]
::
++ on-peek
|= =path
(on-peek:pass path)
::
++ on-agent
|= [=wire =sign:agent:gall]
=^ cards agent-2 (on-agent:pass wire sign)
[(cards-2-to-3 cards) this]
::
++ on-arvo
|= [=wire =sign-arvo]
=^ cards agent-2 (on-arvo:pass wire sign-arvo)
[(cards-2-to-3 cards) this]
::
++ on-fail
|= [=term =tang]
=^ cards agent-2 (on-fail:pass term tang)
[(cards-2-to-3 cards) this]
--
::
++ state-2
$: %2
=agents-2
==
::
++ agents-2
$: system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
running=(map term running-agent-2)
blocked=(map term blocked)
==
::
++ running-agent-2
$: cache=worm
control-duct=duct
live=?
=stats
=subscribers
=agent-2
=beak
marks=(map duct mark)
==
::
++ agent-2
=< form
|%
+$ step (quip card form)
+$ card (wind note gift)
+$ note note:agent
+$ task task:agent
+$ sign sign:agent
+$ gift
$% [%fact path=(unit path) =cage]
[%kick path=(unit path) ship=(unit ship)]
[%watch-ack p=(unit tang)]
[%poke-ack p=(unit tang)]
==
++ form
$_ ^|
|_ bowl
++ on-init
*(quip card _^|(..on-init))
::
++ on-save
*vase
::
++ on-load
|~ old-state=vase
*(quip card _^|(..on-init))
::
++ on-poke
|~ [mark vase]
*(quip card _^|(..on-init))
::
++ on-watch
|~ path
*(quip card _^|(..on-init))
::
++ on-leave
|~ path
*(quip card _^|(..on-init))
::
++ on-peek
|~ path
*(unit (unit cage))
::
++ on-agent
|~ [wire sign]
*(quip card _^|(..on-init))
::
++ on-arvo
|~ [wire sign-arvo]
*(quip card _^|(..on-init))
::
++ on-fail
|~ [term tang]
*(quip card _^|(..on-init))
--
--
::
++ state-1-to-2
|= =state-1
^- ^state
^- state-2
%= state-1
- %2
+.agents-1 [~ +.agents-1.state-1]
@ -1590,7 +1762,7 @@
++ agents-1
$: system-duct=duct
contacts=(set ship)
running=(map term running-agent)
running=(map term running-agent-2)
blocked=(map term blocked)
==
::
@ -1602,7 +1774,7 @@
running.agents-0
%- ~(run by running.agents-0.state-0)
|= =running-agent-0
^- running-agent
^- running-agent-2
%= running-agent-0
agent-0 (agent-0-to-1 agent-0.running-agent-0)
==
@ -1610,7 +1782,7 @@
::
++ agent-0-to-1
|= =agent-0
^- agent
^- agent-2
|_ =bowl:gall
+* this .
pass ~(. agent-0 bowl)
@ -1692,7 +1864,7 @@
+$ card (wind note gift)
+$ note note:agent
+$ task task:agent
+$ gift gift:agent
+$ gift gift:agent-2
+$ sign sign:agent
++ form
$_ ^|

View File

@ -77,8 +77,11 @@
$% $: %a :: to %ames
$>(%plea task:able:ames) :: send request message
== ::
$: %g :: to self
$>(%deal task:able:gall) :: set ethereum source
$: %b :: to %behn
$>(%wait task:able:behn) :: set timer
== ::
$: %g :: to %gall
$>(%deal task:able:gall) :: talk to app
== ::
$: %j :: to self
$>(%listen task) :: set ethereum source
@ -91,11 +94,14 @@
:: ::
+$ sign :: in result $<-
$~ [%a %done ~] ::
$% $: %a
$% $: %a ::
$% $>(%boon gift:able:ames) :: message response
$>(%done gift:able:ames) :: message (n)ack
$>(%lost gift:able:ames) :: lost boon
== ==
== == ::
$: %b ::
$>(%wake gift:able:behn) ::
== ::
$: %g ::
$> $? %onto ::
%unto ::
@ -257,14 +263,14 @@
=. sig.own.pki sig.seed.tac
:: load our initial public key
::
=/ spon-ship=(unit ship)
=/ flopped-spon (flop spon.tac)
?~(flopped-spon ~ `ship.i.flopped-spon)
=. pos.zim.pki
=/ cub (nol:nu:crub:crypto key.seed.tac)
%+ ~(put by pos.zim.pki)
our
=/ spon-ship
=/ flopped-spon (flop spon.tac)
?~(flopped-spon ~ `ship.i.flopped-spon)
[1 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) spon-ship]
[0 lyf.seed.tac (my [lyf.seed.tac [1 pub:ex:cub]] ~) spon-ship]
:: our initial private key
::
=. lyf.own.pki lyf.seed.tac
@ -298,17 +304,33 @@
(~(gas by points) spon-points)
=. +>.$
%- curd =< abet
(public-keys:~(feel su hen our pki etn) %full points)
(public-keys:~(feel su hen our now pki etn) %full points)
::
:: start subscriptions
::
:: get everything from azimuth-tracker because jael subscriptions
:: seem to be flaky for now
::
=. +>.$ (poke-watch hen %azimuth-tracker nod.own.pki)
=. +>.$
%- curd =< abet
(sources:~(feel su hen our pki etn) ~ [%| %azimuth-tracker])
:: get everything from azimuth-tracker because jael subscriptions
:: seem to be flaky for now
::
?: &
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
::
?- (clan:title our)
%czar
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%| %azimuth-tracker])
::
*
=. +>.$
%- curd =< abet
%+ sources:~(feel su hen our now pki etn)
(silt (turn spon-points head))
[%| %azimuth-tracker]
%- curd =< abet
(sources:~(feel su hen our now pki etn) ~ [%& (need spon-ship)])
==
::
=. moz
%+ weld moz
@ -376,7 +398,7 @@
%listen
~& [%jael-listen whos source]:tac
%- curd =< abet
(sources:~(feel su hen our pki etn) [whos source]:tac)
(sources:~(feel su hen our now pki etn) [whos source]:tac)
::
:: cancel all trackers from duct
:: {$nuke whos=(set ship)}
@ -408,7 +430,7 @@
::
%rekey
%- curd =< abet
(private-keys:~(feel su hen our pki etn) life.tac ring.tac)
(private-keys:~(feel su hen our now pki etn) life.tac ring.tac)
::
:: update private keys
::
@ -420,14 +442,14 @@
~& [%not-our-moon ship.tac]
+>.$
%- curd =< abet
(~(new-event su hen our pki etn) [ship udiff]:tac)
(~(new-event su hen our now pki etn) [ship udiff]:tac)
::
:: watch public keys
:: [%public-keys ships=(set ship)]
::
%public-keys
%- curd =< abet
(~(public-keys ~(feed su hen our pki etn) hen) ships.tac)
(~(public-keys ~(feed su hen our now pki etn) hen) ships.tac)
::
:: seen after breach
:: [%meet our=ship who=ship]
@ -463,7 +485,7 @@
:: {$private-keys $~}
::
%private-keys
(curd abet:~(private-keys ~(feed su hen our pki etn) hen))
(curd abet:~(private-keys ~(feed su hen our now pki etn) hen))
::
%wegh
%_ +>
@ -508,7 +530,7 @@
^+ +>
?- hin
[%a %done *]
?~ error.hin ~&(%ares-fine +>.$)
?~ error.hin +>.$
~& [%done-bad tag.u.error.hin]
%- (slog tang.u.error.hin)
::TODO fail:et
@ -517,13 +539,26 @@
[%a %boon *]
=+ ;; [%public-keys-result =public-keys-result] payload.hin
%- curd =< abet
(public-keys:~(feel su hen our pki etn) public-keys-result)
(public-keys:~(feel su hen our now pki etn) public-keys-result)
::
[%a %lost *]
:: TODO: better error handling
::
~| %jael-ames-lost
!!
::
[%b %wake *]
?^ error.hin
%- %+ slog
leaf+"jael unable to resubscribe, run :azimuth-tracker|listen"
u.error.hin
+>.$
?> ?=([%breach @ ~] tea)
=/ =source-id (slav %ud i.t.tea)
=/ =source (~(got by sources.etn) source-id)
=/ ships (~(get ju ship-sources-reverse.etn) source-id)
%- curd =< abet
(sources:~(feel su hen our now pki etn) ships source)
::
[%g %onto *]
~& [%jael-onto tea hin]
@ -549,7 +584,7 @@
=* app i.tea
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
%- curd =< abet
(~(new-event su hen our pki etn) peer-sign)
(~(new-event su hen our now pki etn) peer-sign)
==
==
:: :: ++curd:of
@ -575,14 +610,15 @@
=| moz=(list move)
=| $: hen=duct
our=ship
now=@da
state-pki
state-eth-node
==
:: moz: moves in reverse order
:: pki: relative urbit state
::
=* pki ->+<
=* etn ->+>
=* pki ->+>-
=* etn ->+>+
|%
++ this-su .
:: :: ++abet:su
@ -799,9 +835,18 @@
?& ?=(^ point)
(gth rift.point.i.pointl rift.u.point)
==
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
[%breach who.i.pointl]
=. ..feel
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
[%breach who.i.pointl]
=/ sor (~(get by sources-reverse) %& who.i.pointl)
?~ sor
..feel
:: delay resubscribing because Ames is going to clear any
:: messages we send now.
::
(emit hen %pass /breach/(scot %ud u.sor) %b %wait now)
::
=. ..feel
%+ public-keys-give
(subscribers-on-ship who.i.pointl)
@ -863,11 +908,6 @@
++ sources
|= [whos=(set ship) =source]
^+ ..feel
?: ?=(%& -.source)
=/ send-message
|= =message
[hen %pass /public-keys %a %plea p.source %j /public-keys message]
(emit (send-message %public-keys whos))
=^ =source-id this-su (get-source-id source)
=. ..feed
?~ whos
@ -882,6 +922,12 @@
%- ~(gas ju ship-sources-reverse.etn)
(turn whol |=(=ship [source-id ship]))
..feed
::
?: ?=(%& -.source)
=/ send-message
|= =message
[hen %pass /public-keys %a %plea p.source %j /public-keys message]
(emit (send-message %public-keys whos))
(peer p.source whos)
--
::

File diff suppressed because it is too large Load Diff

View File

@ -1887,8 +1887,8 @@
[%poke-as =mark =cage]
==
+$ gift
$% [%fact path=(unit path) =cage]
[%kick path=(unit path) ship=(unit ship)]
$% [%fact paths=(list path) =cage]
[%kick paths=(list path) ship=(unit ship)]
[%watch-ack p=(unit tang)]
[%poke-ack p=(unit tang)]
==
@ -2185,13 +2185,17 @@
%disavow ~|(%udiff-to-diff-disavow !!)
%spon `[%spon sponsor.a-point sponsor.a-udiff]
%rift
?: (gth rift.a-udiff rift.a-point)
~? !=(rift.a-udiff +(rift.a-point))
[%udiff-to-diff-skipped a-udiff a-point]
`[%rift rift.a-point rift.a-udiff]
~
?. (gth rift.a-udiff rift.a-point)
~
~? !=(rift.a-udiff +(rift.a-point))
[%udiff-to-diff-skipped-rift a-udiff a-point]
`[%rift rift.a-point rift.a-udiff]
::
%keys
?. (gth life.a-udiff life.a-point)
~
~? !=(life.a-udiff +(life.a-point))
[%udiff-to-diff-skipped-life a-udiff a-point]
:^ ~ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff
@ -4942,7 +4946,7 @@
$(rob (put-word rob col -), sin +(sin))
::
:: c1, c2: prns for picking reference block
=+ ^- [c1=@ c2=@] ::TODO =/ w/o face
=/ [c1=@ c2=@]
?: do-i (snag sin rands)
=+ =- (snag - rob)
?: =(0 col) (dec columns)
@ -6628,7 +6632,7 @@
[~ ~]
?^ t.rax
[p.pok [ire q.pok]]:[pok=$(rax t.rax) ire=i.rax]
=+ ^- raf/(like term)
=/ raf/(like term)
=> |=(a/@ ((sand %tas) (crip (flop (trip a)))))
(;~(sfix (sear . sym) dot) [1^1 (flop (trip i.rax))])
?~ q.raf
@ -7810,7 +7814,7 @@
~? ?=(~ mined.log) %processing-unmined-event
::
?: =(i.topics.log owner-changed)
=+ ^- [who=@ wer=address]
=/ [who=@ wer=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %owner wer]
::
@ -7820,12 +7824,12 @@
`[who %activated who]
::
?: =(i.topics.log spawned)
=+ ^- [pre=@ who=@]
=/ [pre=@ who=@]
(decode-topics t.topics.log ~[%uint %uint])
`[pre %spawned who]
::
?: =(i.topics.log escape-requested)
=+ ^- [who=@ wer=@]
=/ [who=@ wer=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %escape `wer]
::
@ -7834,18 +7838,18 @@
`[who %escape ~]
::
?: =(i.topics.log escape-accepted)
=+ ^- [who=@ wer=@]
=/ [who=@ wer=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %sponsor & wer]
::
?: =(i.topics.log lost-sponsor)
=+ ^- [who=@ pos=@]
=/ [who=@ pos=@]
(decode-topics t.topics.log ~[%uint %uint])
`[who %sponsor | pos]
::
?: =(i.topics.log changed-keys)
=/ who=@ (decode-topics t.topics.log ~[%uint])
=+ ^- [enc=octs aut=octs sut=@ud rev=@ud]
=/ [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who %keys rev (pass-from-eth enc aut sut)]
@ -7856,22 +7860,22 @@
`[who %continuity num]
::
?: =(i.topics.log changed-management-proxy)
=+ ^- [who=@ sox=address]
=/ [who=@ sox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %management-proxy sox]
::
?: =(i.topics.log changed-voting-proxy)
=+ ^- [who=@ tox=address]
=/ [who=@ tox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %voting-proxy tox]
::
?: =(i.topics.log changed-spawn-proxy)
=+ ^- [who=@ sox=address]
=/ [who=@ sox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %spawn-proxy sox]
::
?: =(i.topics.log changed-transfer-proxy)
=+ ^- [who=@ tox=address]
=/ [who=@ tox=address]
(decode-topics t.topics.log ~[%uint %address])
`[who %transfer-proxy tox]
::
@ -8040,42 +8044,124 @@
$% [%l l=(list item)]
[%b b=byts]
==
:: +encode-atoms: encode list of atoms as a %l of %b items
::
:: treat atoms as list of items
++ encode-atoms
|= l=(list @)
^- @
%+ encode %l
%+ turn l
|=(a=@ b+[(met 3 a) a])
::
++ encode
|= in=item
^- @
?- -.in
%b
?: &(=(1 wid.b.in) (lth dat.b.in 0x80))
dat.b.in
%^ cat 3 dat.b.in
::TODO unsure if this should pass wid or (met 3 dat)...
(encode-length wid.b.in 0x80)
|^ ^- @
?- -.in
%b
?: &(=(1 wid.b.in) (lte dat.b.in 0x7f))
dat.b.in
=- (can 3 ~[b.in [(met 3 -) -]])
(encode-length wid.b.in 0x80)
::
%l
=/ out=@
%+ roll l.in
|= [ni=item en=@]
(cat 3 (encode ni) en)
%^ cat 3 out
(encode-length (met 3 out) 0xc0)
==
::
%l
=/ out=@
%+ roll l.in
|= [ni=item en=@]
(cat 3 (encode ni) en)
%^ cat 3 out
(encode-length (met 3 out) 0xc0)
==
++ encode-length
|= [len=@ off=@]
?: (lth len 56) (add len off)
=- (cat 3 len -)
:(add (met 3 len) off 55)
--
:: +decode-atoms: decode expecting a %l of %b items, producing atoms within
::
++ encode-length
|= [len=@ off=@]
?: (lth len 56) (add len off)
=- (cat 3 len -)
:(add (met 3 len) off 55)
::
::TODO decode
++ decode-atoms
|= dat=@
^- (list @)
=/ i=item (decode dat)
~| [%unexpected-data i]
?> ?=(%l -.i)
%+ turn l.i
|= i=item
~| [%unexpected-list i]
?> ?=(%b -.i)
dat.b.i
::
++ decode
|= dat=@
^- item
=/ bytes=(list @) (flop (rip 3 dat))
=? bytes ?=(~ bytes) ~[0]
|^ item:decode-head
::
++ decode-head
^- [done=@ud =item]
?~ bytes
~| %rlp-unexpected-end
!!
=* byt i.bytes
:: byte in 0x00-0x79 range encodes itself
::
?: (lte byt 0x79)
:- 1
[%b 1^byt]
:: byte in 0x80-0xb7 range encodes string length
::
?: (lte byt 0xb7)
=+ len=(sub byt 0x80)
:- +(len)
:- %b
len^(get-value 1 len)
:: byte in 0xb8-0xbf range encodes string length length
::
?: (lte byt 0xbf)
=+ led=(sub byt 0xb7)
=+ len=(get-value 1 led)
:- (add +(led) len)
:- %b
len^(get-value +(led) len)
:: byte in 0xc0-f7 range encodes list length
::
?: (lte byt 0xf7)
=+ len=(sub byt 0xc0)
:- +(len)
:- %l
%. len
decode-list(bytes (slag 1 `(list @)`bytes))
:: byte in 0xf8-ff range encodes list length length
::
?: (lte byt 0xff)
=+ led=(sub byt 0xf7)
=+ len=(get-value 1 led)
:- (add +(led) len)
:- %l
%. len
decode-list(bytes (slag +(led) `(list @)`bytes))
~| [%rip-not-bloq-3 `@ux`byt]
!!
::
++ decode-list
|= rem=@ud
^- (list item)
?: =(0 rem) ~
=+ ^- [don=@ud =item] ::TODO =/
decode-head
:- item
%= $
rem (sub rem don)
bytes (slag don bytes)
==
::
++ get-value
|= [at=@ud to=@ud]
^- @
(rep 3 (flop (swag [at to] bytes)))
--
--
::
:: abi en/decoding

View File

@ -7,6 +7,7 @@
+$ state
$: logs=(list az-log) :: oldest logs first
lives=(map ship [lyfe=life rut=rift])
tym=@da
==
::
+$ azimuth-command
@ -22,19 +23,34 @@
|= args=vase
=/ m (strand ,vase)
^- form:m
;< ~ bind:m (watch-our:strandio /effect/request %aqua /effect/request)
;< ~ bind:m (watch-our:strandio /effect/request %aqua /effect/request)
:: need blits for raw-ship to check booted
::
;< ~ bind:m (watch-our:strandio /effect/blit %aqua /effect/blit)
;< ~ bind:m
%- (main-loop:strandio ,state)
;< ~ bind:m (watch-our:strandio /effect/blit %aqua /effect/blit)
:: start timer to advance 10 blocks every 20 seconds
;< now=@da bind:m get-time:strandio
=/ a-state=state [~ ~ (add now ~s40)]
;< ~ bind:m (send-wait:strandio tym.a-state)
;< ~ bind:m
%- (main-loop:strandio ,_a-state)
:~ |=(=state ~(handle-unix-effect core state))
|=(=state ~(handle-poke core state))
|=(=state ~(handle-wake core state))
pure:(strand ,state)
==
(pure:m *vase)
::
|_ =state
++ handle-wake
=/ m (strand ,_state)
^- form:m
;< ~ bind:m ((handle:strandio ,~) (take-wake:strandio `tym.state))
~& >> 'spamming logs'
;< now=@da bind:m get-time:strandio
=. tym.state (add now ~s40)
;< ~ bind:m (send-wait:strandio tym.state)
(spam-logs 10)
::
++ handle-unix-effect
=/ m (strand ,_state)
^- form:m
@ -353,7 +369,7 @@
1
==
==
(spam-logs 30)
(spam-logs 10)
::
++ cycle-keys
|= who=@p
@ -386,7 +402,7 @@
=. logs.state
%+ weld logs.state
[(broke-continuity:lo who rut) ~]
(spam-logs 30)
(spam-logs 10)
::
++ spam-logs
|= n=@

View File

@ -96,16 +96,16 @@
`[who id %rift num]
?: =(changed-keys i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=+ ^- [enc=octs aut=octs sut=@ud rev=@ud]
=/ [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.event-log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who id %keys rev sut (pass-from-eth:azimuth enc aut sut)]
?: =(lost-sponsor i.topics.event-log)
=+ ^- [who=@ pos=@]
=/ [who=@ pos=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon ~]
?: =(escape-accepted i.topics.event-log)
=+ ^- [who=@ wer=@]
=/ [who=@ wer=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon `wer]
~& [%bad-topic event-log]
@ -120,8 +120,8 @@
(pure:m ~)
=/ =path /(scot %p ship.i.udiffs)
=/ cards
:~ [%give %fact `/ %azimuth-udiff !>(i.udiffs)]
[%give %fact `path %azimuth-udiff !>(i.udiffs)]
:~ [%give %fact ~[/] %azimuth-udiff !>(i.udiffs)]
[%give %fact ~[path] %azimuth-udiff !>(i.udiffs)]
==
;< ~ bind:m (send-raw-cards:strandio cards)
loop(udiffs t.udiffs)

View File

@ -6,7 +6,7 @@
=, able:jael
::
|= args=vase
=+ ^- [url=@t =command]
=/ [url=@t =command]
!<([@t command] args)
=/ m (strand:strandio ,vase)
^- form:m

View File

@ -15,6 +15,8 @@
;< =latest=block bind:m (get-latest-block:ethio url.pup)
;< pup=watchpup bind:m (zoom pup number.id.latest-block)
=| vows=disavows
?. eager.pup
(pure:m !>([vows pup]))
|- ^- form:m
=* loop $
?: (gth number.pup number.id.latest-block)
@ -72,7 +74,7 @@
::
:: Zooming doesn't go forward one block at a time. As a
:: consequence, it cannot detect and handle reorgs. Only use it
:: at a safe distance -- 500 blocks ago is probably sufficient.
:: at a safe distance -- 100 blocks ago is probably sufficient.
::
++ zoom
|= [pup=watchpup =latest=number:block]

View File

@ -0,0 +1,110 @@
:: eth/send-txs: query ethereum for contract data
::
:: produces hex string result, for use with +decode-results:rpc:ethereum
::
/+ ethio, strandio
::
=>
|%
++ tape-to-ux
|= t=tape
(scan t ;~(pfix (jest '0x') hex))
--
::
|= args=vase
=+ !<([url=@t step-size=@ud txs=(list @ux)] args)
=/ m (strand:strandio ,vase)
^- form:m
|-
=* submit-loop $
~& ['remaining txs:' (lent txs)]
?: =(~ txs) (pure:m !>(~))
:: send a step-size batch of transactions
::
;< responses=(list response:rpc:jstd) bind:m
%+ request-batch-rpc-loose:ethio url
%+ turn (scag step-size txs)
|= tx=@ux
:- `(scot %ux (end 3 10 tx))
[%eth-send-raw-transaction tx]
:: parse tx hashes out of responses, bailing on submission failure
::
=/ pending=(each (set @ux) [term tang])
=| pending=(list @ux)
|-
?~ responses &+(sy pending)
=/ res=response:rpc:jstd i.responses ::NOTE =* breaks typechecks
?+ -.res |+[%unexpected-non-result >res< ~]
%result
%_ $
responses t.responses
pending [(tape-to-ux (sa:dejs:format res.res)) pending]
==
::
%error
?: ?| =('known transaction' (end 3 17 message.res))
=('Known transaction' (end 3 17 message.res))
=('Transaction with the same ' (end 3 26 message.res))
==
~& [%sent-a-known-transaction--skipping id.res]
$(responses t.responses)
?: ?| =('nonce too low' message.res)
=('Nonce too low' message.res)
==
::NOTE this assumes it's an "oops re-sent txs" case
~& [%nonce-too-low--skipping id.res]
$(responses t.responses)
|+[%transaction-send-failed >+.res< ~]
==
?: ?=(%| -.pending)
(strand-fail:strandio p.pending)
:: wait for the transactions to get confirmed
::
|-
=* confirm-loop $
?: =(~ p.pending)
:: all confirmed, continue to next step-size transactions
::
submit-loop(txs (slag step-size txs))
~& [~(wyt in p.pending) 'txs awaiting confirmation']
:: get receipts
::
;< responses=(list response:rpc:jstd) bind:m
%+ request-batch-rpc-loose:ethio url
%+ turn ~(tap in p.pending)
|= txh=@ux
:- `(crip '0' 'x' ((x-co:co 64) txh))
[%eth-get-transaction-receipt txh]
:: find transactions that haven't been confirmed yet, bailing on failure
::
=/ unconfirmed=(each (set @ux) [term tang])
=| done=(list @ux)
|-
?~ responses &+(~(dif in p.pending) (sy done))
=/ res=response:rpc:jstd i.responses ::NOTE =* breaks typechecks
?. ?=(?(%error %result) -.res)
|+[%unexpected-non-result >res< ~]
=/ txh=@ux (tape-to-ux (trip id.res))
?- -.res
%error
~& :- 'receipt fetch error'
[code.res message.res]
$(responses t.responses)
::
%result
?. ?=([%o *] res.res)
$(responses t.responses)
=/ status=@
%- tape-to-ux
%- sa:dejs:format
(~(got by p.res.res) 'status')
?. =(1 status)
|+[%transaction-failed >txh< ~]
$(responses t.responses, done [txh done])
==
?: ?=(%| -.unconfirmed)
(strand-fail:strandio p.unconfirmed)
:: some transactions still pending, wait for a bit, then check again
::
;< ~ bind:m (sleep:strandio ~s30)
confirm-loop(pending unconfirmed)

View File

@ -14,6 +14,7 @@
%ph-child-sync
%ph-breach-multiple
%ph-breach-sudden
%ph-breach-hi-cousin
%ph-hi-linnup-az
%ph-moon-az
==

View File

@ -1,3 +1,7 @@
:: This is useful to test that we properly hear about breaches outside
:: our sponsorship tree. We usually hear about these via ship-to-ship
:: communication.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,5 @@
:: This tests breaches of both parent and child in succession.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,7 @@
:: This tests whether we can handle the case where our immediate
:: sponsor dies without telling us about its breach, so we must hear
:: about it from somewhere else.
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -1,3 +1,5 @@
:: This tests that syncs are correctly restarted after a breach
::
/- spider
/+ *ph-io
=, strand=strand:spider

View File

@ -141,8 +141,8 @@
++ test-list-murn
%+ expect-eq
!> ~[6 10]
!> %+ murn `(list @)`~[2 3 4 5]
|= [x=@]
!> %+ murn `(list @)`~[2 3 4 5]
|= [x=@]
^- (unit)
?: =((mod x 2) 0) ~
(some (mul x 2))

View File

@ -205,7 +205,7 @@
::
%+ expect-eq
!> [~[/g/talk] %give %boon [%post 'first1!!']]
!> (snag 1 `(list move:ames)`moves6)
!> (snag 0 `(list move:ames)`moves6)
==
::
++ test-nack ^- tang

View File

@ -308,7 +308,7 @@
:~ :* duct=~[/http-blah] %give %response
[%start [200 ['content-type' 'text/html']~] ~ %.n]
== == ==
;: weld
results1
results2

View File

@ -1,53 +1,57 @@
/+ *test
|%
::NOTE tests lightly modified from the examples here:
:: https://github.com/ethereum/wiki/wiki/RLP
::
++ test-encoding-string
%+ expect-eq
!> %- encode:rlp:ethereum
b+3^0xaa.bbcc
!> 0x83aa.bbcc
/+ *test
=, rlp:ethereum
::
++ test-encoding-list
%+ expect-eq
!> %- encode:rlp:ethereum
l+~[b+3^0xaa.bbcc b+3^0xdd.eeff]
!> 0xc8.83aa.bbcc.83dd.eeff
=/ vectors=(list [nom=tape dat=@ rlp=item])
:~ :+ "string"
0x83aa.bbcc
b+3^0xaa.bbcc
::
:+ "list"
0xc8.83aa.bbcc.83dd.eeff
l+~[b+3^0xaa.bbcc b+3^0xdd.eeff]
::
:+ "empty list"
0xc0
l+~
::
:+ "zero byte"
0x0
b+1^0x0
::
:+ "empty zero"
0x80
b+0^0x0
::
:+ "value 15"
0xf
b+1^0xf
::
:+ "value 1024"
0x82.0400
b+2^0x400
::
:+ "set of three"
0xc7c0.c1c0.c3c0.c1c0
l+[l+~ l+[l+~ ~] l+[l+~ l+[l+~ ~] ~] ~]
==
::
++ test-encoding-empty-list
|%
++ test-all-vectors
|- ^- tang
?~ vectors ~
%+ weld $(vectors t.vectors)
=, i.vectors
%+ category nom
%+ weld
%+ category "encode"
%+ expect-eq
!> dat
!> (encode rlp)
%+ category "decode"
%+ expect-eq
!> %- encode:rlp:ethereum
l+~
!> 0xc0
::
++ test-encoding-zero-byte
%+ expect-eq
!> %- encode:rlp:ethereum
b+1^0x0
!> 0x0
::
++ test-encoding-empty-zero
%+ expect-eq
!> %- encode:rlp:ethereum
b+0^0x0
!> 0x80
::
++ test-encoding-15
%+ expect-eq
!> %- encode:rlp:ethereum
b+1^15
!> 0xf
::
++ test-encoding-1024
%+ expect-eq
!> %- encode:rlp:ethereum
b+2^1.024
!> 0x82.0400
::
++ test-encoding-set-of-three
%+ expect-eq
!> %- encode:rlp:ethereum
l+[l+~ l+[l+~ ~] l+[l+~ l+[l+~ ~] ~] ~]
!> 0xc7c0.c1c0.c3c0.c1c0
!> rlp
!> (decode dat)
--

View File

@ -144,7 +144,7 @@ gulp.task('urbit-copy', function () {
gulp.task('js-bundle-dev', gulp.series('jsx-transform', 'js-imports'));
gulp.task('tile-js-bundle-dev', gulp.series('tile-jsx-transform', 'tile-js-imports'));
gulp.task('js-bundle-prod', gulp.series('jsx-transform', 'js-imports', 'js-minify'))
gulp.task('tile-js-bundle-prod',
gulp.task('tile-js-bundle-prod',
gulp.series('tile-jsx-transform', 'tile-js-imports', 'tile-js-minify'));
gulp.task('bundle-dev',

View File

@ -14,7 +14,7 @@ class UrbitApi {
add: this.groupAdd.bind(this),
remove: this.groupRemove.bind(this)
};
this.chat = {
message: this.chatMessage.bind(this),
read: this.chatRead.bind(this)
@ -25,7 +25,7 @@ class UrbitApi {
delete: this.chatViewDelete.bind(this),
join: this.chatViewJoin.bind(this),
};
this.invite = {
accept: this.inviteAccept.bind(this),
decline: this.inviteDecline.bind(this),
@ -36,7 +36,7 @@ class UrbitApi {
bind(path, method, ship = this.authTokens.ship, app, success, fail, quit) {
this.bindPaths = _.uniq([...this.bindPaths, path]);
window.subscriptionId = window.urb.subscribe(ship, app, path,
window.subscriptionId = window.urb.subscribe(ship, app, path,
(err) => {
fail(err);
},
@ -59,7 +59,7 @@ class UrbitApi {
window.urb.poke(ship, appl, mark, data,
(json) => {
resolve(json);
},
},
(err) => {
reject(err);
});
@ -142,7 +142,7 @@ class UrbitApi {
}
chatViewJoin(ship, path, askHistory) {
this.chatViewAction({
this.chatViewAction({
join: {
ship, path,
'ask-history': askHistory
@ -153,9 +153,9 @@ class UrbitApi {
inviteAction(data) {
this.action("invite-store", "json", data);
}
inviteInvite(path, ship) {
this.action("invite-hook", "json",
this.action("invite-hook", "json",
{
invite: {
path: '/chat',
@ -180,7 +180,7 @@ class UrbitApi {
}
});
}
inviteDecline(uid) {
this.inviteAction({
decline: {

View File

@ -64,7 +64,7 @@ export class ChatInput extends Component {
}
});
}
bindShortcuts() {
Mousetrap(this.textareaRef.current).bind('enter', e => {
e.preventDefault();
@ -173,7 +173,7 @@ export class ChatInput extends Component {
const { props, state } = this;
this.bindShortcuts();
return (
<div className="pa3 cf flex black bt b--gray4" style={{ flexGrow: 1 }}>
<div

View File

@ -23,12 +23,12 @@ export class ChatTabBar extends Component {
setColor = 'gray3';
}
(props.location.pathname.includes('/popout'))
(props.location.pathname.includes('/popout'))
? popout = "popout/"
: popout = "";
let hidePopoutIcon = (this.props.popout)
? "dn-m dn-l dn-xl"
let hidePopoutIcon = (this.props.popout)
? "dn-m dn-l dn-xl"
: "dib-m dib-l dib-xl";

View File

@ -7,7 +7,7 @@ export class SidebarSwitcher extends Component {
let popoutSwitcher = this.props.popout
? "dn-m dn-l dn-xl"
: "dib-m dib-l dib-xl";
return (
<div className="pt2">
<a

View File

@ -3,7 +3,7 @@ import React, { Component } from 'react';
export class IconSpinner extends Component {
render() {
return (
<div className="spinner-pending"></div>
<div className="spinner-pending"></div>
);
}
}

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { sigil, reactRenderer } from 'urbit-sigil-js';
export class Sigil extends Component {
render() {
const { props } = this;

View File

@ -14,8 +14,8 @@ export class Message extends Component {
let letter = props.msg.letter;
if ('code' in letter) {
let outputElement =
(!!letter.code.output &&
let outputElement =
(!!letter.code.output &&
letter.code.output.length && letter.code.output.length > 0) ?
(
<pre className="clamp-attachment pa1 mt0 mb0">
@ -56,7 +56,7 @@ export class Message extends Component {
);
} else if ('me' in letter) {
return (
<p className='f7 lh-copy v-top'>
<p className='f7 i lh-copy v-top'>
{letter.me}
</p>
);
@ -70,7 +70,7 @@ export class Message extends Component {
&& (chatroom[0] === letter.text))) { // entire message is room name?
return (
<Link
className="bb b--black f7 mono lh-copy v-top"
className="bb b--black f7 mono lh-copy v-top"
to={"/~chat/join/" + chatroom.input}>
{letter.text}
</Link>
@ -108,9 +108,9 @@ export class Message extends Component {
<Sigil
ship={props.msg.author}
size={24}
color={((props.msg.author === window.ship)
color={((props.msg.author === window.ship)
|| (props.msg.author.substr(1) === window.ship))
? "#4330FC"
? "#4330FC"
: "#000000"}
/>
</div>

View File

@ -37,7 +37,7 @@ export class SidebarItem extends Component {
getLetter(lett) {
if ('text' in lett) {
return lett.text;
return lett.text;
} else if ('url' in lett) {
return lett.url;
} else if ('code' in lett) {
@ -50,8 +50,8 @@ export class SidebarItem extends Component {
render() {
const { props, state } = this;
let unreadElem = !!props.unread
? "fw7 green2"
let unreadElem = !!props.unread
? "fw7 green2"
: "";
let title = props.title.substr(1);
@ -59,7 +59,7 @@ export class SidebarItem extends Component {
let description = this.getLetter(props.description);
let selectedCss = !!props.selected ? 'bg-gray5' : 'bg-white pointer';
return (
<div
className={"z1 pa3 pt4 pb4 bb b--gray4 " + selectedCss}

View File

@ -51,8 +51,8 @@ export class MemberScreen extends Component {
let writeListMembers = writeGroup.map((mem) => {
return (
<MemberElement
key={mem}
<MemberElement
key={mem}
owner={deSig(props.match.params.ship)}
ship={mem}
path={`/chat${state.station}/write`}
@ -63,8 +63,8 @@ export class MemberScreen extends Component {
let readListMembers = readGroup.map((mem) => {
return (
<MemberElement
key={mem}
<MemberElement
key={mem}
owner={deSig(props.match.params.ship)}
ship={mem}
path={`/chat${state.station}/read`}

View File

@ -28,7 +28,7 @@ export class NewScreen extends Component {
componentDidUpdate(prevProps, prevState) {
const { props, state } = this;
if (prevProps !== props) {
if (prevProps !== props) {
let station = `/~${window.ship}/${state.idName}`;
if (station in props.inbox) {
props.history.push('/~chat/room' + station);
@ -77,7 +77,15 @@ export class NewScreen extends Component {
onClickCreate() {
const { props, state } = this;
if (!state.idName) {
let invalidChara = new RegExp(/[^a-z0-9/-]/);
let invalid = (
(!state.idName) || (state.idName.startsWith("/")) ||
(state.idName.includes("//")) || (invalidChara.test(state.idName))
);
if (invalid) {
this.setState({
idError: true,
inviteError: false
@ -124,7 +132,7 @@ export class NewScreen extends Component {
// TODO: don't do this, it's shitty
let writeAud;
let readAud;
let readAud;
if (state.security === 'village') {
aud.push(`~${window.ship}`);
@ -192,9 +200,9 @@ export class NewScreen extends Component {
<div className="w-100">
<p className="f8 mt3 lh-copy db">Chat Name</p>
<p className="f9 gray2 db mb4">
Alphanumeric characters, dashes, and slashes only
Lowercase alphanumeric characters, dashes, and slashes only
</p>
<textarea
<textarea
className="f7 ba b--gray3 pa3 db w-100"
placeholder="secret-chat"
rows={1}

View File

@ -37,7 +37,7 @@ export class Root extends Component {
let unreads = {};
Object.keys(state.inbox).forEach((stat) => {
let envelopes = state.inbox[stat].envelopes;
if (envelopes.length === 0) {
messagePreviews[stat] = false;
} else {
@ -47,7 +47,7 @@ export class Root extends Component {
unreads[stat] =
state.inbox[stat].config.length > state.inbox[stat].config.read;
});
let invites = '/chat' in state.invites ?
state.invites['/chat'] : {};

View File

@ -72,7 +72,7 @@ export class Sidebar extends Component {
return (
<div className="h-100-minus-96-s h-100 w-100 overflow-x-hidden flex flex-column relative z1">
<div className="overflow-y-auto h-100">
<div className="overflow-y-auto pb9 h-100">
{sidebarInvites}
{sidebarItems}
</div>

View File

@ -6,12 +6,12 @@ import { HeaderBar } from '/components/lib/header-bar.js';
export class Skeleton extends Component {
render() {
let sidebarHide = (!this.props.sidebarShown || this.props.popout)
? "dn"
let sidebarHide = (!this.props.sidebarShown || this.props.popout)
? "dn"
: "";
let sidebarHideOnMobile = this.props.sidebarHideOnMobile
? "dn-s"
let sidebarHideOnMobile = this.props.sidebarHideOnMobile
? "dn-s"
: "";
let chatHideOnMobile = this.props.chatHideonMobile
@ -21,16 +21,16 @@ export class Skeleton extends Component {
return (
<div className="h-100 w-100 absolute">
<HeaderBar spinner={this.props.spinner} popout={this.props.popout} />
<div className={`cf w-100 absolute flex ` +
((this.props.chatHideonMobile)
<div className={`cf w-100 absolute flex ` +
((this.props.chatHideonMobile)
? "h-100 "
: "h-100-minus-48-s ") +
: "h-100-minus-48-s ") +
((this.props.popout)
? "h-100"
: "h-100-minus-48-m h-100-minus-48-l h-100-minus-48-xl")}>
<div className={
`fl h-100 br b--gray4 overflow-x-hidden
flex-basis-full-s flex-basis-300-m flex-basis-300-l
`fl h-100 br b--gray4 overflow-x-hidden
flex-basis-full-s flex-basis-300-m flex-basis-300-l
flex-basis-300-xl ` +
sidebarHide + " " +
sidebarHideOnMobile

Some files were not shown because too many files have changed in this diff Show More