Code Monkey home page Code Monkey logo

documentation's Introduction

banner-1500x500

Agoric Platform SDK

This repository contains most of the packages that make up the upper layers of the Agoric platform, with the endo repository providing the lower layers. If you want to build on top of this platform, you don't need these repositories: instead you should follow our instructions for getting started with the Agoric SDK.

But if you are improving the platform itself, these are the repositories to use.

Prerequisites

  • Git
  • Go ^1.20.2
  • Node.js ^18.12 or ^20.9
    • we generally support the latest LTS release: use nvm to keep your local system up-to-date
  • Yarn (npm install -g yarn)
  • gcc >=10, clang >=10, or another compiler with __has_builtin()

Any version of Yarn will do: the .yarnrc file should ensure that all commands use the specific checked-in version of Yarn (stored in .yarn/releases/), which we can update later with PRs in conjunction with any necessary compatibility fixes to our package.json files.

Building on Apple Silicon and Newer Architectures

Some dependencies may not be prebuilt for Apple Silicon and other newer architectures, so it may be necessary to build these dependencies from source and install that package’s native dependencies with your package manager (e.g. Homebrew).

Currently these dependencies are:

Additionally, if your package manager utilizes a non-standard include path, you may also need to export the following environment variable before running the commands in the Build section.

export CPLUS_INCLUDE_PATH=/opt/homebrew/include

Finally, you will need the native build toolchain installed to build these items from source.

xcode-select --install

Build

From a new checkout of this repository, run:

yarn install
yarn build

When the yarn install is done, the top-level node_modules/ will contain all the shared dependencies, and each subproject's node_modules/ should contain only the dependencies that are unique to that subproject (e.g. when the version installed at the top level does not meet the subproject's constraints). Our goal is to remove all the unique-to-a-subproject deps.

When one subproject depends upon another, node_modules/ will contain a symlink to the subproject (e.g. ERTP depends upon marshal, so node_modules/@endo/marshal is a symlink to packages/marshal).

Run yarn workspaces info to get a report on which subprojects (aka "workspaces") depend upon which others. The mismatchedWorkspaceDependencies section tells us when symlinks could not be used (generally because e.g. ERTP wants [email protected], but packages/marshal/package.json says it's actually 0.2.0). We want to get rid of all mismatched dependencies.

The yarn build step generates kernel bundles.

Test

To run all unit tests (in all packages):

  • yarn test (from the top-level)

To run the unit tests of just a single package (e.g. eventual-send):

  • cd packages/eventual-send
  • yarn test

Run the larger demo

Visit https://docs.agoric.com for getting started instructions.

TL;DR:

  • yarn link-cli ~/bin/agoric
  • cd ~
  • agoric init foo
  • cd foo
  • agoric install
  • agoric start

Then browse to http://localhost:8000

Edit Loop

  • modify something in e.g. zoe/
  • run yarn build (at the top level or in zoe/)
  • re-run tests or agoric start --reset
  • repeat

Doing a yarn build in zoe creates the "contract facet bundle", a single file that rolls up all the Zoe contract vat sources. This bundle file is needed by all zoe contracts before they can invoke zoe~.install(...). If you don't run yarn build, then changes to the Zoe contract facet will be ignored.

Development Standards

  • All work should happen on branches. Single-commit branches can land on trunk without a separate merge, but multi-commit branches should have a separate merge commit. The merge commit subject should mention which packages were modified (e.g. (SwingSet,cosmic-swingset) merge 123-fix-persistence)
  • Keep the history tidy. Avoid overlapping branches. Rebase when necessary.
  • All work should have an Issue. All branches names should include the issue number as a prefix (e.g. 123-description). Use "Labels" on the Issues to mark which packages are affected.
  • Add user-visible changes to a new file in the changelogs/ directory, named after the Issue number. See the README in those directories for instructions.
  • Unless the issue spans multiple packages, each branch should only modify a single package.
  • Releases should be made as according to MAINTAINERS.md.

documentation's People

Contributors

0xpatrickdev avatar arirubinstein avatar barbaraliau avatar cboydstun avatar chris-hibbert avatar davidbruant avatar dckc avatar dependabot[bot] avatar dominiquejane avatar dtribble avatar erights avatar gibson042 avatar ivanlei avatar jimlarson avatar katelynsills avatar kbennett2000 avatar kriskowal avatar luqipan avatar mergify[bot] avatar mhofman avatar michaelfig avatar mudassir-agoric avatar otoole-brendan avatar samsiegart avatar tatyana0219 avatar toliaqat avatar turadg avatar tyg avatar tyrosine22 avatar warner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

documentation's Issues

Questionning Github Pull Requests for first draft documentation

(...) lots of back and forth. I wonder whether a github pull request is a good tool for this

Originally posted in #10 (comment)

It's not the first time i've come across this problem. A git/hub repo with markdown resources is cool for historicity, receiving pull requests for small changes, and easy publishing, but for a first draft with potentially lots of discussion, it seems inappropriate

Among other experiences, i've had this problem with a collective blog
One solution we came up with is to use Google Docs for the first draft, then transform to markdown when we're in agreement
As long as we don't create dozens of new pages a week, the cost of transforming manually a google docs to markdown is fairly small. It's also possible to automate this transformation (i started a project for this purpose with a friend as a concrete exercice for her to learn how to code) and turn the process from Google Docs to Pull Request on the proper repo into 1 click

Add E.get(x) documentation

This module is full of one-letter methods, and combined with no docs, it is very hard to dive into.

I may document this as I go, because I'm gradually chipping in, but opening an issue in case someone wants to quickly type up an answer key before I have to deduce it from source.

Some mysterious letters that I'm trying to decode:

  • E() itself, which I think basically just lines up methods on the eventual result, but potentially remotely, using some messaging format?
  • E.C(presence)
  • E.C(presence).G
  • E.C(presence.G[objectKey].M[methodName]
  • E.C(presence).G[promiseKey].P

I'm also unclear to what degree pipelining works now. This issue suggests it is not added yet, but some aspect of it was merged soon after.

Some notes on how I'm testing capTP

As a very simple test, I'm experimenting whether I can send a message that says to a pizzeria presence "whatIsLargestPizzaSize().then(orderPizzaBySize)". This should be doable with a single round trip, and so that is my basic benchmark for the feature.

More realistically, I would want to ask pizzeria.getSizeList().then(pickLargestOption).then(orderPizza), where pickLargestOption could be a user-specified algorithm, which might require the .there() call that Mark described to me.

Anyways, once I get a deeper understanding here, I may contribute some of these features here instead of at capnode, if I can just get the developer ergonomics up to where I'd feel comfortable promoting them.

Document a nicer way to install contracts

Currently, contract installation is done by:

  • creating a file in the middle of the cosmic-swingset repo (hacking the pixel demo, really)
  • write the contract content in the file
  • expose the contract source code as a property of home
  • start scenario 3, 2 or 1 of cosmic-swingset

I think a nicer way is possible. Likely via home.uploads

Update ERTP Getting Started with Better Instructions

Currently it is just npm install and npm test. We should mention the Agoric ERTP package now that we have it, and perhaps a few more things.

agoric.com/documentation/ertp/guide/getting-started.html#installation

Update Documentation such that AmountMath.coerce only accepts amounts

We made a change to the ERTP PR Agoric/agoric-sdk#523 such that AmountMath.coerce now only accepts amounts, not extents.

This has other effects: mint.mintPayments() only accepts amounts now. We will need to change our examples.

Two things that can help:

  1. AmountMath is one of the values returned from produceIssuers now, so we have it already and can use AmountMath.make
  2. We've started using a pattern of renaming AmountMath.make to roughly the allegedName of the assets: moola(3), bucks(50) etc. Eventually we may be able to return this option as part of ERTP proper.

[Zoe] Improve explanation around "redeem" step

We currently say something like the following in zoe.chainmail

   * To redeem an invite, the user normally provides a proposal (their rules for the
   * offer) as well as payments to be escrowed by Zoe.  If the proposal or payments are
   * undefined, the default is not to propose or pay (just to obtain the invite's seat).

Possibly bike shed the name 'redeem'

Modeling assets with non-natural numbers in ERTP

I think that all examples i have seen of ERTP either use natural numbers (1, 10, 1000, 32) or use objects to represent rights

Euros, dollars, bitcoins all use non-natural numbers in their usual representation

But JavaScript is notoriously inadequate for non-natural numbers (0.1 + 0.2 !== 0.3)

What is the approach recommanded by Agoric to model non-natural number assets?

(Attn @erights)

Documenting Agoric start

I'm trying to create a visual for the different parts created by agoric start (and the parts interacting with what's created)

Right now, i'm at:

Agoric-cli start

I know i got the major parts more or less ok
i'm sure i got lots of minor parts super wrong, but i don't know in what way

@michaelfig @Chris-Hibbert (maybe others?), could you comment on this first draft and tell me how to improve this?

Thanks!

A couple questions to get started:

  • are all vats run in the fake blockchain?
  • when a contract is deployed, is a new vat created or is it eval'ed in an existing vat (and which?)

documentation on what's required for a zoe contract

We should write up a description of the format and expectations for a zoe contract. We currently have a description of what contracts can expect from zoe, but not what zoe expects from contracts, and what choices contracts can make in their implementation

The starting point is that a zoe contract is a javascript file that can import other javascript code, including harden, Nat, zoeHelpers and anything else we make available. We should describe whether there's any limitation on what library code they can use, and how they can split their code across multiple files.

The file needs to export a makeContract function that takes zoe as a parameter, and return a record that contains at least invite:. We should describe the conventional use of the publicAPI: keyword and say whether there's any particular support for it. What else needs to be written up about makeContract's return value?

We should describe what you do to create an invite, and what's required/expected of the embedded seat. I think it makes sense to have sections describing the case where instantiating the contract hands out a particular seat that provides access to other seats versus contracts that expect all the seats to be handed out from the publicAPI, or something similar.

There's probably more. It might be worthwhile to provide a skeleton template if enough of this is always the same.

A trivial contract in the REPL

Dean asked for an example of a trivial contract entered into the cosmic-SwingSet Read-Eval-Print loop to show how contractHost and other facilities available from home can be experimented with there.

I started with this trivial contract:

/* global makePromise */
// Copyright (C) 2019 Agoric, under Apache License 2.0

import harden from '@agoric/harden';

const doubler = harden({
  start: (_, inviteMaker) => {
    const result = makePromise();
    const seat = harden({
      provide(n) { result.res(2*n); },
      result() { return result.p; },
    });

    return harden({
      seat: inviteMaker.make('multiplicand', seat),
    });
  },
});

const doublerSrcs = harden({ start: `${doubler.start}` });

export { doublerSrcs };

Ignoring false starts and dead-ends, I had this interaction with the REPL:

command[2] d1 = { start: (, inviteMaker) => { const result = makePromise(); const seat = harden({ provide(n) { result.res(2*n); }, result() { return result.p; }, }); return harden({ seat: inviteMaker.make('multiplicand', seat), }); }, }
history[2] {"start":[Function start]}
command[3] d1Srcs = { start: `${d1.start}` };
history[3] {"start":"(
, inviteMaker) => {\n const result = makePromise();\n const seat = harden({\n provide(n) {\n result.res(2 * n);\n },\n\n result() {\n return result.p;\n }\n\n });\n return harden({\n seat: inviteMaker.make('multiplicand', seat)\n });\n }"}
command[4] triv1 = home.contractHost~.install(d1Srcs)
history[4] [Presence o-56]
command[5] triv1~.spawn({})
history[5] {"seat":[Presence o-57]}
command[6] home
history[6] {"gallery":[Presence o-50],"handoffService":[Presence o-51],"purse":[Presence o-52],"canvasStatePublisher":[Presence o-53],"contractHost":[Presence o-54],"handoff":[Presence o-55]}
command[8] home.purse~.getIssuer()
history[8] [Presence o-58]
command[17] iss = home.contractHost~.getInviteIssuer()
history[17] [Presence o-59]
command[18] iss~.claimAll(history[5].seat, "seat1")
history[18] [Presence o-60]
command[20] seat1P = home.contractHost~.redeem(history[18])
history[20] [Presence o-61]
command[21] seat1P~.provide(3)
history[21] undefined
command[22] seat1P~.result()
history[22] 6

Notice that line 2 drops const and the outer harden from the source file.

[Zoe] Explain Invites

We should add more writeup of how the invites work. They're implied by ERTP and various things, but we don't explicitly discuss it anywhere.

Licence for non-code content

The current licence is Apache-2
However, it's not clear whether this licence appropriately addresses non-code contents (prose and images)

  • MDN addresses this with code having a CC-0 licence and content having CC-BY-SA licence
  • developers.google.com has its code in Apache 2 and content as CC-BY

Todos before defi hackathon

Putting this in a more public place than my notebook. This is a living issue so I don't make n number of issues for every single one.

"Claim" an item by putting your name in front of it in bold and the status.

Homepage

  • Update so CTA goes to Getting Started

ERTP

  • Complete ERTP glossary

    • path: /ertp/glossary/README.md
  • Move ExtentOps API into own file and place underneath UnitOps in the sidebar

  • Pull Assay, Payments, Purse sections into own files

    • Assay
    • Payments
    • Purse
  • Pull out definitions from UnitOps and place into /ertp/guide/. Makes much more sense to put it there. API should only contain the methods.

  • Pull out 'Gotchas' from ERTP guide and put into own sections

  • Complete any missing examples in ERTP

  • Add the following methods to Payments API - A payment's balance can only fall, through the action of `depositExactly()`, `claimExactly()` or `burnExactly()`. Payments can be converted to Purses by getting a verified assay and calling `assay.makeEmptyPurse().depositAll(payment)`;

  • BAR: starting Finish default-configuration file

  • DOM: PR pending. Almost complete. Have questions/comments (see red text). ContractHost API [contractHost.chainmal)(https://github.com/Agoric/ERTP/blob/master/core/contractHost.chainmail)

  • Finish unitOps.make(allegedExtent) params definition

  • line 106 /ertp/api/contract-hosts.md - write and verify example - Chris

  • line 128 /ertp/api/contract-hosts.md - verify description -Chris

Zoe

  • KATE: STARTING Complete Zoe glossary
    • path: /zoe/glossary/README.md
  • DOM: in progress zoe.chainmail -> Zoe API
  • Check this: Zoe and ZoeContractFacet have some similar methods so those examples are the same. Those should be double-checked to make sure they are accurate in both locations. Methods: getInviteAssay, getEscrowReceiptAssay
  • verify zcf.getSeatAssay() example - Couldn't find an example in the code, this needs checking.
  • verify zoe.getInviteAssay()

Add Other Projects
Projects Reference
The most relevant of these project's documentation should be pulled out and placed into the site. The less relevant projects can have external links

  • Add definitions for each project (maybe in like a master project list page? not sure yet)
  • Make nested navbar

Site

  • BAR: in process Add favicon

Proofreading:

  • Add missing code markdowns
  • Review for typos
  • Verify links
  • Verify navbar
  • Verify sidebars

Improve dapps/README.md

Edited by Kate:

README-agoric-dapp.md has been moved to dapps/README.md, but we should continue to improve it.

[Process] Remove required reviews

I created a pull request and got this

Capture d’écran de 2020-04-03 11-21-06

I think that at this stage of the doc, this limitation is stronger than necessary

I'm merging my own pull request per a discussion we've had yesterday about typos being ok to go without PR or with self-merged PRs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.