-
Notifications
You must be signed in to change notification settings - Fork 122
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
Support secp256k1 consensus key #644
Support secp256k1 consensus key #644
Conversation
hey @tony-iqlusion, do you think you can review this PR? (or propose other reviewer). thanks |
There is a backlog of other PRs to review first, and I am also busy with other things including security response |
@mkaczanowski it's fantastic! 😍 |
Sorry to ping you @tony-iqlusion, this feature from @mkaczanowski is awesome. |
For starters, this PR needs a rebase. After that it's blocked on code review by myself. This is an extremely security critical project and changes to it must be made very carefully. As I mentioned earlier, there are a queue of other PRs which were opened without prior planning before this one such as #613 which I've been trying to work through, and I have very little time for this sort of unplanned work. It's also Thanksgiving week here in the US, and after that the holiday season, which further limits my time. I would say I can work on this in Q1 2023 if you want a rough estimate. If you need these changes sooner, I would suggest briefly maintaining a fork with them people can use until such a time as they can get upstreamed. |
Please take your time, if one wants to use that feature, feel free to clone the branch (beta testers are most welcome). In a meantime, I'll rebase PR 👍 |
Hey, @tony-iqlusion I've just rebased the branch. It's been a while and I haven't seen much traction here: I wonder if maybe it'll be better/easier/faster to review & merge this PR prior. I don't introduce any new dependencies, so that's one item less to worry about. Anyway, lemme know if you find some time to look at this one :) |
@mkaczanowski can you rebase again? The branch is out-of-date |
@tony-iqlusion yup, rebased 👍 |
Cargo.toml
Outdated
@@ -65,6 +65,7 @@ zeroize = "1" | |||
abscissa_core = { version = "0.7", features = ["testing"] } | |||
byteorder = "1" | |||
rand = "0.7" | |||
parameterized = "1.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not to add additional dependencies, even if they're dev-dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I removed it. Sacrificed a bit "neatness" of the test code, but I think it's fine this way too: 5cb01cf
src/keyring/signature.rs
Outdated
/// ED25519 signature | ||
ED25519(ed25519::Signature), | ||
|
||
/// ECDSA signagure (e.g secp256k1) | ||
ECDSA(ecdsa::Signature), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow RFC 430 naming conventions
/// ED25519 signature | |
ED25519(ed25519::Signature), | |
/// ECDSA signagure (e.g secp256k1) | |
ECDSA(ecdsa::Signature), | |
/// ED25519 signature | |
Ed25519(ed25519::Signature), | |
/// ECDSA signagure (e.g secp256k1) | |
Ecdsa(ecdsa::Signature), |
Although it's debatable if an enum here is really helpful. It could just be a (newtype for) Vec<u8>
unless the algorithm information is actually needed to be retained
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the naming to match RFC:
7b8aaf0
Although it's debatable if an enum here is really helpful. It could just be a (newtype for) Vec unless the algorithm information is actually needed to be retained
I don't have strong opinion for either. Let me know if you think I should change it
runnig tests again:
|
@tony-iqlusion does it look good to you now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security audit failure is unrelated. I'll follow up on that.
Thanks! |
@tony-iqlusion thanks! Could you cut a new release, say |
There's a lot more work I'd like to get into the next release |
In brief
This change adds support for secp256k1 consensus key.
Currently there are two key types allowed
consensus
andaccount
. The former is ed25519 curve while the latter is secp256k1, yet consensus key selection defaults (hardcode) to ed25519 curve.What's the usecase?
While a vast majority of cosmos-sdk networks use ed25519 key type for consensus, there are some exceptional networks that use secp256k1 curve. In current state those networks can't utilize the tmkms.
In particular, Band (https://bandprotocol.com/bandchain) is using the secp256k1 key for consensus.
Test plan
Unittests / integration tests
Test live (band testnet)
I've joined the Band Testnet with secp256k1 consensus key:
Softsign
You can see the signed blocks here:
Config used:
YubiHSM
You can see the signed blocks here:
Config used: