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 05 implementation #5193

Merged
merged 375 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
375 commits
Select commit Hold shift + click to select a range
dbd6b83
fix lint
mossid Jul 7, 2019
f6e5f90
fix lint
mossid Jul 7, 2019
892a120
add handler/msgs/client
mossid Jul 9, 2019
dce1148
rm relay
mossid Jul 9, 2019
26e8038
finalize rebase on 23 root/path sep
mossid Jul 11, 2019
812bea4
fix lint, fix syntax
mossid Jul 11, 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
dbd47aa
rm freebase, reformat query
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
f609249
add docs in progre
mossid Jul 24, 2019
7da69c1
add comments
mossid Jul 25, 2019
600445a
add comments
mossid Jul 25, 2019
98720bb
Apply suggestions from code review
mossid Jul 25, 2019
cdee396
add comments in progress
mossid Jul 25, 2019
ce588a4
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Jul 25, 2019
39dca11
Merge branch 'joon/ics-23-implementation' of github.com:cosmos/cosmos…
mossid Jul 25, 2019
94e2cdc
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/store…
mossid Jul 26, 2019
8d9e779
add comments
mossid Jul 26, 2019
92d0fb4
fix comment
mossid Jul 26, 2019
d896152
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Jul 26, 2019
f70d3bd
add comments in progress
mossid Jul 27, 2019
5d913b7
recover IntEncoding scheme for integer
mossid Jul 29, 2019
699b0ba
add uint tests, don't use codec in custom types
mossid Jul 29, 2019
323818f
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Jul 29, 2019
9a077eb
finalize merge
mossid Jul 29, 2019
a4a20d6
add godoc
mossid Jul 30, 2019
02a9ba5
add godoc in progress
mossid Jul 30, 2019
a9adb58
reformat test
mossid Jul 30, 2019
abb2f51
rm XXX
mossid Jul 30, 2019
361aa42
add godoc
mossid Jul 30, 2019
97edd89
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/store…
mossid Jul 30, 2019
23debb9
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Jul 30, 2019
b0ca51a
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Jul 30, 2019
54a67b0
modify store
mossid Jul 31, 2019
24e621a
add query
mossid Jul 31, 2019
64c0381
update query.go
mossid Jul 31, 2019
971a642
update query.go
mossid Jul 31, 2019
2968dd3
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Jul 31, 2019
6be03df
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Jul 31, 2019
e7f6708
cli refactor in progress
mossid Jul 31, 2019
0d134d5
cli refactor in progress
mossid Jul 31, 2019
fcad487
add Query to boolean.go
mossid Aug 1, 2019
3142d4b
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Aug 1, 2019
6de0ed5
fix key
mossid Aug 1, 2019
05d39a1
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Aug 1, 2019
811b384
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Aug 1, 2019
62b7d75
fix cli / merkle test
mossid Aug 1, 2019
d6fabbd
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Aug 1, 2019
6dc912f
godoc cleanup
alexanderbez Aug 7, 2019
63c6f3c
godoc cleanup
alexanderbez Aug 7, 2019
b6441c0
godoc cleanup
alexanderbez Aug 7, 2019
4d723ae
godoc cleanup
alexanderbez Aug 7, 2019
244d2c2
godoc cleanup
alexanderbez Aug 7, 2019
7286fed
fix test
mossid Aug 14, 2019
f81d7b4
fix client
mossid Aug 14, 2019
7bf4d57
merge from ics04 branch
mossid Aug 15, 2019
7471bdf
Merge branch 'joon/store-mapping' of github.com:cosmos/cosmos-sdk int…
mossid Aug 15, 2019
3c86363
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Aug 15, 2019
32cb0ca
merge from ics04 branch
mossid Aug 15, 2019
af260c8
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Aug 15, 2019
17f18d7
merge from ics04 branch
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
71d2620
fix lint
mossid Aug 15, 2019
073a67a
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Aug 15, 2019
eb7f614
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Aug 15, 2019
04543f8
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/store…
mossid Sep 2, 2019
59d2b3e
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Sep 2, 2019
6d1088f
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Sep 2, 2019
6299864
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 2, 2019
10d1c46
Apply suggestions from code review
mossid Sep 10, 2019
09e6600
applying review in progress
mossid Sep 11, 2019
6f5f633
Merge branch 'joon/store-mapping' of github.com:cosmos/cosmos-sdk int…
mossid Sep 11, 2019
4116bb7
apply review - make querier interface
mossid Sep 11, 2019
8040c81
Merge branch 'master' of github.com:cosmos/cosmos-sdk into joon/store…
mossid Sep 17, 2019
48bb32d
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Sep 17, 2019
9b63a6b
fix dependency
mossid Sep 17, 2019
a7df43c
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Sep 17, 2019
acaaaf2
fix dependency
mossid Sep 17, 2019
c18ba68
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 17, 2019
828badd
revise querier interface to work both on cli & store
mossid Sep 18, 2019
1e64e92
revise querier interface to work both on cli & store
mossid Sep 18, 2019
b4d7491
reflect downstream change
mossid Sep 18, 2019
a59d1e7
Merge branch 'joon/store-mapping' into joon/ics-23-implementation
mossid Sep 18, 2019
bb09ad9
Merge branch 'joon/ics-23-implementation' into joon/ics-02-implementa…
mossid Sep 18, 2019
3ba9f9c
Merge branch 'joon/ics-02-implementation' into joon/ics-03-implementa…
mossid Sep 18, 2019
de1a045
fix cli
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
9f63629
rm commented lines
mossid Sep 28, 2019
b4e71e1
address review in progress
mossid Sep 28, 2019
3f509ee
address review, rm cleanup/closing
mossid Sep 28, 2019
6b966a3
rename Path -> Prefix
mossid Oct 1, 2019
21bd8d0
Store accessor upstream changes (#5119)
fedekunze Oct 1, 2019
af2564b
Merge branch 'joon/store-mapping' of https://github.com/cosmos/cosmos…
fedekunze Oct 1, 2019
303ebf3
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 1, 2019
9b3b120
Merge branch 'master' into joon/store-mapping
fedekunze Oct 1, 2019
18f8d70
Merge branch 'joon/store-mapping' of https://github.com/cosmos/cosmos…
fedekunze Oct 1, 2019
df5b21a
add comments, reformat merkle querier
mossid Oct 1, 2019
7afe221
Merge branch 'joon/ics-23-implementation' of github.com:cosmos/cosmos…
mossid Oct 1, 2019
1ac982c
rm merkle/utils
mossid Oct 1, 2019
fa04419
ICS 23 upstream changes (#5120)
fedekunze Oct 1, 2019
0d5a317
downstream changes
fedekunze Oct 1, 2019
db8d382
update Value
fedekunze Oct 1, 2019
02b31a5
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 1, 2019
4d518f2
update test
fedekunze Oct 1, 2019
8a3e5ea
fix
fedekunze Oct 1, 2019
9975a1d
ICS 02 upstream changes (#5122)
fedekunze Oct 1, 2019
ffc6918
merge ICS 02
fedekunze Oct 1, 2019
11bdbd7
ICS 03 upstream changes (#5123)
fedekunze Oct 1, 2019
cc404a0
cleanup types and submodule
fedekunze Oct 2, 2019
d93a0ae
more cleanup and godocs
fedekunze Oct 2, 2019
9b6afe9
remove counterPartyManager/State and cleanup
fedekunze Oct 2, 2019
c8a0ab4
implement SubmitMisbehaviour and refactor
fedekunze Oct 2, 2019
4483182
errors
fedekunze Oct 4, 2019
23fbb5d
events
fedekunze Oct 4, 2019
ebecbce
fix test
fedekunze Oct 4, 2019
0e85ed0
refactors
fedekunze Oct 4, 2019
03574cb
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 7, 2019
f16d6e9
WIP refactor ICS03
fedekunze Oct 7, 2019
a7d2d98
remove Mapping
fedekunze Oct 7, 2019
1b7e466
remove store accessors
fedekunze Oct 7, 2019
c09a84c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 7, 2019
99c586b
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 7, 2019
02bd6f7
proposed refactor
fedekunze Oct 7, 2019
0e37d75
remove store accessors from ICS02
fedekunze Oct 7, 2019
8dec96f
refactor queriers, handler and clean keeper
fedekunze Oct 8, 2019
83f4c1b
logger and tx long description
fedekunze Oct 8, 2019
178912f
ineffassign
fedekunze Oct 8, 2019
c4617e0
merge ICS02
fedekunze Oct 8, 2019
9a225e9
Apply suggestions from code review
fedekunze Oct 8, 2019
fe7da5f
Apply suggestions from code review
fedekunze Oct 8, 2019
c8ff483
remove store accessors
fedekunze Oct 8, 2019
8bcf17f
refactor handshake to update it to the latest ICS03 spec
fedekunze Oct 9, 2019
3df5378
update handler and msgs
fedekunze Oct 9, 2019
21f7d2c
add verification functions
fedekunze Oct 9, 2019
4e9d2bb
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 9, 2019
604afd5
update verification
fedekunze Oct 9, 2019
cf347bf
ICS02 module.go
fedekunze Oct 9, 2019
5514e9e
top level x/ibc structure
fedekunze Oct 9, 2019
39dd637
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 9, 2019
eefa08b
update connection queries
fedekunze Oct 9, 2019
482f24d
update connection tx
fedekunze Oct 10, 2019
e4ffd8e
remove extra files
fedekunze Oct 10, 2019
0163482
update expected client keeper and export verification funcs
fedekunze Oct 14, 2019
7c37222
ICS 05 Implementation
fedekunze Oct 14, 2019
a8244dc
release port and godocs
fedekunze Oct 14, 2019
a1c22e9
Merge branch 'master' into joon/ics-23-implementation
fedekunze Oct 15, 2019
a8ceb45
Update x/ibc/02-client/client/cli/query.go
fedekunze Oct 15, 2019
956eb5c
Update x/ibc/02-client/types/tendermint/consensus_state.go
fedekunze Oct 15, 2019
2cc23b2
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 15, 2019
2e1e894
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 15, 2019
c573d57
address some of the review comments
fedekunze Oct 15, 2019
6913146
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 15, 2019
f852b1b
resolve some TODOs and address comments from review
fedekunze Oct 15, 2019
245901c
update connection versioning
fedekunze Oct 15, 2019
7a82144
minor error updates
fedekunze Oct 15, 2019
99829bb
Merge branch 'joon/ics-03-implementation' of https://github.com/cosmo…
fedekunze Oct 15, 2019
012bf54
update errors and add port Keeper to ibc Keeper
fedekunze Oct 16, 2019
6af2ce7
minor UX improvements
fedekunze Oct 16, 2019
8be3af7
rename pkg
fedekunze Oct 16, 2019
53ab47d
fixes
fedekunze Oct 16, 2019
d3a533a
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 16, 2019
0d56b51
implement query proofs
fedekunze Oct 17, 2019
7ba777e
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 18, 2019
499abb4
refactor ICS23
fedekunze Oct 18, 2019
a925d88
cleanup types
fedekunze Oct 18, 2019
a0cafbf
Merge branch 'joon/ics-03-implementation' of https://github.com/cosmo…
fedekunze Oct 18, 2019
c3b6b18
ICS 5 updates (#5222)
cwgoes Oct 21, 2019
74d8a4b
rename pkg and fix import
fedekunze Oct 21, 2019
53f5fad
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 21, 2019
c12c298
implement batch verification
fedekunze Oct 21, 2019
a34b741
gosimple suggestion
fedekunze Oct 21, 2019
bf4f096
Merge branch 'master' into joon/ics-23-implementation
fedekunze Oct 21, 2019
386489b
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 21, 2019
383ba49
merge ICS23
fedekunze Oct 21, 2019
9b77275
various fixes; remove legacy tests; remove commitment path query
fedekunze Oct 22, 2019
40fca1a
alias
fedekunze Oct 22, 2019
1eaf55e
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 22, 2019
deceeb8
minor updates from ICS23
fedekunze Oct 22, 2019
2a1a144
renaming
fedekunze Oct 22, 2019
2aa4734
ICS02 changes
fedekunze Oct 22, 2019
714e6e2
update verification and rename root funcs
fedekunze Oct 22, 2019
93bb9d7
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 22, 2019
3351c08
Merge branch 'joon/ics-03-implementation' of https://github.com/cosmo…
fedekunze Oct 22, 2019
323bc8d
Merge branch 'fedekunze/ics-05-implementation' of https://github.com/…
fedekunze Oct 22, 2019
de13f5a
move querier to x/ibc
fedekunze Oct 22, 2019
aae117f
update query.go to use 'custom/...' query path
fedekunze Oct 22, 2019
f8fd580
add tests
AdityaSripal Oct 22, 2019
cbc1106
ICS 24 Implementation (#5229)
AdityaSripal Oct 22, 2019
f8d99ca
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 23, 2019
23ae994
flatten ICS23 structure
fedekunze Oct 23, 2019
e1fa5f8
fix ApplyPrefix
fedekunze Oct 23, 2019
7222642
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 23, 2019
4f89602
updates from ICS23 and ICS24
fedekunze Oct 23, 2019
22f874a
msg.ValidateBasic and ADR09 evidence interface
fedekunze Oct 23, 2019
2edb03f
complete types testing
AdityaSripal Oct 23, 2019
5783b03
merge
AdityaSripal Oct 23, 2019
696db2e
delete empty test file
AdityaSripal Oct 23, 2019
69db1f2
remove ibc errors from core error package
AdityaSripal Oct 23, 2019
c22faa1
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 24, 2019
021544f
custom JSON marshaling; msg.ValidateBasic; renaming of variables
fedekunze Oct 24, 2019
7809e4d
minor update
fedekunze Oct 24, 2019
102ab3d
custom JSON marshaling
fedekunze Oct 24, 2019
2f68c0c
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 24, 2019
b9654da
Merge branch 'joon/ics-03-implementation' of https://github.com/cosmo…
fedekunze Oct 24, 2019
c8289a8
use host validation for port ids
fedekunze Oct 24, 2019
33312c2
start batch-verify tests
AdityaSripal Oct 24, 2019
49d08e3
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Oct 25, 2019
5239720
minor changes on commitment types
fedekunze Oct 25, 2019
e048a6c
R4R - Store consensus state correctly (#5242)
chengwenxi Oct 25, 2019
093c004
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Oct 25, 2019
3965928
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 25, 2019
0c187bf
update alias
fedekunze Oct 25, 2019
29bc19e
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
fedekunze Oct 25, 2019
24e6d29
update alias
fedekunze Oct 25, 2019
a06f30a
Merge branch 'joon/ics-03-implementation' of https://github.com/cosmo…
fedekunze Oct 25, 2019
bd21702
update alias and keeper.GetPort()
fedekunze Oct 25, 2019
d1f71dd
Merge branch 'master' into joon/ics-23-implementation
fedekunze Oct 30, 2019
0a461b5
use testsuite
AdityaSripal Oct 30, 2019
dac68df
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
AdityaSripal Oct 30, 2019
7f9c166
Integrate Evidence Implementation into ICS-02 (#5258)
AdityaSripal Nov 4, 2019
a74ebf3
Merge branch 'master' into joon/ics-23-implementation
fedekunze Nov 4, 2019
6d580aa
finish tendermint tests
AdityaSripal Nov 5, 2019
0dd779e
Merge branch 'joon/ics-02-implementation' of https://github.com/cosmo…
AdityaSripal Nov 5, 2019
e875ca7
complete merge
AdityaSripal Nov 5, 2019
cd0aa22
Add tests for msgs
AdityaSripal Nov 5, 2019
0c8b759
upstream changes
fedekunze Nov 5, 2019
c6fa07b
fix
fedekunze Nov 5, 2019
17abbda
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into jo…
fedekunze Nov 5, 2019
820482f
upstream changes
fedekunze Nov 5, 2019
962979d
ICS23 changes
fedekunze Nov 5, 2019
b5442d3
fix cons state
fedekunze Nov 5, 2019
7c67236
context changes
fedekunze Nov 5, 2019
4866753
Merge branch 'joon/ics-23-implementation' of https://github.com/cosmo…
fedekunze Nov 5, 2019
a696f05
upstream changes
fedekunze Nov 5, 2019
df6bd66
fix cli tx
fedekunze Nov 5, 2019
024486c
upstream changes
fedekunze Nov 5, 2019
b039d37
Merge branch joon/ics-03-implementation' of https://github.com/cosmos…
fedekunze Nov 5, 2019
ab50629
upstream changes
fedekunze Nov 5, 2019
d4ea259
conflicts
fedekunze Nov 5, 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
4 changes: 4 additions & 0 deletions store/types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ type StoreKey interface {
String() string
}

// CapabilityKey represent the Cosmos SDK keys for object-capability
// generation in the IBC protocol as defined in https://github.com/cosmos/ics/tree/master/spec/ics-005-port-allocation#data-structures
type CapabilityKey StoreKey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just a renaming of the StoreKey? Is it completely necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really we should call the StoreKeys CapabilityKeys, since that's what they are (nothing is specific to stores).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion about either. @alexanderbez thoughts here?


// KVStoreKey is used for accessing substores.
// Only the pointer value should ever be used - it functions as a capabilities key.
type KVStoreKey struct {
Expand Down
1 change: 1 addition & 0 deletions types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const (
// nolint - reexport
type (
StoreKey = types.StoreKey
CapabilityKey = types.CapabilityKey
KVStoreKey = types.KVStoreKey
TransientStoreKey = types.TransientStoreKey
)
Expand Down
39 changes: 39 additions & 0 deletions x/ibc/05-port/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package port

// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper
// ALIASGEN: github.com/cosmos/cosmos-sdk/x/ibc/05-port/types

import (
"github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper"
"github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
)

const (
DefaultCodespace = types.DefaultCodespace
CodePortExists = types.CodePortExists
CodePortNotFound = types.CodePortNotFound
CodePortNotAuthenticated = types.CodePortNotAuthenticated
CodeInvalidPortID = types.CodeInvalidPortID
SubModuleName = types.SubModuleName
StoreKey = types.StoreKey
RouterKey = types.RouterKey
QuerierRoute = types.QuerierRoute
)

var (
// functions aliases
NewKeeper = keeper.NewKeeper
ErrPortExists = types.ErrPortExists
ErrPortNotFound = types.ErrPortNotFound
ErrPortNotAuthenticated = types.ErrPortNotAuthenticated
ErrInvalidPortID = types.ErrInvalidPortID
PortPath = types.PortPath
KeyPort = types.KeyPort
)

type (
Keeper = keeper.Keeper
)
77 changes: 77 additions & 0 deletions x/ibc/05-port/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package keeper

import (
"fmt"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)

// Keeper defines the IBC connection keeper
type Keeper struct {
storeKey sdk.StoreKey
cdc *codec.Codec
codespace sdk.CodespaceType
prefix []byte // prefix bytes for accessing the store
ports map[sdk.CapabilityKey]string
bound []string
}

// NewKeeper creates a new IBC connection Keeper instance
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, codespace sdk.CodespaceType) Keeper {
return Keeper{
storeKey: key,
cdc: cdc,
codespace: sdk.CodespaceType(fmt.Sprintf("%s/%s", codespace, types.DefaultCodespace)), // "ibc/port",
prefix: []byte{},
// prefix: []byte(types.SubModuleName + "/"), // "port/"
ports: make(map[sdk.CapabilityKey]string), // map of capabilities to port ids
}
}

// GetPorts returns the list of bound ports.
// (these ports still must have been bound statically)
func (k Keeper) GetPorts() []string {
return k.bound
}

// GetPort retrieves a given port ID from keeper map
func (k Keeper) GetPort(ck sdk.CapabilityKey) (string, bool) {
portID, found := k.ports[ck]
return portID, found
}

// BindPort binds to a port and returns the associated capability.
// Ports must be bound statically when the chain starts in `app.go`.
// The capability must then be passed to a module which will need to pass
// it as an extra parameter when calling functions on the IBC module.
func (k Keeper) BindPort(portID string) sdk.CapabilityKey {
if err := host.DefaultPortIdentifierValidator(portID); err != nil {
panic(err.Error())
}

for _, b := range k.bound {
if b == portID {
panic(fmt.Sprintf("port %s is already bound", portID))
}
}

key := sdk.NewKVStoreKey(portID)
k.ports[key] = portID
k.bound = append(k.bound, portID)
return key
}

// Authenticate authenticates a capability key against a port ID
// by checking if the memory address of the capability was previously
// generated and bound to the port (provided as a parameter) which the capability
// is being authenticated against.
func (k Keeper) Authenticate(key sdk.CapabilityKey, portID string) bool {
if err := host.DefaultPortIdentifierValidator(portID); err != nil {
panic(err.Error())
}

return k.ports[key] == portID
}
37 changes: 37 additions & 0 deletions x/ibc/05-port/types/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package types

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// port error codes
const (
DefaultCodespace sdk.CodespaceType = SubModuleName

CodePortExists sdk.CodeType = 101
CodePortNotFound sdk.CodeType = 102
CodePortNotAuthenticated sdk.CodeType = 103
CodeInvalidPortID sdk.CodeType = 104
)

// ErrPortExists implements sdk.Error
func ErrPortExists(codespace sdk.CodespaceType, portID string) sdk.Error {
return sdk.NewError(codespace, CodePortExists, fmt.Sprintf("port with ID %s is already binded", portID))
}

// ErrPortNotFound implements sdk.Error
func ErrPortNotFound(codespace sdk.CodespaceType, portID string) sdk.Error {
return sdk.NewError(codespace, CodePortNotFound, fmt.Sprintf("port with ID %s not found", portID))
}

// ErrPortNotAuthenticated implements sdk.Error
func ErrPortNotAuthenticated(codespace sdk.CodespaceType) sdk.Error {
return sdk.NewError(codespace, CodePortNotAuthenticated, "port failed authentication")
}

// ErrInvalidPortID implements sdk.Error
func ErrInvalidPortID(codespace sdk.CodespaceType) sdk.Error {
return sdk.NewError(codespace, CodeInvalidPortID, "invalid port ID")
}
31 changes: 31 additions & 0 deletions x/ibc/05-port/types/keys.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package types

import (
"fmt"
)

const (
// SubModuleName defines the IBC port name
SubModuleName = "port"

// StoreKey is the store key string for IBC ports
StoreKey = SubModuleName

// RouterKey is the message route for IBC ports
RouterKey = SubModuleName

// QuerierRoute is the querier route for IBC ports
QuerierRoute = SubModuleName
)

// The following paths are the keys to the store as defined in https://github.com/cosmos/ics/tree/master/spec/ics-005-port-allocation#store-paths

// PortPath defines the path under which ports paths are stored
func PortPath(portID string) string {
return fmt.Sprintf("ports/%s", portID)
}

// KeyPort returns the store key for a particular port
func KeyPort(portID string) []byte {
return []byte(PortPath(portID))
}
4 changes: 4 additions & 0 deletions x/ibc/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
client "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
connection "github.com/cosmos/cosmos-sdk/x/ibc/03-connection"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
)

// Keeper defines each ICS keeper for IBC
type Keeper struct {
ClientKeeper client.Keeper
ConnectionKeeper connection.Keeper
PortKeeper port.Keeper
}

// NewKeeper creates a new ibc Keeper
func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, codespace sdk.CodespaceType) Keeper {
clientKeeper := client.NewKeeper(cdc, key, codespace)
connectionKeeper := connection.NewKeeper(cdc, key, codespace, clientKeeper)
portKeeper := port.NewKeeper(cdc, key, codespace)

return Keeper{
ClientKeeper: clientKeeper,
ConnectionKeeper: connectionKeeper,
PortKeeper: portKeeper,
}
}