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

Error: invalid block #1331

Closed
MicrowaveDev opened this issue Apr 29, 2018 · 13 comments
Closed

Error: invalid block #1331

MicrowaveDev opened this issue Apr 29, 2018 · 13 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@MicrowaveDev
Copy link
Contributor

  • Version:
js-ipfs version: 0.28.2-
Repo version: 6
System version: x64/linux
Node.js version: v9.11.1
  • Platform:
Linux common 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Code::
const IPFSFactory = require('ipfsd-ctl');

IPFSFactory
   .create({ type: 'proc', exec: IPFS })
   .spawn({ disposable: false }, async (err, ipfsd) => {

      ipfsd.init({}); // <-- Throw error
   })

Type: Bug

Severity: Critical

Description:

I'm getting invalid block error on init ipfs:

Error: invalid block
    at setImmediate (/home/jonybang/ipfs-service/node_modules/ipfsd-ctl/node_modules/ipfs-repo/src/blockstore.js:90:20)
    at Immediate.<anonymous> (/home/jonybang/ipfs-service/node_modules/async/internal/setImmediate.js:27:16)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
Emitted 'error' event at:
    at done (/home/jonybang/ipfs-service/node_modules/ipfs/src/core/components/init.js:21:14)
    at /home/jonybang/ipfs-service/node_modules/async/internal/once.js:12:16
    at next (/home/jonybang/ipfs-service/node_modules/async/waterfall.js:21:29)
    at /home/jonybang/ipfs-service/node_modules/async/internal/onlyOnce.js:12:16
    at parallel (/home/jonybang/ipfs-service/node_modules/ipfs/src/core/components/init.js:99:13)
    at /home/jonybang/ipfs-service/node_modules/async/internal/parallel.js:39:9
    at /home/jonybang/ipfs-service/node_modules/async/internal/once.js:12:16
    at iteratorCallback (/home/jonybang/ipfs-service/node_modules/async/eachOf.js:58:13)
    at /home/jonybang/ipfs-service/node_modules/async/internal/onlyOnce.js:12:16
    at /home/jonybang/ipfs-service/node_modules/async/internal/parallel.js:36:13

Steps to reproduce the error:

I'm just running code, and i'm don't know why it crashes on my server.

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label Apr 30, 2018
@daviddias
Copy link
Member

@dryajov mind checking what's up here?

@travisperson
Copy link
Member

This looks to be the constructor check issue. Probably running v0.15.0 of js-ipld which uses ~0.6.1 of js-ipfs-block.

https://github.com/ipfs/js-ipfs-block/blob/v0.6.1/src/index.js#L61,L63

Where as v0.19.0 js-ipfs-repo which uses ~0.7.1 of js-ipfs-block.

I don't know exactly which dependency is locking things down, but v0.28.2 of js-ipfs does ship with ~0.24.4 of js-ipfs-unixfs-engine, which might be holding things back.

find . -type d -name 'ipfs-block' | tee -a /dev/stderr | xargs -I "{}" cat "{}"/package.json | jq '.version'
./node_modules/ipfs-repo/node_modules/ipfs-block
./node_modules/ipfs-api/node_modules/ipfs-block
./node_modules/ipfs-block
"0.7.1"
"0.7.1"
"0.6.1"

@travisperson
Copy link
Member

See ipfs/js-ipfsd-ctl#223 (comment)

js-ipfsd-ctl uses a different version of js-ipfs-repo which is resulting in this compatibility issue.

@daviddias
Copy link
Member

@vasco-santos once you update deps on ipfsd-ctl and release a new version, can you update here so that @Jonybang can test it? Thanks!

@daviddias daviddias added the status/ready Ready to be worked label May 30, 2018
@vasco-santos
Copy link
Member

ipfsd-ctl needs PR 262, in order to have CI green.
Meanwhile, @Jonybang ipfsd-ctl has js-ipfs updated in branch chore/upgrade-ipfs-version PR 262 and will be merged asap

@MicrowaveDev
Copy link
Contributor Author

ok, i will test this today

@MicrowaveDev
Copy link
Contributor Author

MicrowaveDev commented Jun 1, 2018

@diasdavid I can't test this issue because of ipfs installation via npm failed:

npm i --save ipfsd-ctl # done
npm i --save ipfs # error

Output:

WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/package.json'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/.travis.yml'

npm ERR! code EINTEGRITY
npm ERR! sha512-57RAHqbMMcVLEkbzx6PlMs7LnwsfMJrzjjNCNAsQuN2wcT8Abm09UIjo2P36x0leYMNIG2SWiyr1H5OLSKn74Q== integrity checksum failed when using sha512: wanted sha512-57RAHqbMMcVLEkbzx6PlMs7LnwsfMJrzjjNCNAsQuN2wcT8Abm09UIjo2P36x0leYMNIG2SWiyr1H5OLSKn74Q== but got sha512-YtyTkU17VoRDdvtad8VO6d4PMVoKPt2LKdXp49y/ogWEk5R1hYvIaWGWfxf46qZTRoyC0RVjujprSfKVzjfXXA==. (27347 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jonybang/.npm/_logs/2018-06-01T14_32_48_476Z-debug.log

/Users/jonybang/.npm/_logs/2018-06-01T14_32_48_476Z-debug.log:
https://pastebin.com/SUcDnTed

Node version: v10.2.1
OS: MacOS Sierra 10.13.4

@MicrowaveDev
Copy link
Contributor Author

MicrowaveDev commented Jun 1, 2018

After reinit npm and installing ipfs first there was this problem:
#1347 (comment)

And then similar errors if I execute this command:

npm i --save https://github.com/ipfs/js-ipfsd-ctl

@vasco-santos By command above I'm trying to install new code by PR 262, which already merged in master

@fsdiogo
Copy link
Contributor

fsdiogo commented Jun 21, 2018

@Jonybang can you confirm this is still a problem with the latest version of ipfsd-ctl and js-ipfs?

@MicrowaveDev
Copy link
Contributor Author

Now all working fine by this code:

const IPFSFactory = require('ipfsd-ctl');
const IPFS = require('ipfs');

IPFSFactory
    .create({ type: 'proc', exec: IPFS })
    .spawn({ disposable: false }, async (err, ipfsd) => {
        ipfsd.start({}, (err) => {
                if(err) {
                        console.log("Error", err);
                }
        })
    })

if i'm trying to call init instead of start: ipfsd throwing error Error Error: Not able to init from state: stopped, but i'm think this is fine.

@ghost ghost removed the status/ready Ready to be worked label Jun 21, 2018
@aphelionz
Copy link
Contributor

aphelionz commented Apr 22, 2020

This error seems to have returned on ^0.43.0, somehow... you can reproduce it by:

  1. Checking out the latest commit from refactor: update deps, add tests, make more lightweight orbitdb-archive/orbit-db-test-utils#11
  2. Running rm -rf node_modules package-lock.json
  3. Running npm install
  4. Running npm test
"ipfs": "~0.43.0",
"ipfs-repo": "^1.0.1",
"ipfsd-ctl": "^3.1.0",

@aphelionz
Copy link
Contributor

aphelionz commented Apr 22, 2020

This is actually pretty interesting, wondering what changed in the package-lock.json to break this! I tried removing a ton of extraneous dependencies to see if something else got smuggled in, to no avail. Something in the dependencies listed above is causing it :/

Edit: trying with ipfsd-ctl@4.0.1

@aphelionz
Copy link
Contributor

Got it in a sandbox, making a new issue: https://codesandbox.io/s/invalid-block-demo-d4oty?file=/src/index.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

6 participants