-
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
Refactor global sdk.Config #7448
Comments
ACK |
@aaronc @alexanderbez Do we have an ETA for this? Our project currently only supports Terra so it's not a major problem (we just set the prefix for the global config on boot), but it would cause issues (e.g. concurrent map read/write panics) if we choose to support more Cosmos-compatible chains in the future. |
Not sure on timelines here, but we're welcome to reviewing PRs if you believe you have a good understanding of the proposed solution. |
Blocked on #9293 |
is this done @JulianToledano |
nope, we need to deprecate the address string method and then remove it from the sdk. Since those make use of the global config. Line 300 in 38c1d6a
|
Is this completed @JulianToledano ? |
Nope, most of the calls have been removed but there're still some that may need some refactors. For example there are a lot of For example govs cosmos-sdk/x/gov/types/v1/msgs.go Lines 114 to 122 in eeeb5b8
but there are more such as banks cosmos-sdk/types/collections.go Lines 17 to 32 in eeeb5b8
Furthermore all addresses unmarshall methods relies on the String method: Lines 234 to 258 in eeeb5b8
|
reopen if not completed |
We won't be able to change most of those, I think without breaking too much |
Yeah, main problem is the string method depends on the global config 😢 |
Summary
Remove global bech32 prefixes and the rest of the global config before v1.0 (see #7421).
Problem Definition
Global config variables are generally a bad design decision. And in interchain world having more flexibility around bech32 prefixes is probably desirable.
If we are targeting a v1.0 release at some point, we likely want to remove the global
Config
and do something better that allows us to keep the core SDK minimal, well-designed and the other parts modular.#7242 likely brings us closer to being able to do this because address parsing is now happening inside handlers rather than at the encoding level.
Proposal
See initial proposal
In #7242, addresses are now parsed manually using
sdk.AccAddressFromBech32
, etc. Instead we can either pass the parameters into keepers (like we do for codecs) or attach them tosdk.Context
and maybe decode address usingctx.AccAddressFromBech32
in keepers and handlers.Also we may consider removing
ValAddress
andConsAddress
fromtypes/
as they are specific to x/staking.For Admin Use
The text was updated successfully, but these errors were encountered: