Skip to content

Conversation

@jorgecuesta
Copy link
Contributor

@jorgecuesta jorgecuesta commented Dec 2, 2025

Summary

  • Add per-domain key granularity to group endpoints by hosting domain (e.g., rm-01.eu.nodefleet.net → eth:nodefleet.net)
  • Remove per-service granularity (blocking entire services is not useful)
  • Add service_overrides config for per-service granularity settings
  • Change KeyBuilder() to KeyBuilderForService(serviceID) API for per-service configuration

Granularity Options

Option Key Format Use Case
per-endpoint eth:pokt1abc-https://node.com Each URL scored separately (default)
per-domain eth:nodefleet.net Group endpoints by hosting provider
per-supplier eth:pokt1abc123 Group all endpoints from same supplier

Configuration

reputation_config:
    enabled: true
    key_granularity: "per-endpoint"  # Global default
    service_overrides:
      eth:
        key_granularity: "per-domain"   # eth uses per-domain
      sol:
        key_granularity: "per-supplier" # sol uses per-supplier

Changes

  • reputation/key.go - Added DomainKeyBuilder, removed ServiceKeyBuilder
  • reputation/reputation.go - Added ServiceConfig, ServiceOverrides, updated constants
  • reputation/service.go - Added serviceKeyBuilders map, KeyBuilderForService() method
  • reputation/key_test.go - Added per-domain tests, removed per-service tests
  • reputation/reputation_test.go - Updated to use new API
  • protocol/shannon/context.go - Updated to use KeyBuilderForService, fixed style consistency
  • protocol/shannon/reputation.go - Updated filterByReputation to use new API
  • protocol/shannon/reputation_test.go - Added per-domain test, removed per-service test
  • config/examples/config.shannon_example.yaml - Updated documentation

Test plan

  • All unit tests pass
  • Lint passes (0 issues)
  • E2E tests verified (identical results to main branch: 64.33% success rate)
  • Per-domain grouping verified in tests
  • [x]Service overrides verified in tests

Add KeyGranularity config option to control how endpoints are grouped for
reputation scoring:
- per-endpoint: Each endpoint URL scored independently (default, finest)
- per-supplier: All endpoints from same supplier share a score
- per-service: All endpoints for a service share a single score (coarsest)

Changes:
- Add KeyBuilder interface with 3 implementations in reputation/key.go
- Add KeyGranularity field to reputation.Config
- Update ReputationService interface with KeyBuilder() method
- Update protocol/shannon to use KeyBuilder for endpoint key creation
- Add comprehensive tests (unit + integration) for all granularity levels
- Update example config with key_granularity documentation
- Add per-domain key granularity to group endpoints by hosting domain
  (e.g., rm-01.eu.nodefleet.net -> eth:nodefleet.net)
- Remove per-service granularity (blocking entire service not useful)
- Add service_overrides config for per-service granularity settings
- Change KeyBuilder() to KeyBuilderForService(serviceID) API
- Fix style inconsistency in context.go endpoint address handling

Granularity options (finest to coarsest):
- per-endpoint: Each URL scored separately (default)
- per-domain: Endpoints from same hosting domain share score
- per-supplier: Endpoints from same supplier share score
@jorgecuesta jorgecuesta requested a review from oten91 December 2, 2025 21:25
@jorgecuesta jorgecuesta self-assigned this Dec 2, 2025
@jorgecuesta jorgecuesta added the qos Intended to improve quality of service label Dec 2, 2025
oten91 added a commit that referenced this pull request Dec 4, 2025
## Summary

Adds a probation system to the tiered endpoint selection, giving
low-scoring endpoints a chance to recover through limited traffic
sampling.

- **Probation Zone**: Endpoints scoring ≥10 but <30 (min threshold)
enter probation instead of being fully excluded
- **Traffic Sampling**: Only a configurable percentage (default 10%) of
requests consider probation endpoints
- **Recovery Multiplier**: Positive signals for probation endpoints are
boosted (default 2x) to accelerate score recovery
- **Metrics**: New Prometheus metrics for probation selection and
recovery multiplier application

### Score Hierarchy
```
Tier 1 (Premium): score >= 70
Tier 2 (Good):    score >= 50
Tier 3 (Fair):    score >= 30
Probation:        score >= 10 but < 30
Excluded:         score < 10
```

### New Metrics
- `shannon_reputation_probation_selection_total` - Probation endpoint
selection outcomes (selected/skipped)
- `shannon_reputation_recovery_multiplier_applied_total` - When recovery
multiplier boosts positive signals

### Configuration
```yaml
reputation_config:
  tiered_selection:
    probation:
      enabled: true
      threshold: 10           # Min score for probation (must be < min_threshold)
      traffic_percent: 10     # % of requests that consider probation endpoints
      recovery_multiplier: 2.0 # Boost factor for positive signals
```

## Depends On
- #494 (feat: add configurable endpoint key granularity for reputation
system)

## Test Plan

- [x] Unit tests for `TieredSelector.GroupByTierWithProbation()`
- [x] Unit tests for `TieredSelector.SelectEndpointWithProbation()` with
traffic sampling
- [x] Unit tests for recovery multiplier application in `RecordSignal()`
- [x] Config loading tests with probation settings
- [x] Local verification with live endpoint logging showing
`probation_threshold: 10`
- [x] `make test_unit` passes
- [x] `make go_lint` passes

includes #497
---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Otto V <[email protected]>
@oten91 oten91 merged commit cb4a452 into main Dec 4, 2025
12 checks passed
@oten91 oten91 deleted the feat/key-granularity branch December 4, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qos Intended to improve quality of service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants