visualize forkchoice tree#196
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a configurable tree visualization feature to the fork choice logging system to help visualize the blockchain's fork structure. The visualization displays nodes with their block roots and slots, showing parent-child relationships using ASCII tree characters.
- Adds a new
tree_visualizer.zigmodule with functions to build ASCII tree representations of the fork choice tree - Updates the
printSlotfunction to include an optional tree depth parameter and display the fork choice tree visualization - Integrates the tree visualization into the existing chain status logging output
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| pkgs/node/src/tree_visualizer.zig | New module implementing tree visualization logic with depth limiting and ASCII tree formatting |
| pkgs/node/src/chain.zig | Updates printSlot function signature and integrates tree visualization into logging output |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
looks cool! some changes to make it look small and easy for eyes:
|
|
@ScottyPoi can you resolve the conflicts |
7b650c0 to
a8906ec
Compare
|
@ScottyPoi can we truncate in opposite direction because most of the time relevance is to see the leaf forking, and if there are too many leaves include 3 by heaviest weight, and include 3 by most recent, so total 6 but keep this 3 number as a param also relevant to know is justified is a parent in which of these branches |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
a8906ec to
7451031
Compare
|
closing this in favor of #426 |
adds a visualization for the fork choice tree to the printSlot logging function as described in issue: #191.
The visualization is configurable with tree_depth limit. A tree_depth limit of
nullequals no depth limit.A visualization with tree_depth = 2 should look something like: