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

feat: w3filecoin new client and api #848

Merged
merged 11 commits into from
Aug 9, 2023

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Aug 2, 2023

Implements new client and API based on storacha-network/specs#71

Note that new client is filecoin spec based rather than aggregation only. There are other roles that are not aggregator:

  • storefront will be implemented by web3.storage/nft.storage via w3up
  • aggregator will be implemented by w3filecoin
  • broker will be implemented by spade-proxy
  • chain will (likely) be implemented by w3filecoin (reading from spade oracle, while we might have an Oracle ourselves later on)

@vasco-santos vasco-santos force-pushed the feat/w3filecoin-new-client-and-protocol branch 5 times, most recently from 0b757f9 to 1cdc74e Compare August 2, 2023 20:37
@vasco-santos vasco-santos force-pushed the feat/w3filecoin-new-client-and-protocol branch 2 times, most recently from b541ff6 to 568618f Compare August 3, 2023 07:59
@vasco-santos vasco-santos force-pushed the feat/w3filecoin-new-client-and-protocol branch from 568618f to 5b15429 Compare August 3, 2023 08:25
@vasco-santos vasco-santos force-pushed the feat/w3filecoin-new-client-and-protocol branch from 5dbb012 to 0e71e7e Compare August 3, 2023 20:38
@vasco-santos vasco-santos marked this pull request as ready for review August 4, 2023 09:36
@vasco-santos vasco-santos force-pushed the feat/w3filecoin-new-client-and-protocol branch from f7ffeab to 9f365aa Compare August 4, 2023 14:41
Comment on lines +85 to +88
/**
* Storefront requestin piece to be aggregated
*/
storefront: Schema.text(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should drop this field per spec feedback, but if we don't we should:

  1. Ensure that it does not change in delegations, meaning verified in derives.
  2. Ensure that it equals to with field so that nft.storage can't specify web3.storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with might change in follow up invocation, so changing point 1

packages/capabilities/src/filecoin.js Outdated Show resolved Hide resolved
packages/capabilities/src/filecoin.js Outdated Show resolved Hide resolved
* @param {API.AggregatorServiceContext} context
* @returns {Promise<API.UcantoInterface.Result<API.PieceAddSuccess, API.PieceAddFailure> | API.UcantoInterface.JoinBuilder<API.PieceAddSuccess>>}
*/
async function queueHandler(piece, storefront, group, context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async function queueHandler(piece, storefront, group, context) {
async function accept(piece, storefront, group, context) {

Why not call it an accept since basically that is what we do here ? Or alternatively call it a dequeue ?

packages/filecoin-api/src/aggregator.js Show resolved Hide resolved
packages/filecoin-api/src/aggregator.js Outdated Show resolved Hide resolved
packages/filecoin-api/src/aggregator.js Outdated Show resolved Hide resolved
Comment on lines 31 to 36
// Check if self signed to call queue handler
if (context.id.did() === capability.with) {
return queueHandler(piece, offer, deal, context)
}

return queueAdd(piece, offerCid, deal, offer, context)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think following would follow the logic more clearly

Suggested change
// Check if self signed to call queue handler
if (context.id.did() === capability.with) {
return queueHandler(piece, offer, deal, context)
}
return queueAdd(piece, offerCid, deal, offer, context)
// Check if self signed to call queue handler
if (context.id.did() === capability.with) {
return queueHandler(piece, offer, deal, context)
}
// If self issued we accept without verification
return context.id.did() === capability.with
? accept(piece, offer, deal, context)
: enqueue(piece, offer, deal, context)

packages/filecoin-api/src/broker.js Outdated Show resolved Hide resolved
*/
async function queueHandler(piece, content, context) {
// store piece
const put = await context.pieceStore.put({
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure howe piece propagates to the aggregator here, if there was no user call with filecoin/add first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I decoupled things to happen outside of the scope so that each client/api can be used independently. Otherwise, we would get everything requiring everything else. Either they can rely on store events, or insertion with the client right after

@vasco-santos vasco-santos merged commit 7a58fbe into main Aug 9, 2023
14 checks passed
@vasco-santos vasco-santos deleted the feat/w3filecoin-new-client-and-protocol branch August 9, 2023 08:48
vasco-santos pushed a commit that referenced this pull request Aug 9, 2023
🤖 I have created a release *beep* *boop*
---


##
[8.0.0](capabilities-v7.0.0...capabilities-v8.0.0)
(2023-08-09)


### ⚠ BREAKING CHANGES

* update aggregation capabilitites to use height instead of size
together with client and api
([#831](#831))

### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* update aggregation capabilitites to use height instead of size
together with client and api
([#831](#831))
([31730f0](31730f0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
vasco-santos added a commit that referenced this pull request Aug 9, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.1.0](filecoin-client-v1.0.0...filecoin-client-v1.1.0)
(2023-08-09)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
vasco-santos added a commit that referenced this pull request Aug 9, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.1.0](filecoin-api-v1.0.0...filecoin-api-v1.1.0)
(2023-08-09)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
vasco-santos pushed a commit that referenced this pull request Aug 10, 2023
🤖 I have created a release *beep* *boop*
---


## 1.0.0 (2023-08-10)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
vasco-santos added a commit that referenced this pull request Aug 10, 2023
🤖 I have created a release *beep* *boop*
---


## 1.0.0 (2023-08-10)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
vasco-santos pushed a commit that referenced this pull request Aug 10, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](filecoin-api-v1.1.0...filecoin-api-v1.2.0)
(2023-08-10)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
vasco-santos added a commit that referenced this pull request Aug 10, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](filecoin-client-v1.1.0...filecoin-client-v1.2.0)
(2023-08-10)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
vasco-santos pushed a commit that referenced this pull request Aug 30, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.3.0](filecoin-client-v1.2.2...filecoin-client-v1.3.0)
(2023-08-30)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))
* w3filecoin spec separate capabilities to queue and enqueue
([#856](#856))
([6bf9142](6bf9142)),
closes [#855](#855)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
vasco-santos added a commit that referenced this pull request Aug 30, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.3.0](filecoin-api-v1.2.2...filecoin-api-v1.3.0)
(2023-08-30)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* upgrade data segment
([#850](#850))
([fba281f](fba281f))
* w3filecoin spec separate capabilities to queue and enqueue
([#856](#856))
([6bf9142](6bf9142)),
closes [#855](#855)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
vasco-santos pushed a commit that referenced this pull request Aug 30, 2023
🤖 I have created a release *beep* *boop*
---


##
[1.4.0](filecoin-api-v1.3.1...filecoin-api-v1.4.0)
(2023-08-30)


### Features

* w3filecoin new client and api
([#848](#848))
([7a58fbe](7a58fbe))


### Bug Fixes

* types when storefront is not in capability nb
([#886](#886))
([448a7d1](448a7d1))
* upgrade data segment
([#850](#850))
([fba281f](fba281f))
* w3filecoin spec separate capabilities to queue and enqueue
([#856](#856))
([6bf9142](6bf9142)),
closes [#855](#855)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

None yet

2 participants