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

Add JobDeclaratorClient struct #993

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

jbesraa
Copy link
Contributor

@jbesraa jbesraa commented Jun 21, 2024

resolves #992

With the goal to write more tests, this commit moves JDC initialisation logic from main.rs to lib.rs so its easier to test and also separate the actual lib code from the binary.

Copy link
Contributor

github-actions bot commented Jun 21, 2024

🐰Bencher

ReportWed, July 17, 2024 at 18:57:55 UTC
ProjectStratum v2 (SRI)
Branch993/merge
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client-sv1-authorize-serialize/client-sv1-authorize-serializeLatency (nanoseconds (ns))🚨 (view plot | view alert)266.80 (+7.14%)259.49 (102.82%)
client-sv1-get-authorize/client-sv1-get-authorizeLatency (nanoseconds (ns))🚨 (view plot | view alert)191.91 (+21.25%)171.22 (112.08%)

Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,409.60 (-6.96%)7,362.89 (87.05%)
client-submit-serialize-deserialize✅ (view plot)7,298.40 (-6.46%)8,348.45 (87.42%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)7,978.30 (-4.74%)8,856.58 (90.08%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)900.49 (+0.10%)928.33 (97.00%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)713.54 (+2.09%)722.45 (98.77%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize🚨 (view plot | view alert)266.80 (+7.14%)259.49 (102.82%)
client-sv1-get-authorize/client-sv1-get-authorize🚨 (view plot | view alert)191.91 (+21.25%)171.22 (112.08%)
client-sv1-get-submit✅ (view plot)6,285.20 (-5.61%)7,138.85 (88.04%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)290.32 (+3.96%)292.15 (99.37%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)771.71 (+2.95%)780.84 (98.83%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)626.52 (+1.71%)643.45 (97.37%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)203.76 (-1.22%)219.14 (92.98%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 21, 2024

🐰Bencher

ReportWed, July 17, 2024 at 18:57:52 UTC
ProjectStratum v2 (SRI)
Branch2024-06-21-jdc-refactor
Testbedsv2

🚨 1 ALERT: Threshold Boundary Limit exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_setup_connection_serialize_deserializeLatency (nanoseconds (ns))🚨 (view plot | view alert)1,179.10 (+20.65%)1,067.57 (110.45%)

Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.51 (-0.14%)45.24 (98.39%)
client_sv2_handle_message_mining✅ (view plot)74.67 (+2.21%)80.70 (92.52%)
client_sv2_mining_message_submit_standard✅ (view plot)14.67 (+0.12%)14.70 (99.84%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)249.03 (-5.67%)283.97 (87.70%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)586.35 (-1.25%)626.47 (93.60%)
client_sv2_open_channel✅ (view plot)169.26 (+1.95%)173.32 (97.66%)
client_sv2_open_channel_serialize✅ (view plot)293.39 (+3.79%)294.24 (99.71%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)374.65 (-0.99%)422.36 (88.70%)
client_sv2_setup_connection✅ (view plot)159.97 (-2.44%)174.47 (91.69%)
client_sv2_setup_connection_serialize✅ (view plot)444.03 (-5.90%)508.03 (87.40%)
client_sv2_setup_connection_serialize_deserialize🚨 (view plot | view alert)1,179.10 (+20.65%)1,067.57 (110.45%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 21, 2024

🐰Bencher

ReportWed, July 17, 2024 at 18:57:51 UTC
ProjectStratum v2 (SRI)
Branch2024-06-21-jdc-refactor
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
serialize_deserialize_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)299.00 (+1.32%)298.58 (100.14%)
serialize_deserialize_handle_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)369.00 (+1.32%)368.22 (100.21%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Upper Boundary
accesses | (%)
get_authorize✅ (view plot)8,538.00 (+1.14%)8,724.57 (97.86%)✅ (view plot)3,746.00 (+0.14%)3,851.96 (97.25%)✅ (view plot)5,248.00 (+0.05%)5,396.69 (97.24%)✅ (view plot)7.00 (-11.18%)10.30 (67.96%)✅ (view plot)93.00 (+3.10%)94.27 (98.65%)
get_submit✅ (view plot)95,509.00 (-0.04%)96,119.05 (99.37%)✅ (view plot)59,439.00 (-0.05%)59,766.81 (99.45%)✅ (view plot)85,359.00 (-0.05%)85,819.98 (99.46%)✅ (view plot)49.00 (-10.41%)62.59 (78.29%)✅ (view plot)283.00 (+0.31%)287.55 (98.42%)
get_subscribe✅ (view plot)7,991.00 (+0.18%)8,260.65 (96.74%)✅ (view plot)2,841.00 (+0.37%)2,937.05 (96.73%)✅ (view plot)3,971.00 (+0.41%)4,096.21 (96.94%)✅ (view plot)13.00 (-18.58%)19.85 (65.48%)✅ (view plot)113.00 (+0.33%)116.79 (96.75%)
serialize_authorize✅ (view plot)12,291.00 (+0.66%)12,500.13 (98.33%)✅ (view plot)5,317.00 (+0.10%)5,422.96 (98.05%)✅ (view plot)7,411.00 (+0.04%)7,560.03 (98.03%)✅ (view plot)10.00 (-6.94%)13.27 (75.36%)✅ (view plot)138.00 (+1.70%)140.32 (98.34%)
serialize_deserialize_authorize✅ (view plot)24,588.00 (+0.45%)24,713.94 (99.49%)✅ (view plot)9,898.00 (-0.02%)10,021.97 (98.76%)✅ (view plot)13,958.00 (-0.06%)14,144.58 (98.68%)✅ (view plot)33.00 (-9.19%)41.55 (79.42%)🚨 (view plot | view alert)299.00 (+1.32%)298.58 (100.14%)
serialize_deserialize_handle_authorize✅ (view plot)30,327.00 (+0.56%)30,368.12 (99.86%)✅ (view plot)12,101.00 (+0.04%)12,206.96 (99.13%)✅ (view plot)17,117.00 (-0.00%)17,274.68 (99.09%)✅ (view plot)59.00 (+0.32%)64.53 (91.43%)🚨 (view plot | view alert)369.00 (+1.32%)368.22 (100.21%)
serialize_deserialize_handle_submit✅ (view plot)126,372.00 (-0.03%)127,008.93 (99.50%)✅ (view plot)73,224.00 (-0.03%)73,606.64 (99.48%)✅ (view plot)104,947.00 (-0.04%)105,492.53 (99.48%)✅ (view plot)120.00 (-0.39%)130.89 (91.68%)✅ (view plot)595.00 (+0.02%)599.09 (99.32%)
serialize_deserialize_handle_subscribe✅ (view plot)27,491.00 (+0.13%)27,599.38 (99.61%)✅ (view plot)9,643.00 (+0.11%)9,739.05 (99.01%)✅ (view plot)13,641.00 (+0.12%)13,771.99 (99.05%)✅ (view plot)61.00 (-6.95%)73.63 (82.85%)✅ (view plot)387.00 (+0.30%)388.58 (99.59%)
serialize_deserialize_submit✅ (view plot)114,999.00 (-0.07%)115,630.58 (99.45%)✅ (view plot)68,001.00 (-0.08%)68,389.11 (99.43%)✅ (view plot)97,559.00 (-0.09%)98,130.66 (99.42%)✅ (view plot)65.00 (-5.98%)75.26 (86.37%)✅ (view plot)489.00 (+0.17%)492.32 (99.33%)
serialize_deserialize_subscribe✅ (view plot)22,922.00 (+0.20%)23,106.21 (99.20%)✅ (view plot)8,195.00 (+0.10%)8,294.54 (98.80%)✅ (view plot)11,542.00 (+0.10%)11,678.80 (98.83%)✅ (view plot)36.00 (-8.09%)44.03 (81.75%)✅ (view plot)320.00 (+0.44%)321.52 (99.53%)
serialize_submit✅ (view plot)99,826.00 (-0.06%)100,447.03 (99.38%)✅ (view plot)61,483.00 (-0.05%)61,816.01 (99.46%)✅ (view plot)88,206.00 (-0.05%)88,673.29 (99.47%)✅ (view plot)49.00 (-11.32%)62.53 (78.36%)✅ (view plot)325.00 (+0.10%)329.03 (98.77%)
serialize_subscribe✅ (view plot)11,328.00 (+0.02%)11,596.33 (97.69%)✅ (view plot)4,188.00 (+0.25%)4,284.05 (97.76%)✅ (view plot)5,828.00 (+0.26%)5,955.27 (97.86%)✅ (view plot)15.00 (-7.81%)18.89 (79.41%)✅ (view plot)155.00 (-0.11%)159.58 (97.13%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

github-actions bot commented Jun 21, 2024

🐰Bencher

ReportWed, July 17, 2024 at 18:57:51 UTC
ProjectStratum v2 (SRI)
Branch2024-06-21-jdc-refactor
Testbedsv2

🚨 8 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_mining_message_submit_standardL2 Accesses (accesses)🚨 (view plot | view alert)26.00 (+42.67%)25.26 (102.93%)
client_sv2_mining_message_submit_standard_serializeL2 Accesses (accesses)🚨 (view plot | view alert)55.00 (+14.71%)54.50 (100.93%)
client_sv2_mining_message_submit_standard_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)10,585.00 (+0.37%)10,578.26 (100.06%)
client_sv2_mining_message_submit_standard_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)15,399.00 (+0.35%)15,389.47 (100.06%)
client_sv2_open_channel_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)8,027.00 (+0.49%)8,020.59 (100.08%)
client_sv2_open_channel_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)11,672.00 (+0.45%)11,663.44 (100.07%)
client_sv2_setup_connection_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)14,855.00 (+0.27%)14,848.24 (100.05%)
client_sv2_setup_connection_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)21,811.00 (+0.25%)21,801.22 (100.04%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Upper Boundary
accesses | (%)
client_sv2_handle_message_common✅ (view plot)2,111.00 (+2.83%)2,131.66 (99.03%)✅ (view plot)473.00 (+0.45%)486.03 (97.32%)✅ (view plot)731.00 (-0.15%)754.34 (96.91%)✅ (view plot)10.00 (+38.76%)11.28 (88.67%)✅ (view plot)38.00 (+3.52%)38.62 (98.40%)
client_sv2_handle_message_mining✅ (view plot)8,219.00 (+0.25%)8,333.53 (98.63%)✅ (view plot)2,137.00 (+0.43%)2,170.73 (98.45%)✅ (view plot)3,159.00 (+0.43%)3,214.91 (98.26%)✅ (view plot)39.00 (+1.12%)43.46 (89.74%)✅ (view plot)139.00 (+0.10%)141.87 (97.98%)
client_sv2_mining_message_submit_standard✅ (view plot)6,316.00 (+0.62%)6,387.04 (98.89%)✅ (view plot)1,750.00 (+0.03%)1,762.72 (99.28%)✅ (view plot)2,546.00 (-0.28%)2,574.94 (98.88%)🚨 (view plot | view alert)26.00 (+42.67%)25.26 (102.93%)✅ (view plot)104.00 (+0.20%)106.78 (97.39%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,657.00 (-0.72%)15,025.32 (97.55%)✅ (view plot)4,694.00 (+0.01%)4,706.72 (99.73%)✅ (view plot)6,752.00 (-0.03%)6,774.39 (99.67%)🚨 (view plot | view alert)55.00 (+14.71%)54.50 (100.93%)✅ (view plot)218.00 (-1.80%)229.83 (94.85%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,469.00 (-0.02%)27,829.16 (98.71%)🚨 (view plot | view alert)10,585.00 (+0.37%)10,578.26 (100.06%)🚨 (view plot | view alert)15,399.00 (+0.35%)15,389.47 (100.06%)✅ (view plot)90.00 (+6.84%)90.74 (99.18%)✅ (view plot)332.00 (-0.76%)344.84 (96.28%)
client_sv2_open_channel✅ (view plot)4,451.00 (-0.80%)4,607.24 (96.61%)✅ (view plot)1,461.00 (+0.05%)1,473.99 (99.12%)✅ (view plot)2,156.00 (+0.14%)2,172.65 (99.23%)✅ (view plot)11.00 (-7.54%)15.08 (72.93%)✅ (view plot)64.00 (-1.51%)68.09 (93.99%)
client_sv2_open_channel_serialize✅ (view plot)14,040.00 (-1.13%)14,462.88 (97.08%)✅ (view plot)5,064.00 (+0.01%)5,076.99 (99.74%)✅ (view plot)7,320.00 (+0.03%)7,338.79 (99.74%)✅ (view plot)42.00 (+11.49%)43.02 (97.64%)✅ (view plot)186.00 (-2.75%)199.07 (93.43%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,557.00 (-0.33%)23,006.57 (98.05%)🚨 (view plot | view alert)8,027.00 (+0.49%)8,020.59 (100.08%)🚨 (view plot | view alert)11,672.00 (+0.45%)11,663.44 (100.07%)✅ (view plot)84.00 (+13.17%)84.59 (99.30%)✅ (view plot)299.00 (-1.66%)314.71 (95.01%)
client_sv2_setup_connection✅ (view plot)4,693.00 (-0.06%)4,762.73 (98.54%)✅ (view plot)1,502.00 (+0.05%)1,514.99 (99.14%)✅ (view plot)2,273.00 (-0.16%)2,298.70 (98.88%)✅ (view plot)15.00 (+56.47%)15.13 (99.12%)✅ (view plot)67.00 (-1.12%)69.68 (96.15%)
client_sv2_setup_connection_serialize✅ (view plot)15,976.00 (-1.62%)16,523.45 (96.69%)✅ (view plot)5,963.00 (+0.01%)5,975.99 (99.78%)✅ (view plot)8,661.00 (+0.06%)8,677.66 (99.81%)✅ (view plot)49.00 (+8.89%)49.91 (98.18%)✅ (view plot)202.00 (-3.91%)218.69 (92.37%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,416.00 (-0.30%)35,742.85 (99.09%)🚨 (view plot | view alert)14,855.00 (+0.27%)14,848.24 (100.05%)🚨 (view plot | view alert)21,811.00 (+0.25%)21,801.22 (100.04%)✅ (view plot)110.00 (+9.43%)114.51 (96.06%)✅ (view plot)373.00 (-1.58%)385.34 (96.80%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link
Contributor

@Shourya742 Shourya742 left a comment

Choose a reason for hiding this comment

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

ACK 1bdf132

@jbesraa
Copy link
Contributor Author

jbesraa commented Jun 23, 2024

@Shourya742 @plebhash
Fixed up documentation(taken from https://stratumprotocol.org/docs/) for JobDeclaratorClient

diff --git a/roles/jd-client/src/lib/mod.rs b/roles/jd-client/src/lib/mod.rs
index 3ae1d1c1..1979eecb 100644
--- a/roles/jd-client/src/lib/mod.rs
+++ b/roles/jd-client/src/lib/mod.rs
@@ -47,7 +47,15 @@ use tracing::{error, info};
 ///    between all the contexts is not necessary.
 pub static IS_NEW_TEMPLATE_HANDLED: AtomicBool = AtomicBool::new(true);

+/// Job Declarator Client (or JDC) is the role which is Miner-side, in charge of creating new
+/// mining jobs from the templates received by the Template Provider to which it is connected. It
+/// declares custom jobs to the JDS, in order to start working on them.
+/// JDC is also responsible for putting in action the Pool-fallback mechanism, automatically
+/// switching to backup Pools in case of declared custom jobs refused by JDS (which is Pool side).
+/// As a solution of last-resort, it is able to switch to Solo Mining until new safe Pools appear
+/// in the market.
 pub struct JobDeclaratorClient {
+    /// Configuration of the proxy server [`JobDeclaratorClient`] is connected to.
     config: ProxyConfig,
 }

@plebhash
Copy link
Collaborator

@jbesraa it looks like merging #987 introduced some conflics here

@jbesraa
Copy link
Contributor Author

jbesraa commented Jun 26, 2024

@plebhash resolved conflict

@plebhash plebhash force-pushed the 2024-06-21-jdc-refactor branch 2 times, most recently from f90b0ee to e50e9f0 Compare June 27, 2024 21:27
@jbesraa jbesraa force-pushed the 2024-06-21-jdc-refactor branch 2 times, most recently from f0787a1 to 116ed68 Compare July 17, 2024 12:49
@plebhash
Copy link
Collaborator

rebased for merging

With the goal to write more tests, this commit moves JDC initialisation
logic from `main.rs` to `lib.rs` so its easier to test and also separate
the actual `lib` code from the binary.
@jbesraa
Copy link
Contributor Author

jbesraa commented Jul 17, 2024

@Fi3 we need to make dev a default branch otherwise we are gonna keep having commits like the one in this PR. @plebhash need to rebase and co-commit even tho there are no conflicts.

@plebhash plebhash merged commit 5d569bb into stratum-mining:dev Jul 17, 2024
31 checks passed
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