Skip to content

feat(vms/evm/sync/handlers): add proto-based sync server handlers#5383

Draft
powerslider wants to merge 2 commits into
powerslider/5351-sync-proto-messagesfrom
powerslider/5376-sae-sync-server-handlers
Draft

feat(vms/evm/sync/handlers): add proto-based sync server handlers#5383
powerslider wants to merge 2 commits into
powerslider/5351-sync-proto-messagesfrom
powerslider/5376-sae-sync-server-handlers

Conversation

@powerslider
Copy link
Copy Markdown
Contributor

Why this should be merged

Check #5376

How this works

  • Port the EVM-sync server handlers (leaf, code, block) into vms/evm/sync/handlers``, switching the wire format from the legacy codec to protobuf messages defined in proto/pb/sync`.

  • The package exposes a generic Handler[Req, Resp] shell that owns proto marshal/unmarshal once and delegates the per-RPC work to a typed Responder.

  • Per-RPC files (block.go, code.go, leaf.go) bind the proto types via aliases and wire concrete responders.

  • The Responder contract encodes three outcomes via the return values:

    • (resp, nil) delivers
    • (zero, nil) drops as an application-level reject
    • (zero, err) surfaces as p2p.ErrUnexpected at the wire layer.
  • The leaf responder preserves the snapshot fast path with a segment-based fallback to trie iteration, range-proof generation, and request validation against the configured trie key length.

  • Handlers register at:

    • p2p.EVMLeafsRequestHandlerID
    • p2p.EVMCodeRequestHandlerID
    • p2p.EVMBlockRequestHandlerID pair up with the typed clients in vms/evm/sync/network.

How this was tested

Each handler has UT.

Need to be documented in RELEASES.md?

no

@powerslider powerslider self-assigned this May 15, 2026
@powerslider powerslider requested a review from a team as a code owner May 15, 2026 11:04
@powerslider powerslider marked this pull request as draft May 15, 2026 11:04
@powerslider powerslider force-pushed the powerslider/5376-sae-sync-server-handlers branch 2 times, most recently from 29ad6c7 to 890ec9b Compare May 15, 2026 11:10
@powerslider powerslider force-pushed the powerslider/5351-sync-proto-messages branch from 781ac59 to b3a26bd Compare May 18, 2026 13:13
- Port the EVM-sync server handlers (leaf, code, block) into
  `vms/evm/sync/handlers``, switching the wire format from the legacy
  codec to protobuf messages defined in `proto/pb/sync`.
- The package exposes a generic `Handler[Req, Resp]` shell that owns
  proto marshal/unmarshal once and delegates the per-RPC work to a
  typed `Responder`.
- Per-RPC files (block.go, code.go, leaf.go) bind the proto types
  via aliases and wire concrete responders.
- The `Responder` contract encodes three outcomes via the return values:
  - (resp, nil) delivers
  - (zero, nil) drops as an application-level reject
  - (zero, err) surfaces as `p2p.ErrUnexpected` at the wire layer.

- The leaf responder preserves the snapshot fast path with a
  segment-based fallback to trie iteration, range-proof generation,
  and request validation against the configured trie key length.

- Handlers register at:
  - `p2p.EVMLeafsRequestHandlerID`
  - `p2p.EVMCodeRequestHandlerID`
  - `p2p.EVMBlockRequestHandlerID`
  pair up with the typed clients in `vms/evm/sync/network`.

resolves #5376

Signed-off-by: Tsvetan Dimitrov (tsvetan.dimitrov@avalabs.org)
@powerslider powerslider force-pushed the powerslider/5376-sae-sync-server-handlers branch from 92b963e to ea3b7b5 Compare May 20, 2026 11:15
@powerslider powerslider force-pushed the powerslider/5376-sae-sync-server-handlers branch from ea3b7b5 to aacf74a Compare May 20, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant