Skip to content

refactor(node): replace no-op publisher sentinels with None defaults#797

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/noop-publishers
May 29, 2026
Merged

refactor(node): replace no-op publisher sentinels with None defaults#797
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/noop-publishers

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

Summary

The sync and validator services defaulted their publish callbacks to no-op async functions (_noop_publish_agg, _noop_block_publisher, _noop_attestation_publisher) used purely as sentinels. This replaces them with optional callables defaulting to None and guards each call site — a simpler, more honest signature with no behavior change.

Changes

  • sync/service.py: Delete _noop_publish_agg; publish_aggregated_attestation is now Callable[...] | None = None. The drain method clears its queue first (preserving the original always-clear behavior), then guards the publish call.
  • validator/service.py: Delete _noop_block_publisher and _noop_attestation_publisher; on_block and on_attestation are now ... | None = None, with is not None guards at both emit sites.
  • chain/service.py: Bind the publisher to a local and guard before awaiting in the tick loop.
  • tests/.../test_node.py: The two tests invoking the wired publishers directly now assert non-None first.

Verification

  • just check — all green (ruff, format, ty, codespell, mdformat, lock).
  • Affected test suites pass.

🤖 Generated with Claude Code

The sync and validator services defaulted their publish callbacks to
no-op async functions used purely as sentinels. Replace them with
optional callables defaulting to None and guard each call site.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit a588bf3 into leanEthereum:main May 29, 2026
13 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.

1 participant