feat: Validator grid and UP/CE networking infrastructure#925
Open
feat: Validator grid and UP/CE networking infrastructure#925
Conversation
…ection handling in Peer
Terryhung
reviewed
Apr 5, 2026
| return result | ||
| } | ||
|
|
||
| func (g *GridMapper) IsNeighborInEpoch(a, b int) bool { |
Contributor
There was a problem hiding this comment.
Should IsNeighbor(key) consider peers whose key exists only in Previous/Next (same validator index), since JAMNP-S counts same-index-across-epochs as grid neighbours, or is Current-only lookup?
Terryhung
reviewed
Apr 5, 2026
| } | ||
| } | ||
|
|
||
| func (p *Peer) Broadcast(kind string, message interface{}) { |
Contributor
There was a problem hiding this comment.
Should Broadcast follow JAMNP-S message framing (4-byte LE length after the stream kind byte)?
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.
Summary
This PR adds validator grid topology and neighbor computation aligned with JAMNP, and strengthens QUIC connection handling / stream dispatch and CE handler wire consistency. It also includes small API, naming, and index-safety cleanups so follow-up work (UP 0, automatic dialing, epoch transitions) can land cleanly.
Motivation
SubscribevsPublish, so handlers never ran.Previous/Current/Nextfor clearer alignment with the spec.Scope (by file)
P0 / foundational fixes
internal/networking/quic/event_bus.gohandlersasmap[EventType][]Handler;Publish(ctx, eventType, event)internal/networking/quic/connection.goConnectionManager;Add/Remove/AllValidator grid and dial addresses
internal/networking/validator/grid.goGridMapper(Previous/Current/Next),ComputeWidth, same-epoch neighbors, same-index across epochs,FindIndexinternal/networking/validator/manager.goValidatorManager,PreferredInitiator, metadata → IPv6 + little-endian portPeer / stream dispatch
internal/networking/quic/peer_set.goAddreturnserror; Ed25519 key length must be 32 bytes when a key is presentinternal/networking/quic/peer.goStart/ accept loop; validate TLS cert and extract peer key;RegisterHandler;Broadcastwrites stream kind; integratesPeerSetinternal/networking/quic/handler.goHandleStreamByKind;HandleStreamkeeps backward-compatible 1-byte read then dispatchCE dispatch
internal/networking/handler/ce/ce_handler.goHandleStream(blockchain, protoID, stream)Tests
internal/networking/quic/peer_test.goEd25519Key,Connectsignature, broadcast wire includes kind byteinternal/networking/handler/ce/ce128_test.go,ce129_test.goConnectcallsValidation
go test ./internal/networking/quic ./internal/networking/validator ./internal/networking/handler/ceExpected:
quicandhandler/cepass;validatorcurrently has no test files.Out of scope (follow-ups)
PeerRole/ builder ALPN onConnectif product wiring needs it (small follow-up PR).login networking with the sharedloggerpackage for consistent levels and configuration.