-
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
Add consensus params into Simulation #6002
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6002 +/- ##
==========================================
- Coverage 54.71% 54.65% -0.06%
==========================================
Files 424 424
Lines 25794 25820 +26
==========================================
Hits 14113 14113
- Misses 10710 10736 +26
Partials 971 971 |
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.
Thanks @jgimeno, I left a few bits of feedback.
|
||
// GetGenesisStateFromAppState returns x/staking GenesisState given raw application | ||
// genesis state. | ||
func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState { |
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.
Is this even called/used? I'd opt to remove 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.
yeah in x/simulation/params.go line 182
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.
Ok so you removed the other, now removed private helper function 👍
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 🎉
|
||
// GetGenesisStateFromAppState returns x/staking GenesisState given raw application | ||
// genesis state. | ||
func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState { |
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.
Ok so you removed the other, now removed private helper function 👍
|
Checking |
so the problem is that // TestAppImportExport L86
appState, _, cp, err := app.ExportAppStateAndValidators(false, []string{}) // return ConsensusParams
require.NoError(t, err)
require.NotNil(t, cp)
fmt.Printf("importing genesis...\n")
_, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
require.NoError(t, err, "simulation setup failed")
defer func() {
newDB.Close()
require.NoError(t, os.RemoveAll(newDir))
}()
newApp := NewSimApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, DefaultNodeHome, FlagPeriodValue, fauxMerkleModeOpt)
require.Equal(t, "SimApp", newApp.Name())
var genesisState GenesisState
err = app.Codec().UnmarshalJSON(appState, &genesisState)
require.NoError(t, err)
genesisState["consensus_params"] = app.Codec().MustMarshalJSON(cp) // add consensus params
ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
newApp.mm.InitGenesis(ctxB, app.Codec(), genesisState) // will fail because consensus params are not part of any module |
Ok thanks! Got it, can we revert this branch meanwhile? |
This reverts commit 6504868.
Closes: #5988
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)