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

doc: Document Seq064K #1046

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

Conversation

marathon-gary
Copy link
Contributor

Takes specific of bytes, types and sizes from the specification. Lists some use cases for this struct.

Work toward: #1011

Copy link
Contributor

github-actions bot commented Jul 9, 2024

🐰Bencher

ReportWed, September 4, 2024 at 14:10:10 UTC
ProjectStratum V2 (SRI)
Branchdocstring-sequences
Testbedsv1
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,428.00 (-0.26%)8,305.47 (98.55%)8,594.33 (98.06%)✅ (view plot)3,746.00 (-0.20%)3,724.71 (99.43%)3,782.02 (99.05%)✅ (view plot)5,253.00 (-0.20%)5,215.89 (99.29%)5,310.91 (98.91%)✅ (view plot)5.00 (-26.83%)4.81 (96.29%)8.85 (56.48%)✅ (view plot)90.00 (-0.07%)86.96 (96.62%)93.18 (96.59%)
get_submit✅ (view plot)95,341.00 (-0.03%)95,268.55 (99.92%)95,466.85 (99.87%)✅ (view plot)59,439.00 (-0.04%)59,371.15 (99.89%)59,551.98 (99.81%)✅ (view plot)85,371.00 (-0.04%)85,258.31 (99.87%)85,559.09 (99.78%)✅ (view plot)41.00 (-1.44%)34.79 (84.87%)48.41 (84.70%)✅ (view plot)279.00 (+0.14%)275.45 (98.73%)281.75 (99.02%)
get_subscribe✅ (view plot)8,021.00 (-0.14%)7,976.93 (99.45%)8,087.00 (99.18%)✅ (view plot)2,841.00 (-0.08%)2,834.28 (99.76%)2,852.32 (99.60%)✅ (view plot)3,971.00 (-0.12%)3,958.93 (99.70%)3,993.01 (99.45%)✅ (view plot)12.00 (+15.38%)7.97 (66.43%)12.83 (93.54%)✅ (view plot)114.00 (-0.35%)112.77 (98.92%)116.03 (98.25%)
serialize_authorize✅ (view plot)12,279.00 (-0.02%)12,192.76 (99.30%)12,369.31 (99.27%)✅ (view plot)5,317.00 (-0.14%)5,295.71 (99.60%)5,353.02 (99.33%)✅ (view plot)7,414.00 (-0.15%)7,376.84 (99.50%)7,473.89 (99.20%)✅ (view plot)7.00 (-16.67%)6.43 (91.86%)10.37 (67.50%)✅ (view plot)138.00 (+0.34%)135.65 (98.30%)139.41 (98.99%)
serialize_deserialize_authorize✅ (view plot)24,701.00 (-0.22%)24,500.50 (99.19%)25,011.97 (98.76%)✅ (view plot)9,868.00 (-0.14%)9,825.56 (99.57%)9,939.04 (99.29%)✅ (view plot)13,931.00 (-0.15%)13,856.33 (99.46%)14,047.80 (99.17%)✅ (view plot)33.00 (-7.39%)31.64 (95.88%)39.63 (83.27%)✅ (view plot)303.00 (-0.20%)298.57 (98.54%)308.63 (98.18%)
serialize_deserialize_handle_authorize✅ (view plot)30,356.00 (-0.10%)30,284.83 (99.77%)30,490.04 (99.56%)✅ (view plot)12,071.00 (-0.06%)12,049.71 (99.82%)12,107.02 (99.70%)✅ (view plot)17,096.00 (-0.07%)17,054.26 (99.76%)17,161.28 (99.62%)✅ (view plot)55.00 (+0.06%)46.81 (85.12%)63.12 (87.14%)✅ (view plot)371.00 (-0.15%)368.89 (99.43%)374.24 (99.13%)
serialize_deserialize_handle_submit✅ (view plot)126,460.00 (-0.02%)126,456.07 (100.00%)126,514.47 (99.96%)✅ (view plot)73,280.00 (-0.03%)73,211.77 (99.91%)73,392.50 (99.85%)✅ (view plot)105,060.00 (-0.04%)104,944.55 (99.89%)105,249.32 (99.82%)✅ (view plot)101.00 (-1.14%)93.27 (92.34%)111.07 (90.94%)✅ (view plot)597.00 (+0.08%)591.23 (99.03%)601.77 (99.21%)
serialize_deserialize_handle_subscribe✅ (view plot)27,974.00 (-0.07%)27,921.32 (99.81%)28,063.68 (99.68%)✅ (view plot)9,659.00 (-0.02%)9,652.28 (99.93%)9,670.32 (99.88%)✅ (view plot)13,664.00 (-0.02%)13,645.87 (99.87%)13,687.79 (99.83%)✅ (view plot)62.00 (-0.91%)55.19 (89.01%)69.94 (88.64%)✅ (view plot)400.00 (-0.09%)398.21 (99.55%)402.52 (99.37%)
serialize_deserialize_submit✅ (view plot)115,211.00 (-0.03%)114,962.01 (99.78%)115,536.52 (99.72%)✅ (view plot)68,057.00 (-0.07%)67,920.53 (99.80%)68,282.00 (99.67%)✅ (view plot)97,656.00 (-0.08%)97,429.13 (99.77%)98,034.73 (99.61%)✅ (view plot)60.00 (-0.66%)54.12 (90.20%)66.68 (89.98%)✅ (view plot)493.00 (+0.23%)490.34 (99.46%)493.39 (99.92%)
serialize_deserialize_subscribe✅ (view plot)23,409.00 (+0.01%)23,308.14 (99.57%)23,505.66 (99.59%)✅ (view plot)8,211.00 (-0.05%)8,199.22 (99.86%)8,231.11 (99.76%)✅ (view plot)11,564.00 (-0.07%)11,544.08 (99.83%)11,600.05 (99.69%)✅ (view plot)38.00 (+1.69%)35.21 (92.66%)39.52 (96.15%)✅ (view plot)333.00 (+0.06%)330.47 (99.24%)335.13 (99.37%)
serialize_submit✅ (view plot)99,798.00 (-0.02%)99,763.24 (99.97%)99,866.42 (99.93%)✅ (view plot)61,483.00 (-0.04%)61,415.15 (99.89%)61,595.98 (99.82%)✅ (view plot)88,213.00 (-0.04%)88,094.99 (99.87%)88,403.34 (99.78%)✅ (view plot)42.00 (-5.97%)38.40 (91.42%)50.94 (82.45%)✅ (view plot)325.00 (+0.29%)318.90 (98.12%)329.23 (98.72%)
serialize_subscribe✅ (view plot)11,418.00 (+0.01%)11,353.02 (99.43%)11,479.84 (99.46%)✅ (view plot)4,188.00 (-0.05%)4,181.28 (99.84%)4,199.32 (99.73%)✅ (view plot)5,828.00 (-0.07%)5,815.23 (99.78%)5,848.97 (99.64%)✅ (view plot)12.00 (+1.69%)9.85 (82.09%)13.75 (87.28%)✅ (view plot)158.00 (+0.08%)155.60 (98.48%)160.14 (98.67%)

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

Copy link
Contributor

github-actions bot commented Jul 9, 2024

🐰Bencher

ReportWed, September 4, 2024 at 14:09:59 UTC
ProjectStratum V2 (SRI)
Branch1046/merge
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client-sv1-authorize-serialize/client-sv1-authorize-serializeLatency (nanoseconds (ns))🚨 (view plot | view alert)268.27 (+7.25%)239.28 (89.19%)260.99 (102.79%)
client-sv1-get-authorize/client-sv1-get-authorizeLatency (nanoseconds (ns))🚨 (view plot | view alert)165.21 (+4.56%)151.21 (91.53%)164.81 (100.24%)

Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Lower Boundary
nanoseconds (ns) | (%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,897.10 (+0.62%)6,458.10 (93.63%)7,251.77 (95.11%)
client-submit-serialize-deserialize✅ (view plot)7,931.70 (+0.73%)7,355.26 (92.73%)8,392.75 (94.51%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,548.40 (+1.15%)8,022.37 (93.85%)8,879.58 (96.27%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)927.52 (+1.16%)882.86 (95.19%)950.93 (97.54%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)732.06 (+2.10%)690.21 (94.28%)743.83 (98.42%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize🚨 (view plot | view alert)268.27 (+7.25%)239.28 (89.19%)260.99 (102.79%)
client-sv1-get-authorize/client-sv1-get-authorize🚨 (view plot | view alert)165.21 (+4.56%)151.21 (91.53%)164.81 (100.24%)
client-sv1-get-submit✅ (view plot)6,688.20 (+0.81%)6,209.60 (92.84%)7,059.05 (94.75%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)276.69 (+1.07%)260.73 (94.23%)286.81 (96.47%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)758.05 (-1.36%)731.50 (96.50%)805.54 (94.10%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)629.09 (-0.08%)592.07 (94.12%)667.08 (94.30%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)205.46 (-1.67%)195.25 (95.03%)222.63 (92.29%)

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

Copy link
Contributor

github-actions bot commented Jul 9, 2024

🐰Bencher

ReportWed, September 4, 2024 at 14:09:59 UTC
ProjectStratum V2 (SRI)
Branchdocstring-sequences
Testbedsv2

🚨 3 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_mining_message_submit_standard_serializeL2 Accesses (accesses)🚨 (view plot | view alert)48.00 (+15.20%)35.46 (73.87%)47.87 (100.26%)
client_sv2_open_channel_serialize_deserializeL2 Accesses (accesses)🚨 (view plot | view alert)82.00 (+12.38%)64.72 (78.92%)81.22 (100.96%)
client_sv2_setup_connection_serializeL2 Accesses (accesses)🚨 (view plot | view alert)43.00 (+16.01%)31.79 (73.93%)42.34 (101.55%)

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,145.00 (+2.04%)2,022.98 (94.31%)2,181.09 (98.35%)✅ (view plot)473.00 (-0.01%)468.75 (99.10%)477.32 (99.09%)✅ (view plot)730.00 (-0.80%)726.57 (99.53%)745.16 (97.97%)✅ (view plot)10.00 (+114.29%)-2.19 (-21.90%)11.52 (86.78%)✅ (view plot)39.00 (+1.65%)36.41 (93.36%)40.32 (96.72%)
client_sv2_handle_message_mining✅ (view plot)8,216.00 (+0.33%)8,139.66 (99.07%)8,238.07 (99.73%)✅ (view plot)2,137.00✅ (view plot)3,156.00 (-0.14%)3,154.48 (99.95%)3,166.59 (99.67%)✅ (view plot)39.00 (+12.18%)29.09 (74.60%)40.44 (96.44%)✅ (view plot)139.00 (+0.22%)137.57 (98.97%)139.83 (99.41%)
client_sv2_mining_message_submit_standard✅ (view plot)6,335.00 (+0.88%)6,205.48 (97.96%)6,354.45 (99.69%)✅ (view plot)1,750.00 (-0.00%)1,745.75 (99.76%)1,754.32 (99.75%)✅ (view plot)2,545.00 (-0.26%)2,542.11 (99.89%)2,561.16 (99.37%)✅ (view plot)23.00 (+33.72%)10.25 (44.58%)24.15 (95.25%)✅ (view plot)105.00 (+0.90%)102.06 (97.20%)106.07 (98.99%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,728.00 (+0.10%)14,614.39 (99.23%)14,811.14 (99.44%)✅ (view plot)4,694.00 (-0.00%)4,689.75 (99.91%)4,698.32 (99.91%)✅ (view plot)6,753.00 (-0.09%)6,750.08 (99.96%)6,767.79 (99.78%)🚨 (view plot | view alert)48.00 (+15.20%)35.46 (73.87%)47.87 (100.26%)✅ (view plot)221.00 (-0.14%)218.59 (98.91%)224.01 (98.66%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,514.00 (-0.04%)27,432.04 (99.70%)27,617.50 (99.63%)✅ (view plot)10,585.00 (-0.00%)10,580.75 (99.96%)10,589.32 (99.96%)✅ (view plot)15,399.00 (-0.03%)15,395.33 (99.98%)15,410.53 (99.93%)✅ (view plot)85.00 (+6.16%)74.98 (88.22%)85.15 (99.82%)✅ (view plot)334.00 (-0.27%)332.25 (99.48%)337.55 (98.95%)
client_sv2_open_channel✅ (view plot)4,371.00 (-0.16%)4,319.41 (98.82%)4,436.52 (98.52%)✅ (view plot)1,461.00 (-0.00%)1,456.75 (99.71%)1,465.32 (99.71%)✅ (view plot)2,161.00 (-0.01%)2,154.75 (99.71%)2,167.51 (99.70%)✅ (view plot)8.00 (+6.67%)4.90 (61.23%)10.10 (79.19%)✅ (view plot)62.00 (-0.43%)60.59 (97.73%)63.94 (96.97%)
client_sv2_open_channel_serialize✅ (view plot)13,986.00 (-0.23%)13,925.69 (99.57%)14,109.44 (99.13%)✅ (view plot)5,064.00 (-0.00%)5,059.75 (99.92%)5,068.32 (99.91%)✅ (view plot)7,326.00 (-0.03%)7,320.83 (99.93%)7,335.64 (99.87%)✅ (view plot)37.00 (+11.11%)28.13 (76.03%)38.47 (96.18%)✅ (view plot)185.00 (-0.73%)183.71 (99.30%)189.02 (97.87%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,651.00 (+0.07%)22,543.28 (99.52%)22,727.06 (99.67%)✅ (view plot)8,027.00 (-0.00%)8,022.75 (99.95%)8,031.32 (99.95%)✅ (view plot)11,671.00 (-0.07%)11,669.26 (99.99%)11,689.41 (99.84%)🚨 (view plot | view alert)82.00 (+12.38%)64.72 (78.92%)81.22 (100.96%)✅ (view plot)302.00 (-0.20%)300.17 (99.39%)305.03 (99.01%)
client_sv2_setup_connection✅ (view plot)4,707.00 (+0.52%)4,619.96 (98.15%)4,745.04 (99.20%)✅ (view plot)1,502.00 (-0.00%)1,497.75 (99.72%)1,506.32 (99.71%)✅ (view plot)2,277.00 (-0.07%)2,271.84 (99.77%)2,285.16 (99.64%)✅ (view plot)10.00 (+11.11%)5.82 (58.22%)12.18 (82.11%)✅ (view plot)68.00 (+0.89%)65.65 (96.54%)69.15 (98.33%)
client_sv2_setup_connection_serialize✅ (view plot)16,156.00 (+0.10%)16,072.54 (99.48%)16,207.66 (99.68%)✅ (view plot)5,963.00 (-0.00%)5,958.75 (99.93%)5,967.32 (99.93%)✅ (view plot)8,661.00 (-0.06%)8,658.82 (99.97%)8,674.38 (99.85%)🚨 (view plot | view alert)43.00 (+16.01%)31.79 (73.93%)42.34 (101.55%)✅ (view plot)208.00 (-0.11%)206.36 (99.21%)210.11 (99.00%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,610.00 (+0.11%)35,465.73 (99.59%)35,677.94 (99.81%)✅ (view plot)14,855.00 (-0.00%)14,850.75 (99.97%)14,859.32 (99.97%)✅ (view plot)21,815.00 (-0.04%)21,812.57 (99.99%)21,836.77 (99.90%)✅ (view plot)99.00 (+10.99%)79.08 (79.88%)99.32 (99.68%)✅ (view plot)380.00 (-0.01%)377.53 (99.35%)382.53 (99.34%)

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

Copy link
Contributor

github-actions bot commented Jul 9, 2024

🐰Bencher

ReportWed, September 4, 2024 at 14:09:58 UTC
ProjectStratum V2 (SRI)
Branchdocstring-sequences
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)44.63 (+0.10%)43.18 (96.75%)45.99 (97.03%)
client_sv2_handle_message_mining✅ (view plot)75.16 (-1.43%)62.74 (83.47%)89.76 (83.74%)
client_sv2_mining_message_submit_standard✅ (view plot)14.73 (+0.34%)14.59 (99.03%)14.77 (99.70%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)272.41 (+1.69%)252.06 (92.53%)283.69 (96.02%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)587.96 (-0.94%)566.99 (96.43%)620.10 (94.82%)
client_sv2_open_channel✅ (view plot)163.19 (-2.39%)159.94 (98.01%)174.41 (93.57%)
client_sv2_open_channel_serialize✅ (view plot)270.84 (-2.46%)255.17 (94.21%)300.15 (90.24%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)374.31 (+0.08%)365.04 (97.52%)382.96 (97.74%)
client_sv2_setup_connection✅ (view plot)159.57 (-2.09%)146.39 (91.74%)179.55 (88.87%)
client_sv2_setup_connection_serialize✅ (view plot)429.23 (-6.18%)364.51 (84.92%)550.49 (77.97%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)1,029.50 (+3.20%)904.58 (87.87%)1,090.51 (94.41%)

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

Copy link
Contributor

@Shourya742 Shourya742 left a comment

Choose a reason for hiding this comment

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

Concept ACK. Just one nit

@marathon-gary marathon-gary force-pushed the docstring-sequences branch 2 times, most recently from a849ccb to 3c0fa5a Compare July 16, 2024 13:47
@plebhash plebhash changed the base branch from dev to main August 28, 2024 20:17
@rrybarczyk rrybarczyk added documentation Improvements or additions to documentation protocols Lowest level protocol logic labels Sep 4, 2024
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.

Fine with merging as long as we know that issues #1011 and #1010 will address the full crates and also impose the documentation standards we have discussing in #970.

Takes specific of bytes, types and sizes from the specification.
Lists some use cases for this struct.

Work toward: stratum-mining#1011

fix: cargo fmt for docstrings
@rrybarczyk
Copy link
Collaborator

@marathon-gary has updated this PR with main, however the CI checks are not running. He said there has been issues with his GitHub account and is contact with their support. Once this is resolved, we can merge.

@@ -95,6 +95,15 @@ impl<'a, T: GetSize> GetSize for Seq0255<'a, T> {
}
}

/// Fixed size data sequence up to a length of 65535
///
/// Byte Length Calculation:
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 this referring to? where this byte calculation is happening?

Copy link
Collaborator

@Fi3 Fi3 Sep 6, 2024

Choose a reason for hiding this comment

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

this is how is defined in spec. Actual byte calculation happen in get_size.

Copy link
Collaborator

Choose a reason for hiding this comment

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

/// Return the encoded byte size of an `Encodable` comprehensive of the header, if any
pub trait GetSize {
    fn get_size(&self) -> usize;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

So should this doc live here or in the binary-sv2 and link to it?
another question please, what does L refer to?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Which L ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

a ok the one in docs

Copy link
Collaborator

Choose a reason for hiding this comment

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

so that doc come directly from the spec and L stand for the number of elments in the sequnce
https://github.com/stratum-mining/sv2-spec/blob/main/03-Protocol-Overview.md#31-data-types-mapping

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, its mentioned here twice Decsription: 2-byte length L, unsigned little-endian integer 16-bits, followed by a sequence of L elements of type T. Allowed range of length is 0 to 65535.

Copy link
Collaborator

Choose a reason for hiding this comment

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

btw yes we could link the the GetSize and SizeHint trait in that doc. GetSize is implemented for Encodable and return the total len SizeHint is implemented for Decodable and retutrn total len - header len

/// Decsription: 2-byte length L, unsigned little-endian integer 16-bits, followed by a sequence of L elements of type T. Allowed range of length is 0 to 65535.
///
/// Used for listing channel ids, tx short hashes, tx hashes, list indexes, and full transaction data.
///
/// The liftime is here only for type compatibility with serde-sv2
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Seq064K<'a, T>(pub(crate) Vec<T>, PhantomData<&'a T>);
Copy link
Contributor

Choose a reason for hiding this comment

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

Its still not clear to me what the Vec<T> and PhantomData represent here tbh

/// - For variable-length T: 2 + seq.map(|x| x.length()).sum()
/// Decsription: 2-byte length L, unsigned little-endian integer 16-bits, followed by a sequence of L elements of type T. Allowed range of length is 0 to 65535.
///
/// Used for listing channel ids, tx short hashes, tx hashes, list indexes, and full transaction data.
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 great. Is it possible to also explain why this type is used in the mentioned scenarios?

@@ -9,6 +9,7 @@ use crate::{
use alloc::vec::Vec;
use serde::{ser, ser::SerializeTuple, Deserialize, Deserializer, Serialize};

/// See `binary_sv2::Seq064k`
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this link to the binary_sv2::Seq064k in docs.rs ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jbesraa, good eye/thought process. The answer is no, but check out this comment I left on the #970 discussion.

Let me know your thoughts on making this part of our documentation standard.

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

Successfully merging this pull request may close these issues.

5 participants