-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Create PubKey proto types #7109
Comments
I think approach 2 seems to make the most sense tbh, although I don't quite follow what you mean by embedding. In general, I think it's favorable to be consistent, so that's why I like option 2. |
By embedding I mean that the generated struct will look like: type PubKey struct {
PubKeyBytes
} so that methods get forwarded to |
In general I'm leaning towards approach 2 as well because I dislike having to deal with those overrides. They cause too many surprises. |
I have a draft here #7110. I guess this approach could work. It is a bit messy with the |
I too feel approach 2 is better, it's better to avoid overrides imo. |
What do we do about |
Can we have a custom |
Then the two types need to be aware of each other, or do something else entirely like performing equality with only |
Having separate proto and amino types is in general problematic because we still need to convert to/from amino JSON... 🤯 |
I'm kind of stuck on this... Not really sure what to do, in case anyone has any ideas. |
Following up on #7102 (comment) and https://hackmd.io/1s1yKkjkQ7aER8uKnCc06Q?view, only While implementing tendermint That being said, Another cleaner and long term solution would be to move away from tendermint's /cc @amaurymartiny @robert-zaremba @anilcse @atheeshp @aaronc @clevinson @alexanderbez |
Thanks for the excellent summary @blushi! Is there a way we can know to call |
@alexanderbez yeah that's already done in https://github.com/cosmos/cosmos-sdk/blob/8de96d16f9f72afb576af7bf6d9351d37cd1d828/x/auth/signing/verify.go for instance. |
Yes, |
The approach we have been working on so far is to have separate proto and amino types for secp256k1 and use conversion functions. An alternative that we haven't considered is making some small upstream changes to go-amino that allows for separate In discussing this with @blushi and @amaurymartiny, we agreed that the first approach of separate proto and amino pubkey's has the downsides of:
So our preference now is to just make small changes to amino (here and here to support @okwme we'll need to chat with you about how to make these upstream changes to that repo. /cc @alexanderbez |
@aaronc - do we need |
ACK @aaronc -- In fact, I recall attempting to do this months ago when first starting to migrate to Proto, but abandoned it for reasons I can't recall. I'm sure you can still find my PR. @robert-zaremba yes because when calling |
@robert-zaremba yes we need the |
@alexanderbez if you can find your PR that would be great. I'm not seeing anything. |
I can't seem to find it either, but shouldn't be difficult to do again. |
Following up on #7008, we need to add .proto definitions of
PubKey
types to complete #6928 usingAny
.My general proposal is to add proto types like this:
The big problem I see with this approach is that it would break amino marshaling which is needed for the keyring and JSON signing. I can think of two work-arounds
Approach 1: override
MarshalAmino
/MarshalJSON
methods.The downside to this is that overriding JSON affects proto JSON which might not be a good idea. But maybe it's okay...?
Approach 2: have separate amino and a proto types using struct embedding.
This would look like:
where
PubKeyBytes
(or whatever we call it) is the base type alias used for amino:I'm not in love with either approach but it's what we've got. Unless we want to abandon the
Any
approach and deal with this amino compatibility elsewhere... but that's also annoying.Thoughts?
/cc @alexanderbez @sahith-narahari
The text was updated successfully, but these errors were encountered: