feat(vms/evm/sync/handlers): add proto-based sync server handlers#5383
Draft
powerslider wants to merge 2 commits into
Draft
feat(vms/evm/sync/handlers): add proto-based sync server handlers#5383powerslider wants to merge 2 commits into
powerslider wants to merge 2 commits into
Conversation
29ad6c7 to
890ec9b
Compare
781ac59 to
b3a26bd
Compare
- 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)
92b963e to
ea3b7b5
Compare
ea3b7b5 to
aacf74a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inproto/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 typedResponder.Per-RPC files (block.go, code.go, leaf.go) bind the proto types via aliases and wire concrete responders.
The
Respondercontract encodes three outcomes via the return values:p2p.ErrUnexpectedat 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.EVMLeafsRequestHandlerIDp2p.EVMCodeRequestHandlerIDp2p.EVMBlockRequestHandlerIDpair up with the typed clients invms/evm/sync/network.How this was tested
Each handler has UT.
Need to be documented in RELEASES.md?
no