-
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
EPIC: remove global bech32 #13140
Comments
@marbar3778 this is an epic epic. I am a huge fan. if I get time might look at closing it or seeing if we've got someone at Notional feeling up to the task. |
|
|
In #1533 I read about We can combine |
How do we feel about deprecating bech32 entirely and just using byte addresses (maybe EIP-55), whats the advantage to the human readable prefix bech32, many nontechnical users find it confusing that their address changes when they switch chains and is a huge confusion point from many members in our community. |
Bech32 could be a purely client-side or rpc side thing, no need to exist in chain state I think. We can use raw bytes in state, but convert to bech32 in rpc. |
Personally i think we should kill accaddress type as well. It should all be bytes. The decode and encode are handled by the address codec. We shouldnt combine it with the codec.codec since they do two separate things and some modules dont need codec.codec. Bech32 or any address encoding is only an client layer thing, it shouldnt be used in state |
This is already the case. Bech32 isn't used in the state-machine. Modules store bytes, not strings. Bech32 is used for clients and tests primarily. |
It is used in the state machine in so much as transaction addresses are encoded in bech32 and need to be decoded in modules. I agree with @yihuang that we should evaluate making it client side only, but as an option. Removing it from the state machine entirely would be too breaking for clients. But we could add support in sign mode textual for rendering bytes addresses as bech32. Any thoughts @AmauryM ? |
That only happens in message validation, the state machine does not rely on any string interpretations. |
Message validation is part of the state machine. But in addition, all msg servers decode bech32 addresses. Just look at any msg server implementation - even the simplest bank |
Yes, but they're never read or written to/from storage is what I meant. |
Yes they are usually not used in storage, but some chains might store them. |
There are several sdk modules store bech32 into the state, I did a search in the change set file:
|
I both stand corrected and am very disappointed. Thanks for pointing that out @yihuang! |
dam this was my worry, we will have to approach this issue based on where it is used. Some places like staking could only be removed in a staking v2 design. |
We'll need migrations then. Which shouldn't be hard. Just take string to bytes. Still a bummer though. |
Why is it a problem that they're stored in state though? It doesn't affect our ability to remove the global. |
main issue is how long migrations would take, but something we can test.
if a user wants to use something other than bech32 then they still need to use bech32 for this layer. |
as long as the modules storing string addresses in state use |
Hey guys!! A lot of String calls have been removed from However, my current concern is the String method, has a cache for Bech32 addresses. I think it makes sense to create an address codec with a cache to maintain performance. |
yea the cache makes sense. for the breaking of interfaces i think we can leave them on the global for now. We have plans on changing things in the future so would prefer to avoid breaking things for users |
closing this, the cache is still being worked on but this is a nice to have performance improvement |
Summary
Currently bech32 prefixes is a global in the cosmos-sdk and for applications as well. We should aim to remove most if not all globals within the sdk.
Problem Definition
Globals should be removed.
Work Breakdown
Notes:
Is there any other work we should mention here?
ref #8332
The text was updated successfully, but these errors were encountered: