-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Use protobuf public key in BaseAccount #6886
Comments
I also believe that approach (1) is the cleaner and more intuitive approach. Let's go with that if we can. |
PubKey bech32 encoding is still using amino. I'm assuming we should update that as well to use protobuf? |
Oh no... the whole keyring is still using amino. What do we do? Leave it like that? |
Yikes! I would rather avoid using Amino in the Keybase in favor of Proto if we can. However, this may require too much work before Stargate. I would consider, instead:
Other ideas? /cc @alessio |
Can someone explain how bech32 pubkeys are used? That's one hard piece of this refactoring. |
We need to avoid Bech32 pubkey encoding at all costs. |
Oh so we can just delete that code? |
Which code specifically? |
|
Yeah all of that should be removed IMHO. |
Great 👍 . Now the question is how to serialize the |
so the ie. pubkey:
- type: secp256k1
- value: CAF90... ? |
Alright because it's the proto |
There are a few other complexities I'm running into. Using the protobuf A few options:
Thoughts @alexanderbez ? Side note: I have been thinking about a larger x/auth & x/bank refactoring for a while now and started writing out an ADR but will probably wait until we have a 0.40 RC before opening a PR. But this complexity for me begs the question of a larger x/auth refactor. For one thing, the way vesting accounts are intertwined definitely makes this more a bit more complicated IMHO because any wrapper structs need to deal with vesting accounts separately. |
Another thought on this. Using |
My initial thought was, why not just use
I'm OK with this. We'll just need to make sure we capture this in migration and notify upstream clients.
I don't think we should do this.
How does it diverge? Will this lead to a weird UX, confusion and/or tech debt?
Also seems like a reasonable approach. |
Well, then we end up with the whole dependency on tendermint issue and needing to migrate all tm If we're doing that we might as well backtrack on the whole |
I thought Tendermint was moving away from fixed-sized arrays for public key types @marbar3778? I don't see any harm in redefining key types. This is what I understood that we were doing anyway? Or did I misunderstand? |
Either way I think there are two questions that should be answered separately:
What we do about |
yup you are correct. all key types are no longer sized:
I would love for the sdk to absorb secp256k1 as I dont see it being used in tendermint. |
For the use cases that were using |
So I'm thinking for now to just stick with the existing |
I think whichever way we go, it would actually be good to have all the concrete
|
So after our call last week, I said I would some pros and cons to using a
|
I do think secp can be taken out as I don't foresee the Tendermint team iterating on the implementation. For sr25519 and ed25519, since these are both reliant on external libs, we would keep them in Tendermint as we would offer sr25519 as a validator key along side ed25519. |
Would there be any harm in adding ed/sr25519 directly to the SDK so that we can have our own |
Yes we should do that @aaronc. |
Just an update, in our last call we agreed to go the |
Thanks for the heads up @aaronc We still need a good way to figure out the Any registries on the client side. In general, we need to runtime enforce which instances can validly be used in the Any. Or make Any really like TypeScript I assume there is no proto reference to the Any registry and it is just done in the Go code that registers the concrete implementations for the interfaces, right? Very similar to how Amino did it. It would be great if that info could be pulled out into some canonical spec file we could just compile into our JS proto types. Is there a |
@ethanfrey please see #6722 which was just merged. |
Thanks, I will add an issue to figure out how to use that (cosmos/cosmjs#393) Ah, it still needs to figure this out dynamically on runtime, right? So we will be returning There is no language-neutral compile-time information that describes this data? That we can use in our TypeSystem to refine say |
We're seeing the end of the tunnel regarding this issue. PR tracker (order is important):
|
Now that we have added new pub keys proto types for secp256k1 and multisig to cosmos-sdk (see #7147 and #7284), we can use them in Here are some ideas to solve this:
UPDATE: CONCLUSION: |
As a temporary measure in #5682, we decided to use amino-encoded bytes for the
BaseAccount
pub_key
in protobuf. We can't cut a release without fixing this.We have a
cosmos.crypto.PublicKey
proto type which we can use onBaseAccount
.The biggest glitch is that the
AccountI
interface hasGet/SetPubKey
methods which takecrypto.PubKey
interfaces.I see two solutions:
AccountI.Get/SetPubKey
to usecosmos.crypto.PublicKey
proto type and then usePublicKeyCodec
wherever a conversion tocrypto.PubKey
is neededcrypto.PubKey
on theBaseAccount
struct (maybe with a hidden field)My preference is to go with approach 1. Thoughts? @alexanderbez ?
The text was updated successfully, but these errors were encountered: