Skip to content

Unify message wire format for coreth and subnet-evm in Helicon network upgrade #4932

@powerslider

Description

@powerslider

Summary

Unify the message wire formats for coreth (C-Chain) and subnet-evm into a single codec, eliminating the need for two separate codecs with nearly identical serialization formats.

Background

Check this discussion: #4882 (comment)

Currently, the graft/evm/message package maintains two separate codecs:

  • CorethCodec - used for C-Chain state sync messages
  • SubnetEVMCodec - used for Subnet-EVM state sync messages

These codecs differ only in:

  1. Skip registrations count: Coreth skips 3 deprecated types (gossip types + sync summary type), while Subnet-EVM skips 2 (gossip types only)
  2. LeafsRequest wire format: CorethLeafsRequest serializes the NodeType field, while SubnetEVMLeafsRequest does not (uses serialize:"false" tag)

The rest of the message types (BlockRequest, BlockResponse, LeafsResponse, CodeRequest, CodeResponse) share identical wire formats.

Proposal

Introduce a unified wire format that both C-Chain and Subnet-EVM networks can use. This would involve:

  1. Standardizing the LeafsRequest format - decide whether to include NodeType in the wire format or not.
  2. Aligning skip registration counts - establish a common base for deprecated type handling.
  3. Single codec implementation - replace the dual-codec system with one unified codec.

Benefits

  • Single code path for message serialization/deserialization.
  • No need to keep two codec configurations in sync.
  • One wire format to test instead of two.
  • New message types automatically work across both networks.

Migration Considerations

  • This is a breaking wire format change and requires a coordinated network upgrade.
  • All nodes must upgrade simultaneously to avoid deserialization failures during state sync.
  • Backward compatibility period may be needed where nodes accept both old and new formats.

Checklist

  • Decide on the unified LeafsRequest wire format (with or without NodeType).
  • Implement unified codec.
  • Add migration/compatibility layer if needed.
  • Update state sync handlers in both coreth and subnet-evm.
  • Comprehensive testing on testnet.
  • Documentation updates.

Metadata

Metadata

Assignees

Labels

corethRelated to the former coreth standalone repositoryevmRelated to EVM functionalitysubnet-evmRelated to the former subnet-evm standalone repository

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions