Skip to content

refactor(protocol): prune grpc-gateway related proto#72

Closed
317787106 wants to merge 5 commits into
developfrom
feature/prune_proto
Closed

refactor(protocol): prune grpc-gateway related proto#72
317787106 wants to merge 5 commits into
developfrom
feature/prune_proto

Conversation

@317787106

@317787106 317787106 commented Apr 17, 2026

Copy link
Copy Markdown
Owner

Summary

Closes tronprotocol#6548.

Removes all google.api.http option annotations from gRPC service definitions and deletes eight unused empty proto files under protocol/src/main/protos/core/tron/. 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. Retaining them adds maintenance overhead and cognitive complexity without providing value.

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.
  • Removed option go_package declarations from API and contract proto files.

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 has been removed; Go client stubs can no longer be generated directly from these proto files.

Test

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

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@317787106 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 40 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83852070-4c90-4eb3-9be4-0c2a3db846f9

📥 Commits

Reviewing files that changed from the base of the PR and between 04821b8 and 6df6132.

📒 Files selected for processing (17)
  • protocol/src/main/protos/api/api.proto
  • protocol/src/main/protos/api/zksnark.proto
  • protocol/src/main/protos/core/Discover.proto
  • protocol/src/main/protos/core/Tron.proto
  • protocol/src/main/protos/core/TronInventoryItems.proto
  • protocol/src/main/protos/core/contract/account_contract.proto
  • protocol/src/main/protos/core/contract/asset_issue_contract.proto
  • protocol/src/main/protos/core/contract/balance_contract.proto
  • protocol/src/main/protos/core/contract/common.proto
  • protocol/src/main/protos/core/contract/exchange_contract.proto
  • protocol/src/main/protos/core/contract/market_contract.proto
  • protocol/src/main/protos/core/contract/proposal_contract.proto
  • protocol/src/main/protos/core/contract/shield_contract.proto
  • protocol/src/main/protos/core/contract/smart_contract.proto
  • protocol/src/main/protos/core/contract/storage_contract.proto
  • protocol/src/main/protos/core/contract/vote_asset_contract.proto
  • protocol/src/main/protos/core/contract/witness_contract.proto
📝 Walkthrough

Walkthrough

This pull request removes Go package generation directives and HTTP/REST gateway annotations from proto files. The go_package option is deleted from 15 proto files across API and contract modules. Additionally, all google.api.http annotations (including HTTP method mappings and bindings) are removed from the Wallet, WalletSolidity, WalletExtension, and Monitor services in the main API proto file.

Changes

Cohort / File(s) Summary
API Gateway HTTP Mappings
protocol/src/main/protos/api/api.proto
Removed go_package option and all google.api.http annotations (post/get, body, additional_bindings) from Wallet, WalletSolidity, WalletExtension, and Monitor RPC methods. RPC signatures unchanged; HTTP/REST gateway routes no longer declared.
ZkSnark Service Configuration
protocol/src/main/protos/api/zksnark.proto
Removed go_package option from proto file. Service and RPC declarations remain unchanged.
Contract Proto Package Configuration
protocol/src/main/protos/core/contract/*.proto (account_contract, asset_issue_contract, balance_contract, common, exchange_contract, market_contract, proposal_contract, shield_contract, smart_contract, storage_contract, vote_asset_contract, witness_contract)
Removed go_package option from 12 contract proto files. Message definitions and java_package options remain unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops of joy!
HTTP routes now drift away,
Go packages freed from chains,
Proto files spring-cleaned today,
Cleaner code in our veins! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing grpc-gateway related proto options across multiple files. It is concise, specific, and clearly summarizes the primary refactoring objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/prune_proto

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 15 minutes and 40 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 22 files

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

3 issues found across 17 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="protocol/src/main/protos/core/contract/shield_contract.proto">

<violation number="1" location="protocol/src/main/protos/core/contract/shield_contract.proto:7">
P3: Remove the `go_package` option; this file is meant to be part of the proto cleanup that strips Go-generation metadata.</violation>
</file>

<file name="protocol/src/main/protos/core/contract/smart_contract.proto">

<violation number="1" location="protocol/src/main/protos/core/contract/smart_contract.proto:7">
P3: Remove the `go_package` option here; it contradicts the proto cleanup and keeps this contract proto generateable as Go.</violation>
</file>

<file name="protocol/src/main/protos/core/contract/storage_contract.proto">

<violation number="1" location="protocol/src/main/protos/core/contract/storage_contract.proto:7">
P2: Remove this `go_package` option. It keeps Go stub generation enabled for this proto, which contradicts the cleanup.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
//option java_outer_classname = "BuyStorageBytesContract"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/grpc-gateway/core";
option go_package = "github.com/tronprotocol/protocol/core/contract";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Remove this go_package option. It keeps Go stub generation enabled for this proto, which contradicts the cleanup.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At protocol/src/main/protos/core/contract/storage_contract.proto, line 7:

<comment>Remove this `go_package` option. It keeps Go stub generation enabled for this proto, which contradicts the cleanup.</comment>

<file context>
@@ -4,6 +4,7 @@ package protocol;
 
 option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
 //option java_outer_classname = "BuyStorageBytesContract"; //Specify the class name of the generated Java file
+option go_package = "github.com/tronprotocol/protocol/core/contract";
 
 message BuyStorageBytesContract {
</file context>

option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
//option java_outer_classname = "ShieldedTransferContract"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/grpc-gateway/core";
option go_package = "github.com/tronprotocol/protocol/core/contract";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Remove the go_package option; this file is meant to be part of the proto cleanup that strips Go-generation metadata.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At protocol/src/main/protos/core/contract/shield_contract.proto, line 7:

<comment>Remove the `go_package` option; this file is meant to be part of the proto cleanup that strips Go-generation metadata.</comment>

<file context>
@@ -4,6 +4,7 @@ package protocol;
 
 option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
 //option java_outer_classname = "ShieldedTransferContract"; //Specify the class name of the generated Java file
+option go_package = "github.com/tronprotocol/protocol/core/contract";
 
 // for shielded transaction
</file context>

option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
//option java_outer_classname = "CreateSmartContract"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/grpc-gateway/core";
option go_package = "github.com/tronprotocol/protocol/core/contract";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Remove the go_package option here; it contradicts the proto cleanup and keeps this contract proto generateable as Go.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At protocol/src/main/protos/core/contract/smart_contract.proto, line 7:

<comment>Remove the `go_package` option here; it contradicts the proto cleanup and keeps this contract proto generateable as Go.</comment>

<file context>
@@ -4,6 +4,7 @@ package protocol;
 
 option java_package = "org.tron.protos.contract"; //Specify the name of the package that generated the Java file
 //option java_outer_classname = "CreateSmartContract"; //Specify the class name of the generated Java file
+option go_package = "github.com/tronprotocol/protocol/core/contract";
 
 import "core/Tron.proto";
</file context>

@317787106 317787106 closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate http rest mappings in gRPC protos

1 participant