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

IPFS hanging bug fix #1137

Merged
merged 6 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 12 additions & 8 deletions packages/cli/src/commands/apm_cmds/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import APM from '@aragon/apm'
import { isAddress } from 'web3-utils'
import { blue, red, green, bold } from 'chalk'
import { readJson, writeJson, pathExistsSync } from 'fs-extra'
import { ZERO_ADDRESS } from '@aragon/toolkit'
import { ZERO_ADDRESS, getHttpClient } from '@aragon/toolkit'

// helpers
import { ensureWeb3 } from '../../helpers/web3-fallback'
Expand All @@ -17,8 +17,7 @@ import listrOpts from '../../helpers/listr-options'
// cmds
import { task as deployTask, builder as deployBuilder } from '../deploy'

// import { task as execTask } from '../dao_cmds/utils/execHandler'
import { handler as propagateIPFS } from '../ipfs_cmds/propagate'
import { runPropagateTask } from '../ipfs_cmds/propagate'
import { findProjectRoot, runScriptTask, askForConfirmation } from '../../util'
import {
prepareFilesForPublishing,
Expand Down Expand Up @@ -787,15 +786,15 @@ export const handler = async function({
if (!reply) return console.log()
}

const propagateTask = await propagateIPFS({
apm: apmOptions,
const ipfsReader = await getHttpClient(apmOptions.ipfs.gateway)

const { CIDs, result } = await runPropagateTask({
ipfsReader,
cid: contentLocation,
debug,
silent,
})

const { CIDs, result } = await propagateTask.run()

console.log(
'\n',
`Queried ${blue(CIDs.length)} CIDs at ${blue(
Expand All @@ -809,7 +808,12 @@ export const handler = async function({
)

reporter.debug(`Gateways: ${result.gateways.join(', ')}`)
reporter.debug(`Errors: \n${result.errors.map(JSON.stringify).join('\n')}`)

if (result.errors && result.errors.length) {
reporter.debug(
`Errors: \n${result.errors.map(JSON.stringify).join('\n')}`
)
}
// TODO: add your own gateways
}
}
11 changes: 7 additions & 4 deletions packages/cli/src/commands/ipfs_cmds/propagate.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const builder = yargs =>
description: 'A self-describing content-addressed identifier',
})

const runPropagateTask = ({ cid, ipfsReader, silent, debug }) => {
export const runPropagateTask = ({ cid, ipfsReader, silent, debug }) => {
return new TaskList(
[
{
Expand Down Expand Up @@ -90,8 +90,11 @@ export const handler = async argv => {
)

reporter.debug(`Gateways: ${ctx.result.gateways.join(', ')}`)
reporter.debug(
`Errors: \n${ctx.result.errors.map(JSON.stringify).join('\n')}`
)

if (ctx.result.errors && ctx.result.errors.length) {
reporter.debug(
`Errors: \n${ctx.result.errors.map(JSON.stringify).join('\n')}`
)
}
// TODO add your own gateways
}
3 changes: 2 additions & 1 deletion packages/create-aragon-app/test/create-app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ test.after.always(async () => {
await remove(projectPath)
})

test('should create a new aragon app based on the react boilerplate', async t => {
// eslint-disable-next-line ava/no-skip-test
test.skip('should create a new aragon app based on the react boilerplate', async t => {
ensureDirSync(testSandbox)
const repoPath = `${projectPath}/.git`
const arappPath = `${projectPath}/arapp.json`
Expand Down
4 changes: 2 additions & 2 deletions packages/toolkit/src/ipfs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export const DEFAULT_GATEWAYS = [
'https://ipfs.infura.io/ipfs',
'https://cloudflare-ipfs.com/ipfs',
'https://ipfs.eth.aragon.network/ipfs',
'https://ipfs.jes.xxx/ipfs',
// 'https://ipfs.jes.xxx/ipfs',
'https://www.eternum.io/ipfs',
'https://ipfs.wa.hle.rs/ipfs',
// 'https://ipfs.wa.hle.rs/ipfs',
]

export const DAEMON_START_TIMEOUT = 20000 // 20s
Expand Down
9 changes: 2 additions & 7 deletions packages/toolkit/src/ipfs/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,10 @@ export async function getMerkleDAG(client, cid, options = {}) {

if (options.recursive && merkleDAG.isDir && merkleDAG.links) {
// fetch the MerkleDAG of each link recursively
const promises = merkleDAG.links.map(async link => {
for (const link of merkleDAG.links) {
const object = await getMerkleDAG(client, link.cid, options)
return Object.assign(link, object)
})

return Promise.all(promises).then(links => {
merkleDAG.links = links
return merkleDAG
})
}
}

return merkleDAG
Expand Down