* change abci file to use BinaryBare * change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in mint keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in auth keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in distribution keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in staking keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in gov keeper store. * change all calls to EncodeLengthPrefixed to BinaryBare in slashing keeper store. * update decoder test * migrate decoder * migrate gov simulation decoder * migrate baseapp_test * refactor QuerySubspace * refactor coedc std codec * migrate keybase * migrate iavl store * migrate root multi * migrate ante basic * migrate tx type to bare * migrate auth client * update auth types * update decoder * migrate supply decoder * migrate stake encoding * migrate staking simulation * migrate genutil * migrate simapp test helpers * migrate docs * upgrade changelog * Update CHANGELOG.md Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
33 lines
1016 B
Go
33 lines
1016 B
Go
package simulation
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
|
|
tmkv "github.com/tendermint/tendermint/libs/kv"
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/exported"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
)
|
|
|
|
// DecodeStore unmarshals the KVPair's Value to the corresponding auth type
|
|
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
|
|
switch {
|
|
case bytes.Equal(kvA.Key[:1], types.AddressStoreKeyPrefix):
|
|
var accA, accB exported.Account
|
|
cdc.MustUnmarshalBinaryBare(kvA.Value, &accA)
|
|
cdc.MustUnmarshalBinaryBare(kvB.Value, &accB)
|
|
return fmt.Sprintf("%v\n%v", accA, accB)
|
|
|
|
case bytes.Equal(kvA.Key, types.GlobalAccountNumberKey):
|
|
var globalAccNumberA, globalAccNumberB uint64
|
|
cdc.MustUnmarshalBinaryBare(kvA.Value, &globalAccNumberA)
|
|
cdc.MustUnmarshalBinaryBare(kvB.Value, &globalAccNumberB)
|
|
return fmt.Sprintf("GlobalAccNumberA: %d\nGlobalAccNumberB: %d", globalAccNumberA, globalAccNumberB)
|
|
|
|
default:
|
|
panic(fmt.Sprintf("invalid account key %X", kvA.Key))
|
|
}
|
|
}
|