Skip to content

fix: re-create v1betaN proto versions that import modified v1 protos #3090

@andynog

Description

@andynog

As part of the PR #1677, some beta proto files (v1betaN) ended up importing a v1 proto. The reason was to avoid protobuf code duplication (i.e., having analogous proto data structures both in v1 and v1betaN. The drawback of this approach is that, when modifying a v1 proto, we need to be careful, we need to:

  • Search for any v1betaN proto file that imports the v1 proto being modified
  • If there exists at least one v1betaN proto file importing the v1 proto being modified then
    • In Promote latest versions of Protobuf definitions to v1 packages #1677, find the v1betaN proto file that corresponds to the v1 proto being modified
    • If that v1betaN proto has been converted to v1 (so the v1betaN proto appears in red) then
      • Recreate it again in a new PR
      • Adapt every v1betaN proto that imports the v1 proto under modification to import the newly recreated v1betaN proto

This would prevent issues when making changes to the current level proto level that can inadvertently cause breaking changes.

Some examples of the current imports are:

  • v1beta1 (lower level) imports v1 (higher level)
    • File proto/cometbft/abci/v1beta1/types.proto has import "cometbft/crypto/v1/keys.proto"
    • File proto/cometbft/types/v1beta1/validator.proto has import "cometbft/crypto/v1/keys.proto";

Definition of Done (DoD):

Go through all the current proto files and find all the use cases where a lower proto level references a higher proto level (as the examples above)

  • v1beta1
  • v1beta2
  • v1beta3

For each level (v1betaN)

  • Ensure the proto on a higher level proto with the level of the proto that was there before (e.g. v1beta1 was deleted and v1 was referenced instead, so ensure the v1beta1 and v1 have the same structure).
  • Recreate the higher level proto in the lower level (e.g. if in a v1beta1 level references v1, then re-create a v1beta1 with the same content and replace the import.
  • Generate the .pb.go files for the newly re-created protos.

Backport changes

In the release that uses a particular proto level as specified in this table, ensure that the code references are updated accordingly to use the refactored protos above (if applicable)

  • v0.34
  • v0.37
  • v0.38

Final check

  • Ensure that all the dependencies between proto levels are right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    protobufProtocol buffers-related

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions