Skip to content

Witness → Validator migration (Phase A, dual-support)#36

Merged
On1x merged 20 commits into
masterfrom
witness-to-validator-migration
May 19, 2026
Merged

Witness → Validator migration (Phase A, dual-support)#36
On1x merged 20 commits into
masterfrom
witness-to-validator-migration

Conversation

@chiliec
Copy link
Copy Markdown
Member

@chiliec chiliec commented May 19, 2026

Summary

Mirrors the JS/PHP libs' Phase A migration: send validator names on the wire, accept both old and new from callers (with DeprecationWarning), tolerate old nodes via runtime witness_api fallback. No breaking changes for existing callers.

  • Wire format: operations, API methods, chain-properties fields, and per-op kwargs use validator names exclusively
  • Caller compat: old names still work via _DeprecatedAlias.make() op-class subclasses, kwarg translation, and dispatcher inbound translation
  • Node compat: if the node returns NoSuchMethod for a validator_api call, the dispatcher falls back to witness_api; result is cached per Rpc instance via _uses_legacy_witness_api

Single source of truth: vizbase/validator_compat.py (OP_NAME_ALIASES, API_METHOD_ALIASES, CHAIN_PROPS_FIELD_ALIASES, OP_FIELD_ALIASES, translate_kwargs, pick).

Spec: docs/superpowers/specs/2026-05-19-witness-to-validator-migration-design.md
Plan: docs/superpowers/plans/2026-05-19-witness-to-validator-migration.md

Test plan

  • 53 dedicated unit tests in tests/test_validator_compat.py (alias dicts, op classes, dispatcher fallback, shim re-exports, parametrized coverage-drift tests across all alias dicts)
  • Full unit suite: 90 passed, 1 skipped, 0 failures (/Users/babin/.venv/bin/poetry run pytest)
  • All pre-commit hooks (ruff, ruff-format, mypy) pass cleanly
  • Integration tests on rebuilt testnet image — blocked by pending vizblockchain/vizd:latest rebuild with validator-renamed genesis (gates test_serialization::test_versioned_chain_properties_update, test_blockchain::test_stream_virtual_ops*)
  • CI green on Python 3.10–3.14 matrix
  • Verify from viz.witness import Witness still works downstream (emits one-time DeprecationWarning)

Notes

  • 16 incremental TDD commits, one task per commit. 61ccf15 is a defect fix caught during review (plan's _canonical_filter would have raised TypeError on filter_by=[...] — extended to handle lists).
  • Phase B (removing the deprecated surface) is intentionally deferred ≥6 months after the v1.3.0 release that includes this PR.

chiliec added 20 commits May 19, 2026 19:08
Phase A dual-support strategy mirroring the JS/PHP libs: send new
validator names on the wire, accept both old and new from callers
with DeprecationWarning, tolerate responses from older nodes.

Central compat module (vizbase/validator_compat.py) holds all old->new
mappings so Phase C cleanup is a one-file deletion.
Run on push only for master (post-merge validation) and on
pull_request for all PRs. Add concurrency group so new pushes
to a PR branch cancel any in-flight run, eliminating the
testnet-Docker port collisions caused by the previous
push+pull_request double-fire.
@chiliec chiliec requested review from On1x, asuleymanov and bitphage May 19, 2026 13:30
@On1x On1x merged commit 6d08297 into master May 19, 2026
7 checks passed
@On1x On1x deleted the witness-to-validator-migration branch May 19, 2026 15:16
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