diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b06580dab..1bd171e9b20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (core, apps) [\#7213](https://github.com/cosmos/ibc-go/pull/7213) Remove capabilities from `SendPacket`. * (core, apps) [\#7213](https://github.com/cosmos/ibc-go/pull/7225) Remove capabilities from `WriteAcknowledgement`. * (core, apps) [\#7232](https://github.com/cosmos/ibc-go/pull/7232) Remove capabilities from channel handshake methods. TODO list all changes +* (core, apps) [\#7270](https://github.com/cosmos/ibc-go/pull/7270) Remove remaining dependencies on capability module. * (core/04-channel) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) Removed function `LookupModuleByChannel` * (core/05-port) [\#7252](https://github.com/cosmos/ibc-go/pull/7252) Removed function `LookupModuleByPort` * (core/24-host) [\#7239](https://github.com/cosmos/ibc-go/pull/7239) Removed function `ChannelCapabilityPath` diff --git a/docs/docs/05-migrations/14-v9-to-v10.md b/docs/docs/05-migrations/14-v9-to-v10.md index bfebba37e8d..fc00c16f5fc 100644 --- a/docs/docs/05-migrations/14-v9-to-v10.md +++ b/docs/docs/05-migrations/14-v9-to-v10.md @@ -21,6 +21,7 @@ There are four sections based on the four potential user groups of this document - (TODO: expand later) Removal of capabilities in `SendPacket` [\#7213](https://github.com/cosmos/ibc-go/pull/7213). - (TODO: expand later) Removal of capabilities in `WriteAcknowledgement` [\#7225](https://github.com/cosmos/ibc-go/pull/7213). - (TODO: expand later) Removal of capabilities in channel handshake methods [\#7232](https://github.com/cosmos/ibc-go/pull/7232). +- (TODO: expand later) More removal of capabilities in [\#7270](https://github.com/cosmos/ibc-go/pull/7270). ### ICS27 - Interchain Accounts diff --git a/e2e/go.mod b/e2e/go.mod index 15002c0392a..9bb46052747 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -37,7 +37,7 @@ require ( cloud.google.com/go/iam v1.1.9 // indirect cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/api v0.7.5 // indirect - cosmossdk.io/client/v2 v2.0.0-beta.3 // indirect + cosmossdk.io/client/v2 v2.0.0-beta.4 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.1 // indirect cosmossdk.io/depinject v1.0.0 // indirect @@ -66,6 +66,7 @@ require ( github.com/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.12.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -144,6 +145,7 @@ require ( github.com/hashicorp/go-metrics v0.5.3 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -191,6 +193,8 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.27.10 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect diff --git a/e2e/go.sum b/e2e/go.sum index 96d9463b7a0..c054db3105f 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -188,8 +188,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= -cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/client/v2 v2.0.0-beta.4 h1:LGIzWbVTOof/IHQZeoWwxPX0fq607ONXhsfA7eUrQIg= +cosmossdk.io/client/v2 v2.0.0-beta.4/go.mod h1:c753d0sBv3AQRx6X+BOKL1aGpKjZMTZAHGiLPbVi5TE= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= @@ -301,8 +301,8 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurT github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -516,6 +516,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -702,8 +703,8 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -886,6 +887,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= @@ -899,13 +901,13 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -1362,6 +1364,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1481,6 +1484,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= diff --git a/go.mod b/go.mod index 6a57c3f3e2e..001ae158eef 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ics23/go v0.11.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -114,6 +113,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-uuid v1.0.2 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -143,6 +143,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect + github.com/onsi/ginkgo v1.16.4 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20240607163614-bb94eb51e7a7 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -198,5 +199,3 @@ require ( ) replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - -replace github.com/cosmos/ibc-go/modules/capability => ./modules/capability //TODO: remove after capability is tagged diff --git a/go.sum b/go.sum index 1db3e4a8ca6..a5ab438e85b 100644 --- a/go.sum +++ b/go.sum @@ -460,6 +460,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -789,6 +790,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= @@ -1234,6 +1236,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1354,6 +1357,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 86be4431c7a..e8e8a6012fa 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -1035,8 +1035,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeOpen() { } if tc.expPanic != nil { - mockModule := ibcmock.NewAppModule(suite.chainA.App.GetIBCKeeper().PortKeeper) - mockApp := ibcmock.NewIBCApp(path.EndpointA.ChannelConfig.PortID, suite.chainA.App.GetScopedIBCKeeper()) + mockModule := ibcmock.NewAppModule() + mockApp := ibcmock.NewIBCApp(path.EndpointA.ChannelConfig.PortID) cbs = controller.NewIBCMiddlewareWithAuth(ibcmock.NewBlockUpgradeMiddleware(&mockModule, mockApp), suite.chainA.GetSimApp().ICAControllerKeeper) suite.Require().PanicsWithError(tc.expPanic.Error(), func() { upgradeOpenCb(cbs) }) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account.go b/modules/apps/27-interchain-accounts/controller/keeper/account.go index e0cdd500fc8..e2a7fe58f8b 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/ibc-go/v9/internal/logging" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" ) @@ -65,16 +64,7 @@ func (k Keeper) registerInterchainAccount(ctx context.Context, connectionID, por return "", errorsmod.Wrapf(icatypes.ErrActiveChannelAlreadySet, "existing active channel %s for portID %s on connection %s", activeChannelID, portID, connectionID) } - switch { - case k.portKeeper.IsBound(ctx, portID) && !k.hasCapability(ctx, portID): - return "", errorsmod.Wrapf(icatypes.ErrPortAlreadyBound, "another module has claimed capability for and bound port with portID: %s", portID) - case !k.portKeeper.IsBound(ctx, portID): - k.setPort(ctx, portID) - capability := k.portKeeper.BindPort(ctx, portID) - if err := k.ClaimCapability(ctx, capability, host.PortPath(portID)); err != nil { - return "", errorsmod.Wrapf(err, "unable to bind to newly generated portID: %s", portID) - } - } + k.setPort(ctx, portID) sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223 msg := channeltypes.NewMsgChannelOpenInit(portID, version, ordering, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String()) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go index a904d9de271..81d9ade6672 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go @@ -2,27 +2,14 @@ package keeper import ( "context" - "fmt" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ) // InitGenesis initializes the interchain accounts controller application state from a provided genesis state func InitGenesis(ctx context.Context, keeper Keeper, state genesistypes.ControllerGenesisState) { for _, portID := range state.Ports { keeper.setPort(ctx, portID) - - // generate port capability if it does not already exist - if !keeper.hasCapability(ctx, portID) { - // use the port keeper to generate a new capability - capability := keeper.portKeeper.BindPort(ctx, portID) - - // use the controller scoped keeper to claim the port capability - if err := keeper.ClaimCapability(ctx, capability, host.PortPath(portID)); err != nil { - panic(fmt.Errorf("could not claim port capability: %v", err)) - } - } } for _, ch := range state.ActiveChannels { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go index 4a8e5d19bcb..70ec159d0b0 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go @@ -6,7 +6,6 @@ import ( genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -20,14 +19,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() { { "success", func() {}, }, - { - "success: capabilities already initialized for first port", - func() { - capability := suite.chainA.GetSimApp().IBCKeeper.PortKeeper.BindPort(suite.chainA.GetContext(), ports[0]) - err := suite.chainA.GetSimApp().ICAControllerKeeper.ClaimCapability(suite.chainA.GetContext(), capability, host.PortPath(ports[0])) - suite.Require().NoError(err) - }, - }, } interchainAccAddr := icatypes.GenerateAddress(suite.chainB.GetContext(), ibctesting.FirstConnectionID, TestPortID) @@ -86,10 +77,6 @@ func (suite *KeeperTestSuite) TestInitGenesis() { for _, port := range ports { store := suite.chainA.GetContext().KVStore(suite.chainA.GetSimApp().GetKey(types.StoreKey)) suite.Require().True(store.Has(icatypes.KeyPort(port))) - - capability, found := suite.chainA.GetSimApp().ScopedICAControllerKeeper.GetCapability(suite.chainA.GetContext(), host.PortPath(port)) - suite.Require().True(found) - suite.Require().NotNil(capability) } }) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index be9fa6b08ef..c30ee44f0a2 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -16,13 +16,11 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/genesis/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -34,9 +32,6 @@ type Keeper struct { legacySubspace icatypes.ParamSubspace ics4Wrapper porttypes.ICS4Wrapper channelKeeper icatypes.ChannelKeeper - portKeeper icatypes.PortKeeper - - scopedKeeper exported.ScopedKeeper msgRouter icatypes.MessageRouter @@ -48,8 +43,8 @@ type Keeper struct { // NewKeeper creates a new interchain accounts controller Keeper instance func NewKeeper( cdc codec.Codec, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, - ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper, - scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, authority string, + ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, + msgRouter icatypes.MessageRouter, authority string, ) Keeper { if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) @@ -61,8 +56,6 @@ func NewKeeper( legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, msgRouter: msgRouter, authority: authority, } @@ -119,22 +112,6 @@ func (k Keeper) setPort(ctx context.Context, portID string) { } } -// hasCapability checks if the interchain account controller module owns the port capability for the desired port -func (k Keeper) hasCapability(ctx context.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function -func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool { - return k.scopedKeeper.AuthenticateCapability(ctx, cap, name) -} - -// ClaimCapability wraps the scopedKeeper's ClaimCapability function -func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error { - return k.scopedKeeper.ClaimCapability(ctx, cap, name) -} - // GetAppVersion calls the ICS4Wrapper GetAppVersion function. func (k Keeper) GetAppVersion(ctx context.Context, portID, channelID string) (string, bool) { return k.ics4Wrapper.GetAppVersion(ctx, portID, channelID) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go index bffb0a87105..520c6a4383c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -122,8 +122,6 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) @@ -135,8 +133,6 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), "", // authority ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go index f7751fa9476..0a9da175f92 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/migrations_test.go @@ -33,8 +33,6 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, - suite.chainA.GetSimApp().ScopedICAControllerKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay.go b/modules/apps/27-interchain-accounts/controller/keeper/relay.go index d33f82c5da4..ac3ee2da5f2 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay.go @@ -7,7 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" @@ -24,7 +23,7 @@ import ( // Prior to v6.x.x of ibc-go, the controller module was only functional as middleware, with authentication performed // by the underlying application. For a full summary of the changes in v6.x.x, please see ADR009. // This API will be removed in later releases. -func (k Keeper) SendTx(ctx context.Context, _ *capabilitytypes.Capability, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { +func (k Keeper) SendTx(ctx context.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) { return k.sendTx(ctx, connectionID, portID, icaPacketData, timeoutTimestamp) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go index 5279bbb27d2..ee886fc59f8 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go @@ -157,7 +157,7 @@ func (suite *KeeperTestSuite) TestSendTx() { tc.malleate() // malleate mutates test data // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp) if tc.expErr == nil { suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index e2d08f7e714..e5050e85442 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -822,7 +822,7 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose() suite.chainB.GetSimApp().ICAHostKeeper.SetParams(suite.chainB.GetContext(), params) // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) suite.Require().NoError(err) err = path.EndpointB.UpdateClient() suite.Require().NoError(err) @@ -848,7 +848,7 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose() path.CreateChannels() // nolint: staticcheck // SA1019: ibctesting.FirstConnectionID is deprecated: use path.EndpointA.ConnectionID instead. (staticcheck) - _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), nil, ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) + _, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), ibctesting.FirstConnectionID, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0)) suite.Require().NoError(err) err = path.EndpointB.UpdateClient() suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 479f1a12cf2..5d67bd7f666 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -39,11 +39,8 @@ type Keeper struct { ics4Wrapper porttypes.ICS4Wrapper channelKeeper icatypes.ChannelKeeper - portKeeper icatypes.PortKeeper accountKeeper icatypes.AccountKeeper - scopedKeeper exported.ScopedKeeper - msgRouter icatypes.MessageRouter queryRouter icatypes.QueryRouter @@ -58,9 +55,8 @@ type Keeper struct { // NewKeeper creates a new interchain accounts host Keeper instance func NewKeeper( cdc codec.Codec, storeService corestore.KVStoreService, legacySubspace icatypes.ParamSubspace, - ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper, - accountKeeper icatypes.AccountKeeper, scopedKeeper exported.ScopedKeeper, msgRouter icatypes.MessageRouter, - queryRouter icatypes.QueryRouter, authority string, + ics4Wrapper porttypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, + accountKeeper icatypes.AccountKeeper, msgRouter icatypes.MessageRouter, queryRouter icatypes.QueryRouter, authority string, ) Keeper { // ensure ibc interchain accounts module account is set if addr := accountKeeper.GetModuleAddress(icatypes.ModuleName); addr == nil { @@ -77,9 +73,7 @@ func NewKeeper( legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, accountKeeper: accountKeeper, - scopedKeeper: scopedKeeper, msgRouter: msgRouter, queryRouter: queryRouter, mqsAllowList: newModuleQuerySafeAllowList(), diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index 4a4e000bfd5..e2b186286c3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -146,9 +146,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), @@ -161,9 +159,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, authkeeper.AccountKeeper{}, // empty account keeper - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), @@ -176,9 +172,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.SubModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), "", // authority diff --git a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go index b190c0a921b..99a11b9be65 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go @@ -35,9 +35,7 @@ func (suite *KeeperTestSuite) TestMigratorMigrateParams() { nil, // assign a nil legacy param subspace suite.chainA.GetSimApp().IBCFeeKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, - suite.chainA.GetSimApp().ScopedICAHostKeeper, suite.chainA.GetSimApp().MsgServiceRouter(), suite.chainA.GetSimApp().GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/modules/apps/27-interchain-accounts/types/expected_keepers.go b/modules/apps/27-interchain-accounts/types/expected_keepers.go index 3c65541acd3..9ae0e0346ae 100644 --- a/modules/apps/27-interchain-accounts/types/expected_keepers.go +++ b/modules/apps/27-interchain-accounts/types/expected_keepers.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -28,12 +27,6 @@ type ChannelKeeper interface { GetAllChannelsWithPortPrefix(ctx context.Context, portPrefix string) []channeltypes.IdentifiedChannel } -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx context.Context, portID string) *capabilitytypes.Capability - IsBound(ctx context.Context, portID string) bool -} - // ParamSubspace defines the expected Subspace interface for module parameters. type ParamSubspace interface { GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 5dbb766dbbb..641fa156932 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" @@ -20,10 +19,7 @@ import ( // Middleware must implement types.ChannelKeeper and types.PortKeeper expected interfaces // so that it can wrap IBC channel and port logic for underlying application. -var ( - _ types.ChannelKeeper = (*Keeper)(nil) - _ types.PortKeeper = (*Keeper)(nil) -) +var _ types.ChannelKeeper = (*Keeper)(nil) // Keeper defines the IBC fungible transfer keeper type Keeper struct { @@ -33,7 +29,6 @@ type Keeper struct { authKeeper types.AccountKeeper ics4Wrapper porttypes.ICS4Wrapper channelKeeper types.ChannelKeeper - portKeeper types.PortKeeper bankKeeper types.BankKeeper } @@ -41,14 +36,13 @@ type Keeper struct { func NewKeeper( cdc codec.BinaryCodec, storeService corestore.KVStoreService, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, - portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, ) Keeper { return Keeper{ cdc: cdc, storeService: storeService, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, authKeeper: authKeeper, bankKeeper: bankKeeper, } @@ -72,12 +66,6 @@ func (Keeper) Logger(ctx context.Context) log.Logger { return sdkCtx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) } -// BindPort defines a wrapper function for the port Keeper's function in -// order to expose it to module's InitGenesis function -func (k Keeper) BindPort(ctx context.Context, portID string) *capabilitytypes.Capability { - return k.portKeeper.BindPort(ctx, portID) -} - // GetChannel wraps IBC ChannelKeeper's GetChannel function func (k Keeper) GetChannel(ctx context.Context, portID, channelID string) (channeltypes.Channel, bool) { return k.channelKeeper.GetChannel(ctx, portID, channelID) diff --git a/modules/apps/29-fee/types/expected_keepers.go b/modules/apps/29-fee/types/expected_keepers.go index f83198484b4..0285a2bc683 100644 --- a/modules/apps/29-fee/types/expected_keepers.go +++ b/modules/apps/29-fee/types/expected_keepers.go @@ -5,7 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) @@ -23,11 +22,6 @@ type ChannelKeeper interface { HasChannel(ctx context.Context, portID, channelID string) bool } -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx context.Context, portID string) *capabilitytypes.Capability -} - // BankKeeper defines the expected bank keeper type BankKeeper interface { HasBalance(ctx context.Context, addr sdk.AccAddress, amt sdk.Coin) bool diff --git a/modules/apps/callbacks/go.mod b/modules/apps/callbacks/go.mod index b0c7135100d..ada148472ba 100644 --- a/modules/apps/callbacks/go.mod +++ b/modules/apps/callbacks/go.mod @@ -6,8 +6,6 @@ replace github.com/cosmos/ibc-go/v9 => ../../../ replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 -replace github.com/cosmos/ibc-go/modules/capability => ../../capability - require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-beta.3 @@ -26,7 +24,6 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 diff --git a/modules/apps/callbacks/testing/simapp/app.go b/modules/apps/callbacks/testing/simapp/app.go index b2efd323b6d..85d485d21fc 100644 --- a/modules/apps/callbacks/testing/simapp/app.go +++ b/modules/apps/callbacks/testing/simapp/app.go @@ -102,9 +102,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" ibccallbacks "github.com/cosmos/ibc-go/modules/apps/callbacks" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -178,7 +175,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -199,15 +195,6 @@ type SimApp struct { ConsensusParamsKeeper consensusparamkeeper.Keeper CircuitKeeper circuitkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // mock contract keeper used for testing MockContractKeeper *ContractKeeper @@ -299,7 +286,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, ) @@ -309,7 +296,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -328,25 +315,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[capabilitytypes.StoreKey]), runtime.NewMemStoreService(memKeys[capabilitytypes.MemStoreKey])) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -405,7 +373,7 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // NOTE: The mock ContractKeeper is only created for testing. @@ -433,15 +401,15 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -449,8 +417,8 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -466,8 +434,8 @@ func NewSimApp( app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -476,10 +444,10 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Create Transfer Stack @@ -517,7 +485,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { panic(fmt.Errorf("cannot convert %T to %T", icaControllerStack, app.ICAAuthModule)) @@ -559,7 +527,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> callbacks.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule var feeWithMockModule porttypes.Middleware = ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) feeWithMockModule = ibccallbacks.NewIBCMiddleware(feeWithMockModule, app.IBCFeeKeeper, app.MockContractKeeper, maxCallbackGas) @@ -600,7 +568,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -656,7 +623,6 @@ func NewSimApp( // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -676,7 +642,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -692,7 +657,6 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -789,17 +753,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -1057,11 +1010,6 @@ func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 879a69b5f9a..1ebb14ace71 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -34,10 +34,8 @@ type Keeper struct { ics4Wrapper porttypes.ICS4Wrapper channelKeeper types.ChannelKeeper - portKeeper types.PortKeeper authKeeper types.AccountKeeper bankKeeper types.BankKeeper - scopedKeeper exported.ScopedKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. @@ -51,10 +49,8 @@ func NewKeeper( legacySubspace types.ParamSubspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, - portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - scopedKeeper exported.ScopedKeeper, authority string, ) Keeper { // ensure ibc transfer module account is set @@ -72,10 +68,8 @@ func NewKeeper( legacySubspace: legacySubspace, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, - portKeeper: portKeeper, authKeeper: authKeeper, bankKeeper: bankKeeper, - scopedKeeper: scopedKeeper, authority: authority, } } diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index b873501396b..72dc5453733 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -62,10 +62,8 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) }, ""}, @@ -76,10 +74,8 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, authkeeper.AccountKeeper{}, // empty account keeper suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(), ) }, "the IBC transfer module account has not been set"}, @@ -90,10 +86,8 @@ func (suite *KeeperTestSuite) TestNewKeeper() { suite.chainA.GetSimApp().GetSubspace(types.ModuleName), suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper, - suite.chainA.GetSimApp().IBCKeeper.PortKeeper, suite.chainA.GetSimApp().AccountKeeper, suite.chainA.GetSimApp().BankKeeper, - suite.chainA.GetSimApp().ScopedTransferKeeper, "", // authority ) }, "authority must be non-empty"}, diff --git a/modules/apps/transfer/types/expected_keepers.go b/modules/apps/transfer/types/expected_keepers.go index ee12699cd9a..157703fd771 100644 --- a/modules/apps/transfer/types/expected_keepers.go +++ b/modules/apps/transfer/types/expected_keepers.go @@ -7,7 +7,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -52,11 +51,6 @@ type ConnectionKeeper interface { GetConnection(ctx sdk.Context, connectionID string) (connection connectiontypes.ConnectionEnd, found bool) } -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx context.Context, portID string) *capabilitytypes.Capability -} - // ParamSubspace defines the expected Subspace interface for module parameters. type ParamSubspace interface { GetParamSet(ctx sdk.Context, ps paramtypes.ParamSet) diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 40f56aac65e..db81e134084 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -36,8 +36,6 @@ type Keeper struct { cdc codec.BinaryCodec clientKeeper types.ClientKeeper connectionKeeper types.ConnectionKeeper - portKeeper types.PortKeeper - scopedKeeper exported.ScopedKeeper } // NewKeeper creates a new IBC channel Keeper instance @@ -46,16 +44,12 @@ func NewKeeper( storeService corestore.KVStoreService, clientKeeper types.ClientKeeper, connectionKeeper types.ConnectionKeeper, - portKeeper types.PortKeeper, - scopedKeeper exported.ScopedKeeper, ) *Keeper { return &Keeper{ storeService: storeService, cdc: cdc, clientKeeper: clientKeeper, connectionKeeper: connectionKeeper, - portKeeper: portKeeper, - scopedKeeper: scopedKeeper, } } diff --git a/modules/core/04-channel/types/expected_keepers.go b/modules/core/04-channel/types/expected_keepers.go index 79595818798..dfe2a5552ea 100644 --- a/modules/core/04-channel/types/expected_keepers.go +++ b/modules/core/04-channel/types/expected_keepers.go @@ -3,7 +3,6 @@ package types import ( "context" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" @@ -87,8 +86,3 @@ type ConnectionKeeper interface { errorReceipt ErrorReceipt, ) error } - -// PortKeeper expected account IBC port keeper -type PortKeeper interface { - Authenticate(ctx context.Context, key *capabilitytypes.Capability, portID string) bool -} diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index 9d031ebed66..a35288a48c1 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -2,31 +2,24 @@ package keeper import ( "context" - "fmt" "strings" "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // Keeper defines the IBC connection keeper type Keeper struct { Router *types.Router - - scopedKeeper exported.ScopedKeeper } // NewKeeper creates a new IBC connection Keeper instance -func NewKeeper(sck exported.ScopedKeeper) *Keeper { - return &Keeper{ - scopedKeeper: sck, - } +func NewKeeper() *Keeper { + return &Keeper{} } // Logger returns a module-specific logger. @@ -35,46 +28,6 @@ func (Keeper) Logger(ctx context.Context) log.Logger { return sdkCtx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } -// IsBound checks a given port ID is already bounded. -func (k *Keeper) IsBound(ctx context.Context, portID string) bool { - _, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID)) - return ok -} - -// 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(ctx context.Context, portID string) *capabilitytypes.Capability { - if err := host.PortIdentifierValidator(portID); err != nil { - panic(err.Error()) - } - - if k.IsBound(ctx, portID) { - panic(fmt.Errorf("port %s is already bound", portID)) - } - - key, err := k.scopedKeeper.NewCapability(ctx, host.PortPath(portID)) - if err != nil { - panic(err.Error()) - } - - k.Logger(ctx).Info("port binded", "port", 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(ctx context.Context, key *capabilitytypes.Capability, portID string) bool { - if err := host.PortIdentifierValidator(portID); err != nil { - panic(err.Error()) - } - - return k.scopedKeeper.AuthenticateCapability(ctx, key, host.PortPath(portID)) -} - // Route returns a IBCModule for a given module, and a boolean indicating // whether or not the route is present. func (k *Keeper) Route(module string) (types.IBCModule, bool) { diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index 8856a7e4a07..541ce96f462 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/require" testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,11 +11,6 @@ import ( "github.com/cosmos/ibc-go/v9/testing/simapp" ) -var ( - validPort = "validportid" - invalidPort = "(invalidPortID)" -) - type KeeperTestSuite struct { testifysuite.Suite @@ -35,42 +29,3 @@ func (suite *KeeperTestSuite) SetupTest() { func TestKeeperTestSuite(t *testing.T) { testifysuite.Run(t, new(KeeperTestSuite)) } - -func (suite *KeeperTestSuite) TestBind() { - // Test that invalid portID causes panic - require.Panics(suite.T(), func() { suite.keeper.BindPort(suite.ctx, invalidPort) }, "Did not panic on invalid portID") - - // Test that valid BindPort returns capability key - capKey := suite.keeper.BindPort(suite.ctx, validPort) - require.NotNil(suite.T(), capKey, "capabilityKey is nil on valid BindPort") - - isBound := suite.keeper.IsBound(suite.ctx, validPort) - require.True(suite.T(), isBound, "port is bound successfully") - - isNotBound := suite.keeper.IsBound(suite.ctx, "not-a-port") - require.False(suite.T(), isNotBound, "port is not bound") - - // Test that rebinding the same portid causes panic - require.Panics(suite.T(), func() { suite.keeper.BindPort(suite.ctx, validPort) }, "did not panic on re-binding the same port") -} - -func (suite *KeeperTestSuite) TestAuthenticate() { - capKey := suite.keeper.BindPort(suite.ctx, validPort) - - // Require that passing in invalid portID causes panic - require.Panics(suite.T(), func() { suite.keeper.Authenticate(suite.ctx, capKey, invalidPort) }, "did not panic on invalid portID") - - // Valid authentication should return true - auth := suite.keeper.Authenticate(suite.ctx, capKey, validPort) - require.True(suite.T(), auth, "valid authentication failed") - - // Test that authenticating against incorrect portid fails - auth = suite.keeper.Authenticate(suite.ctx, capKey, "wrongportid") - require.False(suite.T(), auth, "invalid authentication failed") - - // Test that authenticating port against different valid - // capability key fails - capKey2 := suite.keeper.BindPort(suite.ctx, "otherportid") - auth = suite.keeper.Authenticate(suite.ctx, capKey2, validPort) - require.False(suite.T(), auth, "invalid authentication for different capKey failed") -} diff --git a/modules/core/exported/expected_keepers.go b/modules/core/exported/expected_keepers.go deleted file mode 100644 index 22bd5ee841d..00000000000 --- a/modules/core/exported/expected_keepers.go +++ /dev/null @@ -1,16 +0,0 @@ -package exported - -import ( - "context" - - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" -) - -// ScopedKeeper defines the expected x/capability scoped keeper interface -type ScopedKeeper interface { - NewCapability(ctx context.Context, name string) (*capabilitytypes.Capability, error) - GetCapability(ctx context.Context, name string) (*capabilitytypes.Capability, bool) - AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool - LookupModules(ctx context.Context, name string) ([]string, *capabilitytypes.Capability, error) - ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error -} diff --git a/modules/core/keeper/keeper.go b/modules/core/keeper/keeper.go index 0ed9e438cad..ccb1abe974d 100644 --- a/modules/core/keeper/keeper.go +++ b/modules/core/keeper/keeper.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" clientkeeper "github.com/cosmos/ibc-go/v9/modules/core/02-client/keeper" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" connectionkeeper "github.com/cosmos/ibc-go/v9/modules/core/03-connection/keeper" @@ -34,26 +33,21 @@ type Keeper struct { // NewKeeper creates a new ibc Keeper func NewKeeper( cdc codec.BinaryCodec, storeService corestore.KVStoreService, paramSpace types.ParamSubspace, - upgradeKeeper clienttypes.UpgradeKeeper, - scopedKeeper capabilitykeeper.ScopedKeeper, authority string, + upgradeKeeper clienttypes.UpgradeKeeper, authority string, ) *Keeper { // panic if any of the keepers passed in is empty if isEmpty(upgradeKeeper) { panic(errors.New("cannot initialize IBC keeper: empty upgrade keeper")) } - if reflect.DeepEqual(capabilitykeeper.ScopedKeeper{}, scopedKeeper) { - panic(errors.New("cannot initialize IBC keeper: empty scoped keeper")) - } - if strings.TrimSpace(authority) == "" { panic(errors.New("authority must be non-empty")) } clientKeeper := clientkeeper.NewKeeper(cdc, storeService, paramSpace, upgradeKeeper) connectionKeeper := connectionkeeper.NewKeeper(cdc, storeService, paramSpace, clientKeeper) - portKeeper := portkeeper.NewKeeper(scopedKeeper) - channelKeeper := channelkeeper.NewKeeper(cdc, storeService, clientKeeper, connectionKeeper, portKeeper, scopedKeeper) + portKeeper := portkeeper.NewKeeper() + channelKeeper := channelkeeper.NewKeeper(cdc, storeService, clientKeeper, connectionKeeper) return &Keeper{ cdc: cdc, diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index eb35bd015c3..f03bd02a0c9 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/runtime" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" @@ -46,7 +45,6 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) TestNewKeeper() { var ( upgradeKeeper clienttypes.UpgradeKeeper - scopedKeeper capabilitykeeper.ScopedKeeper newIBCKeeperFn func() ) @@ -65,11 +63,6 @@ func (suite *KeeperTestSuite) TestNewKeeper() { upgradeKeeper = emptyUpgradeKeeperPointer }, false}, - {"failure: empty scoped keeper", func() { - emptyScopedKeeper := capabilitykeeper.ScopedKeeper{} - - scopedKeeper = emptyScopedKeeper - }, false}, {"failure: empty authority", func() { newIBCKeeperFn = func() { ibckeeper.NewKeeper( @@ -77,7 +70,6 @@ func (suite *KeeperTestSuite) TestNewKeeper() { runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName), upgradeKeeper, - scopedKeeper, "", // authority ) } @@ -96,13 +88,11 @@ func (suite *KeeperTestSuite) TestNewKeeper() { runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(ibcexported.StoreKey)), suite.chainA.GetSimApp().GetSubspace(ibcexported.ModuleName), upgradeKeeper, - scopedKeeper, suite.chainA.App.GetIBCKeeper().GetAuthority(), ) } upgradeKeeper = suite.chainA.GetSimApp().UpgradeKeeper - scopedKeeper = suite.chainA.GetSimApp().ScopedIBCKeeper tc.malleate() diff --git a/modules/light-clients/08-wasm/go.mod b/modules/light-clients/08-wasm/go.mod index 85c24cfae71..9afa10cf07f 100644 --- a/modules/light-clients/08-wasm/go.mod +++ b/modules/light-clients/08-wasm/go.mod @@ -8,8 +8,6 @@ replace github.com/cosmos/ibc-go/v9 => ../../../ replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 -replace github.com/cosmos/ibc-go/modules/capability => ../../capability - require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-beta.3 @@ -30,7 +28,6 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index f925bf18a9a..1804f057d16 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -105,9 +105,6 @@ import ( cmtos "github.com/cometbft/cometbft/libs/os" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" wasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" wasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" wasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" @@ -186,7 +183,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -208,15 +204,6 @@ type SimApp struct { ConsensusParamsKeeper consensusparamkeeper.Keeper CircuitKeeper circuitkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router ICAAuthModule ibcmock.IBCModule @@ -306,7 +293,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, wasmtypes.StoreKey, ) @@ -316,7 +303,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -335,25 +322,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[capabilitytypes.StoreKey]), runtime.NewMemStoreService(memKeys[capabilitytypes.MemStoreKey])) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -412,7 +380,7 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) govConfig := govtypes.DefaultConfig() @@ -478,15 +446,15 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -494,8 +462,8 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -509,8 +477,8 @@ func NewSimApp( app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -519,10 +487,10 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Create Transfer Stack @@ -551,7 +519,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule var ok bool - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { panic(fmt.Errorf("cannot convert %T into %T", icaControllerStack, app.ICAAuthModule)) @@ -585,7 +553,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -628,7 +596,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -685,7 +652,6 @@ func NewSimApp( // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -706,7 +672,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -723,7 +688,6 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -841,17 +805,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -1111,11 +1064,6 @@ func (app *SimApp) GetWasmKeeper() wasmkeeper.Keeper { return app.WasmClientKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/simapp/app.go b/simapp/app.go index 02adfad461e..5c000c18664 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -101,9 +101,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -178,7 +175,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -199,15 +195,6 @@ type SimApp struct { ConsensusParamsKeeper consensusparamkeeper.Keeper CircuitKeeper circuitkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router IBCMockModule mock.IBCModule @@ -297,7 +284,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, ) @@ -307,7 +294,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, mock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(mock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -326,26 +313,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[capabilitytypes.StoreKey]), runtime.NewMemStoreService(memKeys[capabilitytypes.MemStoreKey])) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(mock.ModuleName) - scopedIBCMockBlockUpgradeKeeper := app.CapabilityKeeper.ScopeToModule(mock.MockBlockUpgrade) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(mock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -404,7 +371,7 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) govConfig := govtypes.DefaultConfig() @@ -428,15 +395,15 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -444,8 +411,8 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, - scopedICAHostKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), + app.IBCKeeper.ChannelKeeper, app.AccountKeeper, + app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -459,8 +426,8 @@ func NewSimApp( app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -469,17 +436,17 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := mock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := mock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.ModuleName)) app.IBCMockModule = mockIBCModule ibcRouter.AddRoute(mock.ModuleName, mockIBCModule) // Mock IBC app wrapped with a middleware which does not implement the UpgradeableModule interface. // NOTE: this is used to test integration with apps which do not yet fulfill the UpgradeableModule interface and error when // an upgrade is tried on the channel. - mockBlockUpgradeIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.MockBlockUpgrade, scopedIBCMockBlockUpgradeKeeper)) + mockBlockUpgradeIBCModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(mock.MockBlockUpgrade)) mockBlockUpgradeMw := mock.NewBlockUpgradeMiddleware(&mockModule, mockBlockUpgradeIBCModule.IBCApp) ibcRouter.AddRoute(mock.MockBlockUpgrade, mockBlockUpgradeMw) @@ -508,7 +475,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = mock.NewIBCModule(&mockModule, mock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = mock.NewIBCModule(&mockModule, mock.NewIBCApp("")) var ok bool app.ICAAuthModule, ok = icaControllerStack.(mock.IBCModule) if !ok { @@ -543,7 +510,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := mock.NewIBCModule(&mockModule, mock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -583,7 +550,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), @@ -639,7 +605,6 @@ func NewSimApp( // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -659,7 +624,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, icatypes.ModuleName, @@ -675,7 +639,6 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, @@ -776,17 +739,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } diff --git a/simapp/go.mod b/simapp/go.mod index c8b7aa39f7c..083609790ac 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -4,10 +4,7 @@ toolchain go1.22.3 module github.com/cosmos/ibc-go/simapp -replace ( - github.com/cosmos/ibc-go/modules/capability => ../modules/capability - github.com/cosmos/ibc-go/v9 => ../ -) +replace github.com/cosmos/ibc-go/v9 => ../ require ( cosmossdk.io/api v0.7.5 @@ -25,7 +22,6 @@ require ( github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef github.com/cosmos/gogoproto v1.7.0 - github.com/cosmos/ibc-go/modules/capability v1.0.1 github.com/cosmos/ibc-go/v9 v9.0.0 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 diff --git a/testing/README.md b/testing/README.md index a14cbe70ef4..297a3150d3f 100644 --- a/testing/README.md +++ b/testing/README.md @@ -53,7 +53,6 @@ type TestingApp interface { GetBaseApp() *baseapp.BaseApp GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper - GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig // Implemented by SimApp @@ -86,11 +85,6 @@ func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/testing/mock/ibc_app.go b/testing/mock/ibc_app.go index f3dcb1fa533..09532ac0ff5 100644 --- a/testing/mock/ibc_app.go +++ b/testing/mock/ibc_app.go @@ -5,15 +5,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) // IBCApp contains IBC application module callbacks as defined in 05-port. type IBCApp struct { - PortID string - ScopedKeeper capabilitykeeper.ScopedKeeper + PortID string OnChanOpenInit func( ctx context.Context, @@ -122,9 +120,8 @@ type IBCApp struct { } // NewIBCApp returns a IBCApp. An empty PortID indicates the mock app doesn't bind/claim ports. -func NewIBCApp(portID string, scopedKeeper capabilitykeeper.ScopedKeeper) *IBCApp { +func NewIBCApp(portID string) *IBCApp { return &IBCApp{ - PortID: portID, - ScopedKeeper: scopedKeeper, + PortID: portID, } } diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 17055eda29e..2c8d7fa13fd 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -1,7 +1,6 @@ package mock import ( - "context" "encoding/json" "errors" "fmt" @@ -19,11 +18,9 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" feetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v9/modules/core/24-host" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -65,13 +62,6 @@ var ( _ porttypes.IBCModule = (*IBCModule)(nil) ) -// Expected Interface -// PortKeeper defines the expected IBC port keeper -type PortKeeper interface { - BindPort(ctx context.Context, portID string) *capabilitytypes.Capability - IsBound(ctx context.Context, portID string) bool -} - // AppModuleBasic is the mock AppModuleBasic. type AppModuleBasic struct{} @@ -124,15 +114,12 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // AppModule represents the AppModule for the mock module. type AppModule struct { AppModuleBasic - ibcApps []*IBCApp - portKeeper PortKeeper + ibcApps []*IBCApp } // NewAppModule returns a mock AppModule instance. -func NewAppModule(pk PortKeeper) AppModule { - return AppModule{ - portKeeper: pk, - } +func NewAppModule() AppModule { + return AppModule{} } // RegisterInvariants implements the AppModule interface. @@ -142,18 +129,7 @@ func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} func (AppModule) RegisterServices(module.Configurator) {} // InitGenesis implements the AppModule interface. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - for _, ibcApp := range am.ibcApps { - if ibcApp.PortID != "" && !am.portKeeper.IsBound(ctx, ibcApp.PortID) { - // bind mock portID - capability := am.portKeeper.BindPort(ctx, ibcApp.PortID) - err := ibcApp.ScopedKeeper.ClaimCapability(ctx, capability, host.PortPath(ibcApp.PortID)) - if err != nil { - panic(err) - } - } - } - +func (AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/testing/simapp/app.go b/testing/simapp/app.go index dd96cb9f53d..390401cc8ea 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -87,9 +87,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/ibc-go/modules/capability" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" @@ -162,7 +159,6 @@ type SimApp struct { // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper @@ -178,15 +174,6 @@ type SimApp struct { TransferKeeper ibctransferkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper - // make scoped keepers public for test purposes - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedTransferKeeper capabilitykeeper.ScopedKeeper - ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper - ScopedICAMockKeeper capabilitykeeper.ScopedKeeper - // make IBC modules public for test purposes // these modules are never directly routed to by the IBC Router IBCMockModule ibcmock.IBCModule @@ -276,7 +263,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, - ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, ) @@ -286,7 +273,7 @@ func NewSimApp( } tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, ibcmock.MemStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(ibcmock.MemStoreKey) app := &SimApp{ BaseApp: bApp, @@ -305,26 +292,6 @@ func NewSimApp( app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authtypes.NewModuleAddress(govtypes.ModuleName).String(), runtime.EventService{}) bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore) - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[capabilitytypes.StoreKey]), runtime.NewMemStoreService(memKeys[capabilitytypes.MemStoreKey])) - - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // not replicate if you do not need to test core IBC or light clients. - scopedIBCMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName) - scopedIBCMockBlockUpgradeKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.MockBlockUpgrade) - scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) - scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) - - // seal capability keeper after scoping modules - // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating - // their scoped modules in `NewApp` with `ScopeToModule` - app.CapabilityKeeper.Seal() - // SDK module keepers // add keepers @@ -367,7 +334,7 @@ func NewSimApp( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.IBCKeeper = ibckeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]), app.GetSubspace(ibcexported.ModuleName), app.UpgradeKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) govConfig := govtypes.DefaultConfig() @@ -391,15 +358,15 @@ func NewSimApp( appCodec, runtime.NewKVStoreService(keys[ibcfeetypes.StoreKey]), app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, + app.AccountKeeper, app.BankKeeper, ) // ICA Controller keeper app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icacontrollertypes.StoreKey]), app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, app.MsgServiceRouter(), + app.IBCKeeper.ChannelKeeper, + app.MsgServiceRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -407,8 +374,8 @@ func NewSimApp( app.ICAHostKeeper = icahostkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[icahosttypes.StoreKey]), app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, app.AccountKeeper, - scopedICAHostKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), + app.IBCKeeper.ChannelKeeper, app.AccountKeeper, + app.MsgServiceRouter(), app.GRPCQueryRouter(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -422,8 +389,8 @@ func NewSimApp( app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware - app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, - app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) @@ -432,17 +399,17 @@ func NewSimApp( // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. - mockModule := ibcmock.NewAppModule(app.IBCKeeper.PortKeeper) + mockModule := ibcmock.NewAppModule() // The mock module is used for testing IBC - mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName)) app.IBCMockModule = mockIBCModule ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) // Mock IBC app wrapped with a middleware which does not implement the UpgradeableModule interface. // NOTE: this is used to test integration with apps which do not yet fulfill the UpgradeableModule interface and error when // an upgrade is tried on the channel. - mockBlockUpgradeIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.MockBlockUpgrade, scopedIBCMockBlockUpgradeKeeper)) + mockBlockUpgradeIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.MockBlockUpgrade)) mockBlockUpgradeMw := ibcmock.NewBlockUpgradeMiddleware(&mockModule, mockBlockUpgradeIBCModule.IBCApp) ibcRouter.AddRoute(ibcmock.MockBlockUpgrade, mockBlockUpgradeMw) @@ -471,7 +438,7 @@ func NewSimApp( // initialize ICA module with mock module as the authentication module on the controller side var icaControllerStack porttypes.IBCModule - icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("", scopedICAMockKeeper)) + icaControllerStack = ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp("")) var ok bool app.ICAAuthModule, ok = icaControllerStack.(ibcmock.IBCModule) if !ok { @@ -506,7 +473,7 @@ func NewSimApp( // mockModule.OnAcknowledgementPacket -> fee.OnAcknowledgementPacket -> channel.OnAcknowledgementPacket // create fee wrapped mock module - feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort, scopedFeeMockKeeper)) + feeMockModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(MockFeePort)) app.FeeMockModule = feeMockModule feeWithMockModule := ibcfee.NewIBCMiddleware(feeMockModule, app.IBCFeeKeeper) ibcRouter.AddRoute(MockFeePort, feeWithMockModule) @@ -535,7 +502,6 @@ func NewSimApp( auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), - capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), @@ -586,7 +552,6 @@ func NewSimApp( // NOTE: staking module is required if HistoricalEntries param > 0 // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) app.ModuleManager.SetOrderBeginBlockers( - capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, @@ -604,7 +569,6 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, genutiltypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, @@ -619,7 +583,6 @@ func NewSimApp( // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. genesisModuleOrder := []string{ - capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, @@ -715,17 +678,6 @@ func NewSimApp( } } - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - - // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do - // note replicate if you do not need to test core IBC or light clients. - app.ScopedIBCMockKeeper = scopedIBCMockKeeper - app.ScopedICAMockKeeper = scopedICAMockKeeper - app.ScopedFeeMockKeeper = scopedFeeMockKeeper - return app } @@ -979,11 +931,6 @@ func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } -// GetScopedIBCKeeper implements the TestingApp interface. -func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper -} - // GetTxConfig implements the TestingApp interface. func (app *SimApp) GetTxConfig() client.TxConfig { return app.txConfig diff --git a/testing/testing_app.go b/testing/testing_app.go index 1a1ac564859..bdb99ec35fc 100644 --- a/testing/testing_app.go +++ b/testing/testing_app.go @@ -27,7 +27,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" cmttypes "github.com/cometbft/cometbft/types" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" "github.com/cosmos/ibc-go/v9/modules/core/keeper" "github.com/cosmos/ibc-go/v9/testing/simapp" ibctestingtypes "github.com/cosmos/ibc-go/v9/testing/types" @@ -42,7 +41,6 @@ type TestingApp interface { GetBaseApp() *baseapp.BaseApp GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper - GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig // Implemented by SimApp