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 for protocols::v2::codec-sv2 #1040

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

rrybarczyk
Copy link
Collaborator

Addresses #1012.

See discussion for potential code debt discovered during this documentation effort in this discussion.

@rrybarczyk rrybarczyk added documentation Improvements or additions to documentation protocols Lowest level protocol logic codec-sv2 labels Jul 5, 2024
@rrybarczyk rrybarczyk self-assigned this Jul 5, 2024
Copy link
Contributor

github-actions bot commented Jul 5, 2024

🐰Bencher

ReportMon, September 2, 2024 at 20:22:49 UTC
ProjectStratum V2 (SRI)
Branch2024-07-rust-docs-protocols-codec-sv2
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
serialize_deserialize_authorizeEstimated Cycles (estimated cycles)🚨 (view plot | view alert)24,927.00 (+1.49%)24,206.64 (97.11%)24,913.90 (100.05%)
serialize_deserialize_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)307.00 (+3.19%)288.70 (94.04%)306.32 (100.22%)

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.28%)8,153.47 (95.42%)8,720.11 (97.99%)✅ (view plot)3,772.00 (+0.70%)3,634.67 (96.36%)3,857.19 (97.79%)✅ (view plot)5,295.00 (+0.79%)5,101.37 (96.34%)5,405.81 (97.95%)✅ (view plot)6.00 (-19.03%)4.33 (72.09%)10.49 (57.17%)✅ (view plot)92.00 (+2.35%)85.82 (93.29%)93.96 (97.92%)
get_submit✅ (view plot)95,446.00 (-0.06%)94,913.91 (99.44%)96,096.63 (99.32%)✅ (view plot)59,522.00 (+0.09%)59,195.97 (99.45%)59,741.21 (99.63%)✅ (view plot)85,506.00 (+0.11%)85,028.36 (99.44%)85,792.18 (99.67%)✅ (view plot)49.00 (-1.67%)33.11 (67.56%)66.55 (73.62%)✅ (view plot)277.00 (-1.53%)274.27 (99.01%)288.35 (96.06%)
get_subscribe✅ (view plot)8,064.00 (+0.80%)7,708.23 (95.59%)8,291.99 (97.25%)✅ (view plot)2,848.00 (+0.48%)2,727.45 (95.77%)2,941.41 (96.82%)✅ (view plot)3,984.00 (+0.56%)3,819.02 (95.86%)4,104.50 (97.06%)✅ (view plot)11.00 (-20.29%)6.44 (58.50%)21.16 (51.97%)✅ (view plot)115.00 (+1.40%)108.67 (94.49%)118.15 (97.33%)
serialize_authorize✅ (view plot)12,328.00 (+0.71%)11,929.90 (96.77%)12,551.72 (98.22%)✅ (view plot)5,343.00 (+0.49%)5,205.67 (97.43%)5,428.19 (98.43%)✅ (view plot)7,458.00 (+0.57%)7,263.39 (97.39%)7,568.13 (98.54%)✅ (view plot)8.00 (-17.10%)5.58 (69.71%)13.72 (58.29%)✅ (view plot)138.00 (+1.11%)131.13 (95.03%)141.83 (97.30%)
serialize_deserialize_authorize🚨 (view plot | view alert)24,927.00 (+1.49%)24,206.64 (97.11%)24,913.90 (100.05%)✅ (view plot)9,920.00 (+0.22%)9,768.28 (98.47%)10,027.26 (98.93%)✅ (view plot)14,017.00 (+0.35%)13,778.95 (98.30%)14,156.79 (99.01%)✅ (view plot)33.00 (-8.10%)29.45 (89.24%)42.37 (77.89%)🚨 (view plot | view alert)307.00 (+3.19%)288.70 (94.04%)306.32 (100.22%)
serialize_deserialize_handle_authorize✅ (view plot)30,469.00 (+0.82%)29,894.91 (98.12%)30,546.91 (99.74%)✅ (view plot)12,097.00 (+0.04%)11,977.17 (99.01%)12,206.69 (99.10%)✅ (view plot)17,139.00 (+0.13%)16,957.41 (98.94%)17,277.01 (99.20%)✅ (view plot)55.00 (-4.55%)50.62 (92.04%)64.62 (85.12%)✅ (view plot)373.00 (+1.87%)357.54 (95.85%)374.78 (99.52%)
serialize_deserialize_handle_submit✅ (view plot)126,493.00 (+0.03%)125,849.44 (99.49%)127,048.44 (99.56%)✅ (view plot)73,363.00 (+0.13%)72,936.74 (99.42%)73,594.74 (99.69%)✅ (view plot)105,198.00 (+0.17%)104,554.39 (99.39%)105,494.69 (99.72%)✅ (view plot)108.00 (-4.20%)89.52 (82.89%)135.96 (79.44%)✅ (view plot)593.00 (-0.51%)589.45 (99.40%)602.59 (98.41%)
serialize_deserialize_handle_subscribe✅ (view plot)28,017.00 (+1.42%)27,028.27 (96.47%)28,222.83 (99.27%)✅ (view plot)9,666.00 (+0.26%)9,530.92 (98.60%)9,751.54 (99.12%)✅ (view plot)13,677.00 (+0.29%)13,484.65 (98.59%)13,789.05 (99.19%)✅ (view plot)61.00 (-5.86%)56.48 (92.59%)73.12 (83.42%)✅ (view plot)401.00 (+2.71%)374.87 (93.48%)405.97 (98.78%)
serialize_deserialize_submit✅ (view plot)115,445.00 (+0.26%)114,585.31 (99.26%)115,713.37 (99.77%)✅ (view plot)68,223.00 (+0.22%)67,764.76 (99.33%)68,386.64 (99.76%)✅ (view plot)97,935.00 (+0.26%)97,226.40 (99.28%)98,144.58 (99.79%)✅ (view plot)65.00 (-0.34%)52.21 (80.32%)78.23 (83.09%)✅ (view plot)491.00 (+0.28%)483.01 (98.37%)496.29 (98.93%)
serialize_deserialize_subscribe✅ (view plot)23,469.00 (+1.82%)22,460.61 (95.70%)23,637.77 (99.29%)✅ (view plot)8,225.00 (+0.36%)8,084.52 (98.29%)8,306.70 (99.02%)✅ (view plot)11,589.00 (+0.39%)11,391.49 (98.30%)11,696.39 (99.08%)✅ (view plot)38.00 (-0.78%)32.84 (86.42%)43.76 (86.84%)✅ (view plot)334.00 (+3.33%)308.38 (92.33%)338.12 (98.78%)
serialize_submit✅ (view plot)99,839.00 (-0.05%)99,337.55 (99.50%)100,448.19 (99.39%)✅ (view plot)61,566.00 (+0.09%)61,236.42 (99.46%)61,789.36 (99.64%)✅ (view plot)88,349.00 (+0.11%)87,865.63 (99.45%)88,643.51 (99.67%)✅ (view plot)51.00 (+0.04%)36.48 (71.54%)65.48 (77.89%)✅ (view plot)321.00 (-1.30%)318.89 (99.34%)331.59 (96.80%)
serialize_subscribe✅ (view plot)11,405.00 (+0.24%)11,066.10 (97.03%)11,688.16 (97.58%)✅ (view plot)4,195.00 (+0.32%)4,074.45 (97.13%)4,288.41 (97.82%)✅ (view plot)5,840.00 (+0.37%)5,675.91 (97.19%)5,961.55 (97.96%)✅ (view plot)14.00 (-3.45%)8.77 (62.65%)20.23 (69.21%)✅ (view plot)157.00 (+0.17%)150.67 (95.97%)162.81 (96.43%)

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

Copy link
Contributor

github-actions bot commented Jul 5, 2024

🐰Bencher

ReportThu, September 12, 2024 at 21:41:43 UTC
ProjectStratum V2 (SRI)
Branch1040/merge
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,712.00 (-1.66%)7,563.44 (88.74%)
client-submit-serialize-deserialize✅ (view plot)7,583.90 (-3.17%)8,777.30 (86.40%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,341.60 (-0.84%)9,232.30 (90.35%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)918.39 (+0.31%)983.70 (93.36%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)717.71 (+0.24%)765.77 (93.72%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)245.87 (-1.62%)263.19 (93.42%)
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)157.53 (-0.18%)166.50 (94.61%)
client-sv1-get-submit✅ (view plot)6,600.30 (-0.13%)7,292.74 (90.51%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)281.13 (+1.81%)300.99 (93.40%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)762.15 (-0.65%)830.33 (91.79%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)627.66 (-0.01%)682.57 (91.95%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)205.75 (-1.41%)226.64 (90.78%)

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

Copy link
Contributor

github-actions bot commented Jul 5, 2024

🐰Bencher

ReportMon, September 2, 2024 at 20:22:48 UTC
ProjectStratum V2 (SRI)
Branch2024-07-rust-docs-protocols-codec-sv2
Testbedsv2

🚨 1 ALERT: Threshold Boundary Limit exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_handle_message_miningL2 Accesses (accesses)🚨 (view plot | view alert)29.00 (-21.22%)29.68 (102.34%)43.95 (65.99%)

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)2,121.00 (+2.58%)1,973.14 (93.03%)2,162.03 (98.10%)✅ (view plot)473.00 (+0.34%)457.16 (96.65%)485.63 (97.40%)✅ (view plot)736.00 (+0.38%)711.65 (96.69%)754.77 (97.51%)✅ (view plot)4.00 (-35.46%)-0.64 (-15.95%)13.03 (30.69%)✅ (view plot)39.00 (+4.73%)34.62 (88.77%)39.86 (97.85%)
client_sv2_handle_message_mining✅ (view plot)8,142.00 (-0.74%)8,077.36 (99.21%)8,328.08 (97.77%)✅ (view plot)2,137.00 (+0.22%)2,092.51 (97.92%)2,172.03 (98.39%)✅ (view plot)3,167.00 (+0.46%)3,088.34 (97.52%)3,216.79 (98.45%)🚨 (view plot | view alert)29.00 (-21.22%)29.68 (102.34%)43.95 (65.99%)✅ (view plot)138.00 (-0.74%)136.23 (98.71%)141.84 (97.30%)
client_sv2_mining_message_submit_standard✅ (view plot)6,273.00 (-0.11%)6,169.78 (98.35%)6,390.53 (98.16%)✅ (view plot)1,750.00 (-0.01%)1,736.65 (99.24%)1,763.68 (99.22%)✅ (view plot)2,553.00 (-0.02%)2,532.19 (99.18%)2,574.89 (99.15%)✅ (view plot)16.00 (-7.25%)11.10 (69.39%)23.40 (68.38%)✅ (view plot)104.00 (-0.01%)101.00 (97.12%)107.02 (97.18%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,696.00 (-0.48%)14,527.60 (98.85%)15,005.09 (97.94%)✅ (view plot)4,694.00 (-0.00%)4,680.65 (99.72%)4,707.68 (99.71%)✅ (view plot)6,761.00 (+0.07%)6,736.05 (99.63%)6,776.53 (99.77%)✅ (view plot)40.00 (-11.30%)36.84 (92.10%)53.35 (74.98%)✅ (view plot)221.00 (-0.64%)215.68 (97.59%)229.15 (96.44%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,554.00 (+0.17%)27,178.48 (98.64%)27,833.48 (99.00%)✅ (view plot)10,585.00 (+0.23%)10,505.88 (99.25%)10,615.29 (99.71%)✅ (view plot)15,404.00 (+0.24%)15,287.38 (99.24%)15,446.14 (99.73%)✅ (view plot)78.00 (-4.93%)75.03 (96.19%)89.06 (87.58%)✅ (view plot)336.00 (+0.26%)325.96 (97.01%)344.27 (97.60%)
client_sv2_open_channel✅ (view plot)4,405.00 (-0.80%)4,252.82 (96.55%)4,627.93 (95.18%)✅ (view plot)1,461.00 (+0.05%)1,447.23 (99.06%)1,473.23 (99.17%)✅ (view plot)2,160.00 (+0.22%)2,135.05 (98.84%)2,175.60 (99.28%)✅ (view plot)8.00 (-25.15%)4.87 (60.85%)16.51 (48.46%)✅ (view plot)63.00 (-1.19%)58.72 (93.21%)68.80 (91.57%)
client_sv2_open_channel_serialize✅ (view plot)13,996.00 (-1.07%)13,849.60 (98.95%)14,446.03 (96.88%)✅ (view plot)5,064.00 (+0.02%)5,050.23 (99.73%)5,076.23 (99.76%)✅ (view plot)7,331.00 (+0.13%)7,299.10 (99.56%)7,343.61 (99.83%)✅ (view plot)31.00 (-12.52%)28.92 (93.30%)41.95 (73.89%)✅ (view plot)186.00 (-2.09%)181.66 (97.66%)198.30 (93.80%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,653.00 (+0.04%)22,312.18 (98.50%)22,976.39 (98.59%)✅ (view plot)8,027.00 (+0.32%)7,948.53 (99.02%)8,054.76 (99.66%)✅ (view plot)11,678.00 (+0.32%)11,562.22 (99.01%)11,718.63 (99.65%)✅ (view plot)74.00 (+0.58%)64.20 (86.75%)82.95 (89.21%)✅ (view plot)303.00 (-0.29%)294.56 (97.21%)313.21 (96.74%)
client_sv2_setup_connection✅ (view plot)4,703.00 (+0.30%)4,614.13 (98.11%)4,763.45 (98.73%)✅ (view plot)1,502.00 (+0.05%)1,488.23 (99.08%)1,514.23 (99.19%)✅ (view plot)2,278.00 (+0.05%)2,256.09 (99.04%)2,297.54 (99.15%)✅ (view plot)9.00 (-4.11%)4.01 (44.60%)14.76 (60.99%)✅ (view plot)68.00 (+0.63%)65.45 (96.25%)69.70 (97.56%)
client_sv2_setup_connection_serialize✅ (view plot)16,174.00 (-0.27%)15,971.73 (98.75%)16,464.94 (98.23%)✅ (view plot)5,963.00 (+0.01%)5,949.23 (99.77%)5,975.23 (99.80%)✅ (view plot)8,664.00 (+0.06%)8,634.68 (99.66%)8,682.30 (99.79%)✅ (view plot)39.00 (-7.87%)31.93 (81.87%)52.74 (73.95%)✅ (view plot)209.00 (-0.45%)203.35 (97.30%)216.55 (96.51%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,612.00 (+0.19%)35,353.04 (99.27%)35,735.17 (99.66%)✅ (view plot)14,855.00 (+0.17%)14,774.84 (99.46%)14,883.31 (99.81%)✅ (view plot)21,822.00 (+0.19%)21,691.35 (99.40%)21,871.76 (99.77%)✅ (view plot)91.00 (-4.35%)77.20 (84.83%)113.07 (80.48%)✅ (view plot)381.00 (+0.36%)375.18 (98.47%)384.07 (99.20%)

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

Copy link
Contributor

github-actions bot commented Jul 5, 2024

🐰Bencher

ReportMon, September 2, 2024 at 20:22:48 UTC
ProjectStratum V2 (SRI)
Branch2024-07-rust-docs-protocols-codec-sv2
Testbedsv2

🚨 1 ALERT: Threshold Boundary Limit exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_open_channelLatency (nanoseconds (ns))🚨 (view plot | view alert)174.79 (+5.35%)158.95 (90.94%)172.88 (101.10%)

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)44.03 (-1.38%)43.52 (98.83%)45.78 (96.19%)
client_sv2_handle_message_mining✅ (view plot)74.48 (+0.73%)63.95 (85.86%)83.92 (88.75%)
client_sv2_mining_message_submit_standard✅ (view plot)14.66 (+0.00%)14.60 (99.61%)14.72 (99.62%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)252.28 (-5.34%)246.06 (97.54%)286.96 (87.92%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)593.52 (-0.09%)556.02 (93.68%)632.05 (93.90%)
client_sv2_open_channel🚨 (view plot | view alert)174.79 (+5.35%)158.95 (90.94%)172.88 (101.10%)
client_sv2_open_channel_serialize✅ (view plot)271.32 (-3.57%)265.77 (97.95%)296.93 (91.37%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)371.37 (-1.68%)323.67 (87.16%)431.74 (86.02%)
client_sv2_setup_connection✅ (view plot)154.61 (-5.41%)150.02 (97.03%)176.89 (87.40%)
client_sv2_setup_connection_serialize✅ (view plot)437.72 (-6.86%)412.04 (94.13%)527.89 (82.92%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)905.29 (-7.88%)879.40 (97.14%)1,086.14 (83.35%)

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

@plebhash

This comment was marked as resolved.

@rrybarczyk rrybarczyk linked an issue Jul 5, 2024 that may be closed by this pull request
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did not change any code here, but I did reorder to be in alphabetical order.

@jbesraa
Copy link
Contributor

jbesraa commented Jul 8, 2024

@rrybarczyk let me know when you want a review here

sv2_buffer: B,
}

#[cfg(feature = "noise_sv2")]
impl<'a, T: Serialize + GetSize + Deserialize<'a>, B: IsBuffer + AeadBuffer> WithNoise<B, T> {
/// Attempts to decode the next frame, returning either a frame or an error indicating how many
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can also return other kind of error. So it return either a frame, an error, or an error with missing bytes. I did it like that but I think that maybe here having and enum into the Ok and the error would have been a better interface. Not sure if make sense to change it now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also here an example would be nice. I just stop writing this but I think that when is possible we should add examples

@@ -157,17 +233,24 @@ impl<'a, T: Serialize + GetSize + Deserialize<'a>, B: IsBuffer + AeadBuffer> Wit
frame.into()
}

/// Provides a writable buffer for incoming data.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe I would add that the buffer have the right number of bytes needed by the codec to go to the next step. I would also add an example of how to use the returned buffer.

pub type StandardDecoder<T> = WithoutNoise<Buffer, T>;

/// Decoder for Sv2 frames with Noise protocol support.
Copy link
Collaborator

Choose a reason for hiding this comment

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

here we can add an example of how to create and use a codec. If is possible to do it vai a doc test would be fantastic.

#[inline]
pub fn writable(&mut self) -> &mut [u8] {
self.noise_buffer.get_writable(self.missing_noise_b)
}

/// Checks if the buffers are droppable.
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can link the Buffer trait docs (now is undocumented but as soon as we will document it we will have a meaningful link

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor

github-actions bot commented Sep 10, 2024

🐰Bencher

ReportThu, September 12, 2024 at 21:41:41 UTC
ProjectStratum V2 (SRI)
Branch1040/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,473.00 (+0.32%)8,795.13 (96.34%)✅ (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)5.00 (-28.81%)11.60 (43.10%)✅ (view plot)90.00 (-0.11%)95.33 (94.41%)
get_submit✅ (view plot)95,418.00 (-0.06%)96,204.32 (99.18%)✅ (view plot)59,522.00 (+0.09%)59,798.47 (99.54%)✅ (view plot)85,513.00 (+0.12%)85,878.00 (99.57%)✅ (view plot)42.00 (-12.34%)71.75 (58.54%)✅ (view plot)277.00 (-1.33%)290.06 (95.50%)
get_subscribe✅ (view plot)8,030.00 (+0.27%)8,361.07 (96.04%)✅ (view plot)2,848.00 (+0.40%)2,964.77 (96.06%)✅ (view plot)3,985.00 (+0.50%)4,137.04 (96.33%)✅ (view plot)11.00 (-15.07%)23.26 (47.29%)✅ (view plot)114.00 (+0.30%)119.61 (95.31%)
serialize_authorize✅ (view plot)12,248.00 (-0.05%)12,635.84 (96.93%)✅ (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)5.00 (-45.92%)14.99 (33.35%)✅ (view plot)136.00 (-0.60%)143.66 (94.67%)
serialize_deserialize_authorize✅ (view plot)24,805.00 (+0.80%)25,135.18 (98.69%)✅ (view plot)9,920.00 (+0.24%)10,054.38 (98.66%)✅ (view plot)14,025.00 (+0.41%)14,199.81 (98.77%)✅ (view plot)28.00 (-20.40%)44.58 (62.81%)✅ (view plot)304.00 (+1.69%)312.94 (97.14%)
serialize_deserialize_handle_authorize✅ (view plot)30,385.00 (+0.42%)30,711.39 (98.94%)✅ (view plot)12,097.00 (+0.06%)12,228.16 (98.93%)✅ (view plot)17,145.00 (+0.16%)17,309.85 (99.05%)✅ (view plot)51.00 (-9.26%)68.70 (74.23%)✅ (view plot)371.00 (+0.98%)380.36 (97.54%)
serialize_deserialize_handle_submit✅ (view plot)126,523.00 (+0.05%)127,171.81 (99.49%)✅ (view plot)73,363.00 (+0.12%)73,675.19 (99.58%)✅ (view plot)105,198.00 (+0.15%)105,621.90 (99.60%)✅ (view plot)107.00 (-3.08%)142.48 (75.10%)✅ (view plot)594.00 (-0.34%)604.60 (98.25%)
serialize_deserialize_handle_subscribe✅ (view plot)27,961.00 (+0.93%)28,566.02 (97.88%)✅ (view plot)9,666.00 (+0.21%)9,780.00 (98.83%)✅ (view plot)13,676.00 (+0.23%)13,830.74 (98.88%)✅ (view plot)64.00 (+0.21%)75.84 (84.38%)✅ (view plot)399.00 (+1.63%)415.50 (96.03%)
serialize_deserialize_submit✅ (view plot)115,387.00 (+0.18%)115,893.51 (99.56%)✅ (view plot)68,223.00 (+0.20%)68,476.79 (99.63%)✅ (view plot)97,942.00 (+0.25%)98,290.42 (99.65%)✅ (view plot)59.00 (-7.90%)81.97 (71.98%)✅ (view plot)490.00 (-0.04%)498.93 (98.21%)
serialize_deserialize_subscribe✅ (view plot)23,351.00 (+0.97%)23,978.23 (97.38%)✅ (view plot)8,225.00 (+0.30%)8,335.64 (98.67%)✅ (view plot)11,596.00 (+0.39%)11,737.82 (98.79%)✅ (view plot)34.00 (-10.23%)45.25 (75.14%)✅ (view plot)331.00 (+1.74%)347.30 (95.31%)
serialize_submit✅ (view plot)99,807.00 (-0.07%)100,546.15 (99.26%)✅ (view plot)61,566.00 (+0.09%)61,847.21 (99.55%)✅ (view plot)88,357.00 (+0.11%)88,730.16 (99.58%)✅ (view plot)43.00 (-12.42%)70.80 (60.73%)✅ (view plot)321.00 (-1.21%)333.39 (96.28%)
serialize_subscribe✅ (view plot)11,359.00 (-0.23%)11,760.66 (96.58%)✅ (view plot)4,195.00 (+0.27%)4,311.77 (97.29%)✅ (view plot)5,844.00 (+0.37%)5,994.03 (97.50%)✅ (view plot)11.00 (-19.75%)22.29 (49.34%)✅ (view plot)156.00 (-0.62%)164.50 (94.83%)

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

Copy link
Contributor

github-actions bot commented Sep 10, 2024

🐰Bencher

ReportThu, September 12, 2024 at 21:41:41 UTC
ProjectStratum V2 (SRI)
Branch1040/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,125.00 (+2.36%)2,206.60 (96.30%)✅ (view plot)473.00 (+0.23%)491.06 (96.32%)✅ (view plot)735.00 (+0.15%)762.28 (96.42%)✅ (view plot)5.00 (-15.75%)14.43 (34.65%)✅ (view plot)39.00 (+4.01%)41.15 (94.77%)
client_sv2_handle_message_mining✅ (view plot)8,154.00 (-0.56%)8,353.24 (97.61%)✅ (view plot)2,137.00 (+0.17%)2,180.60 (98.00%)✅ (view plot)3,164.00 (+0.31%)3,230.40 (97.94%)✅ (view plot)32.00 (-12.67%)45.52 (70.30%)✅ (view plot)138.00 (-0.67%)142.40 (96.91%)
client_sv2_mining_message_submit_standard✅ (view plot)6,281.00 (+0.04%)6,417.74 (97.87%)✅ (view plot)1,750.00 (-0.02%)1,768.45 (98.96%)✅ (view plot)2,551.00 (-0.10%)2,581.32 (98.83%)✅ (view plot)18.00 (+5.63%)24.87 (72.36%)✅ (view plot)104.00 (+0.01%)107.80 (96.47%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,624.00 (-0.82%)15,059.54 (97.11%)✅ (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)39.00 (-12.16%)55.32 (70.50%)✅ (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)14,000.00 (-0.78%)14,531.98 (96.34%)✅ (view plot)5,064.00 (+0.01%)5,081.29 (99.66%)✅ (view plot)7,330.00 (+0.09%)7,353.99 (99.67%)✅ (view plot)32.00 (-9.41%)43.84 (72.98%)✅ (view plot)186.00 (-1.51%)200.85 (92.61%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,691.00 (+0.24%)23,037.30 (98.50%)✅ (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)75.00 (+1.87%)85.15 (88.08%)✅ (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,136.00 (-0.38%)16,516.30 (97.70%)✅ (view plot)5,963.00 (+0.01%)5,980.29 (99.71%)✅ (view plot)8,666.00 (+0.06%)8,693.00 (99.69%)✅ (view plot)38.00 (-8.21%)55.01 (69.07%)✅ (view plot)208.00 (-0.69%)217.91 (95.45%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,522.00 (-0.07%)35,783.23 (99.27%)✅ (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)94.00 (-0.42%)116.19 (80.90%)✅ (view plot)378.00 (-0.41%)385.14 (98.15%)

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

Copy link
Contributor

github-actions bot commented Sep 10, 2024

🐰Bencher

ReportThu, September 12, 2024 at 21:41:38 UTC
ProjectStratum V2 (SRI)
Branch1040/merge
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.21 (-1.10%)46.71 (94.63%)
client_sv2_handle_message_mining✅ (view plot)75.12 (+0.02%)91.60 (82.01%)
client_sv2_mining_message_submit_standard✅ (view plot)14.66 (-0.11%)14.81 (98.96%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)265.47 (-0.97%)291.40 (91.10%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)594.08 (+0.21%)650.45 (91.33%)
client_sv2_open_channel✅ (view plot)162.57 (-1.98%)177.62 (91.53%)
client_sv2_open_channel_serialize✅ (view plot)270.45 (-2.36%)307.37 (87.99%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)376.89 (-0.18%)459.00 (82.11%)
client_sv2_setup_connection✅ (view plot)155.12 (-4.17%)186.05 (83.38%)
client_sv2_setup_connection_serialize✅ (view plot)484.16 (+5.79%)569.56 (85.01%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)1,020.10 (+2.11%)1,162.42 (87.76%)

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

Copy link
Contributor

🐰Bencher

ReportTue, September 10, 2024 at 15:32:11 UTC
ProjectStratum V2 (SRI)
Branch1040/merge@b9c69aa5-5720-4a93-acf4-80397127147e
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,458.00 (+0.15%)8,794.94 (96.17%)✅ (view plot)3,746.00 (-0.05%)3,882.19 (96.49%)✅ (view plot)5,253.00 (-0.07%)5,440.98 (96.55%)✅ (view plot)4.00 (-42.99%)11.64 (34.37%)✅ (view plot)91.00 (+0.99%)95.35 (95.44%)
get_submit✅ (view plot)95,417.00 (-0.07%)96,204.31 (99.18%)✅ (view plot)59,439.00 (-0.05%)59,797.58 (99.40%)✅ (view plot)85,367.00 (-0.05%)85,876.18 (99.41%)✅ (view plot)43.00 (-10.27%)71.74 (59.94%)✅ (view plot)281.00 (+0.08%)290.03 (96.89%)
get_subscribe✅ (view plot)8,101.00 (+1.15%)8,362.54 (96.87%)✅ (view plot)2,841.00 (+0.16%)2,964.68 (95.83%)✅ (view plot)3,966.00 (+0.02%)4,136.80 (95.87%)✅ (view plot)15.00 (+15.53%)23.29 (64.39%)✅ (view plot)116.00 (+2.05%)119.66 (96.94%)
serialize_authorize✅ (view plot)12,313.00 (+0.48%)12,636.70 (97.44%)✅ (view plot)5,317.00 (-0.04%)5,453.19 (97.50%)✅ (view plot)7,413.00 (-0.08%)7,603.27 (97.50%)✅ (view plot)7.00 (-24.42%)14.92 (46.93%)✅ (view plot)139.00 (+1.57%)143.70 (96.73%)
serialize_deserialize_authorize✅ (view plot)24,773.00 (+0.68%)25,134.05 (98.56%)✅ (view plot)9,868.00 (-0.28%)10,054.01 (98.15%)✅ (view plot)13,928.00 (-0.28%)14,198.73 (98.09%)✅ (view plot)34.00 (-3.47%)44.41 (76.56%)✅ (view plot)305.00 (+2.02%)312.98 (97.45%)
serialize_deserialize_handle_authorize✅ (view plot)30,462.00 (+0.67%)30,714.22 (99.18%)✅ (view plot)12,071.00 (-0.15%)12,228.04 (98.72%)✅ (view plot)17,092.00 (-0.15%)17,309.40 (98.74%)✅ (view plot)56.00 (-0.44%)68.66 (81.57%)✅ (view plot)374.00 (+1.79%)380.47 (98.30%)
serialize_deserialize_handle_submit✅ (view plot)126,578.00 (+0.10%)127,172.82 (99.53%)✅ (view plot)73,280.00 (+0.01%)73,673.76 (99.47%)✅ (view plot)105,053.00 (+0.01%)105,619.11 (99.46%)✅ (view plot)105.00 (-4.87%)142.49 (73.69%)✅ (view plot)600.00 (+0.66%)604.70 (99.22%)
serialize_deserialize_handle_subscribe✅ (view plot)28,108.00 (+1.45%)28,571.62 (98.38%)✅ (view plot)9,659.00 (+0.14%)9,779.88 (98.76%)✅ (view plot)13,653.00 (+0.07%)13,830.35 (98.72%)✅ (view plot)70.00 (+9.52%)76.02 (92.09%)✅ (view plot)403.00 (+2.64%)415.64 (96.96%)
serialize_deserialize_submit✅ (view plot)115,287.00 (+0.09%)115,890.96 (99.48%)✅ (view plot)68,057.00 (-0.04%)68,473.61 (99.39%)✅ (view plot)97,652.00 (-0.05%)98,284.36 (99.36%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)495.00 (+0.97%)499.07 (99.18%)
serialize_deserialize_subscribe✅ (view plot)23,485.00 (+1.54%)23,982.90 (97.92%)✅ (view plot)8,211.00 (+0.13%)8,335.38 (98.51%)✅ (view plot)11,560.00 (+0.08%)11,737.11 (98.49%)✅ (view plot)40.00 (+5.48%)45.24 (88.42%)✅ (view plot)335.00 (+2.96%)347.44 (96.42%)
serialize_submit✅ (view plot)99,874.00 (-0.00%)100,546.40 (99.33%)✅ (view plot)61,483.00 (-0.05%)61,846.33 (99.41%)✅ (view plot)88,209.00 (-0.05%)88,728.35 (99.41%)✅ (view plot)44.00 (-10.39%)70.79 (62.15%)✅ (view plot)327.00 (+0.62%)333.39 (98.08%)
serialize_subscribe✅ (view plot)11,502.00 (+1.02%)11,763.16 (97.78%)✅ (view plot)4,188.00 (+0.11%)4,311.68 (97.13%)✅ (view plot)5,822.00 (-0.00%)5,993.75 (97.13%)✅ (view plot)16.00 (+16.40%)22.32 (71.68%)✅ (view plot)160.00 (+1.91%)164.58 (97.22%)

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

Copy link
Contributor

🐰Bencher

ReportTue, September 10, 2024 at 15:32:11 UTC
ProjectStratum V2 (SRI)
Branch1040/merge@f6f4dd8a-4cbd-416d-934e-bacf6af4f920
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,073.00 (-0.12%)2,205.42 (94.00%)✅ (view plot)473.00 (+0.23%)491.06 (96.32%)✅ (view plot)733.00 (-0.13%)762.27 (96.16%)✅ (view plot)9.00 (+50.82%)14.50 (62.07%)✅ (view plot)37.00 (-1.28%)41.11 (90.00%)
client_sv2_handle_message_mining✅ (view plot)8,136.00 (-0.78%)8,353.61 (97.39%)✅ (view plot)2,137.00 (+0.17%)2,180.60 (98.00%)✅ (view plot)3,161.00 (+0.22%)3,230.35 (97.85%)✅ (view plot)36.00 (-1.84%)45.46 (79.20%)✅ (view plot)137.00 (-1.38%)142.42 (96.19%)
client_sv2_mining_message_submit_standard✅ (view plot)6,187.00 (-1.45%)6,419.37 (96.38%)✅ (view plot)1,750.00 (-0.02%)1,768.45 (98.96%)✅ (view plot)2,552.00 (-0.06%)2,581.32 (98.86%)✅ (view plot)20.00 (+17.25%)24.93 (80.22%)✅ (view plot)101.00 (-2.85%)107.87 (93.63%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,652.00 (-0.63%)15,058.99 (97.30%)✅ (view plot)4,694.00 (-0.01%)4,712.45 (99.61%)✅ (view plot)6,757.00 (-0.00%)6,784.38 (99.60%)✅ (view plot)46.00 (+3.47%)55.28 (83.21%)✅ (view plot)219.00 (-1.30%)230.59 (94.97%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,426.00 (-0.27%)27,895.95 (98.32%)✅ (view plot)10,585.00 (+0.18%)10,639.06 (99.49%)✅ (view plot)15,406.00 (+0.20%)15,481.66 (99.51%)✅ (view plot)80.00 (-2.15%)90.47 (88.43%)✅ (view plot)332.00 (-0.83%)346.00 (95.95%)
client_sv2_open_channel✅ (view plot)4,333.00 (-2.02%)4,672.83 (92.73%)✅ (view plot)1,461.00 (+0.03%)1,478.29 (98.83%)✅ (view plot)2,163.00 (+0.27%)2,186.36 (98.93%)✅ (view plot)7.00 (-28.49%)18.58 (37.68%)✅ (view plot)61.00 (-3.66%)69.96 (87.19%)
client_sv2_open_channel_serialize✅ (view plot)14,032.00 (-0.55%)14,531.66 (96.56%)✅ (view plot)5,064.00 (+0.01%)5,081.29 (99.66%)✅ (view plot)7,322.00 (-0.01%)7,353.86 (99.57%)✅ (view plot)40.00 (+13.03%)43.96 (90.99%)✅ (view plot)186.00 (-1.51%)200.85 (92.61%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,711.00 (+0.33%)23,037.72 (98.58%)✅ (view plot)8,027.00 (+0.24%)8,079.25 (99.35%)✅ (view plot)11,671.00 (+0.19%)11,755.65 (99.28%)✅ (view plot)80.00 (+8.60%)85.32 (93.76%)✅ (view plot)304.00 (+0.20%)314.97 (96.52%)
client_sv2_setup_connection✅ (view plot)4,635.00 (-1.11%)4,784.92 (96.87%)✅ (view plot)1,502.00 (+0.03%)1,519.29 (98.86%)✅ (view plot)2,280.00 (+0.11%)2,305.36 (98.90%)✅ (view plot)9.00 (-1.95%)15.78 (57.02%)✅ (view plot)66.00 (-2.26%)70.30 (93.88%)
client_sv2_setup_connection_serialize✅ (view plot)16,110.00 (-0.54%)16,516.58 (97.54%)✅ (view plot)5,963.00 (+0.01%)5,980.29 (99.71%)✅ (view plot)8,665.00 (+0.05%)8,692.98 (99.68%)✅ (view plot)40.00 (-3.42%)55.00 (72.73%)✅ (view plot)207.00 (-1.16%)217.92 (94.99%)
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

🐰Bencher

ReportTue, September 10, 2024 at 16:15:07 UTC
ProjectStratum V2 (SRI)
Branch1040/merge@a926fd8e-459a-4b67-a660-b3076a37b558
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,107.00 (+1.50%)2,206.00 (95.51%)✅ (view plot)473.00 (+0.23%)491.06 (96.32%)✅ (view plot)732.00 (-0.26%)762.26 (96.03%)✅ (view plot)9.00 (+50.82%)14.50 (62.07%)✅ (view plot)38.00 (+1.37%)41.12 (92.41%)
client_sv2_handle_message_mining✅ (view plot)8,136.00 (-0.78%)8,353.61 (97.39%)✅ (view plot)2,137.00 (+0.17%)2,180.60 (98.00%)✅ (view plot)3,161.00 (+0.22%)3,230.35 (97.85%)✅ (view plot)36.00 (-1.84%)45.46 (79.20%)✅ (view plot)137.00 (-1.38%)142.42 (96.19%)
client_sv2_mining_message_submit_standard✅ (view plot)6,221.00 (-0.91%)6,418.21 (96.93%)✅ (view plot)1,750.00 (-0.02%)1,768.45 (98.96%)✅ (view plot)2,551.00 (-0.10%)2,581.32 (98.83%)✅ (view plot)20.00 (+17.25%)24.93 (80.22%)✅ (view plot)102.00 (-1.90%)107.83 (94.60%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,686.00 (-0.41%)15,058.59 (97.53%)✅ (view plot)4,694.00 (-0.01%)4,712.45 (99.61%)✅ (view plot)6,756.00 (-0.02%)6,784.37 (99.58%)✅ (view plot)46.00 (+3.47%)55.28 (83.21%)✅ (view plot)220.00 (-0.85%)230.58 (95.41%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,460.00 (-0.15%)27,895.83 (98.44%)✅ (view plot)10,585.00 (+0.18%)10,639.06 (99.49%)✅ (view plot)15,405.00 (+0.19%)15,481.63 (99.51%)✅ (view plot)80.00 (-2.15%)90.47 (88.43%)✅ (view plot)333.00 (-0.53%)345.99 (96.25%)
client_sv2_open_channel✅ (view plot)4,367.00 (-1.25%)4,672.31 (93.47%)✅ (view plot)1,461.00 (+0.03%)1,478.29 (98.83%)✅ (view plot)2,162.00 (+0.23%)2,186.34 (98.89%)✅ (view plot)7.00 (-28.49%)18.58 (37.68%)✅ (view plot)62.00 (-2.09%)69.95 (88.64%)
client_sv2_open_channel_serialize✅ (view plot)14,066.00 (-0.31%)14,531.54 (96.80%)✅ (view plot)5,064.00 (+0.01%)5,081.29 (99.66%)✅ (view plot)7,321.00 (-0.03%)7,353.85 (99.55%)✅ (view plot)40.00 (+13.03%)43.96 (90.99%)✅ (view plot)187.00 (-0.99%)200.85 (93.11%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,745.00 (+0.48%)23,038.62 (98.73%)✅ (view plot)8,027.00 (+0.24%)8,079.25 (99.35%)✅ (view plot)11,670.00 (+0.18%)11,755.63 (99.27%)✅ (view plot)80.00 (+8.60%)85.32 (93.76%)✅ (view plot)305.00 (+0.52%)314.99 (96.83%)
client_sv2_setup_connection✅ (view plot)4,669.00 (-0.39%)4,784.21 (97.59%)✅ (view plot)1,502.00 (+0.03%)1,519.29 (98.86%)✅ (view plot)2,279.00 (+0.06%)2,305.35 (98.86%)✅ (view plot)9.00 (-1.95%)15.78 (57.02%)✅ (view plot)67.00 (-0.79%)70.28 (95.34%)
client_sv2_setup_connection_serialize✅ (view plot)16,144.00 (-0.33%)16,516.24 (97.75%)✅ (view plot)5,963.00 (+0.01%)5,980.29 (99.71%)✅ (view plot)8,664.00 (+0.04%)8,692.96 (99.67%)✅ (view plot)40.00 (-3.42%)55.00 (72.73%)✅ (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

ReportTue, September 10, 2024 at 16:32:28 UTC
ProjectStratum V2 (SRI)
Branch1040/merge@c321016c-8fc1-4314-bb90-ab2710c50f95
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,422.00 (-0.28%)8,794.70 (95.76%)✅ (view plot)3,774.00 (+0.69%)3,882.61 (97.20%)✅ (view plot)5,297.00 (+0.76%)5,441.67 (97.34%)✅ (view plot)2.00 (-71.43%)11.76 (17.01%)✅ (view plot)89.00 (-1.22%)95.33 (93.36%)
get_submit✅ (view plot)95,381.00 (-0.10%)96,204.34 (99.14%)✅ (view plot)59,467.00 (-0.00%)59,797.70 (99.45%)✅ (view plot)85,411.00 (-0.00%)85,876.35 (99.46%)✅ (view plot)41.00 (-14.41%)71.76 (57.14%)✅ (view plot)279.00 (-0.63%)290.02 (96.20%)
get_subscribe✅ (view plot)8,065.00 (+0.71%)8,361.65 (96.45%)✅ (view plot)2,869.00 (+1.14%)2,965.22 (96.75%)✅ (view plot)4,010.00 (+1.12%)4,137.60 (96.92%)✅ (view plot)13.00 (+0.24%)23.26 (55.88%)✅ (view plot)114.00 (+0.30%)119.61 (95.31%)
serialize_authorize✅ (view plot)12,277.00 (+0.18%)12,636.11 (97.16%)✅ (view plot)5,345.00 (+0.48%)5,453.61 (98.01%)✅ (view plot)7,457.00 (+0.51%)7,603.92 (98.07%)✅ (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,741.00 (+0.55%)25,133.08 (98.44%)✅ (view plot)9,896.00 (+0.00%)10,054.04 (98.43%)✅ (view plot)13,971.00 (+0.03%)14,198.82 (98.40%)✅ (view plot)33.00 (-6.29%)44.42 (74.29%)✅ (view plot)303.00 (+1.35%)312.91 (96.83%)
serialize_deserialize_handle_authorize✅ (view plot)30,392.00 (+0.44%)30,711.60 (98.96%)✅ (view plot)12,099.00 (+0.08%)12,228.19 (98.94%)✅ (view plot)17,137.00 (+0.12%)17,309.71 (99.00%)✅ (view plot)54.00 (-3.97%)68.66 (78.65%)✅ (view plot)371.00 (+0.98%)380.36 (97.54%)
serialize_deserialize_handle_submit✅ (view plot)126,578.00 (+0.10%)127,172.82 (99.53%)✅ (view plot)73,280.00 (+0.01%)73,673.76 (99.47%)✅ (view plot)105,053.00 (+0.01%)105,619.11 (99.46%)✅ (view plot)105.00 (-4.87%)142.49 (73.69%)✅ (view plot)600.00 (+0.66%)604.70 (99.22%)
serialize_deserialize_handle_subscribe✅ (view plot)28,064.00 (+1.30%)28,569.74 (98.23%)✅ (view plot)9,687.00 (+0.43%)9,780.55 (99.04%)✅ (view plot)13,699.00 (+0.40%)13,831.34 (99.04%)✅ (view plot)66.00 (+3.32%)75.88 (86.98%)✅ (view plot)401.00 (+2.14%)415.56 (96.50%)
serialize_deserialize_submit✅ (view plot)115,287.00 (+0.09%)115,890.96 (99.48%)✅ (view plot)68,057.00 (-0.04%)68,473.61 (99.39%)✅ (view plot)97,652.00 (-0.05%)98,284.36 (99.36%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)495.00 (+0.97%)499.07 (99.18%)
serialize_deserialize_subscribe✅ (view plot)23,449.00 (+1.39%)23,981.49 (97.78%)✅ (view plot)8,239.00 (+0.47%)8,336.01 (98.84%)✅ (view plot)11,604.00 (+0.46%)11,738.05 (98.86%)✅ (view plot)38.00 (+0.25%)45.20 (84.07%)✅ (view plot)333.00 (+2.35%)347.36 (95.87%)
serialize_submit✅ (view plot)99,838.00 (-0.04%)100,546.20 (99.30%)✅ (view plot)61,511.00 (-0.00%)61,846.44 (99.46%)✅ (view plot)88,253.00 (-0.00%)88,728.51 (99.46%)✅ (view plot)42.00 (-14.44%)70.82 (59.31%)✅ (view plot)325.00 (+0.01%)333.35 (97.49%)
serialize_subscribe✅ (view plot)11,466.00 (+0.71%)11,762.13 (97.48%)✅ (view plot)4,216.00 (+0.77%)4,312.22 (97.77%)✅ (view plot)5,866.00 (+0.75%)5,994.54 (97.86%)✅ (view plot)14.00 (+1.97%)22.28 (62.83%)✅ (view plot)158.00 (+0.65%)164.52 (96.04%)

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

Copy link
Contributor

🐰Bencher

ReportTue, September 10, 2024 at 16:52:55 UTC
ProjectStratum V2 (SRI)
Branch1040/merge@f00f1832-5741-4c6b-a891-5bacc40a109d
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,458.00 (+0.15%)8,794.94 (96.17%)✅ (view plot)3,746.00 (-0.05%)3,882.19 (96.49%)✅ (view plot)5,253.00 (-0.07%)5,440.98 (96.55%)✅ (view plot)4.00 (-42.99%)11.64 (34.37%)✅ (view plot)91.00 (+0.99%)95.35 (95.44%)
get_submit✅ (view plot)95,417.00 (-0.07%)96,204.31 (99.18%)✅ (view plot)59,439.00 (-0.05%)59,797.58 (99.40%)✅ (view plot)85,367.00 (-0.05%)85,876.18 (99.41%)✅ (view plot)43.00 (-10.27%)71.74 (59.94%)✅ (view plot)281.00 (+0.08%)290.03 (96.89%)
get_subscribe✅ (view plot)8,101.00 (+1.15%)8,362.54 (96.87%)✅ (view plot)2,841.00 (+0.16%)2,964.68 (95.83%)✅ (view plot)3,966.00 (+0.02%)4,136.80 (95.87%)✅ (view plot)15.00 (+15.53%)23.29 (64.39%)✅ (view plot)116.00 (+2.05%)119.66 (96.94%)
serialize_authorize✅ (view plot)12,313.00 (+0.48%)12,636.70 (97.44%)✅ (view plot)5,317.00 (-0.04%)5,453.19 (97.50%)✅ (view plot)7,413.00 (-0.08%)7,603.27 (97.50%)✅ (view plot)7.00 (-24.42%)14.92 (46.93%)✅ (view plot)139.00 (+1.57%)143.70 (96.73%)
serialize_deserialize_authorize✅ (view plot)24,773.00 (+0.68%)25,134.05 (98.56%)✅ (view plot)9,868.00 (-0.28%)10,054.01 (98.15%)✅ (view plot)13,928.00 (-0.28%)14,198.73 (98.09%)✅ (view plot)34.00 (-3.47%)44.41 (76.56%)✅ (view plot)305.00 (+2.02%)312.98 (97.45%)
serialize_deserialize_handle_authorize✅ (view plot)30,462.00 (+0.67%)30,714.22 (99.18%)✅ (view plot)12,071.00 (-0.15%)12,228.04 (98.72%)✅ (view plot)17,092.00 (-0.15%)17,309.40 (98.74%)✅ (view plot)56.00 (-0.44%)68.66 (81.57%)✅ (view plot)374.00 (+1.79%)380.47 (98.30%)
serialize_deserialize_handle_submit✅ (view plot)126,578.00 (+0.10%)127,172.82 (99.53%)✅ (view plot)73,280.00 (+0.01%)73,673.76 (99.47%)✅ (view plot)105,053.00 (+0.01%)105,619.11 (99.46%)✅ (view plot)105.00 (-4.87%)142.49 (73.69%)✅ (view plot)600.00 (+0.66%)604.70 (99.22%)
serialize_deserialize_handle_subscribe✅ (view plot)28,108.00 (+1.45%)28,571.62 (98.38%)✅ (view plot)9,659.00 (+0.14%)9,779.88 (98.76%)✅ (view plot)13,653.00 (+0.07%)13,830.35 (98.72%)✅ (view plot)70.00 (+9.52%)76.02 (92.09%)✅ (view plot)403.00 (+2.64%)415.64 (96.96%)
serialize_deserialize_submit✅ (view plot)115,287.00 (+0.09%)115,890.96 (99.48%)✅ (view plot)68,057.00 (-0.04%)68,473.61 (99.39%)✅ (view plot)97,652.00 (-0.05%)98,284.36 (99.36%)✅ (view plot)62.00 (-3.26%)81.94 (75.66%)✅ (view plot)495.00 (+0.97%)499.07 (99.18%)
serialize_deserialize_subscribe✅ (view plot)23,485.00 (+1.54%)23,982.90 (97.92%)✅ (view plot)8,211.00 (+0.13%)8,335.38 (98.51%)✅ (view plot)11,560.00 (+0.08%)11,737.11 (98.49%)✅ (view plot)40.00 (+5.48%)45.24 (88.42%)✅ (view plot)335.00 (+2.96%)347.44 (96.42%)
serialize_submit✅ (view plot)99,874.00 (-0.00%)100,546.40 (99.33%)✅ (view plot)61,483.00 (-0.05%)61,846.33 (99.41%)✅ (view plot)88,209.00 (-0.05%)88,728.35 (99.41%)✅ (view plot)44.00 (-10.39%)70.79 (62.15%)✅ (view plot)327.00 (+0.62%)333.39 (98.08%)
serialize_subscribe✅ (view plot)11,502.00 (+1.02%)11,763.16 (97.78%)✅ (view plot)4,188.00 (+0.11%)4,311.68 (97.13%)✅ (view plot)5,822.00 (-0.00%)5,993.75 (97.13%)✅ (view plot)16.00 (+16.40%)22.32 (71.68%)✅ (view plot)160.00 (+1.91%)164.58 (97.22%)

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

Comment on lines +17 to +21
//! ## Modules
//!
//! * `decoder`: Provides functionality to decode Stratum V2 messages.
//! * `encoder`: Provides functionality to encode Stratum V2 messages.
//! * `error`: Defines error types and result aliases used throughout the crate.
Copy link
Collaborator

@plebhash plebhash Sep 11, 2024

Choose a reason for hiding this comment

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

a # Modules section is automatically generated by Rust docs, so it is redundant to add one here

also, the encoder and decoder modules are not exposed

Copy link
Collaborator

@plebhash plebhash Sep 19, 2024

Choose a reason for hiding this comment

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

assuming we will make encoder and decoder modules public, we should still remove this ## Modules section

Comment on lines +1 to +44
//! # Stratum V2 Codec Encoder
//!
//! This module provides functionality for encoding Stratum V2 messages, including support for the
//! Noise protocol for secure communication.
//!
//! ## Features
//!
//! Two primary encoders are defined:
//! * **Standard Encoder**:
//! * **Noise Encoder**:
//!
//! ## Types
//!
//! * `Encoder`: Encoder for Sv2 frames with Noise protocol support.
//! * `NoiseEncoder`: Encoder for Sv2 frames without Noise protocol support (requires the
//! `noise_sv2` feature).
//! * `Item<T>`: Represents an SV2 frame that is to be encoded and optionally encrypted using the
//! Noise protocol.
//! * `Buffer`: Holds intermediate data during encoding, which can be either a pool-allocated
//! buffer or a system memory buffer depending on the feature flags.
//! * `Slice`: Stores the serialized SV2 frame data before transmission.
//!
//! ## Usage
//!
//! This module is designed to be used to encode outgoing Sv2 messages, with optional Noise
//! protocol encryption support for secure communication.
//!
//! ## Example
//!
//! ```ignore
//! use codec_sv2::encoder::{Encoder, NoiseEncoder};
//! use framing_sv2::framing::Sv2Frame;
//!
//! // Create a standard encoder for unencrypted SV2 frames
//! let mut encoder: Encoder<MyFrameType> = Encoder::new();
//!
//! // Encode a frame into a byte slice
//! let frame = Sv2Frame::new( /* frame details */ );
//! let encoded_data = encoder.encode(frame).unwrap();
//!
//! // Create a Noise encoder for encrypted SV2 frames (requires the `noise_sv2` feature)
//! #[cfg(feature = "noise_sv2")]
//! let mut noise_encoder: NoiseEncoder<MyFrameType> = NoiseEncoder::new();
//! ```
Copy link
Collaborator

@plebhash plebhash Sep 11, 2024

Choose a reason for hiding this comment

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

this header is not going to be displayed in Rust Docs, because the encoder module is not exposed

overall I'd recommend to regularly do cargo doc --all-features --open to render the docs so you can have a good idea of what the end-user is going to see

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we should still impose our documentation standards on private modules, regardless of whether it will be generated. Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no if a module is private we don't have to document it for user but for maintainers so is a different thing. In that case the module should not be private. A rule of thumb is, if you thing that you need to document a private module for the user maybe the module should not be private.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also think we should not document private modules. If there is some private module that is very vague, and we feel strongly about adding a comment, maybe we can use regular comment and not ///?

Copy link
Collaborator

@plebhash plebhash Sep 15, 2024

Choose a reason for hiding this comment

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

I agree with @rrybarczyk in the sense that it's important that we don't fully ignore parts of the code just because they are not exposed. Afterall, one of the main goals of this collective effort is for SRI contributors to refine their understanding (and ultimately, their ownership) over these crates.

I see @rrybarczyk also suggested cargo doc --document-private-items --all-features --open on the other comment thread. I feel this could be dangerous because it could create a blindspot because we're not seeing what the user sees.

But I would follow @Fi3 advice and simply make encoder and decoder modules public:

--- a/protocols/v2/codec-sv2/src/lib.rs
+++ b/protocols/v2/codec-sv2/src/lib.rs
@@ -59,8 +59,8 @@ extern crate alloc;
 #[cfg(feature = "noise_sv2")]
 use alloc::boxed::Box;
 
-mod decoder;
-mod encoder;
+pub mod decoder;
+pub mod encoder;

But for everything that will not be public and we still want to document for maintainer eyes, we should do Non Doc comments, which are essentially // inlines and /* ... */ blocks

Copy link
Collaborator

@plebhash plebhash Sep 19, 2024

Choose a reason for hiding this comment

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

I formalized my proposal around Non Docs comments on the Discussion for Rust Docs Standards here #970 (comment)

Comment on lines +1 to +40
//! # Stratum V2 Codec Decoder
//!
//! This module provides functionality for decoding Stratum V2 messages, including support for
//! the Noise protocol for secure communication.
//!
//! ## Features
//!
//! * **Standard Decoder**: Decodes Stratum V2 frames without encryption.
//! * **Noise Decoder**: Decodes Stratum V2 frames with Noise protocol encryption.
//!
//! ## Types
//!
//! * `WithoutNoise`: Decoder for Sv2 frames without Noise protocol support.
//! * `WithNoise`: Decoder for Sv2 frames with Noise protocol support (requires the `noise_sv2`
//! feature).
//! * `StandardEitherFrame`: Represents an encoded or decoded frame that could be either a regular
//! or Noise-protected frame.
//! * `StandardSv2Frame`: Represents an encoded or decoded Stratum V2 frame.
//! * `StandardNoiseDecoder`: Decoder for Stratum V2 frames with Noise protocol support.
//! * `StandardDecoder`: Decoder for Stratum V2 frames without Noise protocol support.
//!
//! ## Usage
//!
//! This module is designed to be used to decode incoming Sv2 messages, with optional Noise
//! protocol encryption support for secure communication.
//!
//! ## Example
//!
//! ```ignore
//! use codec_sv2::decoder::{StandardDecoder, StandardNoiseDecoder};
//!
//! // Create a standard decoder
//! let mut decoder: StandardDecoder<MyFrameType> = StandardDecoder::new();
//!
//! // Create a noise decoder (requires the `noise_sv2` feature)
//! #[cfg(feature = "noise_sv2")]
//! let mut noise_decoder: StandardNoiseDecoder<MyFrameType> = StandardNoiseDecoder::new();
//! ```
//!

Copy link
Collaborator

Choose a reason for hiding this comment

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

this header is not going to be displayed in Rust Docs, because the decoder module is not exposed

overall I'd recommend to regularly do cargo doc --all-features --open to render the docs so you can have a good idea of what the end-user is going to see

Copy link
Collaborator

@Fi3 Fi3 Sep 12, 2024

Choose a reason for hiding this comment

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

I think that we can change how we export thing in order to include it without changing the API

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry @Fi3 I don't fully understand, can you elaborate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can add the --document-private-items to expose documentation for private modules like:

cargo doc --document-private-items --all-features --open

I left a comment here with some thoughts.

Essentially, I am not sure if you can publish the private crate documentation to crates.io, or if we would want to do that. BUT, we can use it to guide us and view our docs on private modules while we develop the documentation.

Either way, my example here sucks 😝.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yep or we can make the module public in this case: we make codec_sv2::decoder public and in the module we make private all the things that are not exported by lib.rs so we don't change the api.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, we should make these modules public.

Co-authored-by: plebhash <[email protected]>
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.

Few nits.

/// Transport mode where AEAD is fully operational. The `TransportMode` object in this variant
/// as able to perform encryption and decryption resp.

/// The codec is in transport mode, where AEAS encryption and decryption are fully operational.
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
/// The codec is in transport mode, where AEAS encryption and decryption are fully operational.
/// The codec is in transport mode, where AEAD encryption and decryption are fully operational.

Comment on lines +14 to +16
//! * `Encoder`: Encoder for Sv2 frames with Noise protocol support.
//! * `NoiseEncoder`: Encoder for Sv2 frames without Noise protocol support (requires the
//! `noise_sv2` feature).
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
//! * `Encoder`: Encoder for Sv2 frames with Noise protocol support.
//! * `NoiseEncoder`: Encoder for Sv2 frames without Noise protocol support (requires the
//! `noise_sv2` feature).
//! * `Encoder`: Encoder for Sv2 frames without Noise protocol support (requires the
//! `noise_sv2` feature).
//! * `NoiseEncoder`: Encoder for Sv2 frames with Noise protocol support.

This should be the other way around.

Comment on lines +28 to +44
//! ## Example
//!
//! ```ignore
//! use codec_sv2::encoder::{Encoder, NoiseEncoder};
//! use framing_sv2::framing::Sv2Frame;
//!
//! // Create a standard encoder for unencrypted SV2 frames
//! let mut encoder: Encoder<MyFrameType> = Encoder::new();
//!
//! // Encode a frame into a byte slice
//! let frame = Sv2Frame::new( /* frame details */ );
//! let encoded_data = encoder.encode(frame).unwrap();
//!
//! // Create a Noise encoder for encrypted SV2 frames (requires the `noise_sv2` feature)
//! #[cfg(feature = "noise_sv2")]
//! let mut noise_encoder: NoiseEncoder<MyFrameType> = NoiseEncoder::new();
//! ```
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not entirely sure if writing this is really helpful. It could be misleading for someone referencing it, as they might assume these are public-facing APIs. I believe we should include code snippets only for public-facing modules, rather than for all modules.

Copy link
Collaborator

@plebhash plebhash Sep 19, 2024

Choose a reason for hiding this comment

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

I think we should make these modules public

but with regards to the broader discussion around this topic, let's try to reach consensus here #970 (comment)

Comment on lines +25 to +43
//! ```ignore
//! use codec_sv2::{State, HandshakeRole, NoiseCodec};
//! use noise_sv2::Initiator;
//!
//! // Initialize the codec state
//! let role = HandshakeRole::Initiator(Box::new(Initiator::new()));
//! let mut state = State::not_initialized(&role);
//! state = State::initialized(role);
//!
//! // Proceed with the handshake steps
//! match state.step_0() {
//! Ok(frame) => {
//! // Send the initial handshake frame
//! }
//! Err(e) => {
//! // Handle error
//! }
//! }
//! ```
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we can have a doc test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this could be good for CI, but will require more research to figure out the best way to achieve this

Comment on lines +25 to +43
//! ```ignore
//! use codec_sv2::{State, HandshakeRole, NoiseCodec};
//! use noise_sv2::Initiator;
//!
//! // Initialize the codec state
//! let role = HandshakeRole::Initiator(Box::new(Initiator::new()));
//! let mut state = State::not_initialized(&role);
//! state = State::initialized(role);
//!
//! // Proceed with the handshake steps
//! match state.step_0() {
//! Ok(frame) => {
//! // Send the initial handshake frame
//! }
//! Err(e) => {
//! // Handle error
//! }
//! }
//! ```
Copy link
Collaborator

@plebhash plebhash Sep 19, 2024

Choose a reason for hiding this comment

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

this example is going to be the first thing the reader sees when the look at the Rust Docs for codec_sv2 crate

if the main example is going to include encryption, we should do at least two code blocks:

  • one example where Initiator does the full handshake cycle, then encodes a message, and sends it
  • one example where Receiver does the full handshake cycle, then decodes a received message

as an alternative, we could also just simplify things by doing an unencrypted example

I'm working on something, I'll propose it here once I know it compiles.

Copy link
Collaborator

@plebhash plebhash Sep 19, 2024

Choose a reason for hiding this comment

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

I wrote a replit with an atomic unencrypted encode/decode example: https://replit.com/@plebhash/GummyLividClicks

(replit is good because whatever we write as an example, we know it's functional and buildable code)

we have a good chunk of ~90 lines of code there, and a fully functional example including encryption would probably take a lot more lines

so I would lean towards either:

  • showing an unencrypted example code on the top of codec_sv2 Rust Docs
  • not showing any example code on the top of codec_sv2 Rust Docs, and create a protocols/v2/codec_sv2/examples directory where we have encrypted and unencrypted examples

if we decide to create an examples directory, we should create an issue so we can tackle that in the future (instead of this PR)

Comment on lines +93 to +98
/// Used to maintain type information for the generic parameter `T`, which represents the type
/// of frames being decoded.
///
/// `T` refers to a type that implements the necessary traits for serialization
/// (`binary_sv2::Serialize`), deserialization (`binary_sv2::Deserialize`), and size
/// calculation (`binary_sv2::GetSize`).
Copy link
Collaborator

@plebhash plebhash Sep 20, 2024

Choose a reason for hiding this comment

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

private fields are never exposed to reader eyes

it's good to document this for maintainer eyes, but we should use Non Doc comments (// inlines and /* ... */ blocks), as proposed in #970 (comment)

Comment on lines +100 to +103

/// Number of missing bytes needed to complete the Noise header or payload.
///
/// Keeps track of how many more bytes are required to fully decode the current Noise frame.
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Comment on lines +105 to +108

/// Buffer for holding encrypted Noise data.
///
/// Stores the incoming encrypted data until it is ready to be decrypted and processed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Comment on lines +110 to +114

/// Buffer for holding decrypted Sv2 data.
///
/// Stores the decrypted data from the Noise protocol until it is ready to be processed and
/// concerted into a Sv2 frame.
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Comment on lines +74 to +76
/// When the `with_buffer_pool` feature is enabled, `Buffer` is a pool-allocated buffer type
/// (`BufferPool`), which allows for more efficient memory management. Otherwise, it defaults to
/// `BufferFromSystemMemory`.
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 reproduce this comment on decoder.rs because it also has a type alias for Buffer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codec-sv2 documentation Improvements or additions to documentation protocols Lowest level protocol logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need Rust docs on protocols::v2::codec-sv2
5 participants