Skip to content

Commit

Permalink
Cannot commit in my test cases to load from proper height
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Apr 28, 2022
1 parent d8426fb commit 7663d6f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions x/wasm/keeper/snapshotter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
protoio "github.com/gogo/protobuf/io"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

protoio "github.com/gogo/protobuf/io"

"github.com/CosmWasm/wasmd/x/wasm/types"
)

func TestSnapshoting(t *testing.T) {
// we hack this to "fake" copying over all the iavl data
sharedDB := dbm.NewMemDB()

ctx, keepers := createTestInput(t, false, SupportedFeatures, types.DefaultWasmConfig(), sharedDB)
ctx, keepers := CreateTestInput(t, false, SupportedFeatures)
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
creator := keepers.Faucet.NewFundedAccount(ctx, deposit...)
_, _, bob := keyPubAddr()
Expand All @@ -42,6 +35,14 @@ func TestSnapshoting(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", contractAddr.String())

// commit all data to a height (to be snapshotted)
ms := keepers.MultiStore
id := ms.LastCommitID()
fmt.Printf("%#v\n", id)
commitInfo := ms.Commit()
// for debugging
assert.Equal(t, 1, commitInfo)

// successfully query it
queryBz := []byte(`{"verifier":{}}`)
res, err := keepers.WasmKeeper.QuerySmart(ctx, contractAddr, queryBz)
Expand Down

0 comments on commit 7663d6f

Please sign in to comment.