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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(katana-node): distinguish between launched node handle #2504
refactor(katana-node): distinguish between launched node handle #2504
Changes from 3 commits
6220494
e654369
9f48bbf
0559702
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Check warning on line 231 in bin/katana/src/cli/node.rs
Codecov / codecov/patch
bin/katana/src/cli/node.rs#L229-L231
Check warning on line 237 in bin/katana/src/cli/node.rs
Codecov / codecov/patch
bin/katana/src/cli/node.rs#L236-L237
Check warning on line 241 in bin/katana/src/cli/node.rs
Codecov / codecov/patch
bin/katana/src/cli/node.rs#L241
Check warning on line 253 in bin/katana/src/cli/node.rs
Codecov / codecov/patch
bin/katana/src/cli/node.rs#L253
Check warning on line 351 in bin/katana/src/cli/node.rs
Codecov / codecov/patch
bin/katana/src/cli/node.rs#L351
Check warning on line 91 in crates/dojo-test-utils/src/sequencer.rs
Codecov / codecov/patch
crates/dojo-test-utils/src/sequencer.rs#L91
Check warning on line 25 in crates/katana/node/src/exit.rs
Codecov / codecov/patch
crates/katana/node/src/exit.rs#L18-L25
Check warning on line 34 in crates/katana/node/src/exit.rs
Codecov / codecov/patch
crates/katana/node/src/exit.rs#L31-L34
Check warning on line 40 in crates/katana/node/src/exit.rs
Codecov / codecov/patch
crates/katana/node/src/exit.rs#L38-L40
Check warning on line 74 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L69-L74
Check warning on line 79 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L77-L79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohayo, sensei! Great implementation of node shutdown methods!
The
stop
andstopped
methods provide a clean way to manage the node's lifecycle. However, there's room for improvement:The TODO comment on line 71 suggests waiting for the RPC server to stop instead of just stopping it. This would ensure a more graceful shutdown. Consider implementing this enhancement to improve the robustness of the shutdown process.
Would you like assistance in implementing the logic to wait for the RPC server to fully stop, sensei?
Check warning on line 108 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L107-L108
Check warning on line 112 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L110-L112
Check warning on line 120 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L114-L120
Check warning on line 122 in crates/katana/node/src/lib.rs
Codecov / codecov/patch
crates/katana/node/src/lib.rs#L122
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ohayo, sensei! The
launch
method looks promising!The
Node::launch
method does a great job of initializing all the necessary components. However, we can enhance it further with improved error handling and logging:Consider wrapping each major step (metrics initialization, pipeline building, RPC spawning) in separate functions. This will improve readability and make error handling more granular.
Add more detailed logging throughout the launch process. This will make debugging easier in case of issues.
Use
tracing::instrument
to automatically log entry and exit of thelaunch
method along with its parameters.Here's a sketch of how this could look:
This structure will make the code more modular and easier to maintain, sensei!