Skip to content

feat: remove cookie automations and update weight curve#268

Merged
grantdfoster merged 14 commits intomainfrom
feat--incentive-curve
Mar 3, 2026
Merged

feat: remove cookie automations and update weight curve#268
grantdfoster merged 14 commits intomainfrom
feat--incentive-curve

Conversation

@grantdfoster
Copy link
Contributor

@grantdfoster grantdfoster commented Mar 3, 2026

Summary

This PR removes cookie automation tooling from subnet-42 (migrated to cookie-monster repo) and improves validator telemetry handling.

Cookie Automation Removal

  • Deleted: cookie_grabber.py, update_cookies_docker.sh, update_cookies_kubernetes.sh
  • Deleted: Dockerfile.cookies.generator, Dockerfile.cookies.updater.docker, Dockerfile.cookies.updater.kubernetes
  • Cleaned up: docker-compose.yml (removed all cookie-related services and volumes)
  • Updated CI/CD: Removed cookie Dockerfiles from GitHub Actions build matrix

Validator Improvements

Restart Detection

  • Changed from O(N*M) heuristic (scanning all counters for decreases) to O(N) definitive check using boot_time field
  • boot_time is set once at tee-worker startup, making it a reliable restart indicator
  • Added comment noting workers with boot_time=0 won't have restart detection

Platform Configuration

  • Fixed double-counting bug: removed twitter_errors from twitter-apify platform (was duplicating errors already tracked by main twitter platform)
  • Added new metrics: profiles, other for Twitter; auth_errors for TikTok; scraped_pages for Web
  • Added llm platform with emission_weight=0.0 for metrics visibility

Code Quality

  • Reuse self.platform_manager instead of creating new instance in _get_delta_node_data
  • Changed debug print() to logger.debug()
  • Fixed unit tests to use stats_json instead of legacy kwargs
  • Updated test_set_weights to match current method signature (no positional args)

Test Plan

  • Unit tests pass (pytest tests/test_weights_unit.py)
  • Validator starts and sets weights correctly
  • Restart detection works when miners restart (boot_time changes)
  • No cookie-related Docker builds in CI

Copilot AI review requested due to automatic review settings March 3, 2026 15:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes cookie generation/update automation components and updates validator telemetry handling to better support multi-platform restart detection and expanded platform metrics.

Changes:

  • Update _get_delta_node_data restart detection to look for decreases across all configured raw telemetry fields (not just a Twitter legacy counter).
  • Expand PlatformManager platform metric mappings (Twitter profiles/other, Web scraped_pages, TikTok auth_errors) and add an llm platform (tracked but not scored).
  • Simplify cookie tooling by removing the cookie grabber + docker updater paths, and adjust Kubernetes cookie updater defaults.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
validator/weights.py Restart/chunk detection now considers all raw metric fields; logging updated accordingly.
validator/platform_config.py Adds new metrics/mappings and introduces an llm platform with 0 emission weight.
scripts/update_cookies_kubernetes.sh Defaults cookie directory to /app/cookies and adds a directory-existence check + clearer message.
scripts/update_cookies_docker.sh Removes Docker-based cookie updater script.
scripts/cookie_grabber.py Removes cookie automation/grabber script.
docker-compose.yml Removes cookie generator/docker updater services; keeps a single cookies updater service with a host volume mount.
Dockerfile.cookies.updater.docker Removes Docker updater image definition.
Dockerfile.cookies.generator Removes cookie generator image definition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (4)

tests/test_weights_unit.py:69

  • WeightsManager.calculate_weights is async, but this test calls it synchronously and tries to unpack the coroutine result. Update the test to be async (or use asyncio.run) and await the call; also consider passing simulation=True (or mocking metagraph.nodes) since the non-simulation path looks up node IDs in the metagraph.
    uids, weights = weights_manager.calculate_weights(node_data)
    assert len(uids) == len(weights) == 2
    assert weights[0] < weights[1]  # Assuming node2 has more activity

scripts/update_cookies_kubernetes.sh:1

  • This script calls kubectl with --insecure-skip-tls-verify for cluster-info, pod listing, cp, and exec, which disables TLS certificate validation for all Kubernetes API calls. An attacker on the network path to the API server could impersonate the control plane, intercept or tamper with responses, and potentially gain access to cluster credentials or execute arbitrary actions. Use strict TLS verification with a properly configured kubeconfig/CA trust instead of --insecure-skip-tls-verify for these kubectl invocations.
    scripts/update_cookies_docker.sh:1
  • The SSH/SCP commands here use -o StrictHostKeyChecking=no, which disables host key verification for remote cookie update hosts. Without host key checking, an attacker who can spoof DNS or intercept traffic could impersonate the remote host and run arbitrary Docker/volume operations under your credentials. Require host key verification via known_hosts or per-host SSH config instead of globally disabling StrictHostKeyChecking.
    Dockerfile.cookies.updater.docker:1
  • The entrypoint writes /root/.ssh/config with StrictHostKeyChecking no, turning off host key validation for all SSH connections from this container. This allows a network attacker to silently present a fake host key, hijack the SSH session, and intercept or alter cookie update operations on remote Docker hosts. Prefer keeping StrictHostKeyChecking yes and manage trusted host keys via known_hosts or explicit Host entries instead of disabling checks globally.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grantdfoster grantdfoster merged commit 5376bab into main Mar 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants