Skip to content

Commit 64b66ca

Browse files
mergify[bot]pyramationcrodriguezvega
authored
fix: add cosmos_proto.implements_interface (backport #1740) (#1813)
* 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 conflict and add cosmos.proto Co-authored-by: Dan Lynch <pyramation@gmail.com> Co-authored-by: crodriguezvega <carlos@interchain.io>
1 parent e7b9b86 commit 64b66ca

File tree

5 files changed

+76
-52
lines changed

5 files changed

+76
-52
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
4646

4747
### Improvements
4848

49-
* (core/02-client) [\#1570](https://github.com/cosmos/ibc-go/pull/1570) Emitting an event when handling an upgrade client proposal.
49+
* (core/02-client) [\#1570](https://github.com/cosmos/ibc-go/pull/1570) Emitting an event when handling an upgrade client proposal.
50+
* (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
5051

5152
### Features
5253

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ require (
2525
google.golang.org/protobuf v1.27.1
2626
)
2727

28+
require github.com/regen-network/cosmos-proto v0.3.1
29+
2830
require (
2931
filippo.io/edwards25519 v1.0.0-beta.2 // indirect
3032
github.com/99designs/keyring v1.1.6 // indirect
@@ -93,7 +95,6 @@ require (
9395
github.com/prometheus/common v0.32.1 // indirect
9496
github.com/prometheus/procfs v0.7.3 // indirect
9597
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
96-
github.com/regen-network/cosmos-proto v0.3.1 // indirect
9798
github.com/rs/cors v1.8.2 // indirect
9899
github.com/rs/zerolog v1.23.0 // indirect
99100
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect

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

+49-46
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

+7-4
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;
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)