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

v0.1.0 #1

Closed
wants to merge 127 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
02fc52e
Rough notes
expede Aug 16, 2022
f3c64fc
Add authors, start sketching out the basics
expede Nov 26, 2022
cadd78c
Configure GH actions
expede Nov 26, 2022
29c014c
Update README
expede Nov 26, 2022
a251084
Start on receipts
expede Nov 26, 2022
e57a7ac
IPLD basics
expede Nov 26, 2022
68a387e
More IPLD
expede Nov 26, 2022
16956fb
I don't totally love the current format, but unclear how to get IPLD to
expede Nov 26, 2022
428378a
WIP ahead of Irakli
expede Nov 26, 2022
99679aa
WIP fleshig out wrapper
expede Nov 26, 2022
d9b0fee
Early thoughts on delegation vs invocation text
expede Nov 26, 2022
c1bc821
Add fields for pipelining
expede Nov 26, 2022
096339a
Major blocks in place!
expede Nov 26, 2022
ad1ec20
Tighten up examples
expede Nov 26, 2022
38f7d2f
JSON typos
expede Nov 26, 2022
f6f2658
SO MANY TYPOS
expede Nov 26, 2022
8b3735a
Diamond pipeline example
expede Nov 26, 2022
e6f0c8c
Might need to simplify that explination, but it gets the job done for…
expede Nov 27, 2022
d70988a
Intro done minus links
expede Nov 27, 2022
64cd3f8
Cleaning up
expede Nov 27, 2022
19d8eb0
JSON typos
expede Nov 27, 2022
c29dd8a
No more FIXMEs
expede Nov 27, 2022
1ac3b5a
Typos
expede Nov 27, 2022
892516d
Change spellchecker
expede Nov 27, 2022
508d921
Configure spellchecker
expede Nov 27, 2022
8a69456
Limit to readme
expede Nov 27, 2022
283583b
Update dictionary
expede Nov 27, 2022
e96f18d
Typos
expede Nov 27, 2022
2556929
typos typos typos
expede Nov 27, 2022
7e6f2d6
Last one?
expede Nov 27, 2022
e8ae3c9
Configure link checker
expede Nov 27, 2022
b4659f8
The eRights site doesn't have TLS 🤣
expede Nov 27, 2022
f48bfc7
More text in roels table
expede Nov 27, 2022
e88800d
Syntax highlight IPLD Schemas
expede Nov 27, 2022
887bae3
add dataflow exaple
expede Nov 27, 2022
d8bf865
haha yeah taht wasn't json
expede Nov 27, 2022
1483fea
Renumbering and tighten up promise synatx
expede Nov 27, 2022
59a88d6
Prior Art
expede Nov 27, 2022
a2a8813
Update dictionary
expede Nov 27, 2022
f8e650e
Uh oh the dictionary may not understadn Cap'n
expede Nov 27, 2022
0fa485c
Let's thy this?
expede Nov 27, 2022
1ef2a32
Consistency
expede Nov 27, 2022
b1a38c6
More complex example
expede Nov 27, 2022
b21b5ce
Change syntax
expede Nov 27, 2022
b6a2828
JSON Path (have I gone too far?!)
expede Nov 27, 2022
cbcbea5
Switch to JSON Pointer for siplicity
expede Nov 27, 2022
4ce2998
An abstract would be nice
expede Nov 27, 2022
fdb39f3
Numbering
expede Nov 27, 2022
1236f4f
...more numbering
expede Nov 27, 2022
b542457
Update diagram and (somewhat annoyingly) calling convention
expede Nov 27, 2022
f935c5d
Better?
expede Nov 27, 2022
ca95eb2
Update receipt
expede Nov 27, 2022
102cd41
Add invocation flow diagram
expede Nov 27, 2022
da1ba15
Move elements in diagram
expede Nov 27, 2022
ae0f6fd
LOL more realistic for DSys
expede Nov 27, 2022
c4b4f18
Typo
expede Nov 27, 2022
fc9cf55
Thank Bacalhau folks :)
expede Nov 27, 2022
b9dbc6c
Update dictionary
expede Nov 27, 2022
ed201f1
Update examples to match text
expede Nov 28, 2022
fc1f1e7
Tighten up selectors
expede Nov 28, 2022
6eb752d
typo
expede Nov 28, 2022
7840f25
Update IPLD Schema markdown highlighting
expede Nov 28, 2022
3eacc1b
Update dictionary
expede Nov 28, 2022
5344b52
Introduce promise pipelinig much later in the spec
expede Nov 28, 2022
e87b317
Typo
expede Nov 28, 2022
5689113
Reintroduce selectors to example now that it's moved
expede Nov 28, 2022
a79dcc9
Link to Mark Miller
expede Nov 28, 2022
9e638d3
Consistency
expede Nov 28, 2022
4dfd5b5
Update README.md
expede Nov 28, 2022
2668abc
Update README.md
expede Nov 28, 2022
e7aeae2
Make table and IPLD the same
expede Nov 28, 2022
2dd8912
Fix typo (thanks Quinn!)
expede Nov 29, 2022
0dac02d
rename inv to ucan/invoke (thanks Philipp!)
expede Nov 29, 2022
3e336f8
Update README.md
expede Nov 29, 2022
a5c2cb6
Update README.md
expede Nov 29, 2022
ed328f2
Update README.md
expede Nov 29, 2022
19bf685
Get rid of (confusing) retries field
expede Nov 29, 2022
f6fc338
Update README.md
expede Nov 29, 2022
d886fce
Take multiple CIDs
expede Nov 29, 2022
e19c70b
No more Qm
expede Nov 29, 2022
e9a914e
Update dictionary
expede Nov 29, 2022
496570b
Update layout per Philipp, multiple UCANs in a prf
expede Nov 29, 2022
dd3815d
Update dictionary
expede Nov 29, 2022
47c5719
Typo
expede Nov 29, 2022
921569f
Use DAG-JSON consistly
expede Nov 29, 2022
2383f4d
Tighten up receipts, force varsig
expede Nov 29, 2022
3e95289
Remove Resultversion
expede Nov 29, 2022
fc527d0
Include subdelegations
expede Nov 29, 2022
9ef5838
Typos
expede Nov 29, 2022
05369a7
Add to dictionary
expede Nov 29, 2022
0f8680c
TYpo in dictonary
expede Nov 29, 2022
f3652b6
SemVer changes
expede Nov 29, 2022
88fbd37
Code layout
expede Nov 29, 2022
017b5a7
s/using/with/
expede Nov 29, 2022
d87a949
rlt -> out everywhere
expede Nov 29, 2022
ce3d25e
Remove CIDs
expede Nov 30, 2022
c4c9be4
Forgot the IPLD
expede Nov 30, 2022
bdabdf2
update examples
expede Nov 30, 2022
2522f78
Remove prf completely (woah)
expede Nov 30, 2022
ce3ffb0
Back it goes!
expede Nov 30, 2022
6717fcb
typo
expede Nov 30, 2022
b157fad
A couple missing words
expede Nov 30, 2022
8d137d4
s/action/task/g
expede Nov 30, 2022
c79253c
Add missing commas in JSON
expede Nov 30, 2022
8b05002
Thank rvagg
expede Nov 30, 2022
392c765
Add to dict
expede Nov 30, 2022
4134850
oops
expede Nov 30, 2022
b10cae0
Clearer success/error states
expede Dec 1, 2022
e5639da
Add warning label
expede Dec 1, 2022
4ec759d
Add word to dict
expede Dec 1, 2022
6cda9b2
Typo in JSON
expede Dec 1, 2022
41eb8e6
Consistent "Varsig"
expede Dec 2, 2022
f1de75e
Update Varsig spelling in dict
expede Dec 2, 2022
7e0bedb
Update README.md
expede Dec 3, 2022
0f6942f
Add Graphviz action
expede Dec 3, 2022
c9a3345
Okay but actually this time
expede Dec 3, 2022
6c75a60
action create .svg from .dot file
actions-user Dec 3, 2022
4029ea2
Add diagram to README
expede Dec 3, 2022
f954ac5
Major cleanup / reorg (#4)
expede Dec 6, 2022
26a3aef
Fix examples
expede Dec 6, 2022
32f8562
Typo in title!
expede Dec 7, 2022
187d792
Fix Schema typo per Gozala
expede Dec 16, 2022
20037e3
Update README.md
expede Dec 16, 2022
53f9d79
Uodate ucan/ptr to promise/* (thanks Irakli!)
expede Dec 17, 2022
9f68488
Fix dangling sentence
expede Dec 18, 2022
1feb8f8
Add more text about the promise pointers
expede Dec 18, 2022
9cf808f
Add words to dictionary
expede Dec 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
name: 'spellcheck'
on:
pull_request:
name: Spellcheck Action
on: push

jobs:
spellcheck:
build:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: matheus23/md-spellcheck-action@v4.1.0
with:
files-to-check: "**/*.md"
files-to-exclude: |
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Community_Specification_License-v1.md
Notices.md
words-to-ignore-file: ./.github/workflows/words-to-ignore.txt
# The checkout step
- uses: actions/checkout@master
- uses: rojopolis/spellcheck-github-actions@0.24.0
name: Spellcheck
180 changes: 176 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,188 @@
# UCAN Invocation
# UCAN Invocation Specification v0.1.0
expede marked this conversation as resolved.
Show resolved Hide resolved

## Editors

* _
* [Brooklyn Zelenka](https://github.com/expede/), [Fission](https://fission.codes/)

## Authors

* _
* [Brooklyn Zelenka](https://github.com/expede/), [Fission](https://fission.codes/)
* [Irakli Gozalishvili](https://github.com/Gozala), [DAG House](https://dag.house/)

# 0. Abstract
## Depends On

* [`ucan-ipld`](https://github.com/ucan-wg/ucan-ipld/)

# 0 Abstract

## Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://datatracker.ietf.org/doc/html/rfc2119).

# 1 Introduction

## Separation

Why separate the UCAN from the invocation format? Surely the UCAN itself already contains all the infomation required.

I would argue that this is not the case for a few reasons.

1. Authority is not intent to execute. Authority transfer is first-class in UCAN, other actions are not
2. Mixing the two levels means that invocation info will live with the token (as a proof) on subdelegations
3. Other detail, such as scheduling
expede marked this conversation as resolved.
Show resolved Hide resolved

A job request may be picked up by anyone, PRIOR to UCAN delegation. A handshake or matchmaking may need to be performed.
expede marked this conversation as resolved.
Show resolved Hide resolved

## Authority Is Not Intention

Or to put it another way: "just because you can, doens't mean you should". Granting a UCAN to a peer means that they are allowed to perform some actions for a period of time. This is a feature not a bug, but also says nothing about the intention of when it should be run. I may grant a collaborative process the ability to perform actions on an ongoing basis (hmm, but vioating POLA)
expede marked this conversation as resolved.
Show resolved Hide resolved

I could preload the service with `n` UCANs with narrow time windows and `nbf`s in the future. That would certainly be very secure, but it would be less convenient since I need to come online to issue more or to

# 2 Envelope

UCAN uses a capabilities model. The

* UCANTO
* zcap
* IPVM




Specify Roles




## 2.1 IPLD

``` ipldsch
type Invocation struct {
i [&UCAN]
v SemVer
n String
s Bytes
}

type SemVer struct {
ma Integer
mi Integer
pa Integer
ta optional nullable String
}
expede marked this conversation as resolved.
Show resolved Hide resolved
```

## 2.2 Exmaple

``` json
{
"ucan/invoke": [ "bafyLeft", "bafyRight", "bafyEnd" ]
expede marked this conversation as resolved.
Show resolved Hide resolved
"version": "0.1.0",
"nonce": "abcdef",
"siganture": 0xCOFFEE
}
```

# 3 Receipt & Attestation

An invocation receipt is a claim about what the output of an invocation is. A receipt MUST be attested via signature of the principal (the audience of the associated invocation).

Note that this does not guarantee correctness of the result! The level of this statement's veracity MUST be ony taken that the signer claims this to be a fact.

The receipt MUST be signed with by the `aud` from the UCAN.
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this to requirement to be difficult to meet. In our setup actor doing the work would not have access to the key to sign the result, but it would have some delegation from the aud to act on it's behalf.

I think it would be a good idea to consider such a setup and how delegates could sign on behalf of aud.

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea is that if a subdelegate is going to do the work, you need to create an invocation for them

alice --[delegate]--> bob --[delegate]--> carol --[delegate]--> dan
                                &                     &
                              Invoke                Invoke

Here we have both an delegation chain (the right to do the thing), and a wrapper invocation. Bob asks Carol to do the work. She doens't have access to everything required for the job, so she subdelegates a partial job to Dan and wraps it in another invocation.

Does that not match your picture?

Copy link
Contributor

Choose a reason for hiding this comment

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

Problem is that invocation will target web3.storage which has some did:key. But service that receives that invocation will not have access to that key, so it will not be able to sign receipt with it.

Service could have some delegation from web3.storage key as an authorization to act on it’s behalf, which it will get earlier than invocation.

This is more or less what I’ve been trying to accomplish with pipelining/forwarding threads. I

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooooooh interesting @Gozala! You're trying to do that statelessly. The other way of modeling that is of course with a (stateful) DID document.

The problem with not aligning the audience in the invocation is that if you need to coordinate with an external service, you won't be able to prove the chain. For example, let's say that Fission starts using web3.storage for storage, and web3.storage uses Fission for DNSLink management. We would have no way to prove that the user intends to update their DNSLink if they started a request from your service (to abstract away the fact that there's many services here).

I agree that the forwarding concept would alleviate this! Also agree that "sure we'll run anything aimed at that DID" also works for a subset of cases where you're handing the entire request. If you want a service to openly interoperate, "the chain must be unbroken".

So: if we ship the forwarding/powerbox feature, does that make invocation better for you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ooooooh interesting @Gozala! You're trying to do that statelessly. The other way of modeling that is of course with a (stateful) DID document.

You could do with did docs but that indeed introduces state and has additional tradeoffs that I’d like to avoid.

I’m not trying to make it stateless, but rather trying to capture state in the receipt so it could be verified even after state change

The problem with not aligning the audience in the invocation is that if you need to coordinate with an external service, you won't be able to prove the chain. For example, let's say that Fission starts using web3.storage for storage, and web3.storage uses Fission for DNSLink management. We would have no way to prove that the user intends to update their DNSLink if they started a request from your service (to abstract away the fact that there's many services here).

I think we misunderstand each other. All I’m proposing is just like agent could delegate invocation to another agent, it should be possible to delegate execution to another agent.

In other words I could delegate to you file upload capability. But so should upload service be able to delegate providing upload capability to another service. That way agent invoking capability does not need to know which upload service web3.storage relies on.

It is possible to accomplish above with active forwarding of delegations where our service accepts invocation and then forwards (redelegates) it to desired handler. But that implies signing things at every request and access to the keys.

Ideally it would be possible to just route request to a desired handler, who could sign receipt with own key and provide a proof chain warranting it to handle such requests on behalf of the aud service.

So: if we ship the forwarding/powerbox feature, does that make invocation better for you?

That might be a way to address it, but there also might be different ways to address this specific problem without changing UCANs themselves

Copy link
Member Author

@expede expede Nov 26, 2022

Choose a reason for hiding this comment

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

I’m not trying to make it stateless, but rather trying to capture state in the receipt so it could be verified even after state change

Sorry, this is what I mean by "stateless" — in the same sense REST. It doesn't make reference to ambient external state, but everything required to fulfill the request is passed along together.

That way agent invoking capability does not need to know which upload service web3.storage relies on.

Absolutely! My understanding about this scenario is that web3.storage would be unable to further delegate to external services using UCAN 0.9. Is that correct?

Want:
Alice -> Bob -> web3.storage[bot1, bot2, bot3] -> fission.codes

But have these disconnected:

Alice -> Bob -> web3.storage
bot2 -> fission.codes

This scenario would be impossible, because web3.storage would not be able to subdelegate to fission.codes under UCAN 0.9

This can be fixed with your forwarding/powerbox idea to connect the two disconnected chains in the proposed UCAN 0.10 changes

Alice -> Bob -> web3.storage

web3.storage =[fwd]=> bot1
web3.storage =[fwd]=> bot2
web3.storage =[fwd]=> bot3

bot2 -> fission.codes

Which composes as something like:

Alice -> Bob -> web3.storage
                web3.storage =[fwd]=> bot2
                                      bot2 -> fission.codes

This is my current picture/plan for 0.10 ☝️ Does that match yours?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, we may actually need an invocation chain in the Receipts 🤔


## 3.1 IPLD

``` ipldsch
type Receipt struct {
i {&UCAN : {URI : Any}} <!-- not sure if this actually works? My guess is that the link doesn't work because it should not -->
v SemVer
n String
s Bytes
}

type URI = String
```

## 3.2 JSON Example

``` json
{
"ucan/receipt": {
"bafyLeft": {
"a": 42,
"example.com": {
"msg/read": [
"from": "alice@example.com",
"text": "hello world"
]
}
expede marked this conversation as resolved.
Show resolved Hide resolved
},
"bafyRight": {
"sub.example.com?TYPE=TXT": {
"crud/update": {
"12345": {
"http": {
"status": 200
},
"value": "lorem ipsum"
}
}
}
}
},
"version": "0.1.0",
"nonce": "xyz",
"signature": 0xB00
}
```

# 4 Pipelining

> Machines grow faster and memories grow larger. But the speed of light is constant and New York is not getting any closer to Tokyo. As hardware continues to improve, the latency barrier between distant machines will increasingly dominate the performance of distributed computation. When distributed computational steps require unnecessary round trips, compositions of these steps can cause unnecessary cascading sequences of round trips
>
> Robust Composition, Mark Miller

At time of creation, a UCAN MAY not know the concrete value required to scope the resource down sufficiently. This MAY be caused either by invoking them both in the same payload, or following one after another by CID reference.

Variables relative to the result of some other action MAY be used. In this case, the attested (signed) receipt of the previous action MUST be included in the following form:

Refeernced by invocation CID


### 4.1 IPLD Schema

``` ipldsch
type RelativeOutput struct {
i &Invocation
o Path -- output path
}

type Path String
```

### 4.2 JSON Example

``` json
{
"ucan/invoked": "bafy12345",
"output": "example/a/b"
}
```

Inside a next UCAN, substitution of a previous unresolved step MUST be represented as:

``` js
{
// ...,
"att": {
"example.com": {
"path": {
"ucan/invoked": "bafy12345",
"output": "example.com/a/b"
}
}
}
}
```