Skip to content

fix: rename jsonCodec to avoid overriding gRPC default proto codec#9

Open
envestcc wants to merge 1 commit intoiotexproject:mainfrom
envestcc:fix/protocodec
Open

fix: rename jsonCodec to avoid overriding gRPC default proto codec#9
envestcc wants to merge 1 commit intoiotexproject:mainfrom
envestcc:fix/protocodec

Conversation

@envestcc
Copy link
Copy Markdown
Member

Summary

Renamed the jsonCodec from "proto" to "ioswarm-json" to avoid globally
overriding gRPC's default protobuf codec.

Problem

The previous implementation registered a JSON codec with the name "proto", which
overwrote gRPC's default protobuf codec globally. This caused all gRPC services in
the same process to use JSON encoding instead of protobuf, breaking compatibility
with standard gRPC clients.

Solution

Changed the codec name from "proto" to "ioswarm-json":

  • Maintains JSON serialization for ioswarm internal communication
  • No longer interferes with other gRPC services using protobuf
  • Must be paired with the same change on the coordinator/server side

Changes

  • codec.go: Changed jsonCodec.Name() return value from "proto" to
    "ioswarm-json"
  • Updated comments to clarify the purpose of using a distinct codec name

Related

This PR should be merged together with the coordinator fix in iotex-core.

The coordinator's codec was renamed from "proto" to "ioswarm-json" to
avoid overriding gRPC's default protobuf codec. This client must use
the same codec name for interoperability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant