Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICS 02 upstream changes #5122

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
46d228a
add client
mossid Jun 7, 2019
65a904a
add counterpartymanager
mossid Jun 11, 2019
070e7d0
fix manager
mossid Jun 11, 2019
99ad6d4
add Is() to counterobject
mossid Jun 11, 2019
9956f0e
add readme, reflect ICS02 revision
mossid Jun 11, 2019
5f63918
reflect downstream ics
mossid Jun 11, 2019
ab3e4e6
test in progress
mossid Jun 13, 2019
e7dde78
add test
mossid Jun 13, 2019
579060f
in progres
mossid Jun 19, 2019
b3f4ef5
fin rebase
mossid Jun 25, 2019
7b74557
in progress
mossid Jun 25, 2019
b596fe1
fin rebase
mossid Jun 25, 2019
d41b984
add CLIObject in progress
mossid Jun 25, 2019
4ed87ef
cli in progress
mossid Jun 26, 2019
276f18c
add CLIObject
mossid Jun 26, 2019
1078211
separate testing from tendermint
mossid Jun 26, 2019
e64a0d2
add key to node
mossid Jun 26, 2019
e2a61ac
add root and storekey to tests/node, add codec
mossid Jun 26, 2019
c6c4c04
rm cli/query.go
mossid Jul 7, 2019
83afdaf
fix test
mossid Jul 7, 2019
21e0b15
fix lint
mossid Jul 7, 2019
203eaf3
fix lint
mossid Jul 7, 2019
0872511
add CLIObject in progress
mossid Jun 25, 2019
fdf09cc
cli in progress
mossid Jun 26, 2019
ae66357
add connection
mossid Jun 7, 2019
7c44da1
fix assertSymmetry
mossid Jun 7, 2019
043de51
fix remote
mossid Jun 10, 2019
b284119
reformat over dependent icss
mossid Jun 11, 2019
33b3b2d
add CounterManager.Query/90
mossid Jun 11, 2019
f835bab
reflect downstream ics
mossid Jun 11, 2019
6437f59
fix
mossid Jun 26, 2019
927a2d0
add test in progress
mossid Jun 26, 2019
c0ca538
add test in progress
mossid Jun 26, 2019
67818d5
add test in progress/
mossid Jun 28, 2019
d5bed42
add test in progress 02
mossid Jun 29, 2019
93f35b8
add test in progress 23
mossid Jun 29, 2019
82d8a7c
handshake test now working
mossid Jun 29, 2019
1b47501
modularize connection in progress
mossid Jul 4, 2019
a2a0233
fix all syntax errors
mossid Jul 5, 2019
2d4c723
test reworking
mossid Jul 5, 2019
20489fb
change connection structure
mossid Jul 7, 2019
0b4eab0
rm sendable/receivable
mossid Jul 7, 2019
9481364
add sendable/receivable method to object
mossid Jul 7, 2019
a3261d7
add checking availabiltiy
mossid Jul 7, 2019
ca9ecbc
add context() in test
mossid Jul 7, 2019
83b9f5a
fix most of lint
mossid Jul 7, 2019
94edc2f
fix lijt
mossid Jul 7, 2019
8da2598
add client
mossid Jun 7, 2019
9a07feb
add counterpartymanager
mossid Jun 11, 2019
1c204dc
fix manager
mossid Jun 11, 2019
6e5346b
add Is() to counterobject
mossid Jun 11, 2019
3370408
add readme, reflect ICS02 revision
mossid Jun 11, 2019
2d43e20
reflect downstream ics
mossid Jun 11, 2019
2bd98e1
test in progress
mossid Jun 13, 2019
0e52a48
add test
mossid Jun 13, 2019
d234530
in progres
mossid Jun 19, 2019
8caf0ba
fin rebase
mossid Jun 25, 2019
9799769
in progress
mossid Jun 25, 2019
e67b97b
fin rebase
mossid Jun 25, 2019
fb375d2
add CLIObject in progress
mossid Jun 25, 2019
092cd74
cli in progress
mossid Jun 26, 2019
9ddab33
add CLIObject
mossid Jun 26, 2019
d1fad94
separate testing from tendermint
mossid Jun 26, 2019
5bc0068
add key to node
mossid Jun 26, 2019
10f8e61
add root and storekey to tests/node, add codec
mossid Jun 26, 2019
eda101a
rm cli/query.go
mossid Jul 7, 2019
5c254fb
fix test
mossid Jul 7, 2019
6ada539
fix lint
mossid Jul 7, 2019
f7e1336
fix lint
mossid Jul 7, 2019
7bd4ba5
add handler/msgs/client
mossid Jul 9, 2019
f750ac4
rm relay
mossid Jul 9, 2019
a3e2f9c
finalize rebase on 23 root/path sep
mossid Jul 11, 2019
56712b1
fix lint, fix syntax
mossid Jul 11, 2019
d56fdbe
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Jul 11, 2019
ea91bb8
finalize rebase on merkle root/path separation
mossid Jul 13, 2019
812d3ab
add path
mossid Jul 13, 2019
02a3b1c
add comments for manual proof arguments
mossid Jul 13, 2019
631d737
pass proofs manually
mossid Jul 13, 2019
176c8ce
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Jul 13, 2019
00df063
fix querying
mossid Jul 13, 2019
19321f1
extract out context withstore
mossid Jul 13, 2019
486e862
fix 02-client test
mossid Jul 13, 2019
67a3e1b
fix 23-commitment test
mossid Jul 13, 2019
8e660ea
add query in progress
mossid Jul 15, 2019
2369a7c
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Jul 15, 2019
5584ceb
add cli/handler/msg in progress
mossid Jul 15, 2019
503a399
add cli/msg/handler
mossid Jul 17, 2019
3351a6a
add CLIQuery, fix tests
mossid Jul 17, 2019
bed5276
fix golangci
mossid Jul 18, 2019
d6fabbd
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Aug 1, 2019
7286fed
fix test
mossid Aug 14, 2019
f81d7b4
fix client
mossid Aug 14, 2019
30aff55
add CLIObject in progress
mossid Jun 25, 2019
9e46e5f
cli in progress
mossid Jun 26, 2019
ee8d154
add test in progress/
mossid Jun 28, 2019
10835cf
handshake test now working
mossid Jun 29, 2019
d7a5c30
in progress
mossid Jun 10, 2019
f951098
in progress
mossid Jun 10, 2019
7a0b255
add send/receive
mossid Jun 11, 2019
e8f16aa
in progress
mossid Jun 11, 2019
833aeab
fix packets
mossid Jun 11, 2019
8893b4b
in progress
mossid Jun 13, 2019
99de876
in progress
mossid Jul 6, 2019
48d9088
in progress
mossid Jul 7, 2019
b991e84
in progress
mossid Jul 7, 2019
9b5b38e
in progress
mossid Jul 7, 2019
ad8b7bf
in progress
mossid Jul 7, 2019
be293be
implement test in progress
mossid Jul 7, 2019
bf1d7f7
send/receive test working
mossid Jul 7, 2019
705b109
fix most of lint
mossid Jul 7, 2019
72090e7
finalize rebase on merkle path / root separatio
mossid Jul 13, 2019
5f57caa
manually pass proofs
mossid Jul 13, 2019
b01c3f9
add msgs/handler in progress
mossid Jul 17, 2019
2ae06c4
add client query/tx
mossid Jul 18, 2019
7ecd360
fix golangci
mossid Jul 18, 2019
33d1760
add MsgReceive
mossid Jul 18, 2019
bf762ba
fix relayer cli
mossid Jul 19, 2019
1061a78
finalize rebase, fix test
mossid Aug 15, 2019
7a863d7
comment out client
mossid Aug 15, 2019
8b876ba
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Aug 15, 2019
e1abf49
merge from ics04 branch
mossid Aug 15, 2019
918c49a
Merge branch 'joon/ics-03-implementation' into joon/ics-04-implementa…
mossid Aug 15, 2019
eb7f614
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Aug 15, 2019
447eb3b
Merge branch 'joon/ics-03-implementation' into joon/ics-04-implementa…
mossid Aug 15, 2019
df2b7fe
add port
mossid Aug 15, 2019
51303fd
fix test
mossid Aug 15, 2019
c60fd53
add mocks
mossid Aug 21, 2019
ee9bad2
fix connid -> portid in handshake.go
mossid Aug 21, 2019
649ea6e
add mock
mossid Aug 26, 2019
5ea508b
add ibc module.go, finalize mock
mossid Sep 2, 2019
418ec86
add keeper
mossid Sep 2, 2019
0570f84
add StoreKey const
mossid Sep 2, 2019
6299864
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 2, 2019
ed6a7db
Merge branch 'joon/ics-03-implementation' into joon/ics-04-implementa…
mossid Sep 2, 2019
fc35efc
Merge branch 'joon/ics-04-implementation' into joon/ibc-sdk-interface
mossid Sep 3, 2019
075f7c9
fix test
mossid Sep 3, 2019
49c3176
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/ibc-s…
mossid Sep 3, 2019
bb006fd
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/ibc-s…
mossid Sep 12, 2019
08efad1
fix cli errors
mossid Sep 16, 2019
c18ba68
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 17, 2019
ab71a6e
Merge branch 'joon/ics-03-implementation' into joon/ics-04-implementa…
mossid Sep 17, 2019
4e53dcd
reflect method name change
mossid Sep 17, 2019
70a1c97
Merge branch 'joon/ics-04-implementation' into joon/ibc-sdk-interface
mossid Sep 17, 2019
f88d8d3
revise querier interface to work both on cli & store
mossid Sep 18, 2019
3ba9f9c
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 18, 2019
2ef039a
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 18, 2019
a600589
reflect downstream changes
mossid Sep 18, 2019
1fd3040
Merge branch 'joon/ics-03-implementation' into joon/ics-04-implementa…
mossid Sep 18, 2019
c90ed2d
reflect downstream changes
mossid Sep 18, 2019
ffed153
Merge branch 'joon/ics-04-implementation' into joon/ibc-sdk-interface
mossid Sep 18, 2019
cbfb043
fix from address in tx cli
mossid Sep 18, 2019
b15a44d
fix cli in progress(squash later)
mossid Sep 19, 2019
8820838
fix cli
mossid Sep 19, 2019
a72f6c5
remove timeout, add channel cli
mossid Sep 20, 2019
4b81cb5
fix golangci
mossid Sep 20, 2019
3866942
fix cli
mossid Sep 20, 2019
6e6c186
Clean up
tnachen Sep 25, 2019
025caf1
fix mock cli in progress
mossid Sep 25, 2019
c289635
Merge branch 'joon/ibc-sdk-interface' of github.com:cosmos/cosmos-sdk…
mossid Sep 25, 2019
1cea7e3
finalize cleanup, mock cli wip
mossid Sep 28, 2019
45dcdb3
add cli for mocksend
mossid Sep 28, 2019
56be11e
fix handler
mossid Sep 28, 2019
10bf523
rename mock packages
mossid Oct 1, 2019
fea2ba6
fix interface for gaia
mossid Oct 1, 2019
8494ad7
upstream ICS02 changes
fedekunze Oct 1, 2019
d3d19d0
merge ICS23
fedekunze Oct 1, 2019
012e77e
rm ICS03/04
fedekunze Oct 1, 2019
e6b2fa6
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 1, 2019
d47b90e
fix
fedekunze Oct 1, 2019
492c581
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x/ibc/02-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ each corresponds to `spec: Header.{height, proof, state, root}`.

### manager.go

`spec: interface ClientState` is implemented by `type Object`. // TODO
`spec: interface ClientState` is implemented by `type State`. // TODO
14 changes: 11 additions & 3 deletions x/ibc/02-client/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@ import (

"github.com/cosmos/cosmos-sdk/store/state"

commitment "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment"
"github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/merkle"
)

func (obj Object) prefix() []byte {
func (obj State) prefix() []byte {
return bytes.Split(obj.ConsensusState.KeyBytes(), LocalRoot())[0]
}

func (obj Object) ConsensusStateCLI(q state.ABCIQuerier) (res ConsensusState, proof merkle.Proof, err error) {
func (obj State) RootCLI(q state.ABCIQuerier, height uint64) (res commitment.Root, proof merkle.Proof, err error) {
root := obj.Roots.Value(height)
tmproof, err := root.Query(q, &res)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), root)
return
}

func (obj State) ConsensusStateCLI(q state.ABCIQuerier) (res ConsensusState, proof merkle.Proof, err error) {
tmproof, err := obj.ConsensusState.Query(q, &res)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.ConsensusState)
return
}

func (obj Object) FrozenCLI(q state.ABCIQuerier) (res bool, proof merkle.Proof, err error) {
func (obj State) FrozenCLI(q state.ABCIQuerier) (res bool, proof merkle.Proof, err error) {
res, tmproof, err := obj.Frozen.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.Frozen)
return
Expand Down
52 changes: 47 additions & 5 deletions x/ibc/02-client/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import (
"github.com/cosmos/cosmos-sdk/store/state"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/cosmos-sdk/x/ibc"
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/tendermint"
"github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/merkle"
"github.com/cosmos/cosmos-sdk/x/ibc/version"
)

func mapping(cdc *codec.Codec, storeKey string, version int64) state.Mapping {
prefix := []byte(strconv.FormatInt(version, 10) + "/")
func mapping(cdc *codec.Codec, storeKey string, v int64) state.Mapping {
prefix := version.Prefix(v)
return state.NewMapping(sdk.NewKVStoreKey(storeKey), cdc, prefix)
}

Expand All @@ -35,8 +35,10 @@ func GetQueryCmd(storeKey string, cdc *codec.Codec) *cobra.Command {

ibcQueryCmd.AddCommand(cli.GetCommands(
GetCmdQueryConsensusState(storeKey, cdc),
GetCmdQueryPath(storeKey, cdc),
GetCmdQueryHeader(cdc),
GetCmdQueryClient(storeKey, cdc),
GetCmdQueryRoot(storeKey, cdc),
)...)
return ibcQueryCmd
}
Expand All @@ -49,11 +51,11 @@ func GetCmdQueryClient(storeKey string, cdc *codec.Codec) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.NewCLIContext().WithCodec(cdc)
q := state.NewCLIQuerier(ctx)
mapp := mapping(cdc, storeKey, ibc.Version)
mapp := mapping(cdc, storeKey, version.Version)
man := client.NewManager(mapp)
id := args[0]

state, _, err := man.Object(id).ConsensusStateCLI(q)
state, _, err := man.State(id).ConsensusStateCLI(q)
if err != nil {
return err
}
Expand All @@ -65,6 +67,33 @@ func GetCmdQueryClient(storeKey string, cdc *codec.Codec) *cobra.Command {
}
}

func GetCmdQueryRoot(storeKey string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "root",
Short: "Query stored root",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.NewCLIContext().WithCodec(cdc)
q := state.NewCLIQuerier(ctx)
mapp := mapping(cdc, storeKey, version.Version)
man := client.NewManager(mapp)
id := args[0]
height, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}

root, _, err := man.State(id).RootCLI(q, height)
if err != nil {
return err
}

fmt.Printf("%s\n", codec.MustMarshalJSONIndent(cdc, root))

return nil
},
}
}
func GetCmdQueryConsensusState(storeKey string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "consensus-state",
Expand Down Expand Up @@ -109,6 +138,19 @@ func GetCmdQueryConsensusState(storeKey string, cdc *codec.Codec) *cobra.Command
}
}

func GetCmdQueryPath(storeName string, cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "path",
Short: "Query the commitment path of the running chain",
RunE: func(cmd *cobra.Command, args []string) error {
mapp := mapping(cdc, storeName, version.Version)
path := merkle.NewPrefix([][]byte{[]byte(storeName)}, mapp.PrefixBytes())
fmt.Printf("%s\n", codec.MustMarshalJSONIndent(cdc, path))
return nil
},
}
}

func GetCmdQueryHeader(cdc *codec.Codec) *cobra.Command {
return &cobra.Command{
Use: "header",
Expand Down
8 changes: 4 additions & 4 deletions x/ibc/02-client/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const (

func GetTxCmd(storeKey string, cdc *codec.Codec) *cobra.Command {
ibcTxCmd := &cobra.Command{
Use: "ibc",
Short: "IBC transaction subcommands",
Use: "client",
Short: "Client transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
}
Expand All @@ -48,7 +48,7 @@ func GetTxCmd(storeKey string, cdc *codec.Codec) *cobra.Command {

func GetCmdCreateClient(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "create-client",
Use: "create",
Short: "create new client with a consensus state",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -81,7 +81,7 @@ func GetCmdCreateClient(cdc *codec.Codec) *cobra.Command {

func GetCmdUpdateClient(cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "update-client",
Use: "update",
Short: "update existing client with a header",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
10 changes: 5 additions & 5 deletions x/ibc/02-client/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
)

var MsgCdc = codec.New()

func init() {
RegisterCodec(MsgCdc)
}
var MsgCdc *codec.Codec

func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*ConsensusState)(nil), nil)
Expand All @@ -17,3 +13,7 @@ func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(MsgCreateClient{}, "ibc/client/MsgCreateClient", nil)
cdc.RegisterConcrete(MsgUpdateClient{}, "ibc/client/MsgUpdateClient", nil)
}

func SetMsgCodec(cdc *codec.Codec) {
MsgCdc = cdc
}
78 changes: 58 additions & 20 deletions x/ibc/02-client/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,72 +40,80 @@ func (man Manager) RegisterKind(kind Kind, pred ValidityPredicate) Manager {
return man
}
*/
func (man Manager) Object(id string) Object {
return Object{
func (man Manager) State(id string) State {
return State{
id: id,
Roots: man.protocol.Prefix([]byte(id + "/roots/")).Indexer(state.Dec),
ConsensusState: man.protocol.Value([]byte(id)),
Frozen: man.protocol.Value([]byte(id + "/freeze")).Boolean(),
}
}

func (man Manager) Create(ctx sdk.Context, id string, cs ConsensusState) (Object, error) {
obj := man.Object(id)
func (man Manager) Create(ctx sdk.Context, id string, cs ConsensusState) (State, error) {
obj := man.State(id)
if obj.exists(ctx) {
return Object{}, errors.New("Create client on already existing id")
return State{}, errors.New("Create client on already existing id")
}
obj.Roots.Set(ctx, cs.GetHeight(), cs.GetRoot())
obj.ConsensusState.Set(ctx, cs)
return obj, nil
}

func (man Manager) Query(ctx sdk.Context, id string) (Object, error) {
res := man.Object(id)
func (man Manager) Query(ctx sdk.Context, id string) (State, error) {
res := man.State(id)
if !res.exists(ctx) {
return Object{}, errors.New("client not exists")
return State{}, errors.New("client not exists")
}
return res, nil
}

func (man CounterpartyManager) Object(id string) CounterObject {
return CounterObject{
func (man CounterpartyManager) State(id string) CounterState {
return CounterState{
id: id,
ConsensusState: man.protocol.Value([]byte(id)),
}
}

func (man CounterpartyManager) Query(id string) CounterObject {
return man.Object(id)
func (man CounterpartyManager) Query(id string) CounterState {
return man.State(id)
}

// Any actor holding the Object can access on and modify that client information
type Object struct {
// Any actor holding the Stage can access on and modify that client information
type State struct {
id string
Roots state.Indexer
ConsensusState state.Value // ConsensusState
Frozen state.Boolean
}

type CounterObject struct {
type CounterState struct {
id string
ConsensusState commitment.Value
}

func (obj Object) ID() string {
func (obj State) ID() string {
return obj.id
}

func (obj Object) GetConsensusState(ctx sdk.Context) (res ConsensusState) {
func (obj State) GetConsensusState(ctx sdk.Context) (res ConsensusState) {
obj.ConsensusState.Get(ctx, &res)
return
}

func (obj CounterObject) Is(ctx sdk.Context, client ConsensusState) bool {
func (obj State) GetRoot(ctx sdk.Context, height uint64) (res commitment.Root, err error) {
err = obj.Roots.GetSafe(ctx, height, &res)
return
}

func (obj CounterState) Is(ctx sdk.Context, client ConsensusState) bool {
return obj.ConsensusState.Is(ctx, client)
}

func (obj Object) exists(ctx sdk.Context) bool {
func (obj State) exists(ctx sdk.Context) bool {
return obj.ConsensusState.Exists(ctx)
}

func (obj Object) Update(ctx sdk.Context, header Header) error {
func (obj State) Update(ctx sdk.Context, header Header) error {
if !obj.exists(ctx) {
panic("should not update nonexisting client")
}
Expand All @@ -121,6 +129,36 @@ func (obj Object) Update(ctx sdk.Context, header Header) error {
}

obj.ConsensusState.Set(ctx, updated)
obj.Roots.Set(ctx, updated.GetHeight(), updated.GetRoot())

return nil
}

func (obj State) Freeze(ctx sdk.Context) error {
if !obj.exists(ctx) {
panic("should not freeze nonexisting client")
}

if obj.Frozen.Get(ctx) {
return errors.New("client is already Frozen")
}

obj.Frozen.Set(ctx, true)

return nil
}

func (obj State) Delete(ctx sdk.Context) error {
if !obj.exists(ctx) {
panic("should not delete nonexisting client")
}

if !obj.Frozen.Get(ctx) {
return errors.New("client is not Frozen")
}

obj.ConsensusState.Delete(ctx)
obj.Frozen.Delete(ctx)

return nil
}
5 changes: 0 additions & 5 deletions x/ibc/02-client/tendermint/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ package tendermint

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/ibc/02-client"
)

func init() {
RegisterCodec(client.MsgCdc)
}

func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterConcrete(ConsensusState{}, "ibc/client/tendermint/ConsensusState", nil)
cdc.RegisterConcrete(Header{}, "ibc/client/tendermint/Header", nil)
Expand Down
3 changes: 0 additions & 3 deletions x/ibc/version.go

This file was deleted.

13 changes: 13 additions & 0 deletions x/ibc/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package version

import "strconv"

const Version int64 = 1

func DefaultPrefix() []byte {
return Prefix(Version)
}

func Prefix(version int64) []byte {
return []byte("v" + strconv.FormatInt(version, 10) + "/")
}