Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
33 lines
1 KiB
Go
33 lines
1 KiB
Go
package simulation
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cosmos/cosmos-sdk/types/kv"
|
|
|
|
clientsim "github.com/cosmos/ibc-go/v10/modules/core/02-client/simulation"
|
|
connectionsim "github.com/cosmos/ibc-go/v10/modules/core/03-connection/simulation"
|
|
channelsim "github.com/cosmos/ibc-go/v10/modules/core/04-channel/simulation"
|
|
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
|
|
"github.com/cosmos/ibc-go/v10/modules/core/keeper"
|
|
)
|
|
|
|
// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's
|
|
// Value to the corresponding ibc type.
|
|
func NewDecodeStore(k keeper.Keeper) func(kvA, kvB kv.Pair) string {
|
|
return func(kvA, kvB kv.Pair) string {
|
|
if res, found := clientsim.NewDecodeStore(k.Codec(), kvA, kvB); found {
|
|
return res
|
|
}
|
|
|
|
if res, found := connectionsim.NewDecodeStore(k.Codec(), kvA, kvB); found {
|
|
return res
|
|
}
|
|
|
|
if res, found := channelsim.NewDecodeStore(k.Codec(), kvA, kvB); found {
|
|
return res
|
|
}
|
|
|
|
panic(fmt.Errorf("invalid %s key prefix: %s", ibcexported.ModuleName, string(kvA.Key)))
|
|
}
|
|
}
|