-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(signer): add ECDSA proxy keys #87
Conversation
Co-authored-by: reo101 <pavel.atanasov2001@gmail.com>
Co-authored-by: reo101 <pavel.atanasov2001@gmail.com>
- simplify internals of `EcdsaPublicKey`: no need to store the actual abstract object, just its compressed encoding - we construct it when needed - extract verification logic into a separate trait `Verifier`, not in `SecretKey` - remove some (already) obsolete utility functions from `signature.rs`
c88ef02
to
a9ff828
Compare
- move `GenericProxySigner` from common to manager - simplify inners of `EcdsaSignature`
- define public alias `ConsensusSigner = Signerl<BlsSecretKey>`
76b1fda
to
377aa78
Compare
* also, a small fix with error handling (avoid panicking)
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.
- other changes as discussed
- flatten out the code structure by removing generics - TODO: client SDK still not typed straightforward, but with enums insteand
- thus, conclude an implementation variant where ECDSA and BLS types are separated almost everywhere throughout the signer module (+the client SDK)
9ac30c9
to
fede09c
Compare
… key type * also, introduce the `PublicKey` trait * TODO: a custom wrapper type around `BlsPublicKey` was necessary in order to implement `TreeHash` trait for it. Refine the boundaries of usage of alloy's type and our custom wrapper.
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.
Let's make sure to add tests for all new keys + signarures
// derive_more | ||
#[derive(Deref, From, Into)] | ||
pub struct BlsPublicKey { | ||
inner: BlsPublicKeyInner, |
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.
if this is just to re-implement TreeHash
maybe let's also open an issue upstream?
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 had a quick thought about what we can do regarding opening an issue upstream, but I decided for a wrapper type as a common solution. Now that you propose it, I will have a deeper look into how easy this would be (or maybe if the trait is intentionally not implemented); and eventually open up an issue.
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.
Opened up the issue here.
Implementing the required changes in tree_hash
locally wasn't a problem, but then I had a lot of versioning issues, which tie into this task, so I can't say I've got a working PoC of this approach, thus I've not opened a PR in tree_hash
's repo.
Leaving the wrapper type as a temporary solution for now.
Added a TODO in dea0b0c; minimal reexport (as relevant for the wrapper type) in f103c8d
…ic key type thus remove `SignProxyBlsRequest` and `SignProxyEcdsaRequest` as duplicated structs
makes deserialization of signatures properly fallible * also, add both proxy examples in `da_commit`
* replace derived Serialize/Deserialize with sane API ser/de * hex encode fields properly * simplify the inner types of `EcdsaPublicKey` and `EcdsaSignature` to native rust arrays
for the current scale of our needs, we can do without a common (unifying) type for both public key types (BLS and ECDSA), so we basically separate into two separate flows which have only the `PublicKey` trait in common, and that's with a really narrow scope mainly for client-side convenience.
not immediately necessary
they're reexported from the `k256` crate; were previously explicitly imported to enable `serde` feature flag, that's not necessary any longer after type simplifications around inner ECDSA pubkey/signature representation.
Quick summary:
The first two commits are the main content of this PR, so changes are roughly two-fold:
The rest of the commits are smaller decisions and easier to follow.
Update 1
From eba97b0 below, the PR takes an alternative approach to implementing ECDSA proxies where we strive to flatten the flow by losing the generics and making the client SDK more type safe.
TODOs:
fixes #20