Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions inference-chain/x/inference/epochgroup/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ func (eg *EpochGroup) GetRandomMember(
// PoC voting weights (ValidationWeights[].Weight) and the cosmos-sdk group member
// weights (used for block production) are NOT modified; this map is used solely by
// the executor-selection lottery.
//
// Returns an empty map if GroupData or ValidationWeights is nil.
func (eg *EpochGroup) buildSelectionWeightsMap() map[string]int64 {
if eg.GroupData == nil {
return make(map[string]int64)
}
weights := make(map[string]int64, len(eg.GroupData.ValidationWeights))
for _, vw := range eg.GroupData.ValidationWeights {
if vw == nil {
Expand Down
9 changes: 9 additions & 0 deletions inference-chain/x/inference/keeper/circuit_breaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ type cbParams struct {

// getCBParams reads CB parameters from ValidationParams and falls back to Go
// compile-time defaults for any field that is zero (unset).
//
// NOTE: Zero-value governance override caveat — because zero is used as a sentinel
// for "unset" (triggering the default fallback), it is not possible to set any of
// these parameters to 0 via a governance proposal. For example, setting
// CbMissThresholdPct=0 to disable threshold-based exclusion will be silently
// ignored and the default (DefaultCBMissThresholdPct=25) will be used instead.
// This is intentional: a threshold of 0 would immediately exclude every node.
// If disabling the circuit breaker is needed, prefer very large values
// (e.g. CbMissThresholdPct=100 or CbMinSamples=MaxUint64) rather than zero.
func (k Keeper) getCBParams(ctx context.Context) cbParams {
p := cbParams{
MissThresholdPct: DefaultCBMissThresholdPct,
Expand Down
8 changes: 5 additions & 3 deletions inference-chain/x/inference/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ var (
SubnetEscrowCounterPrefix = collections.NewPrefix(49)
SubnetEscrowEpochCountPrefix = collections.NewPrefix(50)
SubnetHostEpochStatsPrefix = collections.NewPrefix(51)
SubnetEscrowsByEpochPrefix = collections.NewPrefix(52)
CircuitBreakerStatePrefix = collections.NewPrefix(53)
ParamsKey = []byte("p_inference")
SubnetEscrowsByEpochPrefix = collections.NewPrefix(52)
// Note: prefix 53 is reserved for circuit breaker state; the implementation uses
// the string-based CircuitBreakerStateKey with KeyPrefix() for consistency with
// other string-keyed stores in this module. Do not reuse prefix 53.
ParamsKey = []byte("p_inference")
)

func KeyPrefix(p string) []byte {
Expand Down
Loading