Skip to content

Add Polygon PoS chain support #4

@vicnaum

Description

@vicnaum

Summary

Polygon PoS (Bor) uses devp2p and serves receipts over P2P via eth/68 and eth/69 — making it compatible with SHiNode's architecture. This issue tracks the work needed to support Polygon as a second chain.

What works already

  • --chain-id CLI flag exists (defaults to 1)
  • Storage layer validates chain ID in meta.json — data isolation between chains works out of the box

What needs to change

1. Pluggable chain configuration

The P2P layer (p2p/mod.rs) is hardcoded to Ethereum mainnet:

  • MAINNET genesis hash for peer validation
  • mainnet_boot_nodes() for bootstrap discovery
  • MAINNET chainspec passed to build_with_noop_provider()

Need a --chain flag (or similar) that selects the right genesis, bootnodes, and fork schedule.

2. Polygon fork ID schedule

Polygon uses its own hardfork schedule (Jaipur, Delhi, Madhugiri, Dandeli, etc.) instead of Ethereum's. The devp2p handshake fork hash must match, otherwise peers reject the connection.

3. Handle StateSyncTxType (0x7f) receipts

Polygon has a custom transaction type 0x7f for Heimdall-to-Bor state sync (bridge transfers, validator set updates). Reth's TxType doesn't include it, so deserialization would fail when a peer sends these receipts.

We don't need to index these — just parse-and-discard or skip gracefully so we don't choke on them.

4. Pre-Madhugiri receipt hash caveat (historical only)

Before the Madhugiri hardfork (block 80,084,800, Dec 2025), state-sync receipts were excluded from the block's receiptsRoot. Post-Madhugiri they're canonical. If we ever validate receipt roots for historical Polygon blocks, this would need special handling. For current/recent blocks this is a non-issue.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions