diff --git a/x/cdp/simulation/decoder.go b/x/cdp/simulation/decoder.go index 202838a8..b2bc1fd0 100644 --- a/x/cdp/simulation/decoder.go +++ b/x/cdp/simulation/decoder.go @@ -22,6 +22,12 @@ func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string { cdc.MustUnmarshalBinaryLengthPrefixed(kvB.Value, &cdpIDsB) return fmt.Sprintf("%v\n%v", cdpIDsA, cdpIDsB) + case bytes.Equal(kvA.Key[:1], types.CdpKeyPrefix): + var cdpA, cdpB types.CDP + cdc.MustUnmarshalBinaryLengthPrefixed(kvA.Value, &cdpA) + cdc.MustUnmarshalBinaryLengthPrefixed(kvB.Value, &cdpB) + return fmt.Sprintf("%v\n%v", cdpA, cdpB) + case bytes.Equal(kvA.Key[:1], types.CdpIDKey), bytes.Equal(kvA.Key[:1], types.CollateralRatioIndexPrefix): idA := binary.BigEndian.Uint64(kvA.Value) diff --git a/x/cdp/simulation/decoder_test.go b/x/cdp/simulation/decoder_test.go index 5790ea6d..52927624 100644 --- a/x/cdp/simulation/decoder_test.go +++ b/x/cdp/simulation/decoder_test.go @@ -28,12 +28,15 @@ func TestDecodeDistributionStore(t *testing.T) { cdpIds := []uint64{1, 2, 3, 4, 5} denom := "denom" - deposit := types.Deposit{CdpID: 1, Amount: sdk.NewCoins(sdk.NewCoin(denom, sdk.OneInt()))} + oneCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.OneInt())) + deposit := types.Deposit{CdpID: 1, Amount: oneCoins} principal := sdk.OneInt() prevDistTime := time.Now().UTC() + cdp := types.CDP{ID: 1, FeesUpdated: prevDistTime, Collateral: oneCoins, Principal: oneCoins, AccumulatedFees: oneCoins} kvPairs := cmn.KVPairs{ cmn.KVPair{Key: types.CdpIDKeyPrefix, Value: cdc.MustMarshalBinaryLengthPrefixed(cdpIds)}, + cmn.KVPair{Key: types.CdpKeyPrefix, Value: cdc.MustMarshalBinaryLengthPrefixed(cdp)}, cmn.KVPair{Key: types.CdpIDKey, Value: sdk.Uint64ToBigEndian(2)}, cmn.KVPair{Key: types.CollateralRatioIndexPrefix, Value: sdk.Uint64ToBigEndian(10)}, cmn.KVPair{Key: []byte(types.DebtDenomKey), Value: cdc.MustMarshalBinaryLengthPrefixed(denom)}, @@ -49,6 +52,7 @@ func TestDecodeDistributionStore(t *testing.T) { expectedLog string }{ {"CdpIDs", fmt.Sprintf("%v\n%v", cdpIds, cdpIds)}, + {"CDP", fmt.Sprintf("%v\n%v", cdp, cdp)}, {"CdpID", "2\n2"}, {"CollateralRatioIndex", "10\n10"}, {"DebtDenom", fmt.Sprintf("%s\n%s", denom, denom)}, diff --git a/x/pricefeed/simulation/decoder.go b/x/pricefeed/simulation/decoder.go index aaa01e9e..9693b6e3 100644 --- a/x/pricefeed/simulation/decoder.go +++ b/x/pricefeed/simulation/decoder.go @@ -20,7 +20,7 @@ func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string { return fmt.Sprintf("%s\n%s", priceA, priceB) case bytes.Contains(kvA.Key, []byte(types.RawPriceFeedPrefix)): - var postedPriceA, postedPriceB types.PostedPrice + var postedPriceA, postedPriceB []types.PostedPrice cdc.MustUnmarshalBinaryBare(kvA.Value, &postedPriceA) cdc.MustUnmarshalBinaryBare(kvB.Value, &postedPriceB) return fmt.Sprintf("%s\n%s", postedPriceA, postedPriceB) diff --git a/x/pricefeed/simulation/decoder_test.go b/x/pricefeed/simulation/decoder_test.go index 2cc846ec..bc886819 100644 --- a/x/pricefeed/simulation/decoder_test.go +++ b/x/pricefeed/simulation/decoder_test.go @@ -27,7 +27,7 @@ func TestDecodeDistributionStore(t *testing.T) { cdc := makeTestCodec() currentPrice := types.CurrentPrice{MarketID: "current", Price: sdk.OneDec()} - postedPrice := types.PostedPrice{MarketID: "posted", Price: sdk.OneDec(), Expiry: time.Now().UTC()} + postedPrice := []types.PostedPrice{{MarketID: "posted", Price: sdk.OneDec(), Expiry: time.Now().UTC()}} kvPairs := cmn.KVPairs{ cmn.KVPair{Key: []byte(types.CurrentPricePrefix), Value: cdc.MustMarshalBinaryBare(currentPrice)}, diff --git a/x/validator-vesting/simulation/decoder_test.go b/x/validator-vesting/simulation/decoder_test.go index fee10265..7cb532ca 100644 --- a/x/validator-vesting/simulation/decoder_test.go +++ b/x/validator-vesting/simulation/decoder_test.go @@ -13,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/kava-labs/kava/x/validator-vesting/internal/types" + "github.com/kava-labs/kava/x/validator-vesting/types" ) func makeTestCodec() (cdc *codec.Codec) {