cosmos-sdk/x/ibc/simulation/decoder.go
Anil Kumar Kammari 3bafd8255a
Remove hybrid codec usage (#6843)
* remove hybrid codec for slashing, staking and upgrade

* Remove hybridcodec from params and mint

* revert staking

* Fix gov

* Fix ibc and evidence

* Fix ibc-transfer

* Fix staking

* remove evidence json marshaling

* Fix tests

Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-25 08:03:58 +00:00

34 lines
1.0 KiB
Go

package simulation
import (
"fmt"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
clientsim "github.com/cosmos/cosmos-sdk/x/ibc/02-client/simulation"
connectionsim "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/simulation"
channelsim "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/simulation"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)
// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's
// Value to the corresponding ibc type.
func NewDecodeStore(cdc codec.BinaryMarshaler, aminoCdc *codec.Codec) func(kvA, kvB tmkv.Pair) string {
return func(kvA, kvB tmkv.Pair) string {
if res, found := clientsim.NewDecodeStore(aminoCdc, kvA, kvB); found {
return res
}
if res, found := connectionsim.NewDecodeStore(cdc, kvA, kvB); found {
return res
}
if res, found := channelsim.NewDecodeStore(cdc, kvA, kvB); found {
return res
}
panic(fmt.Sprintf("invalid %s key prefix: %s", host.ModuleName, string(kvA.Key)))
}
}