Skip to content

Commit

Permalink
include export validators
Browse files Browse the repository at this point in the history
  • Loading branch information
randygrok committed Aug 8, 2024
1 parent e97fda6 commit 57c9751
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion simapp/v2/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ func MoveNextBlock(t *testing.T, app *SimApp[transaction.Tx], ctx context.Contex
require.NoError(t, err)
}

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
func TestSimAppExportAndBlockedAddrs_WithOneBlockProduced(t *testing.T) {
app, ctx := NewTestApp(t)

MoveNextBlock(t, app, ctx)

_, err := app.ExportAppStateAndValidators(false, nil, nil)
require.NoError(t, err)
}

func TestSimAppExportAndBlockedAddrs_NoBlocksProduced(t *testing.T) {
app, _ := NewTestApp(t)

_, err := app.ExportAppStateAndValidators(false, nil, nil)
require.NoError(t, err)
}
4 changes: 3 additions & 1 deletion simapp/v2/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package simapp

import (
"context"
"cosmossdk.io/x/staking"

cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand All @@ -25,9 +26,10 @@ func (app *SimApp[T]) ExportAppStateAndValidators(forZeroHeight bool, jailAllowe
return servertypes.ExportedApp{}, err
}

validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
return servertypes.ExportedApp{
AppState: genesis,
Validators: nil,
Validators: validators,
Height: int64(height),
ConsensusParams: cmtproto.ConsensusParams{}, // TODO: CometBFT consensus params
}, err
Expand Down

0 comments on commit 57c9751

Please sign in to comment.