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

feat: DidDoc versioning [DEV-1892] #443

Merged
merged 21 commits into from
Nov 15, 2022
Merged

feat: DidDoc versioning [DEV-1892] #443

merged 21 commits into from
Nov 15, 2022

Conversation

askolesov
Copy link
Contributor

No description provided.

@ankurdotb
Copy link
Contributor

Copy link
Contributor

@ankurdotb ankurdotb left a comment

Choose a reason for hiding this comment

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

Comments outside of these ones below (since I didn't get to see the protobufs one before merging / looking at everything else in general):

Resource protobufs

  • [ x ] Checksum: Why bytes, not a string? I would prefer just storing the SHA256 checksum rather than in bytes (this is a more commonly understood way of doing it) -> Bytes formatted on display
  • [ x ] Does it make sense to have a namespace property for resources too? -> Let resolver handle it
  • [ x ] Unsure if I missed this but I think I did show it, apologies if not: an optional URI property in resources with a repeated map of description and URI. One of these will be filled by default with the current resource URI. -> Keep it as also known as, let user define a map with description and URI as properties

DIDs

Transactions

  • create-did: Maybe change this to expect a file? Instead of passing verification methods and their private keys one by one. (Also rename to create-did instead) -> All identity (not fee etc) provided as a JSON file
  • Same for update-did

Tests

  • Looking at the create DID tests, I think it's pretty clear we need perhaps an ADR on update operations and external controllers. The rules implemented for what's allowed vs not for external controllers and updates is up to a DID method to choose, and I'm not a 100% sure some of the current ones are very clear.
  • Probably need more happy/unhappy path scenarios but this be in a different PR
  1. diddoc_service_test: The services don't have namespace?
  2. diddoc_service_test: "Base DID is not the same as in ID" <- this doesn't have to be the same as the base DID, no rule says so.
  3. Verification method/material tests: No namespace?
  4. Verification method tests: "Id does not have expected DID as a base" why does the base need to be the same?
  5. Tbh I didn't do all of them since I started seeing a lot of scenarios that were confusing

Types

  1. Do we even need to bother keeping the types/v1 folder?

General comments

I skipped a lot of tests near the end since that seems like a beast on its own, and it's probably worth resolving the top-level questions first (since they may be invalid or explainable), and then perhaps revisit the tests. There's also a questions of tests in general vs tests for just versioning.

@@ -62,7 +63,8 @@ message MsgUpdateDidDocPayload {
repeated string key_agreement = 9;
repeated string also_known_as = 10;
repeated Service service = 11;
string version_id = 12;
string previous_version_id = 12;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really necessary?

Copy link
Contributor

@ankurdotb ankurdotb Nov 10, 2022

Choose a reason for hiding this comment

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

Remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Comment on lines +145 to +168
// 325 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x50, 0x41, 0x4b, 0xf3, 0x40,
0x10, 0xed, 0x7e, 0x85, 0x4f, 0xbb, 0x4d, 0x45, 0x72, 0xd0, 0xda, 0xc3, 0x12, 0x2a, 0x62, 0x2f,
0x26, 0x10, 0xc1, 0x8b, 0xa7, 0x4a, 0xd1, 0x93, 0x22, 0x29, 0x28, 0x78, 0x09, 0xdb, 0xcc, 0xb4,
0x5d, 0xb0, 0xd9, 0xd8, 0x1d, 0x83, 0xfe, 0x0b, 0x7f, 0x89, 0xbf, 0xc3, 0x63, 0x8f, 0x1e, 0xa5,
0xfd, 0x23, 0xe2, 0x6e, 0xab, 0x16, 0xbc, 0x0c, 0xc3, 0x7b, 0x8f, 0xf7, 0x66, 0x1e, 0x6f, 0x65,
0x63, 0x7c, 0x80, 0x08, 0x14, 0x44, 0x65, 0x1c, 0x8d, 0x30, 0x47, 0xa3, 0x4c, 0x58, 0x4c, 0x35,
0x69, 0xdf, 0xb3, 0x5c, 0x08, 0x0a, 0xc2, 0x32, 0x6e, 0xed, 0xad, 0x29, 0x41, 0x01, 0xe8, 0xcc,
0x09, 0x5b, 0x3b, 0x6b, 0xd4, 0x10, 0xd1, 0xe1, 0xed, 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,
0x05, 0x9a, 0xc1, 0x7f, 0x5b, 0xf9, 0xf1, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xed, 0xeb, 0xc7,
0x91, 0xd1, 0x01, 0x00, 0x00,
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this and why does it have such a weird name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is internals of generated proto. Looks like it keeps bytes of the original .proto file. Hard to say why they do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a way to pass .proto field definitions typed to descriptors, as bytes and parse them later, during the decoding process regardless of language.

@askolesov askolesov requested a review from ankurdotb November 15, 2022 06:36
@askolesov
Copy link
Contributor Author

I've fixed all notes except tests. Let's review tests in a separate PR.

Do we even need to bother keeping the types/v1 folder?

That's the whole point of migration. We need to:

  • Read old value
  • Decode it using old models <- that't where v1 is used
  • Transcode to v2 models
  • Persist

@Eengineer1
Copy link
Contributor

And actually v1 is an essential part of the migration / upgrade tests PR.

@askolesov askolesov merged commit 512423a into develop Nov 15, 2022
@askolesov askolesov deleted the did-versioning branch November 15, 2022 12:43
Copy link
Contributor

@Eengineer1 Eengineer1 left a comment

Choose a reason for hiding this comment

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

@askolesov Looks great. Thanks!

Left some concerns regarding the immediate impact on migration / upgrade test suite.

@@ -51,80 +52,90 @@ func Tx(module, tx, from string, txArgs ...string) (sdk.TxResponse, error) {
return resp, nil
}

func CreateDidDoc(payload types.MsgCreateDidDocPayload, signInputs []cli.SignInput, from string) (sdk.TxResponse, error) {
func CreateDidDoc(tmpDit string, payload types.MsgCreateDidDocPayload, signInputs []cli.SignInput, from string) (sdk.TxResponse, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@askolesov Simple typo fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants