decentralized-identity / sidetree

Sidetree Specification and Reference Implementation
https://identity.foundation/sidetree/spec
Apache License 2.0
438 stars 111 forks source link

Test Vectors for Filesystem #861

Open OR13 opened 3 years ago

OR13 commented 3 years ago

When SIP-1 is supported, test vectors for the entire filesystem should be created... especially so we can ensure that IPFS identifiers for compressed files are stable / portable across implementations.... Preliminary testing of zlib worries me, suggest picking an implementation that can run in browsers and that has stable test vectors.... like https://www.npmjs.com/package/pako

https://github.com/decentralized-identity/sidetree/blob/6dad5bf7f99851638d99cfa0aeb53afd0d550869/tests/core/util/Compressor.spec.ts

This test does not compare compressed buffer to static hash... this just tests that you can compress and decompress.

The test should look like this.

const testDataObject:any = require('./test-data.json');
const compressed = Compressor.cannonizeAndCompress(testDataObject);
const digest = sha256(compressed);
expect(digest).toBe(require('./test-data-expected-digest'))

This way GoLang, Rust and other TypeScript implementations can make sure they compress to the exact same binary.... other wise you will see lots of IPFS hashes which are only decompress-able with certain implementations.... which will cause the did method to be perceived as unreliable.

OR13 commented 3 years ago

This ticket is semi blocking for our ability to update our libraries to support SIP-1 / sidetree 1.0

Any chance this will get implemented soon?