Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

chore: update to js-ipld 0.19 #1668

Merged
merged 3 commits into from
Oct 31, 2018
Merged

chore: update to js-ipld 0.19 #1668

merged 3 commits into from
Oct 31, 2018

Conversation

vmx
Copy link
Member

@vmx vmx commented Oct 25, 2018

BREAKING CHANGE: dag-cbor nodes now represent links as CID objects

The API for dag-cbor changed.
Links are no longer represented as JSON objects ({"/": "base-encoded-cid"},
but as CID objects. ipfs.dag.get() and now always return links as CID objects. ipfs.dag.put() also expects links to be represented as CID objects. The old-style JSON objects representation is still
supported, but deprecated.

Prior to this change:

const cid = new CID('QmXed8RihWcWFXRRmfSRG9yFjEbXNxu1bDwgCFAN8Dxcq5')
// Link as JSON object representation
const putCid = await ipfs.dag.put({link: {'/': cid.toBaseEncodedString()}})
const result = await ipfs.dag.get(putCid)
console.log(result.value)

Output:

{ link:
   { '/':
      <Buffer 12 20 8a…> } }

Now:

const cid = new CID('QmXed8RihWcWFXRRmfSRG9yFjEbXNxu1bDwgCFAN8Dxcq5')
// Link as CID object
const putCid = await ipfs.dag.put({link: cid})
const result = await ipfs.dag.get(putCid)
console.log(result.value)

Output:

{ link:
   CID {
     codec: 'dag-pb',
     version: 0,
     multihash:
      <Buffer 12 20 8a…> } }

See ipld/ipld#44 for more information on why this
change was made.

@vmx vmx requested a review from alanshaw October 25, 2018 13:06
@ghost ghost assigned vmx Oct 25, 2018
@ghost ghost added the status/in-progress In progress label Oct 25, 2018
@alanshaw alanshaw mentioned this pull request Oct 25, 2018
38 tasks
@vmx vmx changed the title [WIP] chore: update to js-ipld 0.19 chore: update to js-ipld 0.19 Oct 26, 2018
BREAKING CHANGE: dag-cbor nodes now represent links as CID objects

The API for [dag-cbor](https://github.com/ipld/js-ipld-dag-cbor) changed.
Links are no longer represented as JSON objects (`{"/": "base-encoded-cid"}`,
but as [CID objects](https://github.com/ipld/js-cid). `ipfs.dag.get()` and now always return links as CID objects. `ipfs.dag.put()` also expects links to be represented as CID objects. The old-style JSON objects representation is still
supported, but deprecated.

Prior to this change:

```js
const cid = new CID('QmXed8RihWcWFXRRmfSRG9yFjEbXNxu1bDwgCFAN8Dxcq5')
// Link as JSON object representation
const putCid = await ipfs.dag.put({link: {'/': cid.toBaseEncodedString()}})
const result = await ipfs.dag.get(putCid)
console.log(result.value)

```

Output:

```js
{ link:
   { '/':
      <Buffer 12 20 8a…> } }
```

Now:

```js
const cid = new CID('QmXed8RihWcWFXRRmfSRG9yFjEbXNxu1bDwgCFAN8Dxcq5')
// Link as CID object
const putCid = await ipfs.dag.put({link: cid})
const result = await ipfs.dag.get(putCid)
console.log(result.value)
```

Output:

```js
{ link:
   CID {
     codec: 'dag-pb',
     version: 0,
     multihash:
      <Buffer 12 20 8a…> } }
```

See ipld/ipld#44 for more information on why this
change was made.
@ghost ghost assigned daviddias Oct 30, 2018
vmx added a commit that referenced this pull request Oct 30, 2018
Don't update js-ipld and the corresponding updated tests
in interface-ipfs-core. Those will be updated with
#1668.
@daviddias
Copy link
Member

Locally, only the ping tests fail. We need to figure out why suddently ping got so slow.

@daviddias
Copy link
Member

Only tests failing are ping related

    .ping
      ✓ should send the specified number of packets
      3) should fail when pinging an unknown peer
      4) should fail when pinging an invalid peer
    .pingPullStream
      ✓ should send the specified number of packets over pull stream
      5) should fail when pinging an unknown peer over pull stream
      6) should fail when pinging an invalid peer over pull stream
    .pingReadableStream
      ✓ should send the specified number of packets over readable stream
      7) should fail when pinging an unknown peer over readable stream
      8) should fail when pinging an invalid peer over readable stream

@daviddias
Copy link
Member

Let's get them fixed before release but not block this PR so that we can rebase a bunch of other PRs with master.

@daviddias daviddias merged commit 74edafd into master Oct 31, 2018
@ghost ghost removed the status/in-progress In progress label Oct 31, 2018
@daviddias daviddias deleted the update-ipld-0.19-3 branch October 31, 2018 08:13
vmx added a commit that referenced this pull request Oct 31, 2018
Something went wrong when rebasing #1668
and some code was introduced which shouldn't be there. This commit
removes that code again.
daviddias pushed a commit that referenced this pull request Oct 31, 2018
Something went wrong when rebasing #1668
and some code was introduced which shouldn't be there. This commit
removes that code again.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants