-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
update spec and fix code snippets #9334
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.
Looking good. A lot of little suggestions.
The code snippets need to be fixed. Also, some of the code snippets include the comment (those in the concepts and state documents), and some do not (those in the messages document). Not sure if this was intentional.
x/authz/spec/03_messages.md
Outdated
|
||
## Msg/Grant | ||
## Grant |
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 section is about the message. I think we might want to reference the message not the method.
## Grant | |
## MsgGrant |
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 wanted to discuss and describe service methods, not the request objects. That's why I'm not using Msg
prefix.
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.
The title of this document is Messages
. The next line of this section is "An authorization-grant is created using the MsgGrant
message." Then we provide a code snippet for MsgGrant
. And then we further discuss the message, "This message is expected to fail if..." Switching to the method names for the title of each section without changing the content or even mentioning the method is confusing.
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.
OK, I can rename the file and the header to 03_tx_service
.
[edit] renamed to 03_services.md
.
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.
Each service has exactly one argument, so it makes sense to describe the argument (MsgGrant
) in this case.
It might be nice to order the triple Also, the use of parenthesis around the triple seems a bit odd to me. We might want to consider removing the parenthesis or using another format such as Also, we need to make sure that we are consistent. Sometimes we use |
Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com>
Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com>
Interesting idea. I think we don't need this at this level. The order of this relation is hidden from the user, and it's a storage detail. We use |
Codecov Report
@@ Coverage Diff @@
## master #9334 +/- ##
==========================================
- Coverage 60.39% 60.30% -0.09%
==========================================
Files 589 588 -1
Lines 37087 36978 -109
==========================================
- Hits 22399 22301 -98
+ Misses 12711 12700 -11
Partials 1977 1977
|
Ok, just a thought. No need to change the order or the format for the triple. A few items remaining:
|
Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com>
Thanks for review @ryanchrypto . I've renamed the 3_messages file to 3_services, updated snippets and used |
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've renamed the 3_messages file to 3_services
In other module specifications, we describe the messages in a messages.md
file and we do not have a services.md
file. Do you think we should be breaking the pattern here?
The content for each section in the services.md
file (renamed from messages.md
) describes the messages. I am not sure why renaming each section to the service method names and then renaming the file to services.md
are necessary changes if we are not updating the content to include explanations of the service methods.
Maybe it would make more sense if we added an explanation and a code snippet for each method? If we rename the file, we should probably use the singular tx_service.md
rather than services.md
unless we intend to include the query service.
I have added more suggestions. I also think we could do a better job throughout our specs and documentation on using consistent naming conventions (i.e. when to use backticks, how to refer to Protobuf services and messages, etc.). It would be nice to have a styleguide that everyone could reference when writing documentation, but this is out of scope for this pull request.
x/authz/spec/03_services.md
Outdated
## Grant | ||
|
||
An authorization-grant is created using the `MsgGrant` message. |
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.
The "Grant" section does not include an explanation of Grant
. It currently explains MsgGrant
and provides a snippet of the MsgGrant
message. This is what I was talking about when I said it was confusing to change the title of each section without changing the content.
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.
Correct, we should start describing the method. I have updated the section. Hope it sound better now. (same for comments below)
x/authz/spec/03_services.md
Outdated
## Revoke | ||
|
||
An grant can be removed with `MsgRevoke` message. |
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.
The "Revoke" section does not include an explanation of Revoke
. It currently explains MsgRevoke
and provides a snippet of the MsgRevoke
message. This is what I was talking about when I said it was confusing to change the title of each section without changing the content.
x/authz/spec/03_services.md
Outdated
## Exec | ||
|
||
When a grantee wants to execute transaction on behalf of a granter, it must send `MsgExec`. |
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.
The "Exec" section does not include an explanation of Exec
. It currently explains MsgExec
and provides a snippet of the MsgExec
message. This is what I was talking about when I said it was confusing to change the title of each section without changing the content.
x/authz/spec/03_services.md
Outdated
|
||
# Tx Msg Service | ||
|
||
In this section we describe the Protobuf Msg service for the authz module. |
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.
In this section we describe the Protobuf Msg service for the authz module. | |
In this section we describe the Protobuf Msg service for the `x/authz` module. |
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.
not sure about it. x/authz
emphasis package name, "authz module" is a plain English. Do you have a preference?
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.
That makes sense. I do not have a strong preference. This would be a good example of something to explain in a styleguide for writing documentation/specifications (maybe added to SPEC-SPEC).
This is what I'm proposing here. I think in recent discussions we want to promote the services oriented API. |
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
we do have a SPEC-SPEC here: https://github.com/cosmos/cosmos-sdk/blob/master/docs/spec/SPEC-SPEC.md. IMO we should strictly follow the spec-spec for now. We can start a separate issue/discussion about whether we want to update SPEC-SPEC. I agree we should promote the service-oriented design. However, I still think it's useful to separate query services and msg services into 2 files, so I wouldn't call it |
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.
LGTM
This makes sense to me. I think @robert-zaremba was moving in the direction of making valid improvements but we should discuss updating the spec-spec document before changing the structure here. |
I think this approach that @ryanchristo is suggesting makes sense |
We discussed it during the stand up and arrived to the same conclusion
|
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.
Looks good to me! A few nitpicks but I approve.
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.
lgtm
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
The GitHub CI strikes again. |
* update spec and fix code snippets * updating authz.Grant documentation * Update proto/cosmos/authz/v1beta1/tx.proto Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com> * rename messages to services * Update proto/cosmos/authz/v1beta1/tx.proto Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com> * update snippets * Apply suggestions from code review Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> * authz: update service docs to emphasis the service methods * authz spec: rollback to use message oriented spec * Apply suggestions from code review Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> * Update MsgGrant type doc Co-authored-by: Ryan Christoffersen <12519942+ryanchrypto@users.noreply.github.com> Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
Description
closes: #9257
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes