Skip to content
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

Remove optional fields throughout protos #2933

Closed
conorsch opened this issue Aug 15, 2023 · 2 comments · Fixed by #2951
Closed

Remove optional fields throughout protos #2933

conorsch opened this issue Aug 15, 2023 · 2 comments · Fixed by #2951
Assignees

Comments

@conorsch
Copy link
Contributor

The protoc-gen-gocosmos tool, used to generate golang code from protobuf definitions for many Cosmos projects, does not support the use of optional fields in proto3 syntax. We encountered this on strangelove-ventures/interchaintest#644 (comment). To unblock, let's drop use of optional fields, updating code where necessary.

@conorsch conorsch self-assigned this Aug 15, 2023
conorsch added a commit that referenced this issue Aug 16, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

This commit updates the protos; still to come is the required Rust
changes for compatibility.

Refs #2933.
@conorsch
Copy link
Contributor Author

conorsch commented Aug 16, 2023

Still very much in-progress. Modifying the governance proposal code not to use options got me all tangled up. Had a helpful conversation with @plaidfinch, recommending deeper proto changes that will accommodate, but I expect I'll need more support before this is done. Still a couple more things to bang on before I ask for help again, though.

conorsch added a commit that referenced this issue Aug 17, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

This commit updates the protos; still to come is the required Rust
changes for compatibility.

Refs #2933.
conorsch added a commit that referenced this issue Aug 17, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

This commit updates the protos; still to come is the required Rust
changes for compatibility.

Refs #2933.
@conorsch
Copy link
Contributor Author

Paired with @aubrika today, who pointed out some comparable patterns for de-optionalizing. Used that approach to handle conversions of memo ciphertexts, bonding options, and how commit strings are handled in signaling proposals. Still outstanding however is sane handling of the "withdrawn" proposal state in the governance module. Planning to ask @plaidfinch for another pairing session to get that over the finish line.

conorsch added a commit that referenced this issue Aug 18, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

This commit updates the protos; still to come is the required Rust
changes for compatibility.

Refs #2933.
conorsch added a commit that referenced this issue Aug 18, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

This commit updates the protos; still to come is the required Rust
changes for compatibility.

Refs #2933.
conorsch added a commit that referenced this issue Aug 18, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

In order to preserve the representation of optionality, we use
submessages in the proto types, so we can include or omit the named
field. A notable exception is for encrypted memos: since the encrypted memo
payload must be a specific length, we can check for whether it's empty,
and map an empty encrypted memo to None.

H/t to @plaidfinch for describing the submessage pattern to me,
and implementing it on the governance changes.

Closes #2933.
conorsch added a commit that referenced this issue Aug 18, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

In order to preserve the representation of optionality, we use
submessages in the proto types, so we can include or omit the named
field. A notable exception is for encrypted memos: since the encrypted memo
payload must be a specific length, we can check for whether it's empty,
and map an empty encrypted memo to None.

H/t to @plaidfinch for describing the submessage pattern to me,
and implementing it on the governance changes.

Closes #2933.
conorsch added a commit that referenced this issue Aug 21, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

For the most part, we can still represent optionality by special-casing
zero (for blockheights) and empty (for encrypted memos). The exception
is governance protos, which require use of a submessage type to
represent the optional "withdrawn" state on proposal outcomes.
H/t to @plaidfinch for describing the submessage pattern to me,
and implementing it on the governance changes.

Closes #2933.
conorsch added a commit that referenced this issue Aug 21, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

For the most part, we can still represent optionality by special-casing
zero (for blockheights) and empty (for encrypted memos). The exception
is governance protos, which require use of a submessage type to
represent the optional "withdrawn" state on proposal outcomes.
H/t to @plaidfinch for describing the submessage pattern to me,
and implementing it on the governance changes.

Closes #2933.
hdevalence pushed a commit that referenced this issue Aug 21, 2023
The cosmos fork of gogoproto, used to generate golang code from BSR,
doesn't support "optional" fields in proto3 syntax. Rather than sort
that out, we're removing use of optional to unblock integration work on
interchaintest.

For the most part, we can still represent optionality by special-casing
zero (for blockheights) and empty (for encrypted memos). The exception
is governance protos, which require use of a submessage type to
represent the optional "withdrawn" state on proposal outcomes.
H/t to @plaidfinch for describing the submessage pattern to me,
and implementing it on the governance changes.

Closes #2933.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Testnet 59: Enceladus
1 participant