From 111438395dbd4530fade17b0d216ff056df7d832 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 19 Apr 2024 11:35:19 +0100 Subject: [PATCH] fix!: drop filecoin storefront skip submit queue option (#1371) This is not needed since https://github.com/web3-storage/w3up/pull/1332 got released and used in w3infra https://github.com/web3-storage/w3infra/pull/343 and has been deployed in production without issues for the last few weeks BREAKING CHANGE: not possible to skip submit queue on storefront service anymore --- packages/filecoin-api/src/storefront/api.ts | 11 ------ .../filecoin-api/src/storefront/service.js | 37 +++++++++---------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/packages/filecoin-api/src/storefront/api.ts b/packages/filecoin-api/src/storefront/api.ts index 6fb3584e2..0667d71f1 100644 --- a/packages/filecoin-api/src/storefront/api.ts +++ b/packages/filecoin-api/src/storefront/api.ts @@ -34,13 +34,6 @@ export type DataStore = StreammableStore export type TaskStore = Store export type ReceiptStore = Store -export interface ServiceOptions { - /** - * Implementer MAY handle submission without user request. - */ - skipFilecoinSubmitQueue?: boolean -} - export interface ServiceContext { /** * Service signer @@ -74,10 +67,6 @@ export interface ServiceContext { * Deal tracker connection to find out available deals for an aggregate. */ dealTrackerService: ServiceConfig - /** - * Service options. - */ - options?: ServiceOptions } export interface FilecoinSubmitMessageContext diff --git a/packages/filecoin-api/src/storefront/service.js b/packages/filecoin-api/src/storefront/service.js index 01f6b4544..e0c05c09b 100644 --- a/packages/filecoin-api/src/storefront/service.js +++ b/packages/filecoin-api/src/storefront/service.js @@ -20,27 +20,24 @@ import { export const filecoinOffer = async ({ capability }, context) => { const { piece, content } = capability.nb - // Queue offer for filecoin submission - // We need to identify new client here... - if (!context.options?.skipFilecoinSubmitQueue) { - // dedupe - const hasRes = await context.pieceStore.has({ piece }) - if (hasRes.error) { - return { error: new StoreOperationFailed(hasRes.error.message) } - } + // dedupe + const hasRes = await context.pieceStore.has({ piece }) + if (hasRes.error) { + return { error: new StoreOperationFailed(hasRes.error.message) } + } - const group = context.id.did() - if (!hasRes.ok) { - // Queue the piece for validation etc. - const queueRes = await context.filecoinSubmitQueue.add({ - piece, - content, - group, - }) - if (queueRes.error) { - return { - error: new QueueOperationFailed(queueRes.error.message), - } + // Queue offer for filecoin submission + const group = context.id.did() + if (!hasRes.ok) { + // Queue the piece for validation etc. + const queueRes = await context.filecoinSubmitQueue.add({ + piece, + content, + group, + }) + if (queueRes.error) { + return { + error: new QueueOperationFailed(queueRes.error.message), } } }