Skip to content

realocate constants to their specific crates#1728

Merged
GitGab19 merged 13 commits into
stratum-mining:mainfrom
plebhash:2025-05-30-realocate-constants
Jun 3, 2025
Merged

realocate constants to their specific crates#1728
GitGab19 merged 13 commits into
stratum-mining:mainfrom
plebhash:2025-05-30-realocate-constants

Conversation

@plebhash

Copy link
Copy Markdown
Member

IMO the approach of #1642 was suboptimal

moving the contents from const_sv2 into stratum_common was a bit redundant, since we ended up still having all constants concentrated in one single place

constants should live in the specific crates where they have contextual meaning

@codecov

codecov Bot commented May 30, 2025

Copy link
Copy Markdown

Codecov Report

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

Project coverage is 23.40%. Comparing base (893035b) to head (6bedcd0).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
protocols/v2/sv2-ffi/src/lib.rs 0.00% 4 Missing ⚠️
roles/test-utils/mining-device/src/lib/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1728      +/-   ##
==========================================
- Coverage   23.45%   23.40%   -0.05%     
==========================================
  Files         146      146              
  Lines       10918    10940      +22     
==========================================
  Hits         2561     2561              
- Misses       8357     8379      +22     
Flag Coverage Δ
binary_codec_sv2-coverage 0.00% <0.00%> (ø)
binary_sv2-coverage 7.79% <0.00%> (ø)
bip32_derivation-coverage 0.00% <ø> (ø)
buffer_sv2-coverage 37.68% <ø> (ø)
codec_sv2-coverage 0.02% <0.00%> (ø)
common_messages_sv2-coverage 0.19% <0.00%> (ø)
error_handling-coverage 0.00% <ø> (ø)
framing_sv2-coverage 0.41% <0.00%> (ø)
jd_client-coverage 0.38% <ø> (ø)
jd_server-coverage 13.28% <ø> (ø)
job_declaration_sv2-coverage 0.00% <0.00%> (ø)
key-utils-coverage 3.61% <ø> (ø)
mining-coverage 3.89% <0.00%> (ø)
mining_device-coverage 0.00% <ø> (ø)
mining_proxy_sv2-coverage 1.17% <ø> (ø)
noise_sv2-coverage 6.60% <0.00%> (ø)
pool_sv2-coverage 6.02% <0.00%> (ø)
protocols 33.28% <0.00%> (-0.15%) ⬇️
roles 11.39% <0.00%> (ø)
roles_logic_sv2-coverage 21.32% <0.00%> (-0.69%) ⬇️
sv2_ffi-coverage 0.00% <0.00%> (ø)
template_distribution_sv2-coverage 0.00% <0.00%> (ø)
translator_sv2-coverage 8.28% <ø> (ø)
utils 36.39% <ø> (ø)
v1-coverage 3.66% <0.00%> (ø)

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.

@plebhash plebhash force-pushed the 2025-05-30-realocate-constants branch 3 times, most recently from 2b557e5 to 27eb03a Compare May 30, 2025 22:57
@Shourya742

Copy link
Copy Markdown
Member

IMO the approach of #1642 was suboptimal

moving the contents from const_sv2 into stratum_common was a bit redundant, since we ended up still having all constants concentrated in one single place

constants should live in the specific crates where they have contextual meaning

AFAIK, we moved all the constants to sv2-common because we were considering consolidating the imports directly from roles-logic, which in turn depends on stratum-common. However, I don't have much context on this, @GitGab19 might have more insight.

@plebhash

plebhash commented May 31, 2025

Copy link
Copy Markdown
Member Author

we were considering consolidating the imports directly from roles-logic

yes, I'm aware of that

this PR is still aligned with this strategy

after all, roles_logic_sv2 also depends on most crates where the constants were moved into

[dependencies]
stratum-common = { path = "../../../common", features=["bitcoin", "constants"], version = "^2.0.0"}
binary_sv2 = { path = "../../../protocols/v2/binary-sv2", version = "^3.0.0" }
common_messages_sv2 = { path = "../../../protocols/v2/subprotocols/common-messages", version = "^5.0.0" }
mining_sv2 = { path = "../../../protocols/v2/subprotocols/mining", version = "^4.0.0" }
template_distribution_sv2 = { path = "../../../protocols/v2/subprotocols/template-distribution", version = "^3.0.0" }
job_declaration_sv2 = { path = "../../../protocols/v2/subprotocols/job-declaration", version = "^4.0.0" }
framing_sv2 = { path = "../../../protocols/v2/framing-sv2", version = "^5.0.0" }

the only exceptions would be noise_sv2 and codec_sv2, which are imported into network_helpers_sv2

codec_sv2 = { path = "../../../protocols/v2/codec-sv2", version = "^2.0.0", features=["noise_sv2"], optional = true }

and as described in #1458, ideally the strategy of standardizing dependency exporting actually revolves around both roles_logic_sv2 and network_helpers_sv2.

Comment thread protocols/v2/sv2-ffi/Cargo.toml
Comment thread roles/roles-utils/network-helpers/Cargo.toml Outdated
@GitGab19

GitGab19 commented Jun 3, 2025

Copy link
Copy Markdown
Member

LGTM, I just left a couple of comments to be reviewed before merging this.

@plebhash plebhash force-pushed the 2025-05-30-realocate-constants branch 3 times, most recently from ee1ffe7 to b60f872 Compare June 3, 2025 12:59
@plebhash plebhash force-pushed the 2025-05-30-realocate-constants branch from b60f872 to 6bedcd0 Compare June 3, 2025 13:11
@GitGab19 GitGab19 merged commit 99cd6a1 into stratum-mining:main Jun 3, 2025
16 checks passed
@plebhash plebhash deleted the 2025-05-30-realocate-constants branch June 3, 2025 16:02
This was referenced Jun 17, 2025
plebhash added a commit to plebhash/stratum that referenced this pull request Jun 17, 2025
plebhash added a commit to plebhash/stratum that referenced this pull request Jun 17, 2025
GitGab19 added a commit to GitGab19/stratum that referenced this pull request Jul 9, 2025
GitGab19 added a commit to GitGab19/stratum that referenced this pull request Jul 9, 2025
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.

3 participants