8000 feat(supervisor/core): Implement l2 controller by itschaindev · Pull Request #1866 · op-rs/kona · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(supervisor/core): Implement l2 controller #1866

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

Merged
merged 14 commits into from
May 28, 2025
Merged

Conversation

itschaindev
Copy link
Collaborator

Closes #1680.

  • Broke down functions
  • Added API calls to ManagedNodeApi
  • Added call_rpc() to ManagedNode to for calling the API by passing the ManagedNodeApi function along with params.
  • Added basic unit tests

Copy link
codecov bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 61.33333% with 58 lines in your changes missing coverage. Please review.

Project coverage is 83.7%. Comparing base (5f7584f) to head (c205621).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/supervisor/core/src/syncnode/node.rs 61.3% 58 Missing ⚠️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emhane emhane added A-node Area: cl node (eq. Go op-node) handles single-chain consensus A-rpc Area: rpc W-supervisor Workstream: supervisor labels May 27, 2025
Copy link
Member
@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logs need fixing

debug!(target: "managed_node", "Executing RPC call");

let result = f(client).await.map_err(|err| {
error!(target: "managed_node", "RPC call failed: {:?}", err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error!(target: "managed_node", "RPC call failed: {:?}", err);
error!(target: "managed_node", ?err, "RPC call failed");

?err prints to stdout as "err=<debug-formatted-error>". %err prints to stdout as "err=<display-formatted-error>". usually we want the display formatting unless you have a specific reason to want to debug format it?

The % sigil operates similarly, but indicates that the value should be recorded using its fmt::Display implementation:

https://docs.rs/tracing/latest/tracing/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emhane I'm confused between your code suggestion and comment. So it should be ?err, i.e. Debug formatted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use display format, ie % operator.

since you originally used debug format, ie ? operator, i thought perhaps you had a particular reason for it. for example errors wrapping an enr::Enr are useless in display format because it just shows the base64 serialised enr, while we are mostly interested in reading the enr fields as human readable data for debugging, which we get with debug formatting for the enr::Enr type - but that particular type is an exception.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that be different from how they are used in all other parts of the code? E.g. in node, they have used ?err.

I don't mind changing it to %err, just confirming if that's fine to defer from the followed pattern.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use %err in majority of the cases and use?err in specific places where we need debug information.

@itschaindev itschaindev requested a review from emhane May 28, 2025 08:08
if ws_client_guard.is_none() {
let headers = self.create_auth_headers().map_err(|err| {
error!(target: "managed_node", %err, "Failed to create auth headers");
ClientError::Custom(format!("failed to create auth headers: {}", err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ClientError::Custom(format!("failed to create auth headers: {}", err))
ClientError::Custom(format!("failed to create auth headers: {ett}"))

nitpick, this syntax is preferred, pls check if there are other places in this pr diff where this can be fixed too

@itschaindev itschaindev added this pull request to the merge queue May 28, 2025
Merged via the queue into main with commit 9a707c0 May 28, 2025
21 of 23 checks passed
@itschaindev itschaindev deleted the jk/node-controller branch May 28, 2025 12:04
@github-project-automation github-project-automation bot moved this from In Review to Done in Project Tracking May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-node Area: cl node (eq. Go op-node) handles single-chain consensus A-rpc Area: rpc W-supervisor Workstream: supervisor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(supervisor/core): Build l2-controller
3 participants
0