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

MG understands SubmitSolution as a valid JD message #1003

Merged

Conversation

plebhash
Copy link
Collaborator

@plebhash plebhash commented Jun 24, 2024

close #1002

Copy link
Contributor

github-actions bot commented Jun 24, 2024

🐰Bencher

ReportMon, July 1, 2024 at 15:02:11 UTC
ProjectStratum v2 (SRI)
Branch1002-fix-mg-submit-solution-jd
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.48 (-0.22%)45.25 (98.31%)
client_sv2_handle_message_mining✅ (view plot)73.38 (+0.40%)80.28 (91.40%)
client_sv2_mining_message_submit_standard✅ (view plot)14.65 (-0.01%)14.69 (99.72%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)264.80 (-0.03%)285.45 (92.77%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)590.42 (-0.71%)628.47 (93.95%)
client_sv2_open_channel✅ (view plot)161.31 (-2.91%)181.54 (88.86%)
client_sv2_open_channel_serialize✅ (view plot)284.09 (+0.29%)292.83 (97.02%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)373.41 (-1.25%)420.95 (88.71%)
client_sv2_setup_connection✅ (view plot)165.80 (+0.93%)174.74 (94.89%)
client_sv2_setup_connection_serialize✅ (view plot)472.35 (-0.34%)504.51 (93.63%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)988.80 (+1.62%)1,043.70 (94.74%)

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

Copy link
Contributor

github-actions bot commented Jun 24, 2024

🐰Bencher

ReportMon, July 1, 2024 at 15:02:07 UTC
ProjectStratum v2 (SRI)
Branch1003/merge
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,505.30 (-5.08%)7,366.67 (88.31%)
client-submit-serialize-deserialize✅ (view plot)7,265.00 (-6.54%)8,337.94 (87.13%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,027.70 (-3.88%)8,840.08 (90.81%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)897.45 (-0.19%)926.40 (96.88%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)693.99 (-0.67%)720.41 (96.33%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)245.68 (-1.31%)259.41 (94.71%)
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)156.34 (-0.78%)165.11 (94.69%)
client-sv1-get-submit✅ (view plot)6,327.40 (-4.36%)7,157.62 (88.40%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)279.29 (+0.13%)290.82 (96.03%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)769.32 (+2.09%)792.99 (97.01%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)616.82 (+0.10%)640.99 (96.23%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)202.46 (-1.84%)218.64 (92.60%)

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

Copy link
Contributor

github-actions bot commented Jun 24, 2024

🐰Bencher

ReportMon, July 1, 2024 at 15:02:08 UTC
ProjectStratum v2 (SRI)
Branch1002-fix-mg-submit-solution-jd
Testbedsv1
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,430.00 (-0.10%)8,712.59 (96.76%)✅ (view plot)3,718.00 (-0.57%)3,848.18 (96.62%)✅ (view plot)5,210.00 (-0.63%)5,391.62 (96.63%)✅ (view plot)7.00 (-10.70%)10.23 (68.44%)✅ (view plot)91.00 (+0.89%)94.07 (96.74%)
get_submit✅ (view plot)95,401.00 (-0.15%)96,100.45 (99.27%)✅ (view plot)59,411.00 (-0.09%)59,757.36 (99.42%)✅ (view plot)85,321.00 (-0.09%)85,806.79 (99.43%)✅ (view plot)49.00 (-9.96%)62.53 (78.37%)✅ (view plot)281.00 (-0.36%)287.33 (97.80%)
get_subscribe✅ (view plot)7,883.00 (-1.09%)8,250.67 (95.54%)✅ (view plot)2,813.00 (-0.58%)2,933.38 (95.90%)✅ (view plot)3,933.00 (-0.51%)4,091.33 (96.13%)✅ (view plot)13.00 (-17.84%)19.84 (65.53%)✅ (view plot)111.00 (-1.33%)116.64 (95.16%)
serialize_authorize✅ (view plot)12,183.00 (-0.20%)12,488.03 (97.56%)✅ (view plot)5,289.00 (-0.40%)5,419.18 (97.60%)✅ (view plot)7,373.00 (-0.44%)7,554.94 (97.59%)✅ (view plot)10.00 (-6.63%)13.19 (75.80%)✅ (view plot)136.00 (+0.25%)140.10 (97.07%)
serialize_deserialize_authorize✅ (view plot)24,480.00 (+0.02%)24,702.79 (99.10%)✅ (view plot)9,870.00 (-0.28%)10,017.94 (98.52%)✅ (view plot)13,920.00 (-0.31%)14,138.79 (98.45%)✅ (view plot)33.00 (-8.78%)41.47 (79.57%)✅ (view plot)297.00 (+0.62%)298.45 (99.51%)
serialize_deserialize_handle_authorize✅ (view plot)30,219.00 (+0.19%)30,364.57 (99.52%)✅ (view plot)12,073.00 (-0.18%)12,203.18 (98.93%)✅ (view plot)17,079.00 (-0.21%)17,269.40 (98.90%)✅ (view plot)59.00 (+0.25%)64.47 (91.52%)✅ (view plot)367.00 (+0.73%)368.38 (99.63%)
serialize_deserialize_handle_submit✅ (view plot)126,406.00 (-0.00%)126,993.89 (99.54%)✅ (view plot)73,224.00 (-0.03%)73,596.46 (99.49%)✅ (view plot)104,946.00 (-0.04%)105,477.95 (99.50%)✅ (view plot)120.00 (-0.37%)130.61 (91.88%)✅ (view plot)596.00 (+0.18%)599.10 (99.48%)
serialize_deserialize_handle_subscribe✅ (view plot)27,383.00 (-0.25%)27,594.83 (99.23%)✅ (view plot)9,615.00 (-0.17%)9,735.38 (98.76%)✅ (view plot)13,603.00 (-0.14%)13,766.83 (98.81%)✅ (view plot)61.00 (-6.73%)73.45 (83.05%)✅ (view plot)385.00 (-0.20%)388.41 (99.12%)
serialize_deserialize_submit✅ (view plot)114,999.00 (-0.06%)115,613.77 (99.47%)✅ (view plot)68,001.00 (-0.07%)68,378.84 (99.45%)✅ (view plot)97,559.00 (-0.08%)98,115.63 (99.43%)✅ (view plot)65.00 (-5.71%)75.18 (86.45%)✅ (view plot)489.00 (+0.16%)492.27 (99.34%)
serialize_deserialize_subscribe✅ (view plot)22,814.00 (-0.25%)23,096.61 (98.78%)✅ (view plot)8,167.00 (-0.22%)8,290.83 (98.51%)✅ (view plot)11,504.00 (-0.21%)11,673.73 (98.55%)✅ (view plot)36.00 (-7.73%)43.97 (81.88%)✅ (view plot)318.00 (-0.16%)321.33 (98.96%)
serialize_submit✅ (view plot)99,718.00 (-0.16%)100,429.39 (99.29%)✅ (view plot)61,455.00 (-0.09%)61,806.42 (99.43%)✅ (view plot)88,168.00 (-0.09%)88,659.89 (99.45%)✅ (view plot)49.00 (-10.83%)62.58 (78.30%)✅ (view plot)323.00 (-0.47%)328.87 (98.21%)
serialize_subscribe✅ (view plot)11,220.00 (-0.87%)11,587.59 (96.83%)✅ (view plot)4,160.00 (-0.39%)4,280.38 (97.19%)✅ (view plot)5,790.00 (-0.37%)5,950.37 (97.30%)✅ (view plot)15.00 (-7.46%)18.82 (79.68%)✅ (view plot)153.00 (-1.30%)159.47 (95.94%)

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

Copy link
Contributor

github-actions bot commented Jun 24, 2024

🐰Bencher

ReportMon, July 1, 2024 at 15:02:07 UTC
ProjectStratum v2 (SRI)
Branch1002-fix-mg-submit-solution-jd
Testbedsv2
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)1,991.00 (-2.82%)2,128.04 (93.56%)✅ (view plot)445.00 (-5.24%)488.46 (91.10%)✅ (view plot)696.00 (-4.70%)757.50 (91.88%)✅ (view plot)7.00 (-3.17%)11.30 (61.97%)✅ (view plot)36.00 (-1.74%)38.46 (93.59%)
client_sv2_handle_message_mining✅ (view plot)8,253.00 (+0.59%)8,342.61 (98.93%)✅ (view plot)2,137.00 (+0.41%)2,170.26 (98.47%)✅ (view plot)3,158.00 (+0.38%)3,213.66 (98.27%)✅ (view plot)39.00 (+0.89%)43.48 (89.70%)✅ (view plot)140.00 (+0.71%)142.07 (98.54%)
client_sv2_mining_message_submit_standard✅ (view plot)6,230.00 (-0.75%)6,389.08 (97.51%)✅ (view plot)1,722.00 (-1.50%)1,766.11 (97.50%)✅ (view plot)2,510.00 (-1.60%)2,579.88 (97.29%)✅ (view plot)23.00 (+23.94%)26.18 (87.84%)✅ (view plot)103.00 (-0.79%)106.73 (96.51%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,575.00 (-1.24%)15,021.29 (97.03%)✅ (view plot)4,666.00 (-0.56%)4,710.11 (99.06%)✅ (view plot)6,715.00 (-0.55%)6,778.64 (99.06%)✅ (view plot)53.00 (+9.70%)55.60 (95.33%)✅ (view plot)217.00 (-2.19%)229.60 (94.51%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,383.00 (-0.33%)27,821.50 (98.42%)✅ (view plot)10,557.00 (+0.10%)10,578.37 (99.80%)✅ (view plot)15,363.00 (+0.11%)15,389.12 (99.83%)✅ (view plot)87.00 (+3.07%)90.98 (95.63%)✅ (view plot)331.00 (-1.04%)344.53 (96.07%)
client_sv2_open_channel✅ (view plot)4,331.00 (-3.29%)4,616.63 (93.81%)✅ (view plot)1,433.00 (-1.78%)1,477.13 (97.01%)✅ (view plot)2,121.00 (-1.42%)2,175.53 (97.49%)✅ (view plot)8.00 (-31.65%)15.28 (52.36%)✅ (view plot)62.00 (-4.33%)68.18 (90.94%)
client_sv2_open_channel_serialize✅ (view plot)13,920.00 (-1.87%)14,473.64 (96.17%)✅ (view plot)5,036.00 (-0.51%)5,080.13 (99.13%)✅ (view plot)7,285.00 (-0.43%)7,341.55 (99.23%)✅ (view plot)39.00 (+3.26%)43.12 (90.44%)✅ (view plot)184.00 (-3.60%)199.25 (92.34%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,437.00 (-0.82%)22,997.91 (97.56%)✅ (view plot)7,999.00 (+0.14%)8,020.70 (99.73%)✅ (view plot)11,637.00 (+0.15%)11,663.40 (99.77%)✅ (view plot)81.00 (+8.52%)85.52 (94.71%)✅ (view plot)297.00 (-2.21%)314.57 (94.42%)
client_sv2_setup_connection✅ (view plot)4,573.00 (-2.47%)4,775.30 (95.76%)✅ (view plot)1,474.00 (-1.73%)1,518.13 (97.09%)✅ (view plot)2,238.00 (-1.61%)2,302.46 (97.20%)✅ (view plot)12.00 (+23.65%)15.22 (78.85%)✅ (view plot)65.00 (-3.83%)69.91 (92.97%)
client_sv2_setup_connection_serialize✅ (view plot)15,856.00 (-2.24%)16,549.14 (95.81%)✅ (view plot)5,935.00 (-0.43%)5,979.13 (99.26%)✅ (view plot)8,626.00 (-0.33%)8,679.44 (99.38%)✅ (view plot)46.00 (+1.96%)50.17 (91.68%)✅ (view plot)200.00 (-4.62%)219.27 (91.21%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,296.00 (-0.61%)35,749.46 (98.73%)✅ (view plot)14,827.00 (+0.08%)14,848.44 (99.86%)✅ (view plot)21,776.00 (+0.09%)21,801.84 (99.88%)✅ (view plot)107.00 (+6.10%)114.84 (93.17%)✅ (view plot)371.00 (-2.00%)385.77 (96.17%)

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

@plebhash plebhash force-pushed the 1002-fix-mg-submit-solution-jd branch from 3e17dec to d3514de Compare June 24, 2024 18:57
@plebhash plebhash marked this pull request as draft June 24, 2024 22:59
@plebhash plebhash linked an issue Jun 24, 2024 that may be closed by this pull request
@plebhash plebhash changed the title fix #1002 MG understands SubmitSolution as a valid JD message Jun 24, 2024
@lorbax
Copy link
Collaborator

lorbax commented Jun 25, 2024

It appears to me that you are sending a SubmitSolution right after receiving SetupConnectionSuccess.
What you miss IMO
mock --> JDS: AllocateMiningJobToken
mock <-- JDS: AllocateMiningJobToken.success
mock --> JDS: DeclareMiningJob
mock <-- JDS: DeclareMiningJob.success

The submitted solution should contain the transactions of DeclareMiningJob, so you have to take a real. Also, to check that JDS submit solution works, you have to to prevent submit solution from JDC (by patching the JDC not doing so), and clearly the JDS connected to a bitcoin node. There is also the possibility to use your signet, mine some non empty blocks and use those blocks for the purpose.

What you are trying to do is tricky, ping me if you need help

@plebhash
Copy link
Collaborator Author

What you miss IMO
mock --> JDS: AllocateMiningJobToken
mock <-- JDS: AllocateMiningJobToken.success
mock --> JDS: DeclareMiningJob
mock <-- JDS: DeclareMiningJob.success

I found #1002 while working on #912, and while working there I did follow the message flow indicated above. But the MG behavior that I'm describing on #1002 happens independently of these messages are not related to it.

So I intentionally left these messages out of the flow. We just need an atomic way to get MG to parse a SubmitSolution, and this test was the smallest possible test to achieve this.

The messages listed above should be ignored on the context of this issue.

@plebhash
Copy link
Collaborator Author

todo: try with #949

@plebhash
Copy link
Collaborator Author

todo: try with #949

@lorbax I tried merging your changes from MG-fix-primitives-serialization-and-unit-tests and the issue persists.

@plebhash
Copy link
Collaborator Author

plebhash commented Jun 28, 2024

hey @lorbax just FYI

I found the root cause of the problems discussed above, it is described on #1018 and fixed via #1019

this PR is now ready for review, which is a very simple fix for #1002

@plebhash plebhash force-pushed the 1002-fix-mg-submit-solution-jd branch from d3514de to 1b7d768 Compare June 28, 2024 00:57
@plebhash plebhash marked this pull request as ready for review June 28, 2024 00:57
@plebhash plebhash force-pushed the 1002-fix-mg-submit-solution-jd branch 3 times, most recently from f7ac98b to 6a17642 Compare June 28, 2024 12:21
@plebhash plebhash force-pushed the 1002-fix-mg-submit-solution-jd branch from 6a17642 to 53ee8a9 Compare July 1, 2024 14:58
@plebhash plebhash merged commit 1bc0bd5 into stratum-mining:dev Jul 1, 2024
13 checks passed
@plebhash plebhash deleted the 1002-fix-mg-submit-solution-jd branch July 1, 2024 18:13
@plebhash plebhash mentioned this pull request Aug 18, 2024
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.

MG doesn't understand SubmitSolution as a valid JD message
3 participants