Skip to content

refactor(protocol): prune grpc-gateway proto and support go compile#6726

Open
317787106 wants to merge 5 commits intotronprotocol:developfrom
317787106:feature/prune_proto
Open

refactor(protocol): prune grpc-gateway proto and support go compile#6726
317787106 wants to merge 5 commits intotronprotocol:developfrom
317787106:feature/prune_proto

Conversation

@317787106
Copy link
Copy Markdown
Collaborator

@317787106 317787106 commented Apr 28, 2026

Summary

Closes #6548.

Removes all google.api.http option annotations from gRPC service definitions, deletes eight unused empty proto files under protocol/src/main/protos/core/tron/, and updates option go_package across all proto files to point to the canonical tronprotocol/protocol repository. No RPC method signatures, message types, or service interfaces are changed.

Background

The grpc-gateway project, which relied on google.api.http mappings to translate HTTP requests into gRPC calls, has been deprecated and is no longer maintained. Every gRPC API already has a dedicated HTTP implementation in FullNodeHttpApiService, making the dual HTTP-REST route definitions redundant.

The existing option go_package values pointed to the deprecated grpc-gateway repository (github.com/tronprotocol/grpc-gateway/...). They are updated here to point to the canonical protocol repository (github.com/tronprotocol/protocol/...), which is the correct home for Go code generated from these proto files.

Changes

protocol/src/main/protos/api/api.proto

  • Removed google.api.http option blocks from 56 RPC methods across the Wallet, WalletSolidity, WalletExtension, and Monitor services.
  • Updated option go_package from github.com/tronprotocol/grpc-gateway/api to github.com/tronprotocol/protocol/api.

Other proto files — go_package updates

File(s) Old value New value
api/zksnark.proto grpc-gateway/api protocol/api
core/Tron.proto, core/Discover.proto, core/TronInventoryItems.proto grpc-gateway/core protocol/core
core/contract/*.proto (12 files) grpc-gateway/core or absent protocol/core/contract

Deleted files (protocol/src/main/protos/core/tron/)

Eight empty proto files that served no purpose after grpc-gateway was abandoned:
account.proto, block.proto, delegated_resource.proto, p2p.proto, proposal.proto, transaction.proto, vote.proto, witness.proto

Impact

  • gRPC clients (e.g., Trident SDK): no change — all RPC method signatures are identical.
  • HTTP clients: all HTTP APIs continue to be served by FullNodeHttpApiService and are unaffected.
  • grpc-gateway / HTTP-to-gRPC proxies: the REST route annotations are gone. Anyone still running a custom grpc-gateway setup must migrate to calling gRPC methods directly or use the dedicated HTTP API endpoints.
  • Go code generation: option go_package now points to github.com/tronprotocol/protocol. Go consumers should generate stubs from the tronprotocol/protocol repository (a go.mod will be added there to complete Go module support).

Test

NA — this is a pure proto cleanup with no logic changes. The generated Java/gRPC stubs are functionally identical.

@lvs0075
Copy link
Copy Markdown
Collaborator

lvs0075 commented Apr 29, 2026

Why haven’t the go_package entries in Discover.proto and Tron.proto been removed?

@317787106
Copy link
Copy Markdown
Collaborator Author

317787106 commented Apr 29, 2026

Why haven’t the go_package entries in Discover.proto and Tron.proto been removed?

@lvs0075 To support compiling these proto files in Go, update go_package to point to the repository currently in use : github.com/tronprotocol/protocol.

@317787106 317787106 changed the title refactor(protocol): prune grpc-gateway related proto refactor(protocol): prune grpc-gateway related proto and support go compile Apr 30, 2026
@317787106 317787106 changed the title refactor(protocol): prune grpc-gateway related proto and support go compile refactor(protocol): prune grpc-gateway proto and support go compile Apr 30, 2026
Copy link
Copy Markdown
Collaborator

@lvs0075 lvs0075 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve

@waynercheung
Copy link
Copy Markdown
Collaborator

[SHOULD] This tutorial still tells contributors to set go_package = "github.com/tronprotocol/grpc-gateway/core" (line 22) and to add option (google.api.http) = { ... } to the new RPC (line 56). Both patterns are exactly what this PR removes from the tree, so following the tutorial would re-introduce the deprecated form. Suggest updating both en (lines 22 / 56) and zh (lines 24 / 58):

  • go_packagegithub.com/tronprotocol/protocol/core/contract (matching the new convention used in this PR for *_contract.proto).
  • Drop the option (google.api.http) block from the InvokeSum example.

package protocol;

import "core/Tron.proto";
import "google/api/annotations.proto";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SHOULD] After removing all google.api.http options in this PR, this import has no remaining consumers in the repo (grep -rn "google/api" protocol/ returns only this line). Compilation works either way (it's still provided transitively by proto-google-common-protos), but dropping the import keeps api.proto consistent with the "prune grpc-gateway" goal.

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Deprecate http rest mappings in gRPC protos

5 participants