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

Rust docs noise_sv2 #1111

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

Conversation

Shourya742
Copy link
Contributor

@Shourya742 Shourya742 commented Aug 18, 2024

closes #1013

Copy link
Contributor

github-actions bot commented Aug 18, 2024

🐰Bencher

ReportTue, September 3, 2024 at 10:59:01 UTC
ProjectStratum V2 (SRI)
Branchdoc-noise-sv2
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Lower Boundary
nanoseconds (ns) | (%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)45.26 (+1.34%)43.53 (96.17%)45.79 (98.83%)
client_sv2_handle_message_mining✅ (view plot)73.10 (-1.10%)64.04 (87.60%)83.80 (87.24%)
client_sv2_mining_message_submit_standard✅ (view plot)14.66 (-0.01%)14.60 (99.63%)14.71 (99.61%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)260.45 (-2.37%)246.39 (94.60%)287.16 (90.70%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)588.78 (-0.84%)555.96 (94.43%)631.60 (93.22%)
client_sv2_open_channel✅ (view plot)163.45 (-1.43%)159.07 (97.32%)172.55 (94.72%)
client_sv2_open_channel_serialize✅ (view plot)268.95 (-4.39%)265.56 (98.74%)297.05 (90.54%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)377.83 (+0.05%)324.18 (85.80%)431.11 (87.64%)
client_sv2_setup_connection✅ (view plot)165.74 (+1.33%)150.35 (90.71%)176.79 (93.75%)
client_sv2_setup_connection_serialize✅ (view plot)448.46 (-4.52%)411.92 (91.85%)527.50 (85.02%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)996.92 (+1.37%)882.23 (88.50%)1,084.74 (91.90%)

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

Copy link
Contributor

github-actions bot commented Aug 18, 2024

🐰Bencher

ReportTue, September 3, 2024 at 10:59:04 UTC
ProjectStratum V2 (SRI)
Branchdoc-noise-sv2
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
serialize_deserialize_authorizeEstimated Cycles (estimated cycles)🚨 (view plot | view alert)24,931.00 (+1.48%)24,241.26 (97.23%)24,893.89 (100.15%)
serialize_deserialize_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)307.00 (+3.13%)289.54 (94.31%)305.85 (100.38%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Lower Boundary
estimated cycles | (%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Lower Boundary
instructions | (%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Lower Boundary
accesses | (%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Lower Boundary
accesses | (%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Lower Boundary
accesses | (%)
RAM Accesses Upper Boundary
accesses | (%)
get_authorize✅ (view plot)8,545.00 (+1.26%)8,190.11 (95.85%)8,687.71 (98.36%)✅ (view plot)3,772.00 (+0.68%)3,635.98 (96.39%)3,856.90 (97.80%)✅ (view plot)5,295.00 (+0.77%)5,103.12 (96.38%)5,405.68 (97.95%)✅ (view plot)6.00 (-18.73%)4.29 (71.57%)10.47 (57.30%)✅ (view plot)92.00 (+2.30%)86.34 (93.84%)93.53 (98.37%)
get_submit✅ (view plot)95,442.00 (-0.06%)94,988.50 (99.52%)96,019.56 (99.40%)✅ (view plot)59,522.00 (+0.09%)59,199.22 (99.46%)59,740.05 (99.63%)✅ (view plot)85,507.00 (+0.11%)85,032.82 (99.45%)85,791.52 (99.67%)✅ (view plot)48.00 (-3.60%)33.23 (69.23%)66.36 (72.33%)✅ (view plot)277.00 (-1.50%)274.96 (99.26%)287.49 (96.35%)
get_subscribe✅ (view plot)8,064.00 (+0.78%)7,746.40 (96.06%)8,256.25 (97.67%)✅ (view plot)2,848.00 (+0.47%)2,728.71 (95.81%)2,940.68 (96.85%)✅ (view plot)3,984.00 (+0.55%)3,820.72 (95.90%)4,103.69 (97.08%)✅ (view plot)11.00 (-19.91%)6.36 (57.85%)21.11 (52.12%)✅ (view plot)115.00 (+1.37%)109.28 (95.03%)117.60 (97.79%)
serialize_authorize✅ (view plot)12,328.00 (+0.70%)11,970.48 (97.10%)12,514.56 (98.51%)✅ (view plot)5,343.00 (+0.48%)5,206.98 (97.45%)5,427.90 (98.44%)✅ (view plot)7,458.00 (+0.56%)7,265.14 (97.41%)7,568.04 (98.55%)✅ (view plot)8.00 (-16.82%)5.55 (69.37%)13.69 (58.46%)✅ (view plot)138.00 (+1.09%)131.83 (95.53%)141.19 (97.74%)
serialize_deserialize_authorize🚨 (view plot | view alert)24,931.00 (+1.48%)24,241.26 (97.23%)24,893.89 (100.15%)✅ (view plot)9,920.00 (+0.22%)9,769.83 (98.49%)10,026.59 (98.94%)✅ (view plot)14,016.00 (+0.34%)13,781.15 (98.32%)14,156.46 (99.01%)✅ (view plot)34.00 (-5.25%)29.48 (86.70%)42.29 (80.40%)🚨 (view plot | view alert)307.00 (+3.13%)289.54 (94.31%)305.85 (100.38%)
serialize_deserialize_handle_authorize✅ (view plot)30,431.00 (+0.68%)29,935.24 (98.37%)30,514.31 (99.73%)✅ (view plot)12,097.00 (+0.04%)11,978.42 (99.02%)12,205.64 (99.11%)✅ (view plot)17,141.00 (+0.14%)16,959.31 (98.94%)17,276.02 (99.22%)✅ (view plot)54.00 (-6.20%)50.58 (93.67%)64.56 (83.65%)✅ (view plot)372.00 (+1.57%)358.60 (96.40%)373.93 (99.48%)
serialize_deserialize_handle_submit✅ (view plot)126,463.00 (+0.01%)125,927.17 (99.58%)126,972.00 (99.60%)✅ (view plot)73,363.00 (+0.13%)72,940.44 (99.42%)73,594.86 (99.68%)✅ (view plot)105,198.00 (+0.16%)104,559.13 (99.39%)105,496.71 (99.72%)✅ (view plot)109.00 (-3.26%)89.67 (82.27%)135.68 (80.34%)✅ (view plot)592.00 (-0.66%)590.14 (99.69%)601.77 (98.38%)
serialize_deserialize_handle_subscribe✅ (view plot)27,971.00 (+1.22%)27,101.87 (96.89%)28,163.44 (99.32%)✅ (view plot)9,666.00 (+0.25%)9,532.23 (98.62%)9,751.20 (99.13%)✅ (view plot)13,681.00 (+0.32%)13,486.38 (98.58%)13,789.03 (99.22%)✅ (view plot)58.00 (-10.31%)56.15 (96.81%)73.19 (79.25%)✅ (view plot)400.00 (+2.40%)376.76 (94.19%)404.47 (98.89%)
serialize_deserialize_submit✅ (view plot)115,445.00 (+0.25%)114,656.33 (99.32%)115,654.03 (99.82%)✅ (view plot)68,223.00 (+0.21%)67,767.05 (99.33%)68,390.13 (99.76%)✅ (view plot)97,935.00 (+0.25%)97,228.68 (99.28%)98,152.06 (99.78%)✅ (view plot)65.00 (-0.35%)52.35 (80.53%)78.10 (83.22%)✅ (view plot)491.00 (+0.27%)483.88 (98.55%)495.48 (99.10%)
serialize_deserialize_subscribe✅ (view plot)23,469.00 (+1.79%)22,530.53 (96.00%)23,584.31 (99.51%)✅ (view plot)8,225.00 (+0.35%)8,085.81 (98.31%)8,306.56 (99.02%)✅ (view plot)11,589.00 (+0.38%)11,393.21 (98.31%)11,696.44 (99.08%)✅ (view plot)38.00 (-0.77%)32.89 (86.55%)43.70 (86.96%)✅ (view plot)334.00 (+3.26%)310.14 (92.86%)336.78 (99.17%)
serialize_submit✅ (view plot)99,835.00 (-0.06%)99,407.64 (99.57%)100,375.83 (99.46%)✅ (view plot)61,566.00 (+0.08%)61,239.72 (99.47%)61,788.14 (99.64%)✅ (view plot)88,350.00 (+0.11%)87,870.19 (99.46%)88,642.69 (99.67%)✅ (view plot)50.00 (-1.89%)36.61 (73.22%)65.31 (76.56%)✅ (view plot)321.00 (-1.28%)319.49 (99.53%)330.83 (97.03%)
serialize_subscribe✅ (view plot)11,405.00 (+0.24%)11,106.55 (97.38%)11,648.72 (97.91%)✅ (view plot)4,195.00 (+0.32%)4,075.71 (97.16%)4,287.68 (97.84%)✅ (view plot)5,840.00 (+0.36%)5,677.61 (97.22%)5,960.71 (97.97%)✅ (view plot)14.00 (-3.32%)8.80 (62.84%)20.16 (69.43%)✅ (view plot)157.00 (+0.16%)151.46 (96.47%)162.04 (96.89%)

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

Copy link
Contributor

github-actions bot commented Aug 18, 2024

🐰Bencher

ReportFri, September 13, 2024 at 03:42:34 UTC
ProjectStratum V2 (SRI)
Branch1111/merge
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,868.60 (+0.60%)7,564.04 (90.81%)
client-submit-serialize-deserialize✅ (view plot)7,781.20 (-0.69%)8,772.17 (88.70%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,224.30 (-2.21%)9,235.19 (89.05%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)903.29 (-1.31%)983.71 (91.82%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)704.76 (-1.53%)765.87 (92.02%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)247.01 (-1.17%)263.13 (93.87%)
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)157.70 (-0.08%)166.50 (94.71%)
client-sv1-get-submit✅ (view plot)6,608.90 (-0.00%)7,292.88 (90.62%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)279.17 (+1.11%)300.87 (92.79%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)765.14 (-0.27%)830.33 (92.15%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)615.34 (-1.94%)682.73 (90.13%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)203.38 (-2.53%)226.75 (89.69%)

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

Copy link
Contributor

github-actions bot commented Aug 18, 2024

🐰Bencher

ReportTue, September 3, 2024 at 10:59:05 UTC
ProjectStratum V2 (SRI)
Branchdoc-noise-sv2
Testbedsv2

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_handle_message_commonEstimated Cycles (estimated cycles)🚨 (view plot | view alert)2,159.00 (+4.36%)1,984.12 (91.90%)2,153.39 (100.26%)
client_sv2_handle_message_commonRAM Accesses (accesses)🚨 (view plot | view alert)40.00 (+7.31%)34.60 (86.50%)39.95 (100.12%)

Click to view all benchmark results
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
Estimated Cycles Lower Boundary
estimated cycles | (%)
Estimated Cycles Upper Boundary
estimated cycles | (%)
InstructionsInstructions Results
instructions | (Δ%)
Instructions Lower Boundary
instructions | (%)
Instructions Upper Boundary
instructions | (%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L1 Accesses Lower Boundary
accesses | (%)
L1 Accesses Upper Boundary
accesses | (%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
L2 Accesses Lower Boundary
accesses | (%)
L2 Accesses Upper Boundary
accesses | (%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
RAM Accesses Lower Boundary
accesses | (%)
RAM Accesses Upper Boundary
accesses | (%)
client_sv2_handle_message_common🚨 (view plot | view alert)2,159.00 (+4.36%)1,984.12 (91.90%)2,153.39 (100.26%)✅ (view plot)473.00 (+0.33%)457.33 (96.69%)485.52 (97.42%)✅ (view plot)734.00 (+0.10%)711.90 (96.99%)754.59 (97.27%)✅ (view plot)5.00 (-19.01%)-0.60 (-12.04%)12.95 (38.61%)🚨 (view plot | view alert)40.00 (+7.31%)34.60 (86.50%)39.95 (100.12%)
client_sv2_handle_message_mining✅ (view plot)8,146.00 (-0.68%)8,091.52 (99.33%)8,311.85 (98.00%)✅ (view plot)2,137.00 (+0.22%)2,093.00 (97.94%)2,171.74 (98.40%)✅ (view plot)3,166.00 (+0.42%)3,089.14 (97.57%)3,216.47 (98.43%)✅ (view plot)30.00 (-18.27%)29.43 (98.10%)43.98 (68.22%)✅ (view plot)138.00 (-0.73%)136.21 (98.71%)141.81 (97.32%)
client_sv2_mining_message_submit_standard✅ (view plot)6,311.00 (+0.49%)6,183.26 (97.98%)6,376.84 (98.97%)✅ (view plot)1,750.00 (-0.01%)1,736.79 (99.25%)1,763.53 (99.23%)✅ (view plot)2,551.00 (-0.10%)2,532.38 (99.27%)2,574.66 (99.08%)✅ (view plot)17.00 (-1.36%)11.14 (65.50%)23.33 (72.85%)✅ (view plot)105.00 (+0.95%)101.02 (96.21%)107.00 (98.13%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,734.00 (-0.21%)14,554.39 (98.78%)14,974.73 (98.39%)✅ (view plot)4,694.00 (-0.00%)4,680.79 (99.72%)4,707.53 (99.71%)✅ (view plot)6,759.00 (+0.04%)6,736.27 (99.66%)6,776.53 (99.74%)✅ (view plot)41.00 (-8.87%)36.63 (89.33%)53.35 (76.85%)✅ (view plot)222.00 (-0.17%)215.67 (97.15%)229.09 (96.91%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,588.00 (+0.30%)27,220.89 (98.67%)27,792.33 (99.26%)✅ (view plot)10,585.00 (+0.23%)10,506.34 (99.26%)10,615.82 (99.71%)✅ (view plot)15,403.00 (+0.23%)15,287.98 (99.25%)15,447.08 (99.71%)✅ (view plot)78.00 (-4.83%)74.89 (96.01%)89.03 (87.61%)✅ (view plot)337.00 (+0.56%)326.05 (96.75%)344.19 (97.91%)
client_sv2_open_channel✅ (view plot)4,439.00 (-0.01%)4,275.70 (96.32%)4,603.61 (96.42%)✅ (view plot)1,461.00 (+0.05%)1,447.38 (99.07%)1,473.11 (99.18%)✅ (view plot)2,159.00 (+0.17%)2,135.30 (98.90%)2,175.54 (99.24%)✅ (view plot)8.00 (-24.76%)4.81 (60.07%)16.46 (48.60%)✅ (view plot)64.00 (+0.40%)58.74 (91.78%)68.75 (93.09%)
client_sv2_open_channel_serialize✅ (view plot)14,026.00 (-0.84%)13,880.77 (98.96%)14,408.49 (97.35%)✅ (view plot)5,064.00 (+0.01%)5,050.38 (99.73%)5,076.11 (99.76%)✅ (view plot)7,331.00 (+0.13%)7,299.27 (99.57%)7,343.88 (99.82%)✅ (view plot)30.00 (-15.08%)28.63 (95.43%)42.02 (71.39%)✅ (view plot)187.00 (-1.53%)181.55 (97.08%)198.25 (94.33%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,691.00 (+0.21%)22,354.57 (98.52%)22,933.81 (98.94%)✅ (view plot)8,027.00 (+0.31%)7,948.93 (99.03%)8,055.40 (99.65%)✅ (view plot)11,676.00 (+0.30%)11,562.82 (99.03%)11,719.55 (99.63%)✅ (view plot)75.00 (+1.90%)64.31 (85.75%)82.89 (90.48%)✅ (view plot)304.00 (+0.05%)294.60 (96.91%)313.11 (97.09%)
client_sv2_setup_connection✅ (view plot)4,737.00 (+1.02%)4,623.16 (97.60%)4,755.00 (99.62%)✅ (view plot)1,502.00 (+0.05%)1,488.38 (99.09%)1,514.11 (99.20%)✅ (view plot)2,277.00 (+0.01%)2,256.32 (99.09%)2,297.35 (99.11%)✅ (view plot)9.00 (-4.03%)4.06 (45.13%)14.69 (61.25%)✅ (view plot)69.00 (+2.10%)65.45 (94.85%)69.72 (98.97%)
client_sv2_setup_connection_serialize✅ (view plot)16,204.00 (-0.08%)16,001.83 (98.75%)16,432.78 (98.61%)✅ (view plot)5,963.00 (+0.01%)5,949.38 (99.77%)5,975.11 (99.80%)✅ (view plot)8,664.00 (+0.06%)8,634.96 (99.66%)8,682.31 (99.79%)✅ (view plot)38.00 (-10.03%)31.82 (83.74%)52.65 (72.18%)✅ (view plot)210.00 (+0.03%)203.38 (96.85%)216.47 (97.01%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,650.00 (+0.29%)35,377.31 (99.24%)35,713.14 (99.82%)✅ (view plot)14,855.00 (+0.17%)14,775.24 (99.46%)14,883.96 (99.81%)✅ (view plot)21,820.00 (+0.17%)21,692.12 (99.41%)21,872.61 (99.76%)✅ (view plot)92.00 (-3.23%)77.29 (84.01%)112.85 (81.52%)✅ (view plot)382.00 (+0.62%)375.21 (98.22%)384.08 (99.46%)

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

@Fi3
Copy link
Collaborator

Fi3 commented Aug 18, 2024

just two minor non blocking things for me:

  1. I would remove dead and unused code
  2. I usually do not documents methods on trait impl but only one trait definition

@Shourya742
Copy link
Contributor Author

just two minor non blocking things for me:

  1. I would remove dead and unused code
  2. I usually do not documents methods on trait impl but only one trait definition

noted, will push these.

@Shourya742 Shourya742 marked this pull request as ready for review August 19, 2024 15:03
@plebhash plebhash linked an issue Aug 20, 2024 that may be closed by this pull request
Copy link
Contributor

@marathon-gary marathon-gary left a comment

Choose a reason for hiding this comment

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

Some typos and grammer corrections and some general questions for my curiousity.

Should generate_key be documented for handshake.rs?

protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/cipher_state.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/cipher_state.rs Show resolved Hide resolved
protocols/v2/noise-sv2/src/responder.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/responder.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/responder.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/responder.rs Show resolved Hide resolved
Copy link
Collaborator

@rrybarczyk rrybarczyk left a comment

Choose a reason for hiding this comment

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

Here is my first pass, mainly focusing on the initiator, responder, and handshake trait. I will leave another review for the remaining modules, but this review is already quite large. Everything you are doing is great! Most of this are just my nits.

  1. We should add some top level docs in lib.rs that follow the same format as this which is from my PR Rust docs for protocols::v2::codec-sv2 #1040. Please use the sv2-spec/04-Protocol-Security.md for reference when describing what the crate does in this section.
  2. Each module (file) should have the appropriate top level docs.
  3. lib.rs needs to have doc comments on the PARITY constant and the NoiseCodec struct and its implemented methods.
  4. All documentation should span the full 100 character line length instead of 80 characters.
  5. Avoid including language like "This struct performs ABC" or "This is a trait defining XYZ", just say "Performs ABC" or "Defines XYZ".

Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to have top level documentation here, like:

//! # Handshake Initiator Role

Follow the format here from my #1040 PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense

protocols/v2/noise-sv2/src/initiator.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/initiator.rs Show resolved Hide resolved
protocols/v2/noise-sv2/src/initiator.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/initiator.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/handshake.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/handshake.rs Show resolved Hide resolved
protocols/v2/noise-sv2/src/handshake.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/handshake.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/handshake.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/aed_cipher.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/signature_message.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/signature_message.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/signature_message.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/signature_message.rs Outdated Show resolved Hide resolved
protocols/v2/noise-sv2/src/signature_message.rs Outdated Show resolved Hide resolved
@plebhash plebhash changed the base branch from dev to main August 28, 2024 19:21
@plebhash
Copy link
Collaborator

plebhash commented Sep 2, 2024

//! Implement Sv2 noise https://github.com/stratum-mining/sv2-spec/blob/main/04-Protocol-Security.md#4-protocol-security

which generates this warning:

warning: this URL is not a hyperlink
 --> v2/noise-sv2/src/lib.rs:1:25
  |
1 | ...se https://github.com/stratum-mining/sv2-spec/blob/main/04-Protocol-Security.md#4-protocol-security
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com/stratum-mining/sv2-spec/blob/main/04-Protocol-Security.md#4-protocol-security>`
  |
  = note: bare URLs are not automatically turned into clickable links
  = note: `#[warn(rustdoc::bare_urls)]` on by default

we could give this link some neat markdown formatting, something like:

Implement Noise encryption according to [the SV2 spec](https://github.com/stratum-mining/sv2-spec/blob/main/04-Protocol-Security.md#4-protocol-security)

Copy link
Contributor

github-actions bot commented Sep 12, 2024

🐰Bencher

ReportFri, September 13, 2024 at 03:42:30 UTC
ProjectStratum V2 (SRI)
Branch1111/merge
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)2,129.00 (+2.55%)2,206.76 (96.48%)✅ (view plot)473.00 (+0.23%)491.06 (96.32%)✅ (view plot)734.00 (+0.01%)762.27 (96.29%)✅ (view plot)6.00 (+0.96%)14.43 (41.57%)✅ (view plot)39.00 (+4.01%)41.15 (94.77%)
client_sv2_handle_message_mining✅ (view plot)8,158.00 (-0.51%)8,353.18 (97.66%)✅ (view plot)2,137.00 (+0.17%)2,180.60 (98.00%)✅ (view plot)3,163.00 (+0.28%)3,230.38 (97.91%)✅ (view plot)33.00 (-9.96%)45.49 (72.54%)✅ (view plot)138.00 (-0.67%)142.40 (96.91%)
client_sv2_mining_message_submit_standard✅ (view plot)6,285.00 (+0.10%)6,417.79 (97.93%)✅ (view plot)1,750.00 (-0.02%)1,768.45 (98.96%)✅ (view plot)2,550.00 (-0.14%)2,581.32 (98.79%)✅ (view plot)19.00 (+11.44%)24.90 (76.31%)✅ (view plot)104.00 (+0.01%)107.80 (96.47%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,594.00 (-1.02%)15,060.35 (96.90%)✅ (view plot)4,694.00 (-0.01%)4,712.45 (99.61%)✅ (view plot)6,764.00 (+0.10%)6,784.50 (99.70%)✅ (view plot)40.00 (-9.92%)55.29 (72.34%)✅ (view plot)218.00 (-1.75%)230.61 (94.53%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,438.00 (-0.23%)27,895.88 (98.36%)✅ (view plot)10,585.00 (+0.18%)10,639.06 (99.49%)✅ (view plot)15,403.00 (+0.18%)15,481.57 (99.49%)✅ (view plot)83.00 (+1.49%)90.49 (91.72%)✅ (view plot)332.00 (-0.83%)346.00 (95.95%)
client_sv2_open_channel✅ (view plot)4,413.00 (-0.22%)4,672.19 (94.45%)✅ (view plot)1,461.00 (+0.03%)1,478.29 (98.83%)✅ (view plot)2,158.00 (+0.04%)2,186.27 (98.71%)✅ (view plot)10.00 (+1.91%)18.57 (53.86%)✅ (view plot)63.00 (-0.53%)69.95 (90.07%)
client_sv2_open_channel_serialize✅ (view plot)13,996.00 (-0.80%)14,532.03 (96.31%)✅ (view plot)5,064.00 (+0.01%)5,081.29 (99.66%)✅ (view plot)7,331.00 (+0.11%)7,354.01 (99.69%)✅ (view plot)31.00 (-12.22%)43.87 (70.66%)✅ (view plot)186.00 (-1.51%)200.85 (92.61%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,661.00 (+0.11%)23,036.81 (98.37%)✅ (view plot)8,027.00 (+0.24%)8,079.25 (99.35%)✅ (view plot)11,676.00 (+0.23%)11,755.79 (99.32%)✅ (view plot)76.00 (+3.21%)85.17 (89.23%)✅ (view plot)303.00 (-0.13%)314.96 (96.20%)
client_sv2_setup_connection✅ (view plot)4,703.00 (+0.33%)4,784.44 (98.30%)✅ (view plot)1,502.00 (+0.03%)1,519.29 (98.86%)✅ (view plot)2,278.00 (+0.02%)2,305.34 (98.81%)✅ (view plot)9.00 (-1.95%)15.78 (57.02%)✅ (view plot)68.00 (+0.67%)70.28 (96.75%)
client_sv2_setup_connection_serialize✅ (view plot)16,132.00 (-0.41%)16,516.33 (97.67%)✅ (view plot)5,963.00 (+0.01%)5,980.29 (99.71%)✅ (view plot)8,667.00 (+0.08%)8,693.02 (99.70%)✅ (view plot)37.00 (-10.61%)55.03 (67.24%)✅ (view plot)208.00 (-0.69%)217.91 (95.45%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,492.00 (-0.15%)35,783.40 (99.19%)✅ (view plot)14,855.00 (+0.14%)14,908.31 (99.64%)✅ (view plot)21,822.00 (+0.14%)21,911.25 (99.59%)✅ (view plot)95.00 (+0.63%)116.19 (81.76%)✅ (view plot)377.00 (-0.67%)385.16 (97.88%)

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

Copy link
Contributor

github-actions bot commented Sep 12, 2024

🐰Bencher

ReportFri, September 13, 2024 at 03:42:39 UTC
ProjectStratum V2 (SRI)
Branch1111/merge
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,443.00 (-0.03%)8,794.80 (96.00%)✅ (view plot)3,772.00 (+0.63%)3,882.56 (97.15%)✅ (view plot)5,298.00 (+0.78%)5,441.69 (97.36%)✅ (view plot)6.00 (-14.67%)11.58 (51.80%)✅ (view plot)89.00 (-1.22%)95.33 (93.36%)
get_submit✅ (view plot)95,396.00 (-0.09%)96,204.31 (99.16%)✅ (view plot)59,522.00 (+0.09%)59,798.47 (99.54%)✅ (view plot)85,511.00 (+0.11%)85,877.95 (99.57%)✅ (view plot)45.00 (-6.13%)71.73 (62.74%)✅ (view plot)276.00 (-1.69%)290.08 (95.14%)
get_subscribe✅ (view plot)8,008.00 (+0.00%)8,360.84 (95.78%)✅ (view plot)2,848.00 (+0.40%)2,964.77 (96.06%)✅ (view plot)3,983.00 (+0.45%)4,137.00 (96.28%)✅ (view plot)14.00 (+7.89%)23.27 (60.15%)✅ (view plot)113.00 (-0.57%)119.61 (94.48%)
serialize_authorize✅ (view plot)12,218.00 (-0.29%)12,635.73 (96.69%)✅ (view plot)5,343.00 (+0.45%)5,453.56 (97.97%)✅ (view plot)7,463.00 (+0.59%)7,604.08 (98.14%)✅ (view plot)6.00 (-35.16%)14.95 (40.14%)✅ (view plot)135.00 (-1.33%)143.66 (93.97%)
serialize_deserialize_authorize✅ (view plot)24,783.00 (+0.72%)25,134.39 (98.60%)✅ (view plot)9,920.00 (+0.24%)10,054.38 (98.66%)✅ (view plot)14,023.00 (+0.40%)14,199.76 (98.76%)✅ (view plot)31.00 (-11.93%)44.46 (69.73%)✅ (view plot)303.00 (+1.35%)312.91 (96.83%)
serialize_deserialize_handle_authorize✅ (view plot)30,329.00 (+0.24%)30,709.97 (98.76%)✅ (view plot)12,097.00 (+0.06%)12,228.16 (98.93%)✅ (view plot)17,144.00 (+0.16%)17,309.83 (99.04%)✅ (view plot)54.00 (-3.97%)68.66 (78.65%)✅ (view plot)369.00 (+0.44%)380.31 (97.03%)
serialize_deserialize_handle_submit✅ (view plot)126,501.00 (+0.04%)127,171.50 (99.47%)✅ (view plot)73,363.00 (+0.12%)73,675.19 (99.58%)✅ (view plot)105,196.00 (+0.15%)105,621.84 (99.60%)✅ (view plot)110.00 (-0.38%)142.49 (77.20%)✅ (view plot)593.00 (-0.51%)604.62 (98.08%)
serialize_deserialize_handle_subscribe✅ (view plot)27,893.00 (+0.68%)28,564.08 (97.65%)✅ (view plot)9,666.00 (+0.21%)9,780.00 (98.83%)✅ (view plot)13,678.00 (+0.25%)13,830.78 (98.90%)✅ (view plot)64.00 (+0.21%)75.84 (84.38%)✅ (view plot)397.00 (+1.13%)415.44 (95.56%)
serialize_deserialize_submit✅ (view plot)115,399.00 (+0.19%)115,893.89 (99.57%)✅ (view plot)68,223.00 (+0.20%)68,476.79 (99.63%)✅ (view plot)97,939.00 (+0.24%)98,290.30 (99.64%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)490.00 (-0.04%)498.93 (98.21%)
serialize_deserialize_subscribe✅ (view plot)23,329.00 (+0.87%)23,977.62 (97.29%)✅ (view plot)8,225.00 (+0.30%)8,335.64 (98.67%)✅ (view plot)11,594.00 (+0.37%)11,737.76 (98.78%)✅ (view plot)37.00 (-2.37%)45.20 (81.87%)✅ (view plot)330.00 (+1.43%)347.27 (95.03%)
serialize_submit✅ (view plot)99,785.00 (-0.09%)100,546.18 (99.24%)✅ (view plot)61,566.00 (+0.09%)61,847.21 (99.55%)✅ (view plot)88,355.00 (+0.11%)88,730.12 (99.58%)✅ (view plot)46.00 (-6.35%)70.78 (64.99%)✅ (view plot)320.00 (-1.52%)333.43 (95.97%)
serialize_subscribe✅ (view plot)11,337.00 (-0.42%)11,760.66 (96.40%)✅ (view plot)4,195.00 (+0.27%)4,311.77 (97.29%)✅ (view plot)5,842.00 (+0.34%)5,994.00 (97.46%)✅ (view plot)14.00 (+1.97%)22.28 (62.83%)✅ (view plot)155.00 (-1.25%)164.51 (94.22%)

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

Copy link
Contributor

github-actions bot commented Sep 12, 2024

🐰Bencher

ReportFri, September 13, 2024 at 03:42:37 UTC
ProjectStratum V2 (SRI)
Branch1111/merge
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)45.34 (+1.41%)46.74 (97.02%)
client_sv2_handle_message_mining✅ (view plot)72.92 (-2.86%)91.60 (79.61%)
client_sv2_mining_message_submit_standard✅ (view plot)14.68 (+0.06%)14.81 (99.12%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)265.25 (-1.05%)291.40 (91.03%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)576.11 (-2.77%)650.73 (88.53%)
client_sv2_open_channel✅ (view plot)161.32 (-2.73%)177.70 (90.78%)
client_sv2_open_channel_serialize✅ (view plot)274.92 (-0.77%)307.29 (89.47%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)375.27 (-0.60%)458.98 (81.76%)
client_sv2_setup_connection✅ (view plot)161.08 (-0.55%)185.91 (86.64%)
client_sv2_setup_connection_serialize✅ (view plot)441.91 (-3.31%)568.42 (77.74%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)1,037.70 (+3.85%)1,163.44 (89.19%)

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

Copy link
Contributor

🐰Bencher

ReportThu, September 12, 2024 at 18:41:19 UTC
ProjectStratum V2 (SRI)
Branch1111/merge@4f6bf6e0-7e3d-43a0-8e27-8650fe9b391c
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,507.00 (+0.72%)8,795.73 (96.72%)✅ (view plot)3,772.00 (+0.63%)3,882.56 (97.15%)✅ (view plot)5,297.00 (+0.76%)5,441.67 (97.34%)✅ (view plot)5.00 (-28.81%)11.60 (43.10%)✅ (view plot)91.00 (+0.99%)95.35 (95.44%)
get_submit✅ (view plot)95,460.00 (-0.02%)96,204.46 (99.23%)✅ (view plot)59,522.00 (+0.09%)59,798.47 (99.54%)✅ (view plot)85,510.00 (+0.11%)85,877.93 (99.57%)✅ (view plot)44.00 (-8.20%)71.73 (61.34%)✅ (view plot)278.00 (-0.98%)290.04 (95.85%)
get_subscribe✅ (view plot)8,072.00 (+0.79%)8,361.80 (96.53%)✅ (view plot)2,848.00 (+0.40%)2,964.77 (96.06%)✅ (view plot)3,982.00 (+0.42%)4,136.99 (96.25%)✅ (view plot)13.00 (+0.24%)23.26 (55.88%)✅ (view plot)115.00 (+1.17%)119.63 (96.13%)
serialize_authorize✅ (view plot)12,282.00 (+0.22%)12,636.18 (97.20%)✅ (view plot)5,343.00 (+0.45%)5,453.56 (97.97%)✅ (view plot)7,462.00 (+0.58%)7,604.05 (98.13%)✅ (view plot)5.00 (-45.92%)14.99 (33.35%)✅ (view plot)137.00 (+0.12%)143.66 (95.36%)
serialize_deserialize_authorize✅ (view plot)24,847.00 (+0.97%)25,136.89 (98.85%)✅ (view plot)9,920.00 (+0.24%)10,054.38 (98.66%)✅ (view plot)14,022.00 (+0.39%)14,199.73 (98.75%)✅ (view plot)30.00 (-14.75%)44.49 (67.43%)✅ (view plot)305.00 (+2.02%)312.98 (97.45%)
serialize_deserialize_handle_authorize✅ (view plot)30,393.00 (+0.45%)30,711.64 (98.96%)✅ (view plot)12,097.00 (+0.06%)12,228.16 (98.93%)✅ (view plot)17,143.00 (+0.15%)17,309.81 (99.04%)✅ (view plot)53.00 (-5.73%)68.67 (77.19%)✅ (view plot)371.00 (+0.98%)380.36 (97.54%)
serialize_deserialize_handle_submit✅ (view plot)126,501.00 (+0.04%)127,171.50 (99.47%)✅ (view plot)73,363.00 (+0.12%)73,675.19 (99.58%)✅ (view plot)105,196.00 (+0.15%)105,621.84 (99.60%)✅ (view plot)110.00 (-0.38%)142.49 (77.20%)✅ (view plot)593.00 (-0.51%)604.62 (98.08%)
serialize_deserialize_handle_subscribe✅ (view plot)27,957.00 (+0.91%)28,565.89 (97.87%)✅ (view plot)9,666.00 (+0.21%)9,780.00 (98.83%)✅ (view plot)13,677.00 (+0.24%)13,830.76 (98.89%)✅ (view plot)63.00 (-1.34%)75.84 (83.07%)✅ (view plot)399.00 (+1.63%)415.50 (96.03%)
serialize_deserialize_submit✅ (view plot)115,399.00 (+0.19%)115,893.89 (99.57%)✅ (view plot)68,223.00 (+0.20%)68,476.79 (99.63%)✅ (view plot)97,939.00 (+0.24%)98,290.30 (99.64%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)490.00 (-0.04%)498.93 (98.21%)
serialize_deserialize_subscribe✅ (view plot)23,393.00 (+1.15%)23,979.52 (97.55%)✅ (view plot)8,225.00 (+0.30%)8,335.64 (98.67%)✅ (view plot)11,593.00 (+0.37%)11,737.74 (98.77%)✅ (view plot)36.00 (-4.99%)45.20 (79.64%)✅ (view plot)332.00 (+2.04%)347.33 (95.59%)
serialize_submit✅ (view plot)99,849.00 (-0.03%)100,546.24 (99.31%)✅ (view plot)61,566.00 (+0.09%)61,847.21 (99.55%)✅ (view plot)88,354.00 (+0.11%)88,730.09 (99.58%)✅ (view plot)45.00 (-8.37%)70.78 (63.58%)✅ (view plot)322.00 (-0.91%)333.37 (96.59%)
serialize_subscribe✅ (view plot)11,401.00 (+0.14%)11,760.95 (96.94%)✅ (view plot)4,195.00 (+0.27%)4,311.77 (97.29%)✅ (view plot)5,841.00 (+0.32%)5,993.98 (97.45%)✅ (view plot)13.00 (-5.26%)22.28 (58.36%)✅ (view plot)157.00 (+0.02%)164.51 (95.44%)

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

@rrybarczyk rrybarczyk force-pushed the doc-noise-sv2 branch 3 times, most recently from 5596727 to 5027e63 Compare September 12, 2024 19:06
Copy link
Contributor

🐰Bencher

ReportThu, September 12, 2024 at 20:02:03 UTC
ProjectStratum V2 (SRI)
Branch1111/merge@7ab9dff1-9574-402f-ad6e-26b681474f8e
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)2,129.00 (+2.55%)2,206.76 (96.48%)✅ (view plot)473.00 (+0.23%)491.06 (96.32%)✅ (view plot)734.00 (+0.01%)762.27 (96.29%)✅ (view plot)6.00 (+0.96%)14.43 (41.57%)✅ (view plot)39.00 (+4.01%)41.15 (94.77%)
client_sv2_handle_message_mining✅ (view plot)8,158.00 (-0.51%)8,353.18 (97.66%)✅ (view plot)2,137.00 (+0.17%)2,180.60 (98.00%)✅ (view plot)3,163.00 (+0.28%)3,230.38 (97.91%)✅ (view plot)33.00 (-9.96%)45.49 (72.54%)✅ (view plot)138.00 (-0.67%)142.40 (96.91%)
client_sv2_mining_message_submit_standard✅ (view plot)6,285.00 (+0.10%)6,417.79 (97.93%)✅ (view plot)1,750.00 (-0.02%)1,768.45 (98.96%)✅ (view plot)2,550.00 (-0.14%)2,581.32 (98.79%)✅ (view plot)19.00 (+11.44%)24.90 (76.31%)✅ (view plot)104.00 (+0.01%)107.80 (96.47%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,628.00 (-0.80%)15,059.45 (97.14%)✅ (view plot)4,694.00 (-0.01%)4,712.45 (99.61%)✅ (view plot)6,763.00 (+0.08%)6,784.47 (99.68%)✅ (view plot)40.00 (-9.92%)55.29 (72.34%)✅ (view plot)219.00 (-1.30%)230.59 (94.97%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,468.00 (-0.12%)27,895.83 (98.47%)✅ (view plot)10,585.00 (+0.18%)10,639.06 (99.49%)✅ (view plot)15,403.00 (+0.18%)15,481.57 (99.49%)✅ (view plot)82.00 (+0.28%)90.47 (90.63%)✅ (view plot)333.00 (-0.53%)345.99 (96.25%)
client_sv2_open_channel✅ (view plot)4,413.00 (-0.22%)4,672.19 (94.45%)✅ (view plot)1,461.00 (+0.03%)1,478.29 (98.83%)✅ (view plot)2,158.00 (+0.04%)2,186.27 (98.71%)✅ (view plot)10.00 (+1.91%)18.57 (53.86%)✅ (view plot)63.00 (-0.53%)69.95 (90.07%)
client_sv2_open_channel_serialize✅ (view plot)13,996.00 (-0.80%)14,532.03 (96.31%)✅ (view plot)5,064.00 (+0.01%)5,081.29 (99.66%)✅ (view plot)7,331.00 (+0.11%)7,354.01 (99.69%)✅ (view plot)31.00 (-12.22%)43.87 (70.66%)✅ (view plot)186.00 (-1.51%)200.85 (92.61%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,695.00 (+0.26%)23,037.38 (98.51%)✅ (view plot)8,027.00 (+0.24%)8,079.25 (99.35%)✅ (view plot)11,675.00 (+0.22%)11,755.76 (99.31%)✅ (view plot)76.00 (+3.21%)85.17 (89.23%)✅ (view plot)304.00 (+0.20%)314.97 (96.52%)
client_sv2_setup_connection✅ (view plot)4,703.00 (+0.33%)4,784.44 (98.30%)✅ (view plot)1,502.00 (+0.03%)1,519.29 (98.86%)✅ (view plot)2,278.00 (+0.02%)2,305.34 (98.81%)✅ (view plot)9.00 (-1.95%)15.78 (57.02%)✅ (view plot)68.00 (+0.67%)70.28 (96.75%)
client_sv2_setup_connection_serialize✅ (view plot)16,132.00 (-0.41%)16,516.33 (97.67%)✅ (view plot)5,963.00 (+0.01%)5,980.29 (99.71%)✅ (view plot)8,667.00 (+0.08%)8,693.02 (99.70%)✅ (view plot)37.00 (-10.61%)55.03 (67.24%)✅ (view plot)208.00 (-0.69%)217.91 (95.45%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,526.00 (-0.06%)35,783.24 (99.28%)✅ (view plot)14,855.00 (+0.14%)14,908.31 (99.64%)✅ (view plot)21,821.00 (+0.14%)21,911.22 (99.59%)✅ (view plot)95.00 (+0.63%)116.19 (81.76%)✅ (view plot)378.00 (-0.41%)385.14 (98.15%)

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

Copy link
Contributor

🐰Bencher

ReportThu, September 12, 2024 at 20:27:32 UTC
ProjectStratum V2 (SRI)
Branch1111/merge@aeec1a1e-5b98-4aa5-948b-8636c290d3ef
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.00 (-1.56%)46.72 (94.17%)
client_sv2_handle_message_mining✅ (view plot)74.99 (-0.15%)91.60 (81.87%)
client_sv2_mining_message_submit_standard✅ (view plot)14.66 (-0.10%)14.81 (98.97%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)273.57 (+2.00%)291.63 (93.81%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)602.09 (+1.54%)650.74 (92.52%)
client_sv2_open_channel✅ (view plot)163.16 (-1.63%)177.60 (91.87%)
client_sv2_open_channel_serialize✅ (view plot)270.73 (-2.26%)307.36 (88.08%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)374.10 (-0.91%)458.97 (81.51%)
client_sv2_setup_connection✅ (view plot)165.37 (+2.06%)186.03 (88.89%)
client_sv2_setup_connection_serialize✅ (view plot)448.45 (-1.90%)568.35 (78.90%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)966.09 (-3.21%)1,162.03 (83.14%)

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

Copy link
Contributor

🐰Bencher

ReportThu, September 12, 2024 at 20:27:32 UTC
ProjectStratum V2 (SRI)
Branch1111/merge@263eff3b-6876-4cec-8b0c-80d3afadef67
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,507.00 (+0.72%)8,795.73 (96.72%)✅ (view plot)3,772.00 (+0.63%)3,882.56 (97.15%)✅ (view plot)5,297.00 (+0.76%)5,441.67 (97.34%)✅ (view plot)5.00 (-28.81%)11.60 (43.10%)✅ (view plot)91.00 (+0.99%)95.35 (95.44%)
get_submit✅ (view plot)95,460.00 (-0.02%)96,204.46 (99.23%)✅ (view plot)59,522.00 (+0.09%)59,798.47 (99.54%)✅ (view plot)85,510.00 (+0.11%)85,877.93 (99.57%)✅ (view plot)44.00 (-8.20%)71.73 (61.34%)✅ (view plot)278.00 (-0.98%)290.04 (95.85%)
get_subscribe✅ (view plot)8,072.00 (+0.79%)8,361.80 (96.53%)✅ (view plot)2,848.00 (+0.40%)2,964.77 (96.06%)✅ (view plot)3,982.00 (+0.42%)4,136.99 (96.25%)✅ (view plot)13.00 (+0.24%)23.26 (55.88%)✅ (view plot)115.00 (+1.17%)119.63 (96.13%)
serialize_authorize✅ (view plot)12,282.00 (+0.22%)12,636.18 (97.20%)✅ (view plot)5,343.00 (+0.45%)5,453.56 (97.97%)✅ (view plot)7,462.00 (+0.58%)7,604.05 (98.13%)✅ (view plot)5.00 (-45.92%)14.99 (33.35%)✅ (view plot)137.00 (+0.12%)143.66 (95.36%)
serialize_deserialize_authorize✅ (view plot)24,847.00 (+0.97%)25,136.89 (98.85%)✅ (view plot)9,920.00 (+0.24%)10,054.38 (98.66%)✅ (view plot)14,022.00 (+0.39%)14,199.73 (98.75%)✅ (view plot)30.00 (-14.75%)44.49 (67.43%)✅ (view plot)305.00 (+2.02%)312.98 (97.45%)
serialize_deserialize_handle_authorize✅ (view plot)30,393.00 (+0.45%)30,711.64 (98.96%)✅ (view plot)12,097.00 (+0.06%)12,228.16 (98.93%)✅ (view plot)17,143.00 (+0.15%)17,309.81 (99.04%)✅ (view plot)53.00 (-5.73%)68.67 (77.19%)✅ (view plot)371.00 (+0.98%)380.36 (97.54%)
serialize_deserialize_handle_submit✅ (view plot)126,501.00 (+0.04%)127,171.50 (99.47%)✅ (view plot)73,363.00 (+0.12%)73,675.19 (99.58%)✅ (view plot)105,196.00 (+0.15%)105,621.84 (99.60%)✅ (view plot)110.00 (-0.38%)142.49 (77.20%)✅ (view plot)593.00 (-0.51%)604.62 (98.08%)
serialize_deserialize_handle_subscribe✅ (view plot)27,957.00 (+0.91%)28,565.89 (97.87%)✅ (view plot)9,666.00 (+0.21%)9,780.00 (98.83%)✅ (view plot)13,677.00 (+0.24%)13,830.76 (98.89%)✅ (view plot)63.00 (-1.34%)75.84 (83.07%)✅ (view plot)399.00 (+1.63%)415.50 (96.03%)
serialize_deserialize_submit✅ (view plot)115,399.00 (+0.19%)115,893.89 (99.57%)✅ (view plot)68,223.00 (+0.20%)68,476.79 (99.63%)✅ (view plot)97,939.00 (+0.24%)98,290.30 (99.64%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)490.00 (-0.04%)498.93 (98.21%)
serialize_deserialize_subscribe✅ (view plot)23,393.00 (+1.15%)23,979.52 (97.55%)✅ (view plot)8,225.00 (+0.30%)8,335.64 (98.67%)✅ (view plot)11,593.00 (+0.37%)11,737.74 (98.77%)✅ (view plot)36.00 (-4.99%)45.20 (79.64%)✅ (view plot)332.00 (+2.04%)347.33 (95.59%)
serialize_submit✅ (view plot)99,849.00 (-0.03%)100,546.24 (99.31%)✅ (view plot)61,566.00 (+0.09%)61,847.21 (99.55%)✅ (view plot)88,354.00 (+0.11%)88,730.09 (99.58%)✅ (view plot)45.00 (-8.37%)70.78 (63.58%)✅ (view plot)322.00 (-0.91%)333.37 (96.59%)
serialize_subscribe✅ (view plot)11,401.00 (+0.14%)11,760.95 (96.94%)✅ (view plot)4,195.00 (+0.27%)4,311.77 (97.29%)✅ (view plot)5,841.00 (+0.32%)5,993.98 (97.45%)✅ (view plot)13.00 (-5.26%)22.28 (58.36%)✅ (view plot)157.00 (+0.02%)164.51 (95.44%)

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

Copy link
Collaborator

@rrybarczyk rrybarczyk left a comment

Choose a reason for hiding this comment

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

Looking good. I added a few commits to add type linking supported by cargo docs and also added the module comments in lib.rs. Let's get a couple other team members approval, then we can implement any feedback and merge.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Fi3 I cannot find any instance of the use of the into_aesg and into_chacha methods in the CipherState<Cipher_: AeadCipher> implementation. Should these be removed? If they need to stay, can you help me understand when/how they should be used?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is another into_aesg method in the impl GenericCipher block. It has the [allow(dead_code)] decorator, should this be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree. The documentation should belong to the trait itself, not the implementation. Again reiterating, that there may be exceptions to this rule, however this is not an exception case.

@@ -17,22 +79,47 @@ use secp256k1::{ellswift::ElligatorSwift, Keypair, Secp256k1, SecretKey};

const VERSION: u16 = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const VERSION: u16 = 0;
/// Version of the certificate format.
const VERSION: u16 = 0;

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to change the var name to CERTIFICATE_FORMAT_VERSION and not add docs. wdyt @rrybarczyk ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Note that there are several error variants here that I cannot find uses of in the codebase. I did my best to make comments for them for the sake completeness and listed them in this comment in our #1130 tech debt tracker issue.

Copy link
Contributor

🐰Bencher

ReportThu, September 12, 2024 at 21:08:28 UTC
ProjectStratum V2 (SRI)
Branch1111/merge@f3c602a5-14aa-4042-bcaf-a067bcb46762
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,443.00 (-0.03%)8,794.80 (96.00%)✅ (view plot)3,772.00 (+0.63%)3,882.56 (97.15%)✅ (view plot)5,298.00 (+0.78%)5,441.69 (97.36%)✅ (view plot)6.00 (-14.67%)11.58 (51.80%)✅ (view plot)89.00 (-1.22%)95.33 (93.36%)
get_submit✅ (view plot)95,396.00 (-0.09%)96,204.31 (99.16%)✅ (view plot)59,522.00 (+0.09%)59,798.47 (99.54%)✅ (view plot)85,511.00 (+0.11%)85,877.95 (99.57%)✅ (view plot)45.00 (-6.13%)71.73 (62.74%)✅ (view plot)276.00 (-1.69%)290.08 (95.14%)
get_subscribe✅ (view plot)8,008.00 (+0.00%)8,360.84 (95.78%)✅ (view plot)2,848.00 (+0.40%)2,964.77 (96.06%)✅ (view plot)3,983.00 (+0.45%)4,137.00 (96.28%)✅ (view plot)14.00 (+7.89%)23.27 (60.15%)✅ (view plot)113.00 (-0.57%)119.61 (94.48%)
serialize_authorize✅ (view plot)12,218.00 (-0.29%)12,635.73 (96.69%)✅ (view plot)5,343.00 (+0.45%)5,453.56 (97.97%)✅ (view plot)7,463.00 (+0.59%)7,604.08 (98.14%)✅ (view plot)6.00 (-35.16%)14.95 (40.14%)✅ (view plot)135.00 (-1.33%)143.66 (93.97%)
serialize_deserialize_authorize✅ (view plot)24,783.00 (+0.72%)25,134.39 (98.60%)✅ (view plot)9,920.00 (+0.24%)10,054.38 (98.66%)✅ (view plot)14,023.00 (+0.40%)14,199.76 (98.76%)✅ (view plot)31.00 (-11.93%)44.46 (69.73%)✅ (view plot)303.00 (+1.35%)312.91 (96.83%)
serialize_deserialize_handle_authorize✅ (view plot)30,329.00 (+0.24%)30,709.97 (98.76%)✅ (view plot)12,097.00 (+0.06%)12,228.16 (98.93%)✅ (view plot)17,144.00 (+0.16%)17,309.83 (99.04%)✅ (view plot)54.00 (-3.97%)68.66 (78.65%)✅ (view plot)369.00 (+0.44%)380.31 (97.03%)
serialize_deserialize_handle_submit✅ (view plot)126,501.00 (+0.04%)127,171.50 (99.47%)✅ (view plot)73,363.00 (+0.12%)73,675.19 (99.58%)✅ (view plot)105,196.00 (+0.15%)105,621.84 (99.60%)✅ (view plot)110.00 (-0.38%)142.49 (77.20%)✅ (view plot)593.00 (-0.51%)604.62 (98.08%)
serialize_deserialize_handle_subscribe✅ (view plot)27,893.00 (+0.68%)28,564.08 (97.65%)✅ (view plot)9,666.00 (+0.21%)9,780.00 (98.83%)✅ (view plot)13,678.00 (+0.25%)13,830.78 (98.90%)✅ (view plot)64.00 (+0.21%)75.84 (84.38%)✅ (view plot)397.00 (+1.13%)415.44 (95.56%)
serialize_deserialize_submit✅ (view plot)115,399.00 (+0.19%)115,893.89 (99.57%)✅ (view plot)68,223.00 (+0.20%)68,476.79 (99.63%)✅ (view plot)97,939.00 (+0.24%)98,290.30 (99.64%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)490.00 (-0.04%)498.93 (98.21%)
serialize_deserialize_subscribe✅ (view plot)23,329.00 (+0.87%)23,977.62 (97.29%)✅ (view plot)8,225.00 (+0.30%)8,335.64 (98.67%)✅ (view plot)11,594.00 (+0.37%)11,737.76 (98.78%)✅ (view plot)37.00 (-2.37%)45.20 (81.87%)✅ (view plot)330.00 (+1.43%)347.27 (95.03%)
serialize_submit✅ (view plot)99,785.00 (-0.09%)100,546.18 (99.24%)✅ (view plot)61,566.00 (+0.09%)61,847.21 (99.55%)✅ (view plot)88,355.00 (+0.11%)88,730.12 (99.58%)✅ (view plot)46.00 (-6.35%)70.78 (64.99%)✅ (view plot)320.00 (-1.52%)333.43 (95.97%)
serialize_subscribe✅ (view plot)11,337.00 (-0.42%)11,760.66 (96.40%)✅ (view plot)4,195.00 (+0.27%)4,311.77 (97.29%)✅ (view plot)5,842.00 (+0.34%)5,994.00 (97.46%)✅ (view plot)14.00 (+1.97%)22.28 (62.83%)✅ (view plot)155.00 (-1.25%)164.51 (94.22%)

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

Copy link
Contributor

@jbesraa jbesraa left a comment

Choose a reason for hiding this comment

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

This looks very promising. Added few comments as I was able to review just a couple of files, will deep dive into the rest when I have a minute.

@@ -1,3 +1,70 @@
//! # Noise NX Protocol Initiator
Copy link
Contributor

Choose a reason for hiding this comment

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

What is NX?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For noise protocol, we have a number of different handshake patterns. NX is the one we are using.

//! # Noise NX Protocol Initiator
//!
//! This module manages the state and operations of the initiator within the Noise NX protocol.
//! This struct plays a crucial role in the cryptographic handshake, establishing a secure
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not clear to which struct this is referring to. Maybe we should have the initial documentation general and not specific to any struct in the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not pointing to any struct, just a general module level overview.

@@ -274,6 +379,8 @@ impl Initiator {
}
}
impl Drop for Initiator {
/// Ensures that sensitive data is securely erased when the [`Initiator`] instance is dropped,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should remove this. The docs on the erase function and on the Drop trait are enough IMO

@@ -252,6 +351,12 @@ impl Initiator {
}
}

/// Securely erases sensitive data in the initiator's memory.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Securely erases sensitive data in the initiator's memory.
/// Securely erases sensitive data from the [`Initiator`] memory.

///
/// Clears all sensitive cryptographic material within the [`Initiator`] to prevent any
/// accidental leakage or misuse. It overwrites the stored keys, chaining key, handshake hash,
/// and session ciphers with zeros or other non-sensitive values. This method is typically
Copy link
Contributor

Choose a reason for hiding this comment

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

what is or other non-sensitive-values?

handshake_cipher: Option<ChaCha20Poly1305>,
/// Optional static key used in the handshake. This key may be derived from the pre-shared key
/// (PSK) or generated during the handshake.
k: Option<[u8; 32]>,
Copy link
Contributor

Choose a reason for hiding this comment

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

here and in the initiator (very) short names are used for the variables. wdyt about using full names here and else-where, even if its too long? that should be a task for the refactor phase though if we agree on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are going by the noise protocol naming convention.

///
/// The [`AeadCipher`] trait provides a standard interface for initializing AEAD ciphers, and for
/// performing encryption and decryption operations with additional AAD. This trait is implemented
/// by either the [`ChaCha20Poly1305`] or [`Aes256Gcm`] specific cipher types, allowing them to be
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// by either the [`ChaCha20Poly1305`] or [`Aes256Gcm`] specific cipher types, allowing them to be
/// by both the ChaCha20Poly1305 and Aes256Gcm, allowing them to be

I think both of them implement the trait right? also I dont think we should link to crates outside of our project, unless maybe if its top of the file documentation or something else that is more general

/// Defines the interface for AEAD ciphers.
///
/// The [`AeadCipher`] trait provides a standard interface for initializing AEAD ciphers, and for
/// performing encryption and decryption operations with additional AAD. This trait is implemented
Copy link
Contributor

Choose a reason for hiding this comment

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

What is AAD?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Authenticated Associated data

/// used interchangeably in cryptographic protocols. It is utilized by the
/// [`crate::handshake::HandshakeOp`] trait to secure the handshake process.
///
/// The `T: Buffer` represents the data buffer to be encrypted or decrypted. The buffer must
Copy link
Contributor

Choose a reason for hiding this comment

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

This is decrypt/encrypt functions specific and not in trait level, so maybe it should be moved(duplicated) above each function

///
/// The `T: Buffer` represents the data buffer to be encrypted or decrypted. The buffer must
/// implement the [`Buffer`] trait, which provides necessary operations for in-place encryption and
/// decryption.
pub trait AeadCipher {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Fi3 whats the goal behind this trait and then implementing it for ChaChaPoly1305 if the ChaCha.. already have some AEAD traits implemented for it https://docs.rs/chacha20poly1305/latest/src/chacha20poly1305/lib.rs.html#241 which is used in our implementation without any changes https://github.com/stratum-mining/stratum/pull/1111/files#diff-af2c2f10de68656c4249abc945c50c903ccfcd35bf169ce3a4779f1c4e5245e1L33?

Comment on lines +220 to +224
/// Creates a new [`Initiator`] without specifying a responder's public key.
/// This function initializes the [`Initiator`] with a default empty state.
pub fn without_pk() -> Result<Box<Self>, Error> {
Ok(Self::new(None))
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should elaborate more here to let the user know under which circumstances this could be useful

according to @Fi3 via #916 (comment):

we do not check the certificate. So you still have an encrypted connection but you don't authenticate the upstream

For example when you connect to a TP that you run locally

Copy link
Contributor Author

@Shourya742 Shourya742 Sep 20, 2024

Choose a reason for hiding this comment

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

These are used when we want encrypted connection but without any authentication.

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.

Need Rust docs on protocols::v2::noise-sv2
6 participants