mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Lux unifies subnet (validator-set) and chain identity into a single
ChainID — every chain identifies itself by its ChainID, no separate
'subnet identifier' needed.
Wire/interface changes (BREAKING — coordinated rollout):
- node/message/wire: ChainSubnetPair struct → ChainPingEntry; collapsed
duplicate SubnetId field; ChainSubnetPairs → ChainIds
- node/proto/zap/p2p: SubnetID → ChainID
- node/vms/chainadapter: ICPBlock/ICPSubnet SubnetID → ChainID
- validators/uptime: Calculator interface params subnetID → chainID
- consensus/core/router: Connected method param subnetID → chainID
- p2p/message: outbound_msg_builder var renames
Config/UI changes (cleanup):
- genesis/pkg/genesis ChainEntry: dropped redundant SubnetID field
- tui/views/ChainStatus: dropped redundant SubnetID field
- cli: comment cleanup
- benchmarks: deploy-subnets var rename
72 lines
1.5 KiB
Go
72 lines
1.5 KiB
Go
package router
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/luxfi/ids"
|
|
)
|
|
|
|
// Message represents a network message
|
|
type Message interface {
|
|
NodeID() ids.NodeID
|
|
Op() Op
|
|
Get(Field) interface{}
|
|
Bytes() []byte
|
|
BytesSavedCompression() int
|
|
AddRef()
|
|
DecRef()
|
|
IsProposal() bool
|
|
}
|
|
|
|
// Op represents a message operation type
|
|
type Op byte
|
|
|
|
const (
|
|
// GetAcceptedFrontier gets accepted frontier
|
|
GetAcceptedFrontier Op = iota
|
|
// AcceptedFrontier is accepted frontier response
|
|
AcceptedFrontier
|
|
// GetAccepted gets accepted
|
|
GetAccepted
|
|
// Accepted is accepted response
|
|
Accepted
|
|
// Get gets an item
|
|
Get
|
|
// Put puts an item
|
|
Put
|
|
// PushQuery pushes a query
|
|
PushQuery
|
|
// PullQuery pulls a query
|
|
PullQuery
|
|
// Vote is the authenticated preference signal returned by polling
|
|
Vote
|
|
// GetContext requests the verification context (parent chain) for a block
|
|
GetContext
|
|
// Context is the response containing prerequisite blocks needed to verify/attach a tip
|
|
Context
|
|
)
|
|
|
|
// Field represents a message field
|
|
type Field byte
|
|
|
|
// InboundHandler handles inbound messages
|
|
type InboundHandler interface {
|
|
HandleInbound(context.Context, Message) error
|
|
}
|
|
|
|
// ExternalHandler handles messages from external chains
|
|
type ExternalHandler interface {
|
|
Connected(nodeID ids.NodeID, nodeVersion interface{}, chainID ids.ID)
|
|
Disconnected(nodeID ids.NodeID)
|
|
HandleInbound(context.Context, Message) error
|
|
}
|
|
|
|
// HealthConfig configures health checks
|
|
type HealthConfig struct {
|
|
Enabled bool
|
|
Interval time.Duration
|
|
Timeout time.Duration
|
|
MaxOutstandingChecks int
|
|
}
|