Orbit-db: Signature validation error orbitdb-0.20.0-rc3

Created on 17 Apr 2019  路  13Comments  路  Source: orbitdb/orbit-db

jsipfs-0.35.0
orbitdb-0.20.0-rc3
node-v10.15.3

I am using a document store for orbitdb with jsipfs. IPFS node is created programmatically. When I am trying to replicate orbitdb with an object that contains more than two property I get the following error.

UnhandledPromiseRejectionWarning: Error: Could not validate signature "..." and key "." at verify (.../node_modules/ipfs-log/src/log.js:370:27) at process._tickCallback (internal/process/next_tick.js:68:7)

Example of my object that I want to store in orbitdbt:

await db.put({ _id: "AirQuality", first: 1,second: 2,third: 3 });

It looks like when I have an object in orbitdb with more than two fields it is could not be validated successfully.

Most helpful comment

I've gone a bit further. It seems that the JSON.stringify is not deterministic.
When I use a determinisic librairy there is no more errors:

To test the changes mades in toBuffer method in entry.js from the ipfs-log library.

static toBuffer (entry) {
  var stringify = require('json-stable-stringify')
  return Buffer.from(stringify(entry))
  //return Buffer.from(JSON.stringify(entry))
}

All 13 comments

Noticed this as well. For me it fails when running await mydb.load()

@alexander-lipnitskiy does it work fine in rc2?

Noticed this as well. For me it fails when running await mydb.load()

@alexander-lipnitskiy does it work fine in rc2?

I didn't try with other versions of orbitdb. I found that developers know about this issue. You can read about it there. https://github.com/orbitdb/welcome/commit/29375311e5aa21ca86a9c79af3a05256c08a1ac7

Thanks for that. Hopefully it will be fixed soon.

>

@AlbertoElias @alexander-lipnitskiy thanks for reporting! Indeed we're working on a fix. Can you confirm if you are getting the issue in orbit-db@rc4?

I try it with [email protected]. It is work. Thank you for the new update.

I'm still getting the error. I tested by deleting all storage and starting
again.

>

@AlbertoElias do you still face the issue with clean npm install with rm -r node_modules && rm package-lock.json && npm install orbit-db@rc4?

Yup, you麓re right! Now that is working, but I'm bumping into other errors, one of them being #605 and the other I think is specific to IPFS. Thank you!

Hello, I still have the problem on the RC6 from npm package.
When I check the entrie it seems that the keys of the payload are sorted in alphabetical order. It's not the case in my data.
It is a KV store, the payload is an Array of objects

I've gone a bit further. It seems that the JSON.stringify is not deterministic.
When I use a determinisic librairy there is no more errors:

To test the changes mades in toBuffer method in entry.js from the ipfs-log library.

static toBuffer (entry) {
  var stringify = require('json-stable-stringify')
  return Buffer.from(stringify(entry))
  //return Buffer.from(JSON.stringify(entry))
}

Ok, still have some problems with dates field :(

Ok, the JSON library use Date.prototype.toISOString It work when formating dates now.

Is this still an issue in RC9? I'm running into the same problem. Do I need to delete the store first (I.e. this will not fix an already deployed data store?)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamski picture adamski  路  5Comments

shd101wyy picture shd101wyy  路  5Comments

oed picture oed  路  5Comments

maxkerp picture maxkerp  路  6Comments

daviddias picture daviddias  路  6Comments