Skip to content
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 gaiad export #1800

Merged
merged 4 commits into from
Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ BUG FIXES
* \#1797 Fix off-by-one error in slashing for downtime
* \#1787 Fixed bug where Tally fails due to revoked/unbonding validator
* \#1766 Fixes bad example for keybase identity
* \#1799 Fix `gaiad export`
3 changes: 2 additions & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error {
if main == nil {
return errors.New("baseapp expects MultiStore with 'main' KVStore")
}

// Needed for `gaiad export`, which inits from store but never calls initchain
app.setCheckState(abci.Header{})
return nil
}

Expand Down
17 changes: 17 additions & 0 deletions cmd/gaia/app/app_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package app

import (
"os"
"testing"

"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/stake"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"

abci "github.com/tendermint/tendermint/abci/types"
)
Expand Down Expand Up @@ -31,3 +37,14 @@ func setGenesis(gapp *GaiaApp, accs ...*auth.BaseAccount) error {

return nil
}

func TestGaiadExport(t *testing.T) {
db := db.NewMemDB()
gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil)
setGenesis(gapp)

// Making a new app object with the db, so that initchain hasn't been called
newGapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil)
_, _, err := newGapp.ExportAppStateAndValidators()
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}