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

remove usage of libsecp256k1 for secp256k1 in claims pallet #5841

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gioyik
Copy link

@Gioyik Gioyik commented Sep 25, 2024

Description

removing the usage of libsecp256k1 from claims pallet as we have moved already to use secp256k1.

Context here: #5840.

Integration

I don't think it requires any integration.

Review Notes

mainly a dependency check, just make sure it behaves in the same way as before.

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: ask maintainers to put the right label on your PR.
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

You can remove the "Checklist" section once all have been checked. Thank you for your contribution!

@Gioyik Gioyik added the T2-pallets This PR/Issue is related to a particular pallet. label Sep 25, 2024
Comment on lines -114 to +166
"sp-core/std",
"sp-inherents/std",
"sp-io/std",
"sp-npos-elections/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"libsecp256k1/hmac",
"libsecp256k1/static-context",
"pallet-asset-rate/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-broker/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks",
"pallet-fast-unstake/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"libsecp256k1/hmac",
"libsecp256k1/static-context",
"pallet-asset-rate/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-broker/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks",
"pallet-fast-unstake/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
try-runtime = [
"frame-election-provider-support/try-runtime",
"frame-support-test/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-asset-rate/try-runtime",
"pallet-authorship/try-runtime",
"pallet-babe?/try-runtime",
"pallet-balances/try-runtime",
"pallet-broker/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-fast-unstake/try-runtime",
"pallet-identity/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-vesting/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
"frame-election-provider-support/try-runtime",
"frame-support-test/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-asset-rate/try-runtime",
"pallet-authorship/try-runtime",
"pallet-babe?/try-runtime",
"pallet-balances/try-runtime",
"pallet-broker/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-fast-unstake/try-runtime",
"pallet-identity/try-runtime",
"pallet-session/try-runtime",
"pallet-staking/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-vesting/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
Copy link
Author

Choose a reason for hiding this comment

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

I will fix this, probably my editor did something, sorry

@Gioyik
Copy link
Author

Gioyik commented Sep 25, 2024

let (sig, recovery_id) = libsecp256k1::sign(&libsecp256k1::Message::parse(&msg), secret);

comes directly from libsecp256k1 and there is no equal in secp256k1 as it looks custom for the lib. Do we still need it or use it? if yes, I can move into the repo (someone can tell me where this could go and be exported by) and figure out the equivalent without using libsecp256k1. I haven't checked how much it would be to move it.

@Gioyik
Copy link
Author

Gioyik commented Sep 25, 2024

actually, I am not sure if the whole secp_utils is even used, it looks it is highly attached to certain parts or behavior in libsecp256k1. Just my early check, I haven't seen in deep.

@bkchr
Copy link
Member

bkchr commented Sep 25, 2024

comes directly from libsecp256k1 and there is no equal in secp256k1 as it looks custom for the lib. Do we still need it or use it?

You probably need to use k256 as this only compiles to no_std and then use sign_prehash_recoverable

@Gioyik
Copy link
Author

Gioyik commented Sep 26, 2024

@bkchr sorry if I don't follow, sign_prehash_recoverable is in the ecdsa crate, is that what you referring to? k256 crate has a sign_prehash but it seems to work slightly different. sec256k1 has a sign_ecdsa_recoverable function, but doesn't return the same as the one in ecdsa crate.

or maybe you are referring to something inside sp-io I am not aware of 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants