Skip to content

Commit

Permalink
Merge pull request #85 from dongsam/84-fix-module-app-settings
Browse files Browse the repository at this point in the history
fix: solve module, sdk issues
  • Loading branch information
dongsam authored Aug 19, 2021
2 parents c7800f2 + 6c8c83c commit d721098
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ func NewFarmingApp(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey, farmingtypes.StoreKey,
// todo: farming ordering
evidencetypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, farmingtypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down
36 changes: 36 additions & 0 deletions app/app_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package app

import (
"encoding/json"
"os"
"testing"

"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
encCfg := MakeTestEncodingConfig()
db := dbm.NewMemDB()
app := NewFarmingApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})

genesisState := NewDefaultGenesisState(encCfg.Marshaler)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)

// Initialize the chain
app.InitChain(
abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
AppStateBytes: stateBytes,
},
)
app.Commit()

res, err := app.ExportAppStateAndValidators(false, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
_, err = res.AppState.MarshalJSON()
require.NoError(t, err)
}
2 changes: 1 addition & 1 deletion x/farming/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}

// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 2 }
func (AppModule) ConsensusVersion() uint64 { return 1 }

// BeginBlock returns the begin blocker for the farming module.
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {
Expand Down

0 comments on commit d721098

Please sign in to comment.