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

Use Base58 CID's for CAS Interface #331

Merged
merged 22 commits into from
Jan 5, 2022
Merged

Use Base58 CID's for CAS Interface #331

merged 22 commits into from
Jan 5, 2022

Conversation

BenjaminMoe
Copy link
Contributor

@BenjaminMoe BenjaminMoe commented Dec 22, 2021

This pull request contains the following changes.

  1. Added CAS tests for ion vectors
  2. Changed Cas module to return ipfs-format base58 CID's
  3. Added force initialization to MockCas to replicate compatibility
  4. Updated code where MockCas interface was not being initialized
  5. Cleaned up base64/58 conversion functions from Encoder

Test run:

  • Ganache local read/write
  • Ropsten local read
  • Ganache multiple nodes read/write
  • AWS S3 cas module
  • AWS QLDB ledger module

Transaction Number: 289
Screenshot from 2022-01-06 03-40-02

Note that the comments marked as hidden on this PR are me taking notes for what needs to be tested and confirmed before marking the PR as ready for review.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe BenjaminMoe changed the title Fix/cas tests Use Base58 CID's for CAS (wihtout breaking anything) Jan 3, 2022
@BenjaminMoe BenjaminMoe marked this pull request as ready for review January 3, 2022 17:46
@BenjaminMoe BenjaminMoe changed the title Use Base58 CID's for CAS (wihtout breaking anything) Use Base58 CID's for CAS (without breaking anything) Jan 3, 2022
@BenjaminMoe BenjaminMoe changed the title Use Base58 CID's for CAS (without breaking anything) Use Base58 CID's for CAS Interface Jan 3, 2022
packages/cas-s3/src/S3Cas.ts Outdated Show resolved Hide resolved
@BenjaminMoe BenjaminMoe marked this pull request as draft January 3, 2022 18:50
@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe

This comment has been minimized.

@BenjaminMoe
Copy link
Contributor Author

BenjaminMoe commented Jan 5, 2022

Did a test write with did:elem:ropsten:EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A, looks like we are able to resolve it on both existing and updated nodes.

Screenshot from 2022-01-06 03-40-02

@BenjaminMoe
Copy link
Contributor Author

BenjaminMoe commented Jan 5, 2022

We might have a problem? It still works, but we get a bunch of errors before the document resolves successfully.

Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11611494. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}
Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11611565. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)\n    at runNextTicks (internal/process/task_queues.js:60:5)\n    at processImmediate (internal/timers.js:437:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}
Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11611994. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}
Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11612000. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}
Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11612061. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}
Skipped bad operation for DID EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A at time 11612068. Error: {"stack":"Error: create_operation_missing_or_unknown_property\n    at Function.parseObject (webpack-internal:///../core/dist/core.esm.js:2169:13)\n    at _callee$ (webpack-internal:///../core/dist/core.esm.js:2137:49)\n    at tryCatch (webpack-internal:///../core/dist/core.esm.js:216:40)\n    at Generator.invoke [as _invoke] (webpack-internal:///../core/dist/core.esm.js:447:22)\n    at Generator.eval [as next] (webpack-internal:///../core/dist/core.esm.js:272:21)\n    at asyncGeneratorStep (webpack-internal:///../core/dist/core.esm.js:62:24)\n    at _next (webpack-internal:///../core/dist/core.esm.js:84:9)","message":"create_operation_missing_or_unknown_property","code":"create_operation_missing_or_unknown_property"}

And i checked, this seems to be happening with the existing base64 did's as well. So it't not related to the changes I made for thi PR. I'll open a new issue, and then open this PR for review (finally).

Create: #341

@BenjaminMoe BenjaminMoe marked this pull request as ready for review January 5, 2022 18:59
'1f8b080000000000000325cdc16e82300080e177e979878103851ba0885388202cb065592ab4a50c282b05bb11de7d18cf7ff2fd13e8381b694f590beb435b20e9d21a259c0213844d70239acf2bb7dc17672c7efcd8cea8c661160ca5a2aadb6acc3c2b4c043f4a3d044f80758843b1503d30279073040502e6c704fa01632ab750c07b28502da007fb7279eca8a39cf6b87c59bfdb69e546e9ee2458fbbae99c2bd173c3be0a2fb588a56ae3f91293e5c151ce46c47f1dd6345434a8150f65e57fa9c5e12db1d9b0d213031f633bd0fd3f435aaa9451a490defb769ed71be37203f3fc39cfff5b850a70fa000000',
'hex'
),
json:
jsonStr:
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this name change. much clearer.

'{"provisionalIndexFileUri":"QmNwg5MrjFhGdPftqMTBYi5raYNuh122DjvYHAQUtrKx6Q","operations":{"create":[{"suffixData":{"deltaHash":"EiC1LGfh47ZBXjFRXELtonJ8pCbg6c9BbtHXAgA25vPSTg","recoveryCommitment":"EiC3M_2dIVUBou36U9fKTBN6Mz9xA2xxRR1gsHkC0789Sw"}}]}}',
},
recoverOperation: {
cid: 'QmWA2bmcdTLAVDMjddeFJvw4fdxoNkJSUvUhKJiipPgP7R',
data: Buffer.from(
content: Buffer.from(
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another good name change, well done.

* 'should pass the writer lock ID to CoreIndexFile.createBuffer() if a value lock exists.'
*
* By Logging the values passed into the MockCas write function during the test
* https://github.com/decentralized-identity/sidetree/blob/master/tests/mocks/MockCas.ts#L34
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great comments

export const testBufferHash = 'EiAuYMQ4_ZBO1ckbGpyyDKlcq8EFpG3duG3nkhR79RwFQQ';
export const testStringHash = 'EiBLkBZiYEmzDAD-CuMapW18cBaQr0un-cG0AjiLfdFhZA';
export const testObjectHash = 'EiAxghX7H2qN_c_wwt0GCcCVRt0JEhAPw3UoHS9JS-5cRg';
// Base 58 (Ipfs Content Id)
Copy link
Sponsor Member

@OR13 OR13 Jan 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically an IPFS v1 CID, it is possible to link to a spec for this i believe, if you wanted to.

@BenjaminMoe BenjaminMoe merged commit 9c23c8f into main Jan 5, 2022
@BenjaminMoe BenjaminMoe deleted the fix/cas-tests branch January 5, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants