on master help sign in
Merge pull request #2030 from urbit/alangalis-add-grants

Create feb grant files

commit4efc65a5c90dff4edfd442be3469385bdba2e035 authoralangalis <116312511+alangalis@users.noreply.github.com> dateThu 23 Feb 2023, 13:26 (4 years ago) parente791bb3d3f647c
3 files changed+406
content/grants/2023/json-parser-suite.md+170 content/grants/2023/loch.md+112 content/grants/2023/urbit-react-docs.md+124
content/grants/2023/json-parser-suite.mdnew file+170
@@ -0,0 +1,170 @@
1++++
2+
3+title = "JSON re/parser building suite"
4+date = "2022-02-23"
5+
6+[taxonomies]
7+grant_type = ["Proposal"]
8+grant_category = ["Other"]
9+
10+[extra]
11+image = ""
12+description = "JSON re/parser building suite"
13+reward = "2 Stars"
14+assignee = ["~litlep-nibbyt"]
15+champion = ["~lagrev-nocfep"]
16+grant_id = "P0245"
17+completed = false
18+canceled = false
19+
20++++
21+
22+# Overview
23+
24+A set of three generators which will automate a majority of the work involved in writing parsers to and from JSON. One generator will convert a noun directly to its JSON representation, one generator will produce an example hoon parser given an example input JSON, and one generator that will produce an example hoon parser given a JSON schema.
25+
26+
27+
28+# Motivation
29+
30+JSON is the most widely used format for HTTP payloads. Urbit apps which talk to existing web services must send and receive requests formatted in JSON. Additionally, apps with Javascript frontends use the Urbit HTTP API to facilitate communication between the frontend and Urbit.
31+
32+
33+
34+A set of generators which can automate a majority of the work involved in writing parsers to and from JSON would accelerate the pace of app development.
35+
36+
37+
38+# Implementation
39+
40+For the noun to JSON direction, the conversion would be direct: given any input noun, the generator would produce the corresponding JSON. `~rovnys-ricfer` has completed most of a noun to json encoder. The code can be found [here](https://gist.github.com/belisarius222/d22b39ac0fece6e0680db5d60c6595c6). When complete, it will be able to take a noun and its AST and convert it to a json representation. We have identified missing encodings inside of en-dime for the following auras: `%s, %rq, %rh, %rd, %rs, %ub, %uc, %ux, %uv, %uw`. Part of this bounty will involve implementing the json encoding for the missing auras.
41+
42+
43+
44+For the JSON to noun direction, we will implement two generators, one which accepts an example JSON and another which accepts a JSON schema. Both generators will output a cord containing an example hoon parser for the input JSON. The expectation is that the user will use this parser as a starting point for their own. The generators will produce a structurally correct parser for the target JSON. The user may have to modify the parsing rules inside each entry to get their desired result, but the structure of the parser must be correct.
45+
46+
47+
48+To illustrate how we expect these generators to be used, we provide an example below:
49+
50+
51+
52+Given an example json:
53+
54+```
55+
56+[ ~[ %o
57+
58+ p
59+
60+ { [p='id' q=[%s p='1234']]
61+
62+ [p='name' q=[%s p='James']]
63+
64+ [p='contact_number' q=[%n p='4132549899']]
65+
66+ }
67+
68+ ]
69+
70+]
71+
72+```
73+
74+
75+
76+Or a schema:
77+
78+
79+
80+```
81+
82+{
83+
84+ "$schema":"http://json-schema.org/draft-04/schema#",
85+
86+ "title":"User",
87+
88+ "description":"A user request json",
89+
90+ "type":"object",
91+
92+ "properties":{
93+
94+ "id":{
95+
96+ "description":"The unique identifier for a user",
97+
98+ "type":"integer"
99+
100+ },
101+
102+ "name":{
103+
104+ "description":"Name of the user",
105+
106+ "type":"string"
107+
108+ },
109+
110+ "contact_number":{
111+
112+ "type":"number"
113+
114+ }
115+
116+ },
117+
118+ "required":[
119+
120+ "id",
121+
122+ "name",
123+
124+ "contact_number"
125+
126+ ]
127+
128+}
129+
130+```
131+
132+
133+
134+The generator will produce this piece of hoon code as a cord:
135+
136+
137+
138+```
139+
140+++ req-parser-ot
141+
142+%- ot:dejs-soft:format
143+
144+:~ [%id so:dejs:format]
145+
146+[%name so:dejs:format]
147+
148+[%contact_number no:dejs:format]
149+
150+==
151+
152+```
153+
154+
155+
156+
157+
158+# Deliverable(s)
159+
160+1 Generator which can directly convert from noun to JSON.
161+
162+1 Generator that can produce an example hoon parser given an example input JSON.
163+
164+1 Generator that can produce an example hoon parser given a JSON schema.
165+
166+
167+
168+# Compensation
169+
170+2 Stars upon completion of the grant.
content/grants/2023/loch.mdnew file+112
@@ -0,0 +1,112 @@
1++++
2+
3+title = "%loch"
4+date = "2022-02-23"
5+
6+[taxonomies]
7+grant_type = ["Proposal"]
8+grant_category = ["Core Dev"]
9+
10+[extra]
11+image = ""
12+description = "A Hardware Control Vane"
13+reward = "7 Stars"
14+assignee = ["~mopfel-winrux"]
15+champion = ["~lagrev-nocfep, ~rovnys-ricfer"]
16+grant_id = "P0244"
17+completed = false
18+canceled = false
19+
20++++
21+
22+# Introduction
23+This is a grant for a new vane called %loch. This will act as a hardware control vane providing an interface between Arvo and POSIX's IOCTL interface; enabling communication with various devices ranging from cryptographic hardware keys and dongles, embedded devices speaking on common communication interfaces (UART, SPI, I2C, etc), and IoT connected devices. POSIX-compliant host OSs provide access to these devices via file handles and through the ioctl system call. The runtime side of %loch acts as a hardware abstraction layer, which the Urbit/Hoon side complements by exposing an interface for the various expected communication types to devices
24+
25+How %loch will work is best explained with the following usecase:
26+
27+I have a receipt printer that communicates through UART communication. I want it to print out any %rumors I recieve.
28+
29+This usecase will act as an end to end test of the entire system (described below) and allow incremental experimentation until the final product.
30+
31+This grant is split into N parts
32+
33+1. Creation of the vane (%loch and loch.c)
34+2. UART communication library (/lib/uart.hoon, /mar/*)
35+3. Gall agent (%receipt)
36+4. Documentation and Tutorial
37+
38+# Vane
39+The Urbit/Hoon vane exposes an interface for registering and communicating with an external device using the host OS's systemcalls such as IOCTL. The runtime will have to be passed a list of device registrations @tas and a unix file location (e.g. [%uart '/dev/ttyUSB0'] for a uart device at ttyUSB0). When urbit is booted the runtime will pass this list of @tas to the vane to register the available devices. If a device's status changes the runtime will notify the vane of it through this same method.
40+
41+%loch will also have a list of gall agents which are subscribed to the list of devices and will notify them with changes to it.
42+
43+%loch's formal inteface is still under design but work flushing it out will fall under this grant.
44+
45+
46+# UART communication library
47+Having the %loch vane is nice but useless without "device drivers". A design decision was made to keep Arvo agnostic to different wire based communication protocols (UART, SPI, I2C, etc.). This also keeps vere agnostic to the exact communcation protocol. This design decision was made as to not flood vere with different libraries for these protocols (there is also some liscensing issues that this side steps, GPL is glitter).
48+
49+The consequences of this means that device drivers will need to be written in hoon. The driver will live in userspace and act as middleware between a gall agent and loch.
50+
51+A good basic driver to write is a UART (serial) driver.
52+
53+The driver will need to do the following:
54+
55+Define the IOCTL commands needed to read and write the UART attributes
56+Define UART marks that can convert between a UART settings struct and a noun
57+This can be as simple as a core with different settings as arms
58+Define a serialization arm that takes a noun and properly serializes it (useful for writes)
59+Define a deserialization arm that takes a noun and properly deserializes it (useful for reads)
60+Defines a read arm that handles the process of reading N bytes and unpacks it
61+Defines a write arm that handles the process of writing a noun to the device
62+This driver will act as an example driver that an application can use to talk to a UART device using loch.
63+
64+
65+# Gall Agent
66+Once the vane and library is tested work will begin on implementing a gall agent that subscribes to the %rumors app by ~paldev. The app will begin by subscribing to device notifications from %loch. It will then allow the user to pick which device they want to talk to (device metadata is outside the scope of this proposal). It will register itself to the device on %loch and set it up with the correct settings (baudrate, parity etc.). It will subscribe to %rumors and on recieving one it will send the correct command for the printer to output it.
67+
68+The Agent will include a simple web interface that will allow the user to
69+
70+Pick the device
71+Start subscribing to rumors
72+Stop subscribing to rumors
73+
74+
75+# Documentation and Tutorial
76+Documentation of how the vane works is vital to the succuss of it. The benefit of having a working app alongside the vane is to show users how to use the vane. The resulting communication library and gall agent will be written into a tutorial that should allow anyone to write a gall agent that can speak UART.
77+
78+The library will also act as a template to expand %loch to other devices.
79+
80+
81+# Milestones
82+
83+## Milestone 1: Vane
84+Payment: 3 Stars
85+
86+This milestone includes a working vane that we can "bitbang" commands to talk to an arbitrary IOCTL device.
87+
88+
89+## Milestone 2: UART Library
90+Payment: 2 stars
91+
92+This milestone is complete when a user can execute simple read/write across a UART wire without any "bitbanging"
93+
94+
95+## Milestone 3: Gall Agent
96+Payment: 1 star
97+
98+This milestone is complete when a user can install the app and have the printer print its rumors
99+
100+
101+## Milestone 4: Documentation and Tutorial
102+Payment: 1 star
103+
104+This milestone is complete with the delivery of a documentation and tutorial package.
105+
106+
107+
108+
109+
110+Additional Documents can be found:
111+
112+https://github.com/Native-Planet/documents/tree/main/proposal/loch
content/grants/2023/urbit-react-docs.mdnew file+124
@@ -0,0 +1,124 @@
1++++
2+
3+title = "Modernize Urbit React Developer Documentation"
4+date = "2022-02-23"
5+
6+[taxonomies]
7+grant_type = ["Proposal"]
8+grant_category = ["Documentation"]
9+
10+[extra]
11+image = ""
12+description = "Modernize Urbit React Developer Documentation"
13+reward = "1 Star"
14+assignee = ["~sidnym-ladrut"]
15+champion = ["~lagrev-nocfep"]
16+grant_id = "P0242"
17+completed = false
18+canceled = false
19+
20++++
21+
22+## Rationale ##
23+
24+
25+
26+The front-end React examples provided in Urbit's developer documentation (i.e. the ["Chat Lightning Tutorial"][ex-1] and ["App School II: Full-Stack"][ex-2] pages) use legacy, class-based React patterns that have largely been phased out over the past few years in favor of [modern, hook-based React style][re-hook]. These examples should be refactored to use this modern style to improve the developer onboarding experience (as increasing amounts of [React learning materials use hooks][re-tut]) and future-proof the material presented (as the official React documentation eventually migrates to [primarily present the modern style][re-docs]).
27+
28+
29+
30+## Overview ##
31+
32+
33+
34+The content for the Urbit React examples is split across two repositories:
35+
36+
37+
38+1. [urbit/doc-examples][git-ex]: Contains the source code for the React examples.
39+
40+2. [urbit/developers.urbit.org][git-org]: Contains the web-hosted documentation for the React examples, which can be viewed at [developers.urbit.org](developers.urbit.org).
41+
42+
43+
44+Within these repositories, the content associated with the following examples needs to be updated to the modern React style:
45+
46+
47+
48+1. ["Chat Lightning Tutorial"][ex-1]: Will require edits primarily in the source references, particularly those in the ["Additional commentary" section][ex-1-edit].
49+
50+2. ["App School II: Full-Stack"][ex-2]: Will require nearly a full rewrite, though many source references will look similar.
51+
52+
53+
54+## Features in scope ##
55+
56+
57+
58+- Refactor the ["Chat" example][git-chat-src] to replace React classes with React hooks wherever possible.
59+
60+- Refactor the ["Journal" example][git-jour-src] to replace React classes with React hooks wherever possible.
61+
62+- Revise the ["Chat Lightning Tutorial"][git-chat-doc] documentation to update source references and add commentary to any new and nontrivial references.
63+
64+- Rework the ["App School II: Full-Stack"][git-jour-doc] documentation to explain the flow and key operations (i.e. peeks, pokes, and subscriptions) of the refactored React "Journal" code.
65+
66+
67+
68+## Implementation Notes ##
69+
70+
71+
72+The refactored React examples will take architectural inspiration and library
73+
74+cues from popular React applications in the Urbit ecosystem (e.g. [`%landscape`][git-landscape] and [`%sphinx`][git-sphinx]) to further improve their utility for learning developers.
75+
76+
77+
78+## Milestones and Compensation ##
79+
80+
81+
82+The grantee will receive 1 star upon fulfillment of this grant.
83+
84+
85+
86+
87+
88+[git-ex]: https://github.com/urbit/docs-examples
89+
90+[git-org]: https://github.com/urbit/developers.urbit.org
91+
92+[git-chat-src]: https://github.com/urbit/docs-examples/blob/main/chat-app/react-frontend/src/App.jsx
93+
94+[git-chat-doc]: https://github.com/urbit/developers.urbit.org/blob/main/content/guides/quickstart/chat-guide.md
95+
96+[git-jour-src]: https://github.com/urbit/docs-examples/blob/main/journal-app/ui/src/App.js
97+
98+[git-jour-doc]: https://github.com/urbit/developers.urbit.org/blob/main/content/guides/core/app-school-full-stack/7-app-logic.md
99+
100+[git-landscape]: https://github.com/tloncorp/landscape-apps
101+
102+[git-sphinx]: https://github.com/arthyn/sphinx
103+
104+
105+
106+[re-hook]: https://reactjs.org/blog/2019/02/06/react-v16.8.0.html
107+
108+[re-tut]: https://beta.reactjs.org/learn/tutorial-tic-tac-toe
109+
110+[re-docs]: https://beta.reactjs.org/
111+
112+
113+
114+[ex-1]: https://developers.urbit.org/guides/quickstart/chat-guide
115+
116+[ex-1-edit]: https://developers.urbit.org/guides/quickstart/chat-guide#additional-commentary
117+
118+[ex-2]: https://developers.urbit.org/guides/core/app-school-full-stack/7-app-logic
119+
120+[ex-2-get]: https://developers.urbit.org/guides/core/app-school-full-stack/7-app-logic#getting-entries
121+
122+[ex-2-sub]: https://developers.urbit.org/guides/core/app-school-full-stack/7-app-logic#subscription
123+
124+[ex-2-add]: https://developers.urbit.org/guides/core/app-school-full-stack/7-app-logic#add-edit-delete