-
Notifications
You must be signed in to change notification settings - Fork 19
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
get cap cid and log it, for later retrieval of cacao #1153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this PR get's the CACAO from the genesis commit if present. There could also be another CACAO that's attached to the commit that is being anchored (root.tip
). This CACAO would tell us the application that made the anchor request.
Oh this is super helpful - 2 question: is it possible both root.tip and the signature cid url will both be present and different, or can we just fallback to check both for a single value? Is there one we shoudl check first? what is the meaning of the root.tip one? Is that always generated on genesis commits? I was meaning to ask you if we would always get a cacao if there was not an update after the genesis commit |
Note this is the url, not the actual cacao. will retrieve async from ipfs
d518688
to
937923d
Compare
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## develop #1153 +/- ##
===========================================
- Coverage 81.90% 81.90% -0.01%
===========================================
Files 46 46
Lines 1697 1702 +5
Branches 258 260 +2
===========================================
+ Hits 1390 1394 +4
- Misses 307 308 +1
☔ View full report in Codecov by Sentry. |
ok, to cover the uncovered line, i need to write a test that covers this https://app.codecov.io/gh/ceramicnetwork/ceramic-anchor-service/commit/937923d0b2191606c5f30004467312b7c6d14434/blob/src/ancillary/anchor-request-params-parser.ts#L115 which is derived from genesisJWS.signatures so i looked in the tests, and it turns out, that the test labeled const CAR_FILE_REQUEST_EXAMPLE_SIGNED_GENESIS = mockRequest({ doesn't actually have any signatures (determined this with this tool https://github.com/3box/runbooks-and-oncall/blob/main/CACAOTools/min_decode.mjs using the blob from the test) so now, the question is, how to construct a carfile that DOES have a signature? |
oh! also if it was present, it might be in the data, because js-ceramic would have put it there! but our test cases don't show it, bc they are not really signed, i think
|
I believe that |
I believe there are four cases as outlined below (maybe @ukstv can confirm this)
|
or do they all look the same inside CAS? sorry i am a little confused tying this diagram to different cases in the code, i will look some more I guess it just means - anytime we have JWS commit, we can check for cacao on the protected header Does it mean that the cacao is always only in the protected header? Also don't worry that the actual cacao is not there, i am planning to make async lambda that retrieves from ipfs in the metrics db |
@oed I don't understand cases 3 and 4 that you outlined above. What's the difference between a SignedCommit and a GenesisCommit for a stream that has never been updated past the genesis state? |
For a stream that has never been updated past genesis state only cases 1 and 2 apply. Cases 3 and 4 describe streams that have been updated >= 1 times! |
@stbrody what does it take to run a local js-ceramic and cause it to sign with a cacao? Will that happen if i just use the composedb libraries to generate some model documents? I want to see if it actually puts it into the carfile or if its just in the signatures in the header. |
@gvelez17 you need to use the did-session package with the ethereum auth provider and you'll get a Cacao. |
ok, i constructed a client that is creating streams successfully locally, but js-ceramic is never making the anchor request when i am running locally? https://github.com/ceramicnetwork/js-ceramic/blob/develop/packages/cli/src/ceramic-daemon.ts#L576 is never reached.
Thx to Sergey for a demonstration how to make js-ceramic generate them, now we have test coverage. |
expect(params.capCID).toEqual(FAKE_CAPCID) | ||
}) | ||
|
||
test('throws error on invalid car file', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not throw an error. the validator returns the junk
Here is invalid validation: {"_tag":"Left","left":[{"trail":[{"key":"","type":{"name":"RequestAnchorParamsV2"},"actual":{"0":67,"1":114,"2":101,"3":97,"4":116,"5":101,"6":100,"7":66,"8":121,"9":67,"10":104,"11":97,"12":116,"13":71,"14":80,"15":84,"16":52,"17":89,"18":111,"19":117,"20":99,"21":97,"22":110,"23":85,"24":115,"25":101,"26":84,"27":104,"28":105,"29":115,"30":83,"31":116,"32":114,"33":105,"34":110,"35":103}}]}]}
@oed @ukstv shouldn't the validator throw an error on this junk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can separate out this part into a separate pr since it is not a change affected by the capCID
moved this test here https://github.com/ceramicnetwork/ceramic-anchor-service/pull/1162/files
i already have that one in the logs, so will use both in retrieving the actual CACAO from ipfs. this is to add the other possible source. |
* Revert "move invalid carfile tests to separate PR" This reverts commit d82ee7b. * invalid car file produces isLeft; cannot decode throws error * ok an invalid carfile has isLeft, but what about some random string? * remove duplicate coverage test
Log cap CID - #PLAT-1567
Description
We need cacaos in order to track app usage, and the cap cid will allow us to retrieve cacaos.
How Has This Been Tested?
Describe the tests that you ran to verify your changes. Provide instructions for reproduction.
Definition of Done
Before submitting this PR, please make sure:
References:
Please list relevant documentation (e.g. tech specs, articles, related work etc.) relevant to this change, and note if the documentation has been updated.