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

Framing refactor: test Sv2Frame and HandShakeFrame #1049

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

Conversation

jbesraa
Copy link
Contributor

@jbesraa jbesraa commented Jul 11, 2024

framing-sv2 Crate refactor p4, previous prs #982 #976 #1033
Partially resolves #903
This pr mainly adds basic testing to Sv2Frame and HandShakeFrame

`Frame` is defined with `T` and `B` generics but the constraints are
only introduced in the impl level which makes it harder to read the enum
and understand whats those generics are about. As those generics are a
key part of the `Frame` enum, it makes more sense to introduce the
constraints in the enum level.
Remove `Option` from its return type.
`Sv2Frame` can handle serialized and non-serliazed data, both scenarios
were previously in the same struct wrapped by Option, where if one is
Some, the other is None but never both None or Some.
In `Sv2Frame` and `HandShakeFrame` put initialisers at the top
`HandShakeFrame` as `HandShake::from_message`
@jbesraa jbesraa force-pushed the 2024-07-11-framing-refactor-p4 branch from e9591c1 to 05f9b4c Compare July 16, 2024 13:58
Copy link
Contributor

🐰Bencher

ReportTue, July 16, 2024 at 14:03:30 UTC
ProjectStratum v2 (SRI)
Branch1049/merge
Testbedsv1
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client-submit-serialize✅ (view plot)6,540.10 (-5.63%)7,345.53 (89.04%)
client-submit-serialize-deserialize✅ (view plot)7,347.20 (-6.36%)8,339.46 (88.10%)
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8,047.70 (-4.39%)8,840.44 (91.03%)
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)894.25 (-0.46%)926.60 (96.51%)
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)699.09 (+0.29%)717.96 (97.37%)
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)247.21 (-0.36%)255.18 (96.88%)
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)156.08 (-0.67%)162.44 (96.09%)
client-sv1-get-submit✅ (view plot)6,382.60 (-4.68%)7,135.01 (89.45%)
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)276.59 (-0.70%)291.22 (94.98%)
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)777.15 (+3.93%)778.70 (99.80%)
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)611.43 (-0.46%)637.60 (95.90%)
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)203.17 (-1.67%)219.99 (92.35%)

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

Copy link
Contributor

🐰Bencher

ReportTue, July 16, 2024 at 14:03:31 UTC
ProjectStratum v2 (SRI)
Branch2024-07-11-framing-refactor-p4
Testbedsv2

🚨 8 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
client_sv2_mining_message_submit_standardL2 Accesses (accesses)🚨 (view plot | view alert)24.00 (+36.28%)23.05 (104.10%)
client_sv2_mining_message_submit_standard_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)10,574.00 (+0.30%)10,565.69 (100.08%)
client_sv2_mining_message_submit_standard_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)15,383.00 (+0.28%)15,371.36 (100.08%)
client_sv2_mining_message_submit_standard_serialize_deserializeL2 Accesses (accesses)🚨 (view plot | view alert)90.00 (+7.36%)89.73 (100.30%)
client_sv2_open_channel_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)8,010.00 (+0.32%)8,007.41 (100.03%)
client_sv2_open_channel_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)11,654.00 (+0.34%)11,646.01 (100.07%)
client_sv2_setup_connection_serialize_deserializeInstructions (instructions)🚨 (view plot | view alert)14,838.00 (+0.18%)14,834.69 (100.02%)
client_sv2_setup_connection_serialize_deserializeL1 Accesses (accesses)🚨 (view plot | view alert)21,797.00 (+0.21%)21,783.25 (100.06%)

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 (+2.76%)2,129.16 (98.96%)✅ (view plot)473.00 (+0.49%)486.40 (97.25%)✅ (view plot)732.00 (-0.02%)755.23 (96.92%)✅ (view plot)9.00 (+28.91%)10.81 (83.22%)✅ (view plot)38.00 (+3.64%)38.61 (98.42%)
client_sv2_handle_message_mining✅ (view plot)8,247.00 (+0.60%)8,337.75 (98.91%)✅ (view plot)2,143.00 (+0.73%)2,171.62 (98.68%)✅ (view plot)3,167.00 (+0.71%)3,216.44 (98.46%)✅ (view plot)36.00 (-6.45%)43.60 (82.56%)✅ (view plot)140.00 (+0.81%)142.01 (98.58%)
client_sv2_mining_message_submit_standard✅ (view plot)6,348.00 (+1.14%)6,391.53 (99.32%)✅ (view plot)1,756.00 (+0.36%)1,763.42 (99.58%)✅ (view plot)2,553.00 (-0.03%)2,575.94 (99.11%)🚨 (view plot | view alert)24.00 (+36.28%)23.05 (104.10%)✅ (view plot)105.00 (+1.11%)106.95 (98.18%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14,519.00 (-1.70%)15,039.44 (96.54%)✅ (view plot)4,641.00 (-1.10%)4,712.76 (98.48%)✅ (view plot)6,669.00 (-1.24%)6,784.84 (98.29%)✅ (view plot)51.00 (+7.70%)52.35 (97.42%)✅ (view plot)217.00 (-2.39%)230.03 (94.33%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27,418.00 (-0.21%)27,843.52 (98.47%)🚨 (view plot | view alert)10,574.00 (+0.30%)10,565.69 (100.08%)🚨 (view plot | view alert)15,383.00 (+0.28%)15,371.36 (100.08%)🚨 (view plot | view alert)90.00 (+7.36%)89.73 (100.30%)✅ (view plot)331.00 (-1.12%)345.31 (95.86%)
client_sv2_open_channel✅ (view plot)4,353.00 (-3.04%)4,614.66 (94.33%)✅ (view plot)1,461.00 (+0.06%)1,474.45 (99.09%)✅ (view plot)2,158.00 (+0.24%)2,173.07 (99.31%)✅ (view plot)12.00 (+0.15%)15.24 (78.76%)✅ (view plot)61.00 (-6.23%)68.31 (89.30%)
client_sv2_open_channel_serialize✅ (view plot)13,723.00 (-3.42%)14,489.66 (94.71%)✅ (view plot)5,006.00 (-1.11%)5,083.72 (98.47%)✅ (view plot)7,238.00 (-1.07%)7,347.49 (98.51%)✅ (view plot)37.00 (-0.70%)41.99 (88.12%)✅ (view plot)180.00 (-6.05%)199.43 (90.26%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)22,484.00 (-0.68%)23,024.18 (97.65%)🚨 (view plot | view alert)8,010.00 (+0.32%)8,007.41 (100.03%)🚨 (view plot | view alert)11,654.00 (+0.34%)11,646.01 (100.07%)✅ (view plot)80.00 (+8.95%)82.18 (97.35%)✅ (view plot)298.00 (-2.12%)315.05 (94.59%)
client_sv2_setup_connection✅ (view plot)4,715.00 (+0.35%)4,765.31 (98.94%)✅ (view plot)1,502.00 (+0.05%)1,515.45 (99.11%)✅ (view plot)2,275.00 (-0.08%)2,299.71 (98.93%)✅ (view plot)12.00 (+31.44%)13.68 (87.73%)✅ (view plot)68.00 (+0.16%)69.64 (97.65%)
client_sv2_setup_connection_serialize✅ (view plot)15,809.00 (-2.75%)16,517.92 (95.71%)✅ (view plot)5,887.00 (-1.24%)5,986.45 (98.34%)✅ (view plot)8,534.00 (-1.37%)8,693.95 (98.16%)✅ (view plot)48.00 (+7.42%)49.12 (97.72%)✅ (view plot)201.00 (-4.68%)217.96 (92.22%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35,387.00 (-0.41%)35,748.88 (98.99%)🚨 (view plot | view alert)14,838.00 (+0.18%)14,834.69 (100.02%)🚨 (view plot | view alert)21,797.00 (+0.21%)21,783.25 (100.06%)✅ (view plot)100.00 (+0.37%)112.70 (88.73%)✅ (view plot)374.00 (-1.44%)384.75 (97.21%)

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

Copy link
Contributor

🐰Bencher

ReportTue, July 16, 2024 at 14:03:31 UTC
ProjectStratum v2 (SRI)
Branch2024-07-11-framing-refactor-p4
Testbedsv2
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
client_sv2_handle_message_common✅ (view plot)44.65 (+0.19%)45.24 (98.68%)
client_sv2_handle_message_mining✅ (view plot)73.43 (+0.80%)80.37 (91.37%)
client_sv2_mining_message_submit_standard✅ (view plot)14.63 (-0.14%)14.69 (99.59%)
client_sv2_mining_message_submit_standard_serialize✅ (view plot)254.17 (-3.84%)284.27 (89.41%)
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)566.40 (-4.62%)628.26 (90.15%)
client_sv2_open_channel✅ (view plot)163.42 (-1.50%)173.45 (94.22%)
client_sv2_open_channel_serialize✅ (view plot)281.68 (-0.50%)293.30 (96.04%)
client_sv2_open_channel_serialize_deserialize✅ (view plot)374.42 (-1.03%)423.86 (88.34%)
client_sv2_setup_connection✅ (view plot)167.99 (+2.29%)175.02 (95.99%)
client_sv2_setup_connection_serialize✅ (view plot)426.61 (-9.89%)508.42 (83.91%)
client_sv2_setup_connection_serialize_deserialize✅ (view plot)1,004.40 (+3.35%)1,040.34 (96.55%)

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

Copy link
Contributor

🐰Bencher

ReportTue, July 16, 2024 at 14:03:31 UTC
ProjectStratum v2 (SRI)
Branch2024-07-11-framing-refactor-p4
Testbedsv1

🚨 2 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
serialize_deserialize_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)298.00 (+1.06%)297.85 (100.05%)
serialize_deserialize_handle_authorizeRAM Accesses (accesses)🚨 (view plot | view alert)369.00 (+1.40%)367.32 (100.46%)

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,504.00 (+0.81%)8,725.53 (97.46%)✅ (view plot)3,746.00 (+0.15%)3,855.71 (97.15%)✅ (view plot)5,249.00 (+0.08%)5,402.12 (97.17%)✅ (view plot)7.00 (-11.90%)10.40 (67.31%)✅ (view plot)92.00 (+2.18%)94.03 (97.84%)
get_submit✅ (view plot)95,475.00 (-0.08%)96,143.54 (99.30%)✅ (view plot)59,439.00 (-0.05%)59,779.65 (99.43%)✅ (view plot)85,360.00 (-0.05%)85,838.02 (99.44%)✅ (view plot)49.00 (-11.09%)62.58 (78.30%)✅ (view plot)282.00 (-0.03%)287.71 (98.01%)
get_subscribe✅ (view plot)7,957.00 (-0.25%)8,271.33 (96.20%)✅ (view plot)2,841.00 (+0.39%)2,940.12 (96.63%)✅ (view plot)3,972.00 (+0.46%)4,099.98 (96.88%)✅ (view plot)13.00 (-19.66%)19.82 (65.60%)✅ (view plot)112.00 (-0.56%)116.95 (95.77%)
serialize_authorize✅ (view plot)12,257.00 (+0.42%)12,503.93 (98.03%)✅ (view plot)5,317.00 (+0.11%)5,426.71 (97.98%)✅ (view plot)7,412.00 (+0.06%)7,565.46 (97.97%)✅ (view plot)10.00 (-7.41%)13.38 (74.73%)✅ (view plot)137.00 (+1.06%)140.24 (97.69%)
serialize_deserialize_authorize✅ (view plot)24,554.00 (+0.34%)24,709.48 (99.37%)✅ (view plot)9,898.00 (-0.02%)10,026.68 (98.72%)✅ (view plot)13,959.00 (-0.05%)14,151.77 (98.64%)✅ (view plot)33.00 (-9.79%)41.62 (79.29%)🚨 (view plot | view alert)298.00 (+1.06%)297.85 (100.05%)
serialize_deserialize_handle_authorize✅ (view plot)30,335.00 (+0.62%)30,348.92 (99.95%)✅ (view plot)12,101.00 (+0.05%)12,210.71 (99.10%)✅ (view plot)17,115.00 (-0.01%)17,280.53 (99.04%)✅ (view plot)61.00 (+3.71%)64.77 (94.18%)🚨 (view plot | view alert)369.00 (+1.40%)367.32 (100.46%)
serialize_deserialize_handle_submit✅ (view plot)126,406.00 (-0.00%)127,033.73 (99.51%)✅ (view plot)73,224.00 (-0.04%)73,621.57 (99.46%)✅ (view plot)104,946.00 (-0.04%)105,513.86 (99.46%)✅ (view plot)120.00 (-0.42%)131.31 (91.38%)✅ (view plot)596.00 (+0.19%)599.24 (99.46%)
serialize_deserialize_handle_subscribe✅ (view plot)27,503.00 (+0.17%)27,603.14 (99.64%)✅ (view plot)9,643.00 (+0.12%)9,742.12 (98.98%)✅ (view plot)13,638.00 (+0.11%)13,775.88 (99.00%)✅ (view plot)64.00 (-2.92%)73.80 (86.72%)✅ (view plot)387.00 (+0.31%)388.59 (99.59%)
serialize_deserialize_submit✅ (view plot)114,999.00 (-0.07%)115,655.20 (99.43%)✅ (view plot)68,001.00 (-0.08%)68,404.14 (99.41%)✅ (view plot)97,559.00 (-0.09%)98,152.61 (99.40%)✅ (view plot)65.00 (-6.39%)75.30 (86.32%)✅ (view plot)489.00 (+0.18%)492.39 (99.31%)
serialize_deserialize_subscribe✅ (view plot)22,888.00 (+0.06%)23,112.00 (99.03%)✅ (view plot)8,195.00 (+0.11%)8,297.86 (98.76%)✅ (view plot)11,543.00 (+0.12%)11,683.32 (98.80%)✅ (view plot)36.00 (-8.63%)44.09 (81.65%)✅ (view plot)319.00 (+0.15%)321.50 (99.22%)
serialize_submit✅ (view plot)99,792.00 (-0.10%)100,471.79 (99.32%)✅ (view plot)61,483.00 (-0.05%)61,829.06 (99.44%)✅ (view plot)88,207.00 (-0.05%)88,691.57 (99.45%)✅ (view plot)49.00 (-12.04%)62.30 (78.65%)✅ (view plot)324.00 (-0.21%)329.20 (98.42%)
serialize_subscribe✅ (view plot)11,294.00 (-0.29%)11,607.24 (97.30%)✅ (view plot)4,188.00 (+0.27%)4,287.12 (97.69%)✅ (view plot)5,829.00 (+0.29%)5,959.20 (97.82%)✅ (view plot)15.00 (-8.33%)18.98 (79.05%)✅ (view plot)154.00 (-0.78%)159.77 (96.39%)

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

@plebhash plebhash self-assigned this Jul 16, 2024
@plebhash plebhash linked an issue Aug 20, 2024 that may be closed by this pull request
@plebhash plebhash changed the base branch from dev to main August 28, 2024 19:20
@plebhash
Copy link
Collaborator

plebhash commented Sep 3, 2024

let's revert this to draft for now, we should aim to finish docs and have a refined and wide collective understanding of protocols crates, which will be addressed by the documentation issues listed on #845

@GitGab19 GitGab19 added refactor Implies refactoring code protocols Lowest level protocol logic labels Sep 5, 2024
@GitGab19 GitGab19 marked this pull request as draft September 5, 2024 14:02
@GitGab19
Copy link
Collaborator

GitGab19 commented Sep 5, 2024

Converted to draft for the reason we agree on yesterday call (look at #1033 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocols Lowest level protocol logic refactor Implies refactoring code
Projects
Status: Todo 📝
Development

Successfully merging this pull request may close these issues.

refactor: framing_sv2 crate
3 participants