-
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!: make ExportGenesis return proto.Message #12700
Conversation
…/import-export-genesis
…s/cosmos-sdk into facu/import-export-genesis
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.
Found 13 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Found 13 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Found 13 potential problems in the proposed changes. Check the Files changed tab for more details.
Codecov Report
@@ Coverage Diff @@
## main #12700 +/- ##
==========================================
- Coverage 56.12% 56.12% -0.01%
==========================================
Files 645 645
Lines 54660 54649 -11
==========================================
- Hits 30680 30670 -10
- Misses 21505 21506 +1
+ Partials 2475 2473 -2
|
@marbar3778 should we make a note of something in an upgrading doc? Great work @facundomedica! |
Yes a short explanation in the upgrading doc is needed |
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.
The cleanup looks great!
@@ -20,8 +20,8 @@ type AppBuilder struct { | |||
|
|||
// DefaultGenesis returns a default genesis from the registered | |||
// AppModuleBasic's. | |||
func (a *AppBuilder) DefaultGenesis() map[string]json.RawMessage { | |||
return a.app.basicManager.DefaultGenesis(a.app.cdc) | |||
func (a *AppBuilder) DefaultGenesis() map[string]proto.Message { |
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.
Will we break the AppModule interface again once we remove gogoproto?
How hard would it be to use the api/
genesis state today?
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.
pulsar is not production ready from my understanding. We shouldn't force people to use it yet. the interface break is fairly small in the future, if we document then people will be fine with it
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.
LGTM
// to which we then unmarshal the genesis' file JSON into | ||
genType := reflect.TypeOf(m.Modules[moduleName].DefaultGenesis()) | ||
if genType == nil { | ||
continue |
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 would panic here instead TBH. It's feedback to the app developers that their DefaultGenesis is incorrect.
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 believe there were some modules returning empty structs like this: []byte(`{}`)
and I translated those to nil
. So I'm gonna double check that
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.
For example x/auth/vesting
and x/upgrade
returned this:
func (AppModuleBasic) DefaultGenesis(_ codec.JSONCodec) json.RawMessage {
return []byte("{}")
}
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.
This breaks how the orm does genesis. I'm sorry but let's please close
The orm will be unusable with this API change. It relies on raw json being usable. This is not just an API change but removes functionality other code depends on. If people really want something like this, just have two extension interfaces (current genesis and proto only genesis) and let AppManager type cast. |
I'm trying out different strategies, so far the main blocker is that 2 of the methods are part of DefaultGenesis(codec.JSONCodec) json.RawMessage
ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error And these are used everywhere. I think I can make it work but this would disrupt the module pattern described at the top of the types/module.go file :
|
I thought we were just defining a new extension interface? |
I've opened this replacement PR: #12828 |
Description
This PR replaces the usage of
json.RawMessage
forproto.Message
in most places where genesis states are being passed.AppModuleBasic
AppModuleGenesis
Unresolved issues
ModuleManager
's still usesmap[string]json.RawMessage
I need to figure out how to create a
map[string]proto.Message
that we can unmarshal values to. Maybe we need to define a new type for this somehow? I need more input on this issueCloses: #12642
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change