Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorg JS stuff as Secure Distributed Computing in JavaScript; integrate videos #579

Merged
merged 5 commits into from
Dec 4, 2021

Conversation

dckc
Copy link
Member

@dckc dckc commented Nov 26, 2021

builds on #580

trial deployment:
https://ag-docs-org.netlify.app/documentation/guides/js-programming/

  • Reorganize "Agoric JavaScript Programming" as:
    • JavaScript Framework (aka Secure Distributed Computing in JavaScript, inviting readers to watch part 1 of the the protocol labs talk series)
      • Hardened JavaScript
        • using the Counter Example from part 2 of the protocol labs talk series
        • building up to the 8 minute presentation of the 30 line makeMint core of ERTP
      • Eventual Send
        • subsumes vats
        • toward the end, invites readers to watch Warner's talk on reentrancy hazards
      • Far, marshaling
  • Note BigInt under ERTP Amounts but otherwise leave it to MDN etc.
  • Demote SES details; learning to write smart contracts need not involve learning how to build an ocap platform with stuff like lockdown(); just how to use one.

todo:

  • clean up git history a bit (squash down to fewer commits)

cc @kennyrowe @michaelfig

@dckc
Copy link
Member Author

dckc commented Nov 26, 2021

aha... the /documentation/ top level was the issue with my netlify deployment: https://ag-docs-org.netlify.app/documentation/

@dckc dckc closed this Nov 26, 2021
@dckc

This comment has been minimized.

@dckc dckc reopened this Nov 26, 2021
@dckc dckc changed the title integrate videos; reorg hardened js; focus on learning to write zoe smart contracts (WIP) reorg JS stuff as Secure Distributed Computing in JavaScript; integrate videos (WIP) Nov 26, 2021
@dckc dckc force-pushed the js-guide branch 6 times, most recently from 001afe9 to a8cf682 Compare November 27, 2021 19:55
@dckc dckc changed the title reorg JS stuff as Secure Distributed Computing in JavaScript; integrate videos (WIP) reorg JS stuff as Secure Distributed Computing in JavaScript; integrate videos Nov 28, 2021
@dckc dckc marked this pull request as ready for review November 28, 2021 05:37
@dckc dckc requested a review from rowgraus November 28, 2021 05:37
@dckc
Copy link
Member Author

dckc commented Nov 28, 2021

Here's hoping for time to discuss this with @kennyrowe, @michaelfig , @erights , and @rowgraus

trial deployment:
https://ag-docs-org.netlify.app/documentation/guides/js-programming/

todo:

  • clean up git history a bit (squash down to fewer commits)

@dckc dckc force-pushed the js-guide branch 2 times, most recently from 3710f0b to b3d66a1 Compare November 30, 2021 03:00
@dckc
Copy link
Member Author

dckc commented Nov 30, 2021

some feedback from @erights (MM) and @Chris-Hibbert (CH) in discussion:

  • introduction diagram needs some tweaks
  • likewise eventual send diagram (get rid of the other half circle)
  • incr and decr methods can be more concise
  • in "Pass Style, harden(), and Remote Identity", the mutation example is good but identity is the wrong notion
  • "Secure Distributed Computing in JavaScript" doesn't match "JavaScript Framework" in the nav / TOC bar...
    • I tried that, but it's long enough to wrap, so it's a little awkward. I'm OK with changing it, though.
    • "Secure Distributed Computing in JavaScript" = endo, eventually?

We also discussed some stuff that's out of scope of this PR:

  • stores are missing

Reference / Specification material

MM: thoughts on where to put it?
DC: for SES, in the proposal to TC39
MM: perhaps write up other stuff in that style?

MM: a "Hardened JS API" section seems on target

MM: we have api docs and we have jsdoc in sources... reconcile? generate?
DC: yes, ideally generate
CH: but our .md process supports excerpting from tested code

MM: move API docs to agoric-sdk repo?
DC: I like it
CH: doesn't automatically get us more docs
DC: of course; but friction looks / seems lower, to me

Interactive examples #582

MM: how about examples linked to live fiddles?
DC: yes; Agoric/agoric-sdk#7032 zero install could-hosted IDE is in that direction, but it's too heavy for fiddle style
DC: current yarn install builds C code and stuff that doesn't likely fit fiddle platforms. but it should be doable with some work

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! I'd like to see this land on the doc site as soon as you consider it not to contain any glaring omissions.

main/ertp/api/amount-math.md Outdated Show resolved Hide resolved
main/ertp/api/amount-math.md Outdated Show resolved Hide resolved
main/ertp/guide/amounts.md Outdated Show resolved Hide resolved
main/glossary/README.md Show resolved Hide resolved
main/guides/js-programming/README.md Outdated Show resolved Hide resolved
main/zoe/guide/contract-requirements.md Outdated Show resolved Hide resolved
@erights
Copy link
Member

erights commented Dec 4, 2021

At #579 (comment) @michaelfig suggests

A Number, num that doesn't satisfy Number.isSafeInteger(num) will have rounding errors when you pass it to BigInt(num)

I do not believe that it true. If the number exactly represents an integer beyond the safe range, then BigInt will still convert it exactly. However, prior to conversion it may have resulted from roundoff and so should not be considered to reliably represent the integer it exactly represents. (I stated this badly. But since this suggestion won't be taken in this PR anyway, I won't bother further clarifying. If we do need to explain this well, please let me know.)

erights
erights previously requested changes Dec 4, 2021
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments so far. Not done yet, but don't wait for my further comments before merging. I probably won't get back to this before Monday.

@@ -106,17 +106,15 @@ module.exports = {
]
},
{
title: 'JavaScript Programming',
title: 'JavaScript Framework',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing that the title in the side panel is "JavaScript Framework" but in the main panel it is "Secure Distributed Computing in JavaScript". I understand that the second is too long for the side panel, but that means we need something shorter that both can agree on. Also, this section is (will be) about "Endo", so perhaps we should start using that name now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying out "JavaScript Framework for Secure Distributed Computing" in the main panel.

Comment on lines +84 to +85
text: 'JavaScript Framework',
ariaLabel: 'JavaScript Framework',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above re title of this section

main/ertp/guide/amount-math.md Outdated Show resolved Hide resolved
main/zoe/api/zoe.md Outdated Show resolved Hide resolved
main/guides/js-programming/README.md Outdated Show resolved Hide resolved

<<< @/snippets/test-hardened-js.js#exploit

Our goal is **defensive correctness**: a program is _defensively correct_ if it remains correct despite arbitrary behavior on the part of its clients. _For further discussion, see [Concurrency Among Strangers](http://erights.org/talks/promises/paper/tgc05.pdf) and other [Agoric papers on Robust Composition](https://papers.agoric.com/papers/#robust-composition)_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why, but the tg05 url works manually, but not when I click on it in the rendered text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I can't seem to reproduce the problem.

main/guides/js-programming/hardened-js.md Show resolved Hide resolved
main/guides/js-programming/hardened-js.md Outdated Show resolved Hide resolved
main/guides/js-programming/hardened-js.md Outdated Show resolved Hide resolved
main/guides/js-programming/hardened-js.md Show resolved Hide resolved
dckc and others added 5 commits December 4, 2021 15:03
 - add to TOC
 - add JS talk video; follow makeCounter to makeMint from talk
   - jessie tools how-to
   - freeze intrinsics, ocaps/POLA
     - examples of std globals
     - Navigating the Attack Surface video
     - link TimerService
       as alternative to setTimeout under limiting globals
     - briefly note localStorage alternatives
       orthogonal persistence, `@agoric/store`
   - unpack counter example: stateless objects and makers;
     code animation
 - document `bundleSource` with deployment
 - use ses wiki link to fill out frozen globals tip
 - migrate debugger note
 - shim limitations are already documented in ses-guide.md
 - never mind Jessie reference
 - postpone XS, Intl docs (see Agoric#581)
 - refine Introduction diagram
   per conventions suggested by MarkM

 - fix playlist context of youtube links
 - let menger video play embeded as well
 - don't mix E with guard example
 - `bob` -> Bob per narrator's privilege
 - never mind Airbnb in eslint tools section
   Also, the line breaking issue goes away with the more concise
   method syntax.
 - concise incr/decr in animation too
 - avoid "closes over" jargon
 - fix: strict mode example was bogus
 - Take care that non-fungible values are always referred
   to as _arrays_ of strings/object, not just objects.
   - and document `set` amounts as `copyArray`

Co-authored-by: Michael FIG <michael+github@fig.org>
Co-authored-by: Mark S. Miller <erights@users.noreply.github.com>
 - define vat as queue + stack + heap,
   borrowing from MDN's event loop article;
   - subsume vats page
   - document vat-per-contract under startInstance
   - punt "agoric start starts several vats"
     until we reorg the REPL / home / solo / chain services stuff
 - enumerate the steps in an eventual send
   Use `then` rather than `await` in example code,
   which also matches MDN `fetch` example.
   - hark to `fetch()` to introduce "asynchronous"
 - fix: "`E()` takes a presence as an argument"
   it can take a local object too; or a promise
 - don't assume reader knows that a method call is
   sending a message. Use "message" only for
   things in vat queues.
 - fix: fwd ref deploy script
 - fix: redundancy: "non-local objects in different vats"
 - cite How Agoric Solves Reentrancy Hazards (Nov 2020)
   - I considered integrating the pubSub example,
     but this page is about _using_ eventual send, and
     since the platform forces contract writers to do it,
     they don't necessarily need to learn the alternatives
     and why avoid them.
 - JavaScript Programming -> JavaScript Framework
   - add video
   - roads not taken: Distributed Objects, Distributed Computing,
     (hides "JavaScript", which is a big part of our brand)
     Secure Distributed Computing (too long)
 - eventual send comes before `Far`
 - eventual-send: troubleshooting: try E(obj).method()
 - far: clarify distributed object semantics
   - build on `makeCounter()` example
     - use tested snippets for code examples
   - illustrate remotable / presence with diagram
     - cap arrow tail inside A with ball
     - incr method offset
   - motivate harden() by way of distributed identity
   - move accessor prohibition into Far API section
   - document PassStyles, including
     - `copyArray` for use in ERTP AmountMath API
   - avoid various bits of redundancy
 - demote ses (WIP)
 - notifiers: clean up some incoming links

Co-authored-by: Michael FIG <michael+github@fig.org>
Co-authored-by: Mark S. Miller <erights@users.noreply.github.com>

 - start heading with "JavaScript Framework ..." to match nav
 - never mind date qualifier for contract-per-vat
 - fix playlist context of youtube links
 - don't imply that only the Far end is remotable

docs(far): avoid "identity" in pass-by-copy discussion
The scope of this page should evolve from "Contract Requirements"
to "using bundleSource". It should be linked

 - from deploying.md by way of documenting deployPowers
 - from E(Zoe).install(bundle)
copy .vuepress/dist to .vuepress/dist-root/documentation/
to reify the root URL structure on disk.

This fits conventions for static site hosting such as netlify.
@dckc dckc requested a review from erights December 4, 2021 21:05
@dckc dckc dismissed erights’s stale review December 4, 2021 21:05

MM said I should proceed in his comment

@dckc dckc merged commit 7470dd3 into Agoric:main Dec 4, 2021
@dckc dckc mentioned this pull request Mar 6, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants