Skip to content

feat(api): reject unpaired surrogates in protobuf string fields - #7102

Open
halibobo1205 wants to merge 1 commit into
tronprotocol:release_v4.8.3from
halibobo1205:feature/jsonformat-require-valid-utf8
Open

halibobo1205 wants to merge 1 commit into
tronprotocol:release_v4.8.3from
halibobo1205:feature/jsonformat-require-valid-utf8

Conversation

@halibobo1205

Copy link
Copy Markdown
Collaborator

What does this PR do?

Validates HTTP and JSON-RPC values assigned to protobuf string fields, rejecting unpaired surrogates. This aligns validation with the UTF-8 requirement enforced during gRPC/protobuf decoding.

Why are these changes required?

Malformed Unicode is currently accepted and replaced with ? during protobuf serialization. This change validates it explicitly during request handling.

Compatibility changes:

  • Unpaired surrogates in protobuf string values now cause parsing or parameter errors instead of replacement.
  • When packing a transaction, existing logic skips contract parameters that fail to parse; the subsequent result depends on the request's remaining checks.
  • Well-formed Unicode, including emoji, and existing bytes field conversions remain unchanged.

This PR has been tested by:

  • 610 HTTP and JSON-RPC tests pass locally on JDK 17, covering malformed surrogates, error reporting and valid Unicode.
  • Before/after manual checks on a single-node private chain covered malformed strings and valid emoji through HTTP and JSON-RPC. Results matched the expected behavior.
  • Multi-sign was not enabled on the private chain. gRPC was not tested manually.

Follow up

None.

Extra details

Only HTTP and JSON-RPC request handling changes. Transaction validation, transaction execution and block processing are unchanged.

@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.3 milestone Nov 11, 2026
@halibobo1205 halibobo1205 added the topic:api rpc/http related issue label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:api rpc/http related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant