-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: app config and simapp (v1,v2) fixes #14209
Changes from 13 commits
95e848d
7d53ceb
1b566fb
2006601
527f082
e2ec990
f393e1c
b3a4c23
e8f19ab
351c942
7130073
fde91f6
77d27e1
ad7e4a4
46eb82a
4479d27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,22 @@ func NewSimApp( | |
interfaceRegistry := encodingConfig.InterfaceRegistry | ||
txConfig := encodingConfig.TxConfig | ||
|
||
// Below we could construct and set an application specific mempool and ABCI 1.0 Prepare and Process Proposal | ||
// handlers. These defaults are already set in the SDK's BaseApp, this shows an example of how to override | ||
// them. | ||
// | ||
// nonceMempool := mempool.NewSenderNonceMempool() | ||
// mempoolOpt := baseapp.SetMempool(nonceMempool) | ||
// prepareOpt := func(app *baseapp.BaseApp) { | ||
// app.SetPrepareProposal(app.DefaultPrepareProposal()) | ||
// } | ||
// processOpt := func(app *baseapp.BaseApp) { | ||
// app.SetProcessProposal(app.DefaultProcessProposal()) | ||
// } | ||
// | ||
// Further down we'd set the options in the AppBuilder like below. | ||
// baseAppOptions = append(baseAppOptions, mempoolOpt, prepareOpt, processOpt) | ||
|
||
bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) | ||
bApp.SetCommitMultiStoreTracer(traceStore) | ||
bApp.SetVersion(version.Version) | ||
|
@@ -353,9 +369,6 @@ func NewSimApp( | |
// Set legacy router for backwards compatibility with gov v1beta1 | ||
govKeeper.SetLegacyRouter(govRouter) | ||
|
||
// RegisterUpgradeHandlers is used for registering any on-chain upgrades. | ||
app.RegisterUpgradeHandlers() | ||
|
||
app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) | ||
|
||
// create evidence keeper with router | ||
|
@@ -442,6 +455,10 @@ func NewSimApp( | |
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) | ||
app.ModuleManager.RegisterServices(app.configurator) | ||
|
||
// RegisterUpgradeHandlers is used for registering any on-chain upgrades. | ||
// Make sure it's called after `app.ModuleManager` and `app.configurator` are set. | ||
app.RegisterUpgradeHandlers() | ||
|
||
autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules)) | ||
|
||
reflectionSvc, err := runtimeservices.NewReflectionService() | ||
|
@@ -591,6 +608,11 @@ func (app *SimApp) TxConfig() client.TxConfig { | |
return app.txConfig | ||
} | ||
|
||
// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. | ||
func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we replace |
||
return ModuleBasics.DefaultGenesis(a.appCodec) | ||
} | ||
|
||
// GetKey returns the KVStoreKey for the provided store key. | ||
// | ||
// NOTE: This is solely to be used for testing purposes. | ||
|
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.
Isn't this 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.
I guess we need to set the module version map set for x/upgrade. But this should really be done somehow automatically with app config
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.
app_v2.go
already sets it, so this was overwritting it and not callingapp.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap())
.Didn't run the integration tests locally, if you use runtime standalone it is indeed 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.
What I'm saying is that app_v2.go shouldn't need to manually call it. Is there a clean way to make that happen? Doesn't need to be in this PR btw
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 see, let me check 👍🏾
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.
Because we need the store to be available, I have not found a clean way.