Skip to content

V1 incentive overhaul: crown-time per direction#43

Merged
LandynDev merged 10 commits into
testfrom
feature/incentive-v1
Apr 14, 2026
Merged

V1 incentive overhaul: crown-time per direction#43
LandynDev merged 10 commits into
testfrom
feature/incentive-v1

Conversation

@LandynDev
Copy link
Copy Markdown
Collaborator

@LandynDev LandynDev commented Apr 14, 2026

Summary

Replace the fee/speed/success reward model with a crown-time model per the locked plans/v1-incentive-overhaul.md spec.

  • Each direction (tao→btc, btc→tao) has a fixed emission pool (4% each)
  • At every block in a 12h window, the miner with the best rate holds the "crown"
  • Reward = pool × (miner_crown_blocks / total_crown_blocks) × success_rate^3
  • Remainder recycles to RECYCLE_UID
  • Fees, speed tracking, and volume weighting are removed
  • Reservation state is not used for eligibility (closes a rate-stealing griefing attack)

No miner UX break (alw miner post unchanged), no dashboard pipeline change, no smart-contract change.

What changed

  • allways/validator/rate_state.py — new SQLite store for rate_events, collateral_events, swap_outcomes. Thread-safe, pattern cloned from pending_confirms.py. Prunes to 2 × SCORING_WINDOW_BLOCKS; swap_outcomes is all-time.
  • allways/validator/forward.py — new _poll_commitments, _poll_collaterals, _refresh_min_collateral; new crown-time calculate_miner_rewards + _replay_crown_time + _crown_holders + _success_rate; removed _chain_weighted_speed and legacy reward math.
  • allways/validator/swap_tracker.py — writes swap_outcomes on every terminal transition (resolve + both _poll_inner paths). Dropped window, prune_window, window_blocks.
  • allways/classes.py — dropped MinerScoringStats (unused after crown-time replay).
  • allways/constants.py — added DIRECTION_POOLS, SUCCESS_EXPONENT=3, RATE_UPDATE_MIN_INTERVAL_BLOCKS=75, COMMITMENT_POLL_INTERVAL_BLOCKS=15, COLLATERAL_POLL_INTERVAL_BLOCKS=15, MIN_COLLATERAL_REFRESH_INTERVAL_BLOCKS=1200, EVENT_RETENTION_BLOCKS. Removed DAILY_EMISSION_ALPHA and SCORING_SUCCESS_EXPONENT.
  • Deleted allways/validator/recycle.py, allways/validator/utils/fees.py (scoring-path only, now orphaned).
  • neurons/validator.py — instantiates RateStateStore, caches min_collateral (falls back to MIN_COLLATERAL_TAO on contract read failure), threads store into SwapTracker.
  • README.md / .env.example — lite-node ops guide + SUBTENSOR_NETWORK hint for validators.

Data pipeline

local subtensor ──► _poll_commitments ──► rate_events
                     (every 15 blk)         │
                                            ▼
contract ─► _poll_collaterals ──────► collateral_events
            (every 15 blk)                  │
                                            ▼
SwapTracker.resolve ──────────────► swap_outcomes (all-time)
                                            │
                                            ▼
                                 calculate_miner_rewards
                                 (replay window, attribute
                                  crown blocks per direction)

Commit sequence (reviewable per layer)

  1. 23610b4 RateStateStore SQLite foundation (additive, zero wiring)
  2. 4238ee9 _poll_commitments wiring
  3. 91fa353 _poll_collaterals wiring
  4. 68e609e swap_outcomes persistence in SwapTracker
  5. 998c16c crown-time replay replaces calculate_miner_rewards
  6. e038821 remove legacy window / recycle.py / fees.py / MinerScoringStats
  7. c1d8fd2 constants cleanup + lite node docs
  8. fbe25fb fallback MIN_COLLATERAL_TAO when initial contract read fails
  9. 8f78cfd set SQLite busy_timeout before WAL to fix dev-env concurrent init race
  10. a90892a wire prune_events_older_than, fix _refresh_min_collateral hot-retry, advance rate cache on throttled rejects (self-review sweep)

Test plan

  • 205 unit tests pass (ruff format --check && ruff check && pytest tests/)
  • Focused E2E (suite 01 setup + 02 happy path + 18 V1 pipeline) — 36/36 pass on local dev env
  • Validator's rate_state.db populated with rate + collateral + outcome rows end-to-end
  • Validator produces differentiated weights on-chain (observed [65535, 630, 3875] in dev)
  • Full E2E regression 01–17 still to run against this branch head
  • Companion alw-utils PR entrius/alw-utils#31 — kept draft until this PR is green

Out of scope

  • allways-db, das-allways, allways-ui untouched
  • Smart contract unchanged
  • Reference miner untouched
  • Synapses / axon handlers untouched

Source plan lives at project-allways/plans/v1-incentive-overhaul.md.

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.

1 participant