Repository navigation
fix(python): return the Beacon API event data as JSON text - #2515
Merged
Merged
Conversation
The pool and publish endpoints and the gossip event export return the data of each event as the JSON text that the native call gives, as the fork choice event exports already do. The consensus package module no longer imports json, so the Python boundary check passes again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tcoratger
force-pushed
the
fix-boundary-events
branch
from
November 14, 2026 01:12
2022deb to
16776f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Beacon API pool and publish endpoints, and the gossip event export, now return the data of each event as its JSON text instead of a parsed value.
This makes the
soundnessCI job pass again, since the consensus package module no longer importsjson.The problem
The Python boundary check,
scripts/check_python_boundary.py, forbidsjsonin a package module: a wrapper passes typed values to the native call and back.api_postandapi_gossip_eventparsed the event data withjson.loads, so the check failed on master.The idea
The native calls already return each event as a pair (topic name, JSON data text).
That text is the
datafield of the Beacon API event stream, and the fork choice event exportsapi_chain_eventsandapi_fast_confirmation_eventreturn the same pair.So the two wrappers now return the native pair unchanged, and the tests parse the text themselves.
Example
A valid capella block published to
blocksgives the events("block_gossip", '{"slot":"…","block":"0x…"}')and("block", '{…,"execution_optimistic":false}').Before, the second element was a
dict; now it is that text, andjson.loadsgives the samedictas before.For reviewers
test_beacon_api_events.py:parsedparses the events of each answer, andgossip_eventparses the event of one object.The pool and publish tests import
parsed; tests that compare only topics are unchanged.Checks
scripts/check_python_boundary.py: passes.python -m unittest scripts/test_check_python_boundary.py: OK.ruff check --no-fix,ruff format --check,ty check: pass.scripts/check_python_comments.py --all,scripts/check_docstrings.py: pass.pytestontest_beacon_api_publish.py,test_beacon_api_events.pyandtest_beacon_api_pool.py, with the extension built byuv sync: 490 passed.🤖 Generated with Claude Code