Skip to content

Use correct encoding for public secp256k1 key#722

Merged
Fi3 merged 4 commits into
stratum-mining:mainfrom
jakubtrnka:key-encoding
Feb 13, 2024
Merged

Use correct encoding for public secp256k1 key#722
Fi3 merged 4 commits into
stratum-mining:mainfrom
jakubtrnka:key-encoding

Conversation

@jakubtrnka
Copy link
Copy Markdown
Contributor

This is a suggested solution for #721

@jakubtrnka jakubtrnka changed the base branch from main to dev January 19, 2024 12:57
Comment thread utils/key-utils/src/lib.rs Outdated
@pavlenex pavlenex added this to the Milestone4 milestone Jan 22, 2024
@pavlenex pavlenex removed this from the Milestone 4 milestone Jan 29, 2024
@Sjors
Copy link
Copy Markdown
Collaborator

Sjors commented Feb 5, 2024

Don't forgot to update the branch to main.

@jakubtrnka jakubtrnka changed the base branch from dev to main February 6, 2024 17:47
@Sjors
Copy link
Copy Markdown
Collaborator

Sjors commented Feb 6, 2024

I can test this against the Template Provider when #717 is fixed. But feel free to merge earlier.

Comment thread utils/key-utils/src/lib.rs
Comment thread utils/key-utils/src/lib.rs
@pavlenex pavlenex requested review from Fi3 and Sjors February 6, 2024 18:40
@pavlenex pavlenex linked an issue Feb 6, 2024 that may be closed by this pull request
@jakubtrnka jakubtrnka force-pushed the key-encoding branch 5 times, most recently from f2764fc to 669a5f1 Compare February 6, 2024 19:04
@Fi3
Copy link
Copy Markdown
Collaborator

Fi3 commented Feb 7, 2024

LGTM only cargo fmt and tests to fix, I will open a PR with the fixes against @jakubtrnka branch

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2024

🐰Bencher

ReportTue, February 13, 2024 at 17:49:38 UTC
ProjectStratum v2 (SRI)
Branchkey-encoding
Testbedsv2
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
client_sv2_handle_message_common✅ (view plot)44.116
client_sv2_handle_message_mining✅ (view plot)64.566
client_sv2_mining_message_submit_standard✅ (view plot)14.649
client_sv2_mining_message_submit_standard_serialize✅ (view plot)254.260
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)600.000
client_sv2_open_channel✅ (view plot)163.890
client_sv2_open_channel_serialize✅ (view plot)289.990
client_sv2_open_channel_serialize_deserialize✅ (view plot)371.390
client_sv2_setup_connection✅ (view plot)160.730
client_sv2_setup_connection_serialize✅ (view plot)501.540
client_sv2_setup_connection_serialize_deserialize✅ (view plot)1028.700

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2024

🐰Bencher

ReportTue, February 13, 2024 at 17:49:37 UTC
ProjectStratum v2 (SRI)
Branchkey-encoding
Testbedsv1
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
InstructionsInstructions Results
instructions | (Δ%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
get_authorize✅ (view plot)8512.000✅ (view plot)3746.000✅ (view plot)5247.000✅ (view plot)9.000✅ (view plot)92.000
get_submit✅ (view plot)95571.000✅ (view plot)59439.000✅ (view plot)85351.000✅ (view plot)56.000✅ (view plot)284.000
get_subscribe✅ (view plot)7969.000✅ (view plot)2841.000✅ (view plot)3969.000✅ (view plot)16.000✅ (view plot)112.000
serialize_authorize✅ (view plot)12277.000✅ (view plot)5317.000✅ (view plot)7407.000✅ (view plot)15.000✅ (view plot)137.000
serialize_deserialize_authorize✅ (view plot)24514.000✅ (view plot)9898.000✅ (view plot)13954.000✅ (view plot)40.000✅ (view plot)296.000
serialize_deserialize_handle_authorize✅ (view plot)30237.000✅ (view plot)12101.000✅ (view plot)17117.000✅ (view plot)62.000✅ (view plot)366.000
serialize_deserialize_handle_submit✅ (view plot)126424.000✅ (view plot)73224.000✅ (view plot)104949.000✅ (view plot)116.000✅ (view plot)597.000
serialize_deserialize_handle_subscribe✅ (view plot)27443.000✅ (view plot)9643.000✅ (view plot)13638.000✅ (view plot)66.000✅ (view plot)385.000
serialize_deserialize_submit✅ (view plot)115011.000✅ (view plot)68001.000✅ (view plot)97556.000✅ (view plot)68.000✅ (view plot)489.000
serialize_deserialize_subscribe✅ (view plot)22844.000✅ (view plot)8195.000✅ (view plot)11539.000✅ (view plot)42.000✅ (view plot)317.000
serialize_submit✅ (view plot)99880.000✅ (view plot)61483.000✅ (view plot)88200.000✅ (view plot)54.000✅ (view plot)326.000
serialize_subscribe✅ (view plot)11302.000✅ (view plot)4188.000✅ (view plot)5827.000✅ (view plot)17.000✅ (view plot)154.000

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2024

🐰Bencher

ReportTue, February 13, 2024 at 17:49:38 UTC
ProjectStratum v2 (SRI)
Branchkey-encoding
Testbedsv2
BenchmarkEstimated CyclesEstimated Cycles Results
estimated cycles | (Δ%)
InstructionsInstructions Results
instructions | (Δ%)
L1 AccessesL1 Accesses Results
accesses | (Δ%)
L2 AccessesL2 Accesses Results
accesses | (Δ%)
RAM AccessesRAM Accesses Results
accesses | (Δ%)
client_sv2_handle_message_common✅ (view plot)2075.000✅ (view plot)469.000✅ (view plot)725.000✅ (view plot)11.000✅ (view plot)37.000
client_sv2_handle_message_mining✅ (view plot)8111.000✅ (view plot)2081.000✅ (view plot)3066.000✅ (view plot)43.000✅ (view plot)138.000
client_sv2_mining_message_submit_standard✅ (view plot)6382.000✅ (view plot)1756.000✅ (view plot)2552.000✅ (view plot)24.000✅ (view plot)106.000
client_sv2_mining_message_submit_standard_serialize✅ (view plot)14737.000✅ (view plot)4700.000✅ (view plot)6762.000✅ (view plot)48.000✅ (view plot)221.000
client_sv2_mining_message_submit_standard_serialize_deserialize✅ (view plot)27428.000✅ (view plot)10543.000✅ (view plot)15338.000✅ (view plot)87.000✅ (view plot)333.000
client_sv2_open_channel✅ (view plot)4451.000✅ (view plot)1461.000✅ (view plot)2156.000✅ (view plot)11.000✅ (view plot)64.000
client_sv2_open_channel_serialize✅ (view plot)14172.000✅ (view plot)5064.000✅ (view plot)7317.000✅ (view plot)41.000✅ (view plot)190.000
client_sv2_open_channel_serialize_deserialize✅ (view plot)22536.000✅ (view plot)7979.000✅ (view plot)11606.000✅ (view plot)79.000✅ (view plot)301.000
client_sv2_setup_connection✅ (view plot)4799.000✅ (view plot)1502.000✅ (view plot)2269.000✅ (view plot)16.000✅ (view plot)70.000
client_sv2_setup_connection_serialize✅ (view plot)16240.000✅ (view plot)5963.000✅ (view plot)8655.000✅ (view plot)47.000✅ (view plot)210.000
client_sv2_setup_connection_serialize_deserialize✅ (view plot)35482.000✅ (view plot)14806.000✅ (view plot)21752.000✅ (view plot)93.000✅ (view plot)379.000

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2024

🐰Bencher

ReportTue, February 13, 2024 at 17:49:41 UTC
ProjectStratum v2 (SRI)
Branchkey-encoding
Testbedsv1
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
client-submit-serialize✅ (view plot)6679.300
client-submit-serialize-deserialize✅ (view plot)7609.000
client-submit-serialize-deserialize-handle/client-submit-serialize-deserialize-handle✅ (view plot)8255.000
client-sv1-authorize-serialize-deserialize-handle/client-sv1-authorize-serialize-deserialize-handle✅ (view plot)886.650
client-sv1-authorize-serialize-deserialize/client-sv1-authorize-serialize-deserialize✅ (view plot)690.400
client-sv1-authorize-serialize/client-sv1-authorize-serialize✅ (view plot)245.690
client-sv1-get-authorize/client-sv1-get-authorize✅ (view plot)157.350
client-sv1-get-submit✅ (view plot)6518.100
client-sv1-get-subscribe/client-sv1-get-subscribe✅ (view plot)281.010
client-sv1-subscribe-serialize-deserialize-handle/client-sv1-subscribe-serialize-deserialize-handle✅ (view plot)752.330
client-sv1-subscribe-serialize-deserialize/client-sv1-subscribe-serialize-deserialize✅ (view plot)610.610
client-sv1-subscribe-serialize/client-sv1-subscribe-serialize✅ (view plot)204.720

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

- Improve Display impl for key-util Error, add more error variants
- Update format in key-util unit tests
- consequence of implementing Copy for secp256k1-keys types
@Fi3
Copy link
Copy Markdown
Collaborator

Fi3 commented Feb 13, 2024

@jakubtrnka some tests are failing with InvalidChecksum:

 value: Bs58Decode(InvalidChecksum { checksum: [178, 200, 220, 184], expected_checksum: [9, 43, 108, 231] })

@Fi3 Fi3 merged commit 82d58d7 into stratum-mining:main Feb 13, 2024
@jakubtrnka jakubtrnka deleted the key-encoding branch March 6, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SRI uses incorrect encoding of secp256k1 public keys

4 participants