Skip to content

Commit 7ccdb58

Browse files
mergify[bot]pyramationcrodriguezvega
authored
fix: add cosmos_proto.implements_interface (backport #1740) (#1812)
* fix: add cosmos_proto.implements_interface (#1740) * fix: add cosmos_proto.implements_interface * changelog * Update CHANGELOG.md Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * run `make proto-all` * run `go mod tidy` Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> (cherry picked from commit 40d0ff7) # Conflicts: # CHANGELOG.md # modules/core/02-client/types/client.pb.go * fix conflicts and add cosmos.proto Co-authored-by: Dan Lynch <pyramation@gmail.com> Co-authored-by: crodriguezvega <carlos@interchain.io>
1 parent 8fa6810 commit 7ccdb58

File tree

5 files changed

+74
-50
lines changed

5 files changed

+74
-50
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4545
### Improvements
4646

4747
* (core/02-client) [\#1570](https://github.com/cosmos/ibc-go/pull/1570) Emitting an event when handling an upgrade client proposal.
48+
* (core/client) [\#1740](https://github.com/cosmos/ibc-go/pull/1740) Add `cosmos_proto.implements_interface` to adhere to guidelines in [Cosmos SDK ADR 019](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-019-protobuf-state-encoding.md#safe-usage-of-any) for annotating `google.protobuf.Any` types
4849

4950
### Features
5051

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ require (
3131
github.com/golang/snappy v0.0.3 // indirect
3232
github.com/mitchellh/mapstructure v1.4.2 // indirect
3333
github.com/pelletier/go-toml v1.9.4 // indirect
34+
github.com/regen-network/cosmos-proto v0.3.1
3435
gopkg.in/ini.v1 v1.63.2 // indirect
3536
)

modules/core/02-client/types/client.pb.go

Lines changed: 49 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/ibc/core/client/v1/client.proto

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types";
77
import "gogoproto/gogo.proto";
88
import "google/protobuf/any.proto";
99
import "cosmos/upgrade/v1beta1/upgrade.proto";
10+
import "cosmos_proto/cosmos.proto";
1011

1112
// IdentifiedClientState defines a client state with an additional client
1213
// identifier field.
@@ -41,7 +42,8 @@ message ClientConsensusStates {
4142
// handler may fail if the subject and the substitute do not match in client and
4243
// chain parameters (with exception to latest height, frozen height, and chain-id).
4344
message ClientUpdateProposal {
44-
option (gogoproto.goproto_getters) = false;
45+
option (gogoproto.goproto_getters) = false;
46+
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
4547
// the title of the update proposal
4648
string title = 1;
4749
// the description of the proposal
@@ -56,9 +58,10 @@ message ClientUpdateProposal {
5658
// UpgradeProposal is a gov Content type for initiating an IBC breaking
5759
// upgrade.
5860
message UpgradeProposal {
59-
option (gogoproto.goproto_getters) = false;
60-
option (gogoproto.goproto_stringer) = false;
61-
option (gogoproto.equal) = true;
61+
option (gogoproto.goproto_getters) = false;
62+
option (gogoproto.goproto_stringer) = false;
63+
option (gogoproto.equal) = true;
64+
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
6265

6366
string title = 1;
6467
string description = 2;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
syntax = "proto3";
2+
package cosmos_proto;
3+
4+
import "google/protobuf/descriptor.proto";
5+
6+
option go_package = "github.com/regen-network/cosmos-proto";
7+
8+
extend google.protobuf.MessageOptions {
9+
string interface_type = 93001;
10+
11+
string implements_interface = 93002;
12+
}
13+
14+
extend google.protobuf.FieldOptions {
15+
string accepts_interface = 93001;
16+
}

0 commit comments

Comments
 (0)