Files
consensus/validators/validators.go
T
zeekay af0bbdc3d6 feat: complete integration of all three consensus engines
- Implement chain, DAG, and post-quantum consensus engines with full test coverage
- Create IntegratedEngine in node package combining all three engines
- Add production-ready cmd tools (params, checker, sim, zmq-bench)
- Implement Acceptor interface for node consensus integration
- Add WithBlockTime method to config Parameters
- Ensure all tests pass across consensus and node packages
- Remove stub implementations and add proper production code
- Fix config validation with detailed error messages
- Clean up duplicate files and unused code
2025-08-21 19:25:56 -05:00

61 lines
1.6 KiB
Go

package validators
import (
"github.com/luxfi/ids"
)
// Manager manages validators
type Manager interface {
// GetValidators returns validators for a subnet
GetValidators(subnetID ids.ID) (map[ids.NodeID]*Validator, error)
// GetValidator returns a specific validator
GetValidator(subnetID ids.ID, nodeID ids.NodeID) (*Validator, bool)
// GetWeight returns the weight of a validator
GetWeight(subnetID ids.ID, nodeID ids.NodeID) (uint64, bool)
// SubsetWeight returns total weight of a subset
SubsetWeight(subnetID ids.ID, nodeIDs []ids.NodeID) (uint64, error)
// TotalWeight returns total weight
TotalWeight(subnetID ids.ID) (uint64, error)
}
// Validator represents a validator
type Validator struct {
NodeID ids.NodeID
PublicKey []byte
Weight uint64
}
// Set is a set of validators
type Set interface {
// Add adds a validator
Add(nodeID ids.NodeID, pk []byte, weight uint64) error
// RemoveWeight removes weight from a validator
RemoveWeight(nodeID ids.NodeID, weight uint64) error
// Get returns a validator
Get(nodeID ids.NodeID) (*Validator, bool)
// Len returns the number of validators
Len() int
// Weight returns total weight
Weight() uint64
// Sample samples validators
Sample(n int) ([]ids.NodeID, error)
}
// State manages validator state
type State interface {
// GetCurrentValidators returns current validators
GetCurrentValidators(subnetID ids.ID) (map[ids.NodeID]*Validator, error)
// GetValidatorSet returns a validator set
GetValidatorSet(subnetID ids.ID) (Set, error)
}