Skip to content
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

routing_logic and selectors refactoring #1573

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

GitGab19
Copy link
Collaborator

This PR is built on top of #1567.

It mainly removes routing_logic and selectors modules from roles-logic-sv2, given that the only real usage was done by the mining-proxy.

They are now inside mining-proxy, so that we can simplify a lot both handlers, common-properties, and other roles.

Closes #1446 #1447

@GitGab19 GitGab19 linked an issue Mar 17, 2025 that may be closed by this pull request
@GitGab19 GitGab19 force-pushed the routing-logic-and-selectors-refactoring branch from fdc78fe to 0483895 Compare March 18, 2025 09:42
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 136 lines in your changes missing coverage. Please review.

Project coverage is 19.62%. Comparing base (e44e16f) to head (3e62e09).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rotocols/v2/roles-logic-sv2/src/handlers/mining.rs 0.00% 47 Missing ⚠️
...v2/roles-logic-sv2/src/handlers/job_declaration.rs 0.00% 19 Missing ⚠️
roles/mining-proxy/src/lib/routing_logic.rs 0.00% 19 Missing ⚠️
...rotocols/v2/roles-logic-sv2/src/handlers/common.rs 0.00% 16 Missing ⚠️
roles/jd-client/src/lib/downstream.rs 0.00% 8 Missing ⚠️
roles/mining-proxy/src/lib/upstream_mining.rs 0.00% 8 Missing ⚠️
protocols/v2/roles-logic-sv2/src/parsers.rs 0.00% 5 Missing ⚠️
roles/jd-client/src/lib/upstream_sv2/upstream.rs 0.00% 3 Missing ⚠️
roles/translator/src/lib/upstream_sv2/upstream.rs 0.00% 3 Missing ⚠️
...s/v2/subprotocols/common-messages/src/reconnect.rs 0.00% 2 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1573      +/-   ##
==========================================
+ Coverage   19.31%   19.62%   +0.30%     
==========================================
  Files         131      132       +1     
  Lines        9298     9163     -135     
==========================================
+ Hits         1796     1798       +2     
+ Misses       7502     7365     -137     
Flag Coverage Δ
binary_codec_sv2-coverage 0.00% <0.00%> (ø)
binary_sv2-coverage 9.42% <0.00%> (+0.82%) ⬆️
bip32_derivation-coverage 0.00% <ø> (ø)
buffer_sv2-coverage 37.68% <ø> (ø)
codec_sv2-coverage 0.03% <0.00%> (+<0.01%) ⬆️
common_messages_sv2-coverage 0.23% <0.00%> (+0.02%) ⬆️
const_sv2-coverage 0.00% <0.00%> (ø)
error_handling-coverage 0.00% <ø> (ø)
framing_sv2-coverage 0.50% <0.00%> (+0.04%) ⬆️
jd_client-coverage 0.40% <0.00%> (-0.05%) ⬇️
jd_server-coverage 12.46% <0.00%> (-2.04%) ⬇️
job_declaration_sv2-coverage 0.00% <0.00%> (ø)
key-utils-coverage 3.61% <ø> (ø)
mining-coverage 4.22% <0.00%> (+0.36%) ⬆️
mining_device-coverage 0.00% <0.00%> (ø)
mining_proxy_sv2-coverage 1.18% <0.00%> (+0.20%) ⬆️
noise_sv2-coverage 8.02% <0.00%> (+0.71%) ⬆️
pool_sv2-coverage 2.28% <0.00%> (-0.40%) ⬇️
protocols 28.96% <0.00%> (+1.81%) ⬆️
roles 6.93% <0.00%> (-0.19%) ⬇️
roles_logic_sv2-coverage 14.56% <0.00%> (+0.99%) ⬆️
sv2_ffi-coverage 0.00% <0.00%> (ø)
template_distribution_sv2-coverage 0.00% <0.00%> (ø)
translator_sv2-coverage 9.16% <0.00%> (-1.02%) ⬇️
utils 36.39% <ø> (ø)
v1-coverage 4.08% <0.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

GitGab19 added 15 commits March 19, 2025 14:22
…ctors dependency

- Moved `selectors` and `routing_logic` modules to `mining-proxy`, isolating proxy-specific logic.
- Removed `selectors` dependency from `common_properties.rs`, `handlers/mining.rs`, `routing_logic.rs`, and related modules.
- Updated `IsUpstream` and `IsMiningUpstream` to remove `DownstreamSelector` and simplify their implementation.
- Removed unused imports related to `selectors` and `routing_logic` across multiple modules.
- Updated various `impl` blocks to match the new trait definitions without selectors.
- Fixed type inconsistencies in `on_open_standard_channel_success` and `on_open_standard_channel`.
- Ensured `UpstreamMiningNode` implements `HasDownstreamSelector` for proper selector access.
- Fixed `DownstreamMiningNode` compatibility by enforcing `Down = DownstreamMiningNode` where needed.
- Adjusted `config-examples/proxy-config-example.toml` to update upstream port.

This refactor improves modularity, makes mining-proxy self-contained, and eliminates unnecessary dependencies.
@GitGab19 GitGab19 force-pushed the routing-logic-and-selectors-refactoring branch from 0483895 to 3e62e09 Compare March 19, 2025 13:22
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.

roles_logic_sv2: refactor routing_logic module roles_logic_sv2: refactor selectors module
1 participant