Skip to content

feat(net): normalize inbound messages#6797

Merged
lvs0075 merged 2 commits into
tronprotocol:release_v4.8.2from
halibobo1205:fix/sanitize-inbound-protobuf-unknown-fields
May 25, 2026
Merged

feat(net): normalize inbound messages#6797
lvs0075 merged 2 commits into
tronprotocol:release_v4.8.2from
halibobo1205:fix/sanitize-inbound-protobuf-unknown-fields

Conversation

@halibobo1205
Copy link
Copy Markdown
Collaborator

@halibobo1205 halibobo1205 commented May 22, 2026

Summary

Add sanitize() to BlockCapsule and TransactionCapsule that normalizes the protobuf representation by stripping outer unknown fields, leaving all consensus-hashed and signed regions byte-identical.

Invocation:

  • BlockMsgHandler.processMessage calls blockMessage.sanitize() after the existing size/time checks and before sync/adv dispatch. BlockMessage.sanitize() updates both the capsule and the message's wire data field (if it contains unknown fields).
  • Manager.processTransaction calls trxCap.sanitize() after signature validation, only for mempool transactions (!trxCap.isInBlock()).
  • Wallet.broadcastTransaction constructs the outbound TransactionMessage after pushTransaction so it reflects the post-sanitize state.

Each sanitize() short-circuits when there are no unknown fields, so the common path is allocation-free.

Compatibility

  • Consensus state is unchanged.
  • Existing size checks, error paths, response codes, and log lines are untouched.
  • No consensus impact.

@github-actions github-actions Bot requested a review from 317787106 May 22, 2026 11:17
@halibobo1205 halibobo1205 requested a review from xxo1shine May 22, 2026 11:18
@halibobo1205 halibobo1205 added the topic:net p2p net work, synchronization label May 22, 2026
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.2 milestone May 22, 2026
@halibobo1205 halibobo1205 changed the title feat(net): strip unknown protobuf fields on inbound messages feat(net):strip unknown protobuf fields on inbound messages May 22, 2026
@halibobo1205 halibobo1205 changed the title feat(net):strip unknown protobuf fields on inbound messages feat(net): strip unknown protobuf fields on inbound messages May 22, 2026
@halibobo1205 halibobo1205 changed the title feat(net): strip unknown protobuf fields on inbound messages feat(net): normalize inbound messages May 22, 2026
@halibobo1205 halibobo1205 changed the title feat(net): normalize inbound messages feat(net): normalize inbound messages May 22, 2026
@halibobo1205 halibobo1205 requested a review from waynercheung May 22, 2026 11:43
@halibobo1205 halibobo1205 force-pushed the fix/sanitize-inbound-protobuf-unknown-fields branch 2 times, most recently from 656cb38 to cdcceba Compare May 23, 2026 08:13
Comment thread framework/src/main/java/org/tron/core/net/message/adv/TransactionMessage.java Outdated
Comment thread framework/src/main/java/org/tron/core/net/message/adv/BlockMessage.java Outdated
@halibobo1205 halibobo1205 force-pushed the fix/sanitize-inbound-protobuf-unknown-fields branch from cdcceba to 1dd07e7 Compare May 25, 2026 06:32
@halibobo1205 halibobo1205 requested a review from 317787106 May 25, 2026 06:32
@halibobo1205 halibobo1205 requested a review from 317787106 May 25, 2026 07:31
@lvs0075 lvs0075 merged commit 0c741e3 into tronprotocol:release_v4.8.2 May 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:net p2p net work, synchronization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants