Skip to content

Commit

Permalink
fix: use up.storacha.network (#144)
Browse files Browse the repository at this point in the history
We decided to use the existing URL and DID i.e. `up.storacha.network`
not `upload.storacha.network`. This PR updates the values.
  • Loading branch information
alanshaw authored Feb 11, 2025
1 parent 372f839 commit ac6b5b4
Show file tree
Hide file tree
Showing 21 changed files with 83 additions and 78 deletions.
2 changes: 1 addition & 1 deletion packages/access-client/test/agent-use-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('authorizeWaitAndClaim', async function () {
describe('getAccountPlan', async function () {
const accountWithAPlan = 'did:mailto:example.com:i-have-a-plan'
const accountWithoutAPlan = 'did:mailto:example.com:i-have-no-plan'
const product = 'did:web:test.upload.storacha.network'
const product = 'did:web:test.up.storacha.network'
/** @type {Record<Ucanto.DID, {product: Ucanto.DID, updatedAt: string}>} */
const plans = {
[accountWithAPlan]: {
Expand Down
34 changes: 17 additions & 17 deletions packages/capabilities/test/capabilities/provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -36,7 +36,7 @@ describe('provider/add', function () {
assert.deepEqual(result.ok.audience.did(), service.did())
assert.equal(result.ok.capability.can, 'provider/add')
assert.deepEqual(result.ok.capability.nb, {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
})
}
Expand All @@ -51,7 +51,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
})
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [delegation],
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [attestation],
Expand All @@ -135,7 +135,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-ignore
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
})
}, /Error: Invalid 'nb' - Object contains invalid field "consumer"/)
Expand All @@ -149,7 +149,7 @@ describe('provider/add', function () {
audience: service,
with: bobAccount.did(),
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
// @ts-expect-error
consumer: 'did:mailto:storacha.network:user',
},
Expand All @@ -166,7 +166,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-expect-error - missing provider
nb: {
// provider: 'did:web:test.upload.storacha.network',
// provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
})
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -206,7 +206,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -233,7 +233,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -242,7 +242,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
proofs: await createAuthorization({ agent, service, account }),
}),
Expand All @@ -268,7 +268,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: space.did(),
},
proofs: [
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -338,7 +338,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('provider/add', function () {
audience: service,
with: 'did:mailto:mallory.com:bob',
nb: {
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('provider/add', function () {
with: account.did(),
nb: {
consumer: space.did(),
provider: 'did:web:test.upload.storacha.network',
provider: 'did:web:test.up.storacha.network',
},
// NOTE: no proofs!
})
Expand Down
2 changes: 1 addition & 1 deletion packages/capabilities/test/helpers/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const malloryAccount = Absentee.from({

export const service = Signer.parse(
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8='
).withDID('did:web:test.upload.storacha.network')
).withDID('did:web:test.up.storacha.network')

export const readmeCID = parseLink(
'bafybeihqfdg2ereoijjoyrqzr2x2wsasqm2udurforw7pa3tvbnxhojao4'
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,23 @@ Default `storacha-cli`

### `STORACHA_SERVICE_URL`

`storacha` CLI will use the w3up service at https://upload.storacha.network. If you would like
`storacha` CLI will use the w3up service at https://up.storacha.network. If you would like
to use a different w3up-compatible service, set `STORACHA_SERVICE_DID` and `STORACHA_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `https://upload.storacha.network`
Default `https://up.storacha.network`

### `STORACHA_SERVICE_DID`

`storacha` CLI will use the w3up `did:web:upload.storacha.network` as the service DID. If you would like
`storacha` CLI will use the w3up `did:web:up.storacha.network` as the service DID. If you would like
to use a different w3up-compatible service, set `STORACHA_SERVICE_DID` and `STORACHA_SERVICE_URL` environment variables to set the service DID and URL endpoint.

Default `did:web:upload.storacha.network`
Default `did:web:up.storacha.network`

### `STORACHA_RECEIPTS_URL`

The URL at which UCAN receipts issued by the service may be fetched.

Default `https://upload.storacha.network/receipt/`
Default `https://up.storacha.network/receipt/`

## FAQ

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/bin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export const testSpace = {
})

/** @type {import('@storacha/client/types').DID<'web'>} */
const providerDID = 'did:web:test.upload.storacha.network'
const providerDID = 'did:web:test.up.storacha.network'

const infoWithoutProvider = await storacha
.args(['space', 'info'])
Expand Down
2 changes: 1 addition & 1 deletion packages/filecoin-api/src/aggregator/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const handleAggregateInsertToPieceAcceptQueue = async (
* @param piece
* @returns {Promise<import('@ucanto/interface').Result<import('@ucanto/interface').Unit, RangeError|import('../types.js').QueueAddError>>}
*/
async piece => {
async (piece) => {
const inclusionProof = aggregateBuilder.resolveProof(piece.link)
if (inclusionProof.error) return inclusionProof

Expand Down
43 changes: 25 additions & 18 deletions packages/upload-api/src/blob/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,34 @@ import * as API from '../types.js'
* @returns {API.ServiceMethod<API.SpaceBlobRemove, API.SpaceBlobRemoveSuccess, API.SpaceBlobRemoveFailure>}
*/
export function blobRemoveProvider(context) {
return Server.provide(SpaceBlob.remove, async ({ capability, invocation }) => {
const space = capability.with
const digest = Digest.decode(capability.nb.digest)
return Server.provide(
SpaceBlob.remove,
async ({ capability, invocation }) => {
const space = capability.with
const digest = Digest.decode(capability.nb.digest)

const exists = await context.registry.find(space, digest)
if (exists.error) {
if (exists.error.name === 'EntryNotFound') {
return Server.ok({ size: 0 })
const exists = await context.registry.find(space, digest)
if (exists.error) {
if (exists.error.name === 'EntryNotFound') {
return Server.ok({ size: 0 })
}
return exists
}
return exists
}

const dereg = await context.registry.deregister({space, digest, cause: invocation.link()})
if (dereg.error) {
// unlikely as we just found it...but possible I guess
if (dereg.error.name === 'EntryNotFound') {
return Server.ok({ size: 0 })
const dereg = await context.registry.deregister({
space,
digest,
cause: invocation.link(),
})
if (dereg.error) {
// unlikely as we just found it...but possible I guess
if (dereg.error.name === 'EntryNotFound') {
return Server.ok({ size: 0 })
}
return dereg
}
return dereg
}

return Server.ok({ size: exists.ok?.blob.size })
})
return Server.ok({ size: exists.ok?.blob.size })
}
)
}
2 changes: 1 addition & 1 deletion packages/upload-api/src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const createService = (context) => ({
...createAdminService(context),
// @ts-expect-error `uploadTable` items now have a `cause` field. This does
// not matter since `admin/store/inspect` handler does not use this table.
store: createLegacyAdminService(context).store
store: createLegacyAdminService(context).store,
},
space: createSpaceService(context),
subscription: createSubscriptionService(context),
Expand Down
7 changes: 5 additions & 2 deletions packages/upload-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ServiceContext as FilecoinServiceContext } from '@storacha/filecoin-api
import {
Service as LegacyService,
StoreServiceContext as LegacyStoreServiceContext,
AdminServiceContext as LegacyAdminServiceContext
AdminServiceContext as LegacyAdminServiceContext,
} from '@web3-storage/upload-api'
import { DelegationsStorage as Delegations } from './types/delegations.js'
import { ProvisionsStorage as Provisions } from './types/provisions.js'
Expand Down Expand Up @@ -462,7 +462,10 @@ export interface ServiceContext
UsageServiceContext,
LegacyStoreServiceContext {}

export interface UcantoServerContext extends ServiceContext, RevocationChecker, PrincipalResolver {
export interface UcantoServerContext
extends ServiceContext,
RevocationChecker,
PrincipalResolver {
id: Signer
codec?: InboundCodec
errorReporter: ErrorReporter
Expand Down
4 changes: 2 additions & 2 deletions packages/upload-api/src/types/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export interface BlobModel {
}

export interface DeregistrationData {
space: SpaceDID,
digest: MultihashDigest,
space: SpaceDID
digest: MultihashDigest
cause: Link
}

Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/handlers/plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const test = {
'an account can get plan information': async (assert, context) => {
const account = 'did:mailto:example.com:alice'
const billingID = 'stripe:abc123'
const product = 'did:web:test.upload.storacha.network'
const product = 'did:web:test.up.storacha.network'
await context.plansStorage.initialize(account, billingID, product)
const connection = connect({
id: context.id,
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/helpers/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const createContext = async (
const signer = await Signer.generate()
const aggregatorSigner = await Signer.generate()
const dealTrackerSigner = await Signer.generate()
const id = signer.withDID('did:web:test.upload.storacha.network')
const id = signer.withDID('did:web:test.up.storacha.network')

const service = getMockService()
const dealTrackerConnection = getConnection(
Expand Down
8 changes: 6 additions & 2 deletions packages/upload-api/test/storage/blob-registry-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const test = {
const data = new Uint8Array([11, 22, 34, 44, 55])
const digest = await sha256.digest(data)
const cause = await randomCID()
const dereg = await registry.deregister({space, digest, cause})
const dereg = await registry.deregister({ space, digest, cause })
assert.ok(dereg.error)
assert.equal(dereg.error?.name, EntryNotFound.name)
},
Expand All @@ -157,7 +157,11 @@ export const test = {
assert.ok(find0.ok)

const deregCause = await randomCID()
const dereg = await registry.deregister({space, digest, cause: deregCause})
const dereg = await registry.deregister({
space,
digest,
cause: deregCause,
})
assert.ok(dereg.ok)

const find1 = await registry.find(space, digest)
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/storage/blob-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Registry {
}

/** @type {API.BlobAPI.Registry['deregister']} */
async deregister({space, digest, cause}) {
async deregister({ space, digest, cause }) {
// `cause` is unused in this function but required in production for recording the space usage delta.
const entries = this.data.get(space) ?? []
const entry = entries.find((e) => equals(e.blob.digest.bytes, digest.bytes))
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/storage/provisions-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ProvisionsStorage {
*
* @param {Array<Types.ServiceDID | string>} providers
*/
constructor(providers = ['did:web:test.upload.storacha.network']) {
constructor(providers = ['did:web:test.up.storacha.network']) {
/**
* @type {Record<string, Types.Provision>}
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/upload-api/test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const service = ed25519
.parse(
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8='
)
.withDID('did:web:test.upload.storacha.network')
.withDID('did:web:test.up.storacha.network')

/**
* @param {import('@ucanto/interface').Principal} audience
Expand Down
6 changes: 3 additions & 3 deletions packages/upload-client/src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { connect } from '@ucanto/client'
import { CAR, HTTP } from '@ucanto/transport'
import * as DID from '@ipld/dag-ucan/did'

export const serviceURL = new URL('https://upload.storacha.network')
export const servicePrincipal = DID.parse('did:web:upload.storacha.network')
export const receiptsEndpoint = 'https://upload.storacha.network/receipt/'
export const serviceURL = new URL('https://up.storacha.network')
export const servicePrincipal = DID.parse('did:web:up.storacha.network')
export const receiptsEndpoint = 'https://up.storacha.network/receipt/'

/** @type {import('@ucanto/interface').ConnectionView<import('./types.js').Service>} */
export const connection = connect({
Expand Down
Loading

0 comments on commit ac6b5b4

Please sign in to comment.