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 03 upstream changes #5123

Merged
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
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
918c49a
Merge branch 'joon/ics-03-implementation' into joon/ics-04-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
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
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
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
25b95cb
ICS03 upstream changes
fedekunze Oct 1, 2019
76bdc16
fixes
fedekunze Oct 1, 2019
b58467c
rename types
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
1 change: 0 additions & 1 deletion store/state/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,3 @@ func (m Mapping) Prefix(prefix []byte) Mapping {
prefix: join(m.prefix, prefix),
}
}

46 changes: 27 additions & 19 deletions x/ibc/03-connection/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,63 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/merkle"
)

func (man Manager) CLIObject(connid, clientid string) Object {
obj := man.Object(connid)
obj.Client = man.client.Object(clientid)
func (man Manager) CLIState(connid, clientid string) State {
obj := man.State(connid)
obj.Client = man.client.State(clientid)
return obj
}

func (obj Object) prefix() []byte {
func (man Manager) CLIQuery(q state.ABCIQuerier, connid string) (State, error) {
obj := man.State(connid)
conn, _, err := obj.ConnectionCLI(q)
if err != nil {
return State{}, err
}
obj.Client = man.client.State(conn.Client)
return obj, nil
}

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

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

func (obj Object) AvailableCLI(q state.ABCIQuerier) (res bool, proof merkle.Proof, err error) {
func (obj State) AvailableCLI(q state.ABCIQuerier) (res bool, proof merkle.Proof, err error) {
res, tmproof, err := obj.Available.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.Available)
return
}

func (obj Object) KindCLI(q state.ABCIQuerier) (res string, proof merkle.Proof, err error) {
func (obj State) KindCLI(q state.ABCIQuerier) (res string, proof merkle.Proof, err error) {
res, tmproof, err := obj.Kind.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.Kind)
return
}

func (man Handshaker) CLIObject(connid, clientid string) HandshakeObject {
return man.Object(man.man.CLIObject(connid, clientid))
func (man Handshaker) CLIState(connid, clientid string) HandshakeState {
return man.CreateState(man.man.CLIState(connid, clientid))
}

func (man Handshaker) CLIQuery(q state.ABCIQuerier, connid string) (HandshakeObject, error) {
obj := man.man.Object(connid)
conn, _, err := obj.ConnectionCLI(q)
func (man Handshaker) CLIQuery(q state.ABCIQuerier, connid string) (HandshakeState, error) {
state, err := man.man.CLIQuery(q, connid)
if err != nil {
return HandshakeObject{}, err
return HandshakeState{}, err
}
obj.Client = man.man.client.Object(conn.Client)
return man.Object(obj), nil
return man.CreateState(state), nil
}

func (obj HandshakeObject) StateCLI(q state.ABCIQuerier) (res byte, proof merkle.Proof, err error) {
res, tmproof, err := obj.State.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.State)
func (obj HandshakeState) StageCLI(q state.ABCIQuerier) (res byte, proof merkle.Proof, err error) {
res, tmproof, err := obj.Stage.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.Stage)
return
}

func (obj HandshakeObject) CounterpartyClientCLI(q state.ABCIQuerier) (res string, proof merkle.Proof, err error) {
func (obj HandshakeState) CounterpartyClientCLI(q state.ABCIQuerier) (res string, proof merkle.Proof, err error) {
res, tmproof, err := obj.CounterpartyClient.Query(q)
proof = merkle.NewProofFromValue(tmproof, obj.prefix(), obj.CounterpartyClient)
return
Expand Down
14 changes: 7 additions & 7 deletions x/ibc/03-connection/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ 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"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc/version"
)

const (
FlagProve = "prove"
)

func object(cdc *codec.Codec, storeKey string, prefix []byte, connid, clientid string) connection.Object {
func object(cdc *codec.Codec, storeKey string, prefix []byte, connid, clientid string) connection.State {
base := state.NewMapping(sdk.NewKVStoreKey(storeKey), cdc, prefix)
climan := client.NewManager(base)
man := connection.NewManager(base, climan)
return man.CLIObject(connid, clientid)
return man.CLIState(connid, clientid)
}

func GetQueryCmd(storeKey string, cdc *codec.Codec) *cobra.Command {
Expand All @@ -43,7 +43,7 @@ func GetQueryCmd(storeKey string, cdc *codec.Codec) *cobra.Command {
return ibcQueryCmd
}

func QueryConnection(ctx context.CLIContext, obj connection.Object, prove bool) (res utils.JSONObject, err error) {
func QueryConnection(ctx context.CLIContext, obj connection.State, prove bool) (res utils.JSONState, err error) {
q := state.NewCLIQuerier(ctx)

conn, connp, err := obj.ConnectionCLI(q)
Expand All @@ -60,14 +60,14 @@ func QueryConnection(ctx context.CLIContext, obj connection.Object, prove bool)
}

if prove {
return utils.NewJSONObject(
return utils.NewJSONState(
conn, connp,
avail, availp,
kind, kindp,
), nil
}

return utils.NewJSONObject(
return utils.NewJSONState(
conn, nil,
avail, nil,
kind, nil,
Expand All @@ -81,7 +81,7 @@ func GetCmdQueryConnection(storeKey string, cdc *codec.Codec) *cobra.Command {
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.NewCLIContext().WithCodec(cdc)
obj := object(cdc, storeKey, ibc.VersionPrefix(ibc.Version), args[0], "")
obj := object(cdc, storeKey, version.Prefix(version.Version), args[0], "")
jsonobj, err := QueryConnection(ctx, obj, viper.GetBool(FlagProve))
if err != nil {
return err
Expand Down
Loading