Skip to content

proto: enum definitions should follow the *_UNSPECIFIED guideline #736

Closed

Description

@mzabaluev

One last thing from my side. I'm reading this, and I think it would be a good moment to rename all *_UNKNOWN enums we have to *_UNSPECIFIED, to align with the recommendations.
Also, please check if we have an enum without an UNKNOWN/UNSPECIFIED zero-value

Originally posted by @sergio-mena in #495 (comment)

Activity

  1. added
    protobuf
    on Apr 20, 2023
  2. mzabaluev commented on Apr 20, 2023

    @mzabaluev
    ContributorAuthor

    @sergio-mena There is one enum with a zero value that semantically is not "unspecified": CheckTxType in abci, used in RequestCheckTx. Since it's pretty established by now, is there a way we can fix this without breaking wire compatibility?

  3. mzabaluev commented on Apr 20, 2023

    @mzabaluev
    ContributorAuthor

    There are also some enum definitions that don't pass the ENUM_VALUE_PREFIX lint. We might want to fix these as well, as long as we are renaming things.

  4. self-assigned this
    on Apr 20, 2023
  5. sergio-mena commented on Apr 26, 2023

    @sergio-mena
    Collaborator

    Oh, you're right! I didn't think of this when I added the comment in #495.
    There is the convention in Tendermint Core/CometBFT, in particular in ABCI, that a zero "error code" means the request went OK.
    This convention has been in place from the mists of time, so I think we'll need to stick to it and accept that deviation from the protobuf "dos and don'ts".

  6. mzabaluev commented on Jun 13, 2023

    @mzabaluev
    ContributorAuthor

    It appears that doing a lot of redefinitions just to change the _UNKNOWN suffix to _UNSPECIFIED causes a lot of versioning churn, while the enums BlockIdFlag and SignedMsgType are otherwise already good style wise.
    As the style guide and the buf lint configuration docs suggest, the suffix name is a recommended default and we can choose another as long as the 0 value is reserved for the special case of no meaningful value given.

    Maybe we should stick with _UNKNOWN as our preference?

  7. moved this from Todo to In Progress in CometBFT 2023on Jun 14, 2023
  8. moved this from In Progress to Done in CometBFT 2023on Jul 4, 2023
  9. mzabaluev commented on Jul 4, 2023

    @mzabaluev
    ContributorAuthor

    Completed in #975 (in the feature/proto-upgrade branch)

  10. mzabaluev commented on Oct 16, 2023

    @mzabaluev
    ContributorAuthor

    #1443 is adding a fix, setting the Type field in the RequestCheckTx message to a non-zero enum value everywhere such a message is created.

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

Metadata

Metadata

Assignees

Labels

protobuf

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions