From aa508b296b5ec89caf85c902b58f9eeb46ab4cf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Fri, 26 Nov 2021 11:47:40 +0100
Subject: [PATCH 1/7] add ica params
Add new Params type to ICA. A single test is added to check defaults and validation.
Usage within the ICA keepers is still needed
---
docs/ibc/proto-docs.md | 19 ++
.../27-interchain-accounts/types/params.go | 65 +++++
.../types/params_test.go | 14 +
.../27-interchain-accounts/types/types.pb.go | 263 ++++++++++++++++--
.../interchain_accounts/v1/types.proto | 10 +
5 files changed, 345 insertions(+), 26 deletions(-)
create mode 100644 modules/apps/27-interchain-accounts/types/params.go
create mode 100644 modules/apps/27-interchain-accounts/types/params_test.go
diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md
index da269933b46..e0d7b8872be 100644
--- a/docs/ibc/proto-docs.md
+++ b/docs/ibc/proto-docs.md
@@ -17,6 +17,7 @@
- [ibc/applications/interchain_accounts/v1/types.proto](#ibc/applications/interchain_accounts/v1/types.proto)
- [CosmosTx](#ibc.applications.interchain_accounts.v1.CosmosTx)
- [InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData)
+ - [Params](#ibc.applications.interchain_accounts.v1.Params)
- [Type](#ibc.applications.interchain_accounts.v1.Type)
@@ -438,6 +439,24 @@ InterchainAccountPacketData is comprised of a raw transaction, type of transacti
+
+
+
+### Params
+Params defines the set of on-chain interchain accounts parameters.
+The following parameters may be used to disable controller or host
+submodules.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `controller_enabled` | [bool](#bool) | | controller_enabled enables or disables the controller submodule. |
+| `host_enabled` | [bool](#bool) | | host_enabled enables or disables the host submodule. |
+
+
+
+
+
diff --git a/modules/apps/27-interchain-accounts/types/params.go b/modules/apps/27-interchain-accounts/types/params.go
new file mode 100644
index 00000000000..2e8667fa496
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/types/params.go
@@ -0,0 +1,65 @@
+package types
+
+import (
+ "fmt"
+
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+)
+
+const (
+ // DefaultControllerEnabled enabled
+ DefaultControllerEnabled = true
+ // DefaultHostEnabled enabled
+ DefaultHostEnabled = true
+)
+
+var (
+ // KeyControllerEnabled is store's key for ControllerEnabled Params
+ KeyControllerEnabled = []byte("ControllerEnabled")
+ // KeyHostEnabled is store's key for HostEnabled Params
+ KeyHostEnabled = []byte("HostEnabled")
+)
+
+// ParamKeyTable type declaration for parameters
+func ParamKeyTable() paramtypes.KeyTable {
+ return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
+}
+
+// NewParams creates a new parameter configuration for the interchain accounts module
+func NewParams(enableController, enableHost bool) Params {
+ return Params{
+ ControllerEnabled: enableController,
+ HostEnabled: enableHost,
+ }
+}
+
+// DefaultParams is the default parameter configuration for the ibc-transfer module
+func DefaultParams() Params {
+ return NewParams(DefaultControllerEnabled, DefaultHostEnabled)
+}
+
+// Validate all ibc-transfer module parameters
+func (p Params) Validate() error {
+ if err := validateEnabled(p.ControllerEnabled); err != nil {
+ return err
+ }
+
+ return validateEnabled(p.HostEnabled)
+}
+
+// ParamSetPairs implements params.ParamSet
+func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
+ return paramtypes.ParamSetPairs{
+ paramtypes.NewParamSetPair(KeyControllerEnabled, p.ControllerEnabled, validateEnabled),
+ paramtypes.NewParamSetPair(KeyHostEnabled, p.HostEnabled, validateEnabled),
+ }
+}
+
+func validateEnabled(i interface{}) error {
+ _, ok := i.(bool)
+ if !ok {
+ return fmt.Errorf("invalid parameter type: %T", i)
+ }
+
+ return nil
+}
diff --git a/modules/apps/27-interchain-accounts/types/params_test.go b/modules/apps/27-interchain-accounts/types/params_test.go
new file mode 100644
index 00000000000..ceb28f9f0f2
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/types/params_test.go
@@ -0,0 +1,14 @@
+package types_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+)
+
+func TestValidateParams(t *testing.T) {
+ require.NoError(t, types.DefaultParams().Validate())
+ require.NoError(t, types.NewParams(true, false).Validate())
+}
diff --git a/modules/apps/27-interchain-accounts/types/types.pb.go b/modules/apps/27-interchain-accounts/types/types.pb.go
index 7ed9c1b9e7e..5196857edfb 100644
--- a/modules/apps/27-interchain-accounts/types/types.pb.go
+++ b/modules/apps/27-interchain-accounts/types/types.pb.go
@@ -159,10 +159,68 @@ func (m *CosmosTx) GetMessages() []*types.Any {
return nil
}
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable controller or host
+// submodules.
+type Params struct {
+ // controller_enabled enables or disables the controller submodule.
+ ControllerEnabled bool `protobuf:"varint,1,opt,name=controller_enabled,json=controllerEnabled,proto3" json:"controller_enabled,omitempty" yaml:"controller_enabled"`
+ // host_enabled enables or disables the host submodule.
+ HostEnabled bool `protobuf:"varint,2,opt,name=host_enabled,json=hostEnabled,proto3" json:"host_enabled,omitempty" yaml:"host_enabled"`
+}
+
+func (m *Params) Reset() { *m = Params{} }
+func (m *Params) String() string { return proto.CompactTextString(m) }
+func (*Params) ProtoMessage() {}
+func (*Params) Descriptor() ([]byte, []int) {
+ return fileDescriptor_39bab93e18d89799, []int{2}
+}
+func (m *Params) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Params.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *Params) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Params.Merge(m, src)
+}
+func (m *Params) XXX_Size() int {
+ return m.Size()
+}
+func (m *Params) XXX_DiscardUnknown() {
+ xxx_messageInfo_Params.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Params proto.InternalMessageInfo
+
+func (m *Params) GetControllerEnabled() bool {
+ if m != nil {
+ return m.ControllerEnabled
+ }
+ return false
+}
+
+func (m *Params) GetHostEnabled() bool {
+ if m != nil {
+ return m.HostEnabled
+ }
+ return false
+}
+
func init() {
proto.RegisterEnum("ibc.applications.interchain_accounts.v1.Type", Type_name, Type_value)
proto.RegisterType((*InterchainAccountPacketData)(nil), "ibc.applications.interchain_accounts.v1.InterchainAccountPacketData")
proto.RegisterType((*CosmosTx)(nil), "ibc.applications.interchain_accounts.v1.CosmosTx")
+ proto.RegisterType((*Params)(nil), "ibc.applications.interchain_accounts.v1.Params")
}
func init() {
@@ -170,32 +228,37 @@ func init() {
}
var fileDescriptor_39bab93e18d89799 = []byte{
- // 391 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x41, 0x8b, 0xd3, 0x40,
- 0x18, 0xcd, 0xb8, 0x41, 0xd6, 0x59, 0xd9, 0x2d, 0x61, 0x0f, 0x31, 0x42, 0x08, 0x2b, 0x62, 0x10,
- 0x32, 0xe3, 0x66, 0x0f, 0x5e, 0xbc, 0xd4, 0x6e, 0x84, 0x5e, 0xa4, 0xc4, 0x14, 0xaa, 0x97, 0x30,
- 0x99, 0x8e, 0xe9, 0x60, 0x93, 0x09, 0x9d, 0x49, 0x31, 0xff, 0xa0, 0xf4, 0xe4, 0x1f, 0xe8, 0xc9,
- 0x3f, 0xe3, 0xb1, 0x47, 0x8f, 0xd2, 0xfe, 0x11, 0xc9, 0x04, 0xdb, 0x1e, 0x3c, 0xec, 0xed, 0xf1,
- 0xf8, 0xde, 0x9b, 0xf7, 0xe6, 0xc1, 0x3b, 0x9e, 0x51, 0x4c, 0xaa, 0x6a, 0xce, 0x29, 0x51, 0x5c,
- 0x94, 0x12, 0xf3, 0x52, 0xb1, 0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0xe3, 0x5d, 0x9c, 0x50, 0xd6,
- 0x0b, 0x78, 0xa5, 0xcf, 0xa2, 0x49, 0x34, 0x18, 0x27, 0x51, 0x9a, 0x4c, 0x7a, 0xc0, 0xb9, 0x5c,
- 0x6f, 0x3c, 0x78, 0x64, 0x1c, 0x73, 0xf5, 0xd3, 0x35, 0xde, 0xa7, 0xbf, 0x76, 0x2e, 0xd8, 0xee,
- 0x5c, 0xf0, 0x67, 0xe7, 0x82, 0x1f, 0x7b, 0xd7, 0xd8, 0xee, 0x5d, 0xe3, 0xf7, 0xde, 0x35, 0xbe,
- 0x44, 0x39, 0x57, 0xb3, 0x3a, 0x43, 0x54, 0x14, 0x98, 0xea, 0xe8, 0x98, 0x67, 0x34, 0xc8, 0x05,
- 0x5e, 0x86, 0xb8, 0x10, 0xd3, 0x7a, 0xce, 0x64, 0xbb, 0xb5, 0xc4, 0xe1, 0xdb, 0xe0, 0xf8, 0x51,
- 0xc1, 0x61, 0x66, 0xbd, 0x71, 0xf6, 0x58, 0x57, 0xba, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xfa,
- 0xbe, 0xe0, 0xb6, 0x1b, 0x02, 0x00, 0x00,
+ // 474 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x6b, 0x13, 0x41,
+ 0x14, 0xc7, 0x33, 0x6d, 0x28, 0x71, 0x52, 0xda, 0x38, 0x16, 0x4c, 0x57, 0xdc, 0x2e, 0x2b, 0x62,
+ 0x10, 0x32, 0x63, 0xd3, 0x83, 0x50, 0xbc, 0xa4, 0xe9, 0x0a, 0x01, 0x91, 0xb0, 0x6e, 0x21, 0x7a,
+ 0x59, 0x66, 0x27, 0xe3, 0x66, 0x71, 0x77, 0x67, 0xd9, 0x99, 0x04, 0xf7, 0x1b, 0x94, 0x9e, 0xc4,
+ 0x7b, 0x4f, 0x7e, 0x19, 0x8f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09, 0x61, 0x7a, 0x9f, 0x24, 0x0a, 0x58, 0x37,
+ 0x14, 0x64, 0xde, 0x23, 0x89, 0x98, 0xcc, 0x62, 0x2e, 0xcb, 0x03, 0x94, 0xa4, 0xf7, 0xb2, 0xbb,
+ 0x7e, 0xbd, 0xee, 0xea, 0xf6, 0xf4, 0xe1, 0x05, 0x3b, 0x7a, 0xcf, 0x27, 0xbf, 0x02, 0x00, 0x00,
+ 0xff, 0xff, 0x69, 0x12, 0x34, 0x42, 0xb0, 0x02, 0x00, 0x00,
}
func (m *InterchainAccountPacketData) Marshal() (dAtA []byte, err error) {
@@ -277,6 +340,49 @@ func (m *CosmosTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *Params) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *Params) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.HostEnabled {
+ i--
+ if m.HostEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x10
+ }
+ if m.ControllerEnabled {
+ i--
+ if m.ControllerEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
@@ -323,6 +429,21 @@ func (m *CosmosTx) Size() (n int) {
return n
}
+func (m *Params) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ControllerEnabled {
+ n += 2
+ }
+ if m.HostEnabled {
+ n += 2
+ }
+ return n
+}
+
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -548,6 +669,96 @@ func (m *CosmosTx) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *Params) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTypes
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: Params: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ControllerEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTypes
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.ControllerEnabled = bool(v != 0)
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field HostEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTypes
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.HostEnabled = bool(v != 0)
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTypes(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTypes
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/proto/ibc/applications/interchain_accounts/v1/types.proto b/proto/ibc/applications/interchain_accounts/v1/types.proto
index c6d9d0a3e96..0f3918d0435 100644
--- a/proto/ibc/applications/interchain_accounts/v1/types.proto
+++ b/proto/ibc/applications/interchain_accounts/v1/types.proto
@@ -29,3 +29,13 @@ message InterchainAccountPacketData {
message CosmosTx {
repeated google.protobuf.Any messages = 1;
}
+
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable controller or host
+// submodules.
+message Params {
+ // controller_enabled enables or disables the controller submodule.
+ bool controller_enabled = 1 [(gogoproto.moretags) = "yaml:\"controller_enabled\""];
+ // host_enabled enables or disables the host submodule.
+ bool host_enabled = 2 [(gogoproto.moretags) = "yaml:\"host_enabled\""];
+}
From 5d009b5ebe39e6554b57759d8ec0c32db38ec841 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Mon, 29 Nov 2021 11:35:55 +0100
Subject: [PATCH 2/7] regenerate params proto into host and controller
submodules
---
docs/ibc/proto-docs.md | 19 --
go.mod | 91 -----
.../controller/types/controller.pb.go | 318 ++++++++++++++++++
.../host/types/host.pb.go | 318 ++++++++++++++++++
.../27-interchain-accounts/types/types.pb.go | 263 ++-------------
.../controller/v1/controller.proto | 15 +
.../interchain_accounts/host/v1/host.proto | 15 +
.../interchain_accounts/v1/types.proto | 9 -
8 files changed, 692 insertions(+), 356 deletions(-)
create mode 100644 modules/apps/27-interchain-accounts/controller/types/controller.pb.go
create mode 100644 modules/apps/27-interchain-accounts/host/types/host.pb.go
create mode 100644 proto/ibc/applications/interchain_accounts/controller/v1/controller.proto
create mode 100644 proto/ibc/applications/interchain_accounts/host/v1/host.proto
diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md
index e0d7b8872be..da269933b46 100644
--- a/docs/ibc/proto-docs.md
+++ b/docs/ibc/proto-docs.md
@@ -17,7 +17,6 @@
- [ibc/applications/interchain_accounts/v1/types.proto](#ibc/applications/interchain_accounts/v1/types.proto)
- [CosmosTx](#ibc.applications.interchain_accounts.v1.CosmosTx)
- [InterchainAccountPacketData](#ibc.applications.interchain_accounts.v1.InterchainAccountPacketData)
- - [Params](#ibc.applications.interchain_accounts.v1.Params)
- [Type](#ibc.applications.interchain_accounts.v1.Type)
@@ -439,24 +438,6 @@ InterchainAccountPacketData is comprised of a raw transaction, type of transacti
-
-
-
-### Params
-Params defines the set of on-chain interchain accounts parameters.
-The following parameters may be used to disable controller or host
-submodules.
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| `controller_enabled` | [bool](#bool) | | controller_enabled enables or disables the controller submodule. |
-| `host_enabled` | [bool](#bool) | | host_enabled enables or disables the host submodule. |
-
-
-
-
-
diff --git a/go.mod b/go.mod
index 274ba00ded6..9f96dbd3b10 100644
--- a/go.mod
+++ b/go.mod
@@ -26,94 +26,3 @@ require (
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
)
-
-require (
- filippo.io/edwards25519 v1.0.0-beta.2 // indirect
- github.com/99designs/keyring v1.1.6 // indirect
- github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
- github.com/DataDog/zstd v1.4.5 // indirect
- github.com/Workiva/go-datastructures v1.0.52 // indirect
- github.com/beorn7/perks v1.0.1 // indirect
- github.com/bgentry/speakeasy v0.1.0 // indirect
- github.com/btcsuite/btcd v0.22.0-beta // indirect
- github.com/cespare/xxhash v1.1.0 // indirect
- github.com/cespare/xxhash/v2 v2.1.1 // indirect
- github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect
- github.com/cosmos/go-bip39 v1.0.0 // indirect
- github.com/cosmos/iavl v0.17.1 // indirect
- github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
- github.com/cosmos/ledger-go v0.9.2 // indirect
- github.com/danieljoos/wincred v1.0.2 // indirect
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
- github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
- github.com/dgraph-io/ristretto v0.0.3 // indirect
- github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
- github.com/dustin/go-humanize v1.0.0 // indirect
- github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
- github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect
- github.com/felixge/httpsnoop v1.0.1 // indirect
- github.com/fsnotify/fsnotify v1.5.1 // indirect
- github.com/go-kit/kit v0.10.0 // indirect
- github.com/go-logfmt/logfmt v0.5.0 // indirect
- github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
- github.com/gogo/gateway v1.1.0 // indirect
- github.com/golang/snappy v0.0.3 // indirect
- github.com/google/btree v1.0.0 // indirect
- github.com/google/orderedcode v0.0.1 // indirect
- github.com/gorilla/handlers v1.5.1 // indirect
- github.com/gorilla/websocket v1.4.2 // indirect
- github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
- github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
- github.com/gtank/merlin v0.1.1 // indirect
- github.com/gtank/ristretto255 v0.1.2 // indirect
- github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
- github.com/hashicorp/golang-lru v0.5.4 // indirect
- github.com/hashicorp/hcl v1.0.0 // indirect
- github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
- github.com/improbable-eng/grpc-web v0.14.1 // indirect
- github.com/inconshreveable/mousetrap v1.0.0 // indirect
- github.com/jmhodges/levigo v1.0.0 // indirect
- github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
- github.com/klauspost/compress v1.11.7 // indirect
- github.com/lib/pq v1.10.2 // indirect
- github.com/libp2p/go-buffer-pool v0.0.2 // indirect
- github.com/magiconair/properties v1.8.5 // indirect
- github.com/mattn/go-isatty v0.0.14 // indirect
- github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
- github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
- github.com/minio/highwayhash v1.0.1 // indirect
- github.com/mitchellh/go-homedir v1.1.0 // indirect
- github.com/mitchellh/mapstructure v1.4.2 // indirect
- github.com/mtibben/percent v0.2.1 // indirect
- github.com/pelletier/go-toml v1.9.4 // indirect
- github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
- github.com/pmezard/go-difflib v1.0.0 // indirect
- github.com/prometheus/client_golang v1.11.0 // indirect
- github.com/prometheus/client_model v0.2.0 // indirect
- github.com/prometheus/common v0.29.0 // indirect
- github.com/prometheus/procfs v0.6.0 // indirect
- github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
- github.com/rs/cors v1.7.0 // indirect
- github.com/rs/zerolog v1.23.0 // indirect
- github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
- github.com/spf13/afero v1.6.0 // indirect
- github.com/spf13/jwalterweatherman v1.1.0 // indirect
- github.com/spf13/pflag v1.0.5 // indirect
- github.com/subosito/gotenv v1.2.0 // indirect
- github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect
- github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
- github.com/tendermint/btcd v0.1.1 // indirect
- github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
- github.com/tendermint/go-amino v0.16.0 // indirect
- github.com/zondax/hid v0.9.0 // indirect
- go.etcd.io/bbolt v1.3.5 // indirect
- golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
- golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
- golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect
- golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
- golang.org/x/text v0.3.6 // indirect
- gopkg.in/ini.v1 v1.63.2 // indirect
- gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
- nhooyr.io/websocket v1.8.6 // indirect
-)
diff --git a/modules/apps/27-interchain-accounts/controller/types/controller.pb.go b/modules/apps/27-interchain-accounts/controller/types/controller.pb.go
new file mode 100644
index 00000000000..3a292e9a77b
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/controller/types/controller.pb.go
@@ -0,0 +1,318 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: ibc/applications/interchain_accounts/controller/v1/controller.proto
+
+package types
+
+import (
+ fmt "fmt"
+ _ "github.com/cosmos/cosmos-sdk/codec/types"
+ _ "github.com/gogo/protobuf/gogoproto"
+ proto "github.com/gogo/protobuf/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable the controller submodule.
+type Params struct {
+ // controller_enabled enables or disables the controller submodule.
+ ControllerEnabled bool `protobuf:"varint,1,opt,name=controller_enabled,json=controllerEnabled,proto3" json:"controller_enabled,omitempty" yaml:"controller_enabled"`
+}
+
+func (m *Params) Reset() { *m = Params{} }
+func (m *Params) String() string { return proto.CompactTextString(m) }
+func (*Params) ProtoMessage() {}
+func (*Params) Descriptor() ([]byte, []int) {
+ return fileDescriptor_177fd0fec5eb3400, []int{0}
+}
+func (m *Params) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Params.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *Params) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Params.Merge(m, src)
+}
+func (m *Params) XXX_Size() int {
+ return m.Size()
+}
+func (m *Params) XXX_DiscardUnknown() {
+ xxx_messageInfo_Params.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Params proto.InternalMessageInfo
+
+func (m *Params) GetControllerEnabled() bool {
+ if m != nil {
+ return m.ControllerEnabled
+ }
+ return false
+}
+
+func init() {
+ proto.RegisterType((*Params)(nil), "ibc.applications.interchain_accounts.controller.v1.Params")
+}
+
+func init() {
+ proto.RegisterFile("ibc/applications/interchain_accounts/controller/v1/controller.proto", fileDescriptor_177fd0fec5eb3400)
+}
+
+var fileDescriptor_177fd0fec5eb3400 = []byte{
+ // 268 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xc3, 0x30,
+ 0x14, 0x45, 0x93, 0xa5, 0x42, 0xd9, 0x88, 0x18, 0x68, 0x25, 0x0c, 0xca, 0xc4, 0x92, 0x3c, 0x35,
+ 0x0c, 0x48, 0x8c, 0x45, 0x6c, 0x0c, 0x15, 0x03, 0x03, 0x4b, 0x65, 0xbb, 0xc6, 0x35, 0x72, 0xfc,
+ 0x22, 0xdb, 0x89, 0x94, 0xbf, 0xe0, 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c, 0x56, 0x5a, 0xb8, 0xc3, 0x76, 0x0e, 0xf2,
+ 0xfb, 0x74, 0x6c, 0x9c, 0x9e, 0x9a, 0xcd, 0x37, 0xa5, 0x70, 0x6c, 0xd6, 0x57, 0xb9, 0xfb, 0x0f,
+ 0x00, 0x00, 0xff, 0xff, 0x0f, 0xf9, 0x46, 0xeb, 0x76, 0x01, 0x00, 0x00,
+}
+
+func (m *Params) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *Params) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.ControllerEnabled {
+ i--
+ if m.ControllerEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintController(dAtA []byte, offset int, v uint64) int {
+ offset -= sovController(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *Params) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ControllerEnabled {
+ n += 2
+ }
+ return n
+}
+
+func sovController(x uint64) (n int) {
+ return (math_bits.Len64(x|1) + 6) / 7
+}
+func sozController(x uint64) (n int) {
+ return sovController(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+}
+func (m *Params) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowController
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: Params: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ControllerEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowController
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.ControllerEnabled = bool(v != 0)
+ default:
+ iNdEx = preIndex
+ skippy, err := skipController(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthController
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func skipController(dAtA []byte) (n int, err error) {
+ l := len(dAtA)
+ iNdEx := 0
+ depth := 0
+ for iNdEx < l {
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowController
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ wireType := int(wire & 0x7)
+ switch wireType {
+ case 0:
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowController
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ iNdEx++
+ if dAtA[iNdEx-1] < 0x80 {
+ break
+ }
+ }
+ case 1:
+ iNdEx += 8
+ case 2:
+ var length int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowController
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ length |= (int(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if length < 0 {
+ return 0, ErrInvalidLengthController
+ }
+ iNdEx += length
+ case 3:
+ depth++
+ case 4:
+ if depth == 0 {
+ return 0, ErrUnexpectedEndOfGroupController
+ }
+ depth--
+ case 5:
+ iNdEx += 4
+ default:
+ return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
+ }
+ if iNdEx < 0 {
+ return 0, ErrInvalidLengthController
+ }
+ if depth == 0 {
+ return iNdEx, nil
+ }
+ }
+ return 0, io.ErrUnexpectedEOF
+}
+
+var (
+ ErrInvalidLengthController = fmt.Errorf("proto: negative length found during unmarshaling")
+ ErrIntOverflowController = fmt.Errorf("proto: integer overflow")
+ ErrUnexpectedEndOfGroupController = fmt.Errorf("proto: unexpected end of group")
+)
diff --git a/modules/apps/27-interchain-accounts/host/types/host.pb.go b/modules/apps/27-interchain-accounts/host/types/host.pb.go
new file mode 100644
index 00000000000..f926909215b
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/host/types/host.pb.go
@@ -0,0 +1,318 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: ibc/applications/interchain_accounts/host/v1/host.proto
+
+package types
+
+import (
+ fmt "fmt"
+ _ "github.com/cosmos/cosmos-sdk/codec/types"
+ _ "github.com/gogo/protobuf/gogoproto"
+ proto "github.com/gogo/protobuf/proto"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable the host submodule.
+type Params struct {
+ // host_enabled enables or disables the host submodule.
+ HostEnabled bool `protobuf:"varint,1,opt,name=host_enabled,json=hostEnabled,proto3" json:"host_enabled,omitempty" yaml:"host_enabled"`
+}
+
+func (m *Params) Reset() { *m = Params{} }
+func (m *Params) String() string { return proto.CompactTextString(m) }
+func (*Params) ProtoMessage() {}
+func (*Params) Descriptor() ([]byte, []int) {
+ return fileDescriptor_48e202774f13d08e, []int{0}
+}
+func (m *Params) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Params.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *Params) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Params.Merge(m, src)
+}
+func (m *Params) XXX_Size() int {
+ return m.Size()
+}
+func (m *Params) XXX_DiscardUnknown() {
+ xxx_messageInfo_Params.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Params proto.InternalMessageInfo
+
+func (m *Params) GetHostEnabled() bool {
+ if m != nil {
+ return m.HostEnabled
+ }
+ return false
+}
+
+func init() {
+ proto.RegisterType((*Params)(nil), "ibc.applications.interchain_accounts.host.v1.Params")
+}
+
+func init() {
+ proto.RegisterFile("ibc/applications/interchain_accounts/host/v1/host.proto", fileDescriptor_48e202774f13d08e)
+}
+
+var fileDescriptor_48e202774f13d08e = []byte{
+ //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 0x8d, 0xde, 0xa4, 0x87, 0xd3, 0xf4, 0xf9, 0x78, 0xb4, 0x0f, 0x93, 0xdb, 0x16, 0xef, 0x3d, 0x89,
+ 0xf7, 0x3d, 0x89, 0xbf, 0x7a, 0x12, 0xbf, 0x0d, 0x24, 0xda, 0x0f, 0x24, 0xfa, 0x18, 0x48, 0xf4,
+ 0xf2, 0x28, 0x95, 0x2f, 0x1b, 0x96, 0x73, 0x34, 0xc0, 0xd1, 0x19, 0x74, 0xa0, 0x18, 0xcf, 0x24,
+ 0x42, 0xbb, 0x02, 0x83, 0x45, 0xa3, 0x85, 0x1b, 0x7b, 0x71, 0xb0, 0x5a, 0x67, 0xbf, 0x97, 0x65,
+ 0x7f, 0x2b, 0xf1, 0x5d, 0x25, 0x1c, 0x9b, 0x85, 0x95, 0xef, 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff,
+ 0x78, 0x3c, 0xa0, 0x19, 0x4c, 0x01, 0x00, 0x00,
+}
+
+func (m *Params) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *Params) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.HostEnabled {
+ i--
+ if m.HostEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintHost(dAtA []byte, offset int, v uint64) int {
+ offset -= sovHost(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *Params) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.HostEnabled {
+ n += 2
+ }
+ return n
+}
+
+func sovHost(x uint64) (n int) {
+ return (math_bits.Len64(x|1) + 6) / 7
+}
+func sozHost(x uint64) (n int) {
+ return sovHost(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+}
+func (m *Params) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowHost
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: Params: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field HostEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowHost
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.HostEnabled = bool(v != 0)
+ default:
+ iNdEx = preIndex
+ skippy, err := skipHost(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthHost
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func skipHost(dAtA []byte) (n int, err error) {
+ l := len(dAtA)
+ iNdEx := 0
+ depth := 0
+ for iNdEx < l {
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowHost
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ wireType := int(wire & 0x7)
+ switch wireType {
+ case 0:
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowHost
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ iNdEx++
+ if dAtA[iNdEx-1] < 0x80 {
+ break
+ }
+ }
+ case 1:
+ iNdEx += 8
+ case 2:
+ var length int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowHost
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ length |= (int(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if length < 0 {
+ return 0, ErrInvalidLengthHost
+ }
+ iNdEx += length
+ case 3:
+ depth++
+ case 4:
+ if depth == 0 {
+ return 0, ErrUnexpectedEndOfGroupHost
+ }
+ depth--
+ case 5:
+ iNdEx += 4
+ default:
+ return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
+ }
+ if iNdEx < 0 {
+ return 0, ErrInvalidLengthHost
+ }
+ if depth == 0 {
+ return iNdEx, nil
+ }
+ }
+ return 0, io.ErrUnexpectedEOF
+}
+
+var (
+ ErrInvalidLengthHost = fmt.Errorf("proto: negative length found during unmarshaling")
+ ErrIntOverflowHost = fmt.Errorf("proto: integer overflow")
+ ErrUnexpectedEndOfGroupHost = fmt.Errorf("proto: unexpected end of group")
+)
diff --git a/modules/apps/27-interchain-accounts/types/types.pb.go b/modules/apps/27-interchain-accounts/types/types.pb.go
index 5196857edfb..7ed9c1b9e7e 100644
--- a/modules/apps/27-interchain-accounts/types/types.pb.go
+++ b/modules/apps/27-interchain-accounts/types/types.pb.go
@@ -159,68 +159,10 @@ func (m *CosmosTx) GetMessages() []*types.Any {
return nil
}
-// Params defines the set of on-chain interchain accounts parameters.
-// The following parameters may be used to disable controller or host
-// submodules.
-type Params struct {
- // controller_enabled enables or disables the controller submodule.
- ControllerEnabled bool `protobuf:"varint,1,opt,name=controller_enabled,json=controllerEnabled,proto3" json:"controller_enabled,omitempty" yaml:"controller_enabled"`
- // host_enabled enables or disables the host submodule.
- HostEnabled bool `protobuf:"varint,2,opt,name=host_enabled,json=hostEnabled,proto3" json:"host_enabled,omitempty" yaml:"host_enabled"`
-}
-
-func (m *Params) Reset() { *m = Params{} }
-func (m *Params) String() string { return proto.CompactTextString(m) }
-func (*Params) ProtoMessage() {}
-func (*Params) Descriptor() ([]byte, []int) {
- return fileDescriptor_39bab93e18d89799, []int{2}
-}
-func (m *Params) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_Params.Marshal(b, m, deterministic)
- } else {
- b = b[:cap(b)]
- n, err := m.MarshalToSizedBuffer(b)
- if err != nil {
- return nil, err
- }
- return b[:n], nil
- }
-}
-func (m *Params) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Params.Merge(m, src)
-}
-func (m *Params) XXX_Size() int {
- return m.Size()
-}
-func (m *Params) XXX_DiscardUnknown() {
- xxx_messageInfo_Params.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Params proto.InternalMessageInfo
-
-func (m *Params) GetControllerEnabled() bool {
- if m != nil {
- return m.ControllerEnabled
- }
- return false
-}
-
-func (m *Params) GetHostEnabled() bool {
- if m != nil {
- return m.HostEnabled
- }
- return false
-}
-
func init() {
proto.RegisterEnum("ibc.applications.interchain_accounts.v1.Type", Type_name, Type_value)
proto.RegisterType((*InterchainAccountPacketData)(nil), "ibc.applications.interchain_accounts.v1.InterchainAccountPacketData")
proto.RegisterType((*CosmosTx)(nil), "ibc.applications.interchain_accounts.v1.CosmosTx")
- proto.RegisterType((*Params)(nil), "ibc.applications.interchain_accounts.v1.Params")
}
func init() {
@@ -228,37 +170,32 @@ func init() {
}
var fileDescriptor_39bab93e18d89799 = []byte{
- // 474 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x6b, 0x13, 0x41,
- 0x14, 0xc7, 0x33, 0x6d, 0x28, 0x71, 0x52, 0xda, 0x38, 0x16, 0x4c, 0x57, 0xdc, 0x2e, 0x2b, 0x62,
- 0x10, 0x32, 0x63, 0xd3, 0x83, 0x50, 0xbc, 0xa4, 0xe9, 0x0a, 0x01, 0x91, 0xb0, 0x6e, 0x21, 0x7a,
- 0x59, 0x66, 0x27, 0xe3, 0x66, 0x71, 0x77, 0x67, 0xd9, 0x99, 0x04, 0xf7, 0x1b, 0x94, 0x9e, 0xc4,
- 0x7b, 0x4f, 0x7e, 0x19, 0x8f, 0x3d, 0x7a, 0x2a, 0x92, 0x7c, 0x83, 0x7e, 0x02, 0xd9, 0x59, 0x4d,
- 0x02, 0x7a, 0xf0, 0xf6, 0xdf, 0xff, 0xbe, 0xff, 0x8f, 0xf7, 0xde, 0x3c, 0x78, 0x12, 0x05, 0x8c,
- 0xd0, 0x2c, 0x8b, 0x23, 0x46, 0x55, 0x24, 0x52, 0x49, 0xa2, 0x54, 0xf1, 0x9c, 0x4d, 0x69, 0x94,
- 0xfa, 0x94, 0x31, 0x31, 0x4b, 0x95, 0x24, 0xf3, 0x63, 0xa2, 0x8a, 0x8c, 0x4b, 0x9c, 0xe5, 0x42,
- 0x09, 0xf4, 0x2c, 0x0a, 0x18, 0xde, 0x0c, 0xe1, 0x7f, 0x84, 0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9c, 0x87,
- 0x77, 0xb7, 0x47, 0x0f, 0x2a, 0xce, 0xe6, 0x5f, 0xdb, 0x6d, 0x96, 0x9f, 0xbf, 0xb3, 0xcf, 0xc7,
- 0xb0, 0x5e, 0x2e, 0x02, 0x3d, 0x85, 0x2d, 0xef, 0xfd, 0xc8, 0xf1, 0x2f, 0xde, 0xbe, 0x1b, 0x39,
- 0x83, 0xe1, 0xeb, 0xa1, 0x73, 0xde, 0xaa, 0x19, 0xfb, 0x57, 0xd7, 0x56, 0x73, 0xc3, 0x42, 0x4f,
- 0xe0, 0xbe, 0x2e, 0x73, 0xc6, 0xce, 0xe0, 0xc2, 0x73, 0x7c, 0x6f, 0xdc, 0x02, 0xc6, 0xde, 0xd5,
- 0xb5, 0x05, 0xd7, 0x8e, 0x51, 0xbf, 0xfc, 0x66, 0xd6, 0xce, 0xfc, 0xef, 0x0b, 0x13, 0xdc, 0x2c,
- 0x4c, 0xf0, 0x73, 0x61, 0x82, 0x2f, 0x4b, 0xb3, 0x76, 0xb3, 0x34, 0x6b, 0x3f, 0x96, 0x66, 0xed,
- 0x83, 0x13, 0x46, 0x6a, 0x3a, 0x0b, 0x30, 0x13, 0x09, 0x61, 0x7a, 0x9f, 0x24, 0x0a, 0x58, 0x37,
- 0x14, 0x64, 0xde, 0x23, 0x89, 0x98, 0xcc, 0x62, 0x2e, 0xcb, 0x03, 0x94, 0xa4, 0xf7, 0xb2, 0xbb,
- 0x7e, 0xbd, 0xee, 0xea, 0xf6, 0xf4, 0xe1, 0x05, 0x3b, 0x7a, 0xcf, 0x27, 0xbf, 0x02, 0x00, 0x00,
- 0xff, 0xff, 0x69, 0x12, 0x34, 0x42, 0xb0, 0x02, 0x00, 0x00,
+ // 391 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x41, 0x8b, 0xd3, 0x40,
+ 0x18, 0xcd, 0xb8, 0x41, 0xd6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1b, 0x00, 0x00, 0xff, 0xff, 0xfa,
+ 0xbe, 0xe0, 0xb6, 0x1b, 0x02, 0x00, 0x00,
}
func (m *InterchainAccountPacketData) Marshal() (dAtA []byte, err error) {
@@ -340,49 +277,6 @@ func (m *CosmosTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
-func (m *Params) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalToSizedBuffer(dAtA[:size])
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *Params) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- if m.HostEnabled {
- i--
- if m.HostEnabled {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
- i--
- dAtA[i] = 0x10
- }
- if m.ControllerEnabled {
- i--
- if m.ControllerEnabled {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
- i--
- dAtA[i] = 0x8
- }
- return len(dAtA) - i, nil
-}
-
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
@@ -429,21 +323,6 @@ func (m *CosmosTx) Size() (n int) {
return n
}
-func (m *Params) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if m.ControllerEnabled {
- n += 2
- }
- if m.HostEnabled {
- n += 2
- }
- return n
-}
-
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -669,96 +548,6 @@ func (m *CosmosTx) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *Params) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowTypes
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: Params: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ControllerEnabled", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowTypes
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- v |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.ControllerEnabled = bool(v != 0)
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field HostEnabled", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowTypes
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- v |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.HostEnabled = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipTypes(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if (skippy < 0) || (iNdEx+skippy) < 0 {
- return ErrInvalidLengthTypes
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto b/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto
new file mode 100644
index 00000000000..79430e89e7e
--- /dev/null
+++ b/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+
+package ibc.applications.interchain_accounts.controller.v1;
+
+option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types";
+
+import "google/protobuf/any.proto";
+import "gogoproto/gogo.proto";
+
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable the controller submodule.
+message Params {
+ // controller_enabled enables or disables the controller submodule.
+ bool controller_enabled = 1 [(gogoproto.moretags) = "yaml:\"controller_enabled\""];
+}
diff --git a/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/proto/ibc/applications/interchain_accounts/host/v1/host.proto
new file mode 100644
index 00000000000..a5301199286
--- /dev/null
+++ b/proto/ibc/applications/interchain_accounts/host/v1/host.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+
+package ibc.applications.interchain_accounts.host.v1;
+
+option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types";
+
+import "google/protobuf/any.proto";
+import "gogoproto/gogo.proto";
+
+// Params defines the set of on-chain interchain accounts parameters.
+// The following parameters may be used to disable the host submodule.
+message Params {
+ // host_enabled enables or disables the host submodule.
+ bool host_enabled = 1 [(gogoproto.moretags) = "yaml:\"host_enabled\""];
+}
diff --git a/proto/ibc/applications/interchain_accounts/v1/types.proto b/proto/ibc/applications/interchain_accounts/v1/types.proto
index 0f3918d0435..43350212934 100644
--- a/proto/ibc/applications/interchain_accounts/v1/types.proto
+++ b/proto/ibc/applications/interchain_accounts/v1/types.proto
@@ -30,12 +30,3 @@ message CosmosTx {
repeated google.protobuf.Any messages = 1;
}
-// Params defines the set of on-chain interchain accounts parameters.
-// The following parameters may be used to disable controller or host
-// submodules.
-message Params {
- // controller_enabled enables or disables the controller submodule.
- bool controller_enabled = 1 [(gogoproto.moretags) = "yaml:\"controller_enabled\""];
- // host_enabled enables or disables the host submodule.
- bool host_enabled = 2 [(gogoproto.moretags) = "yaml:\"host_enabled\""];
-}
From d0c6c0a6bf858aad8b937ad7a8833ee88de06022 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Mon, 29 Nov 2021 11:44:06 +0100
Subject: [PATCH 3/7] split params implementation into host/controller
---
go.mod | 91 +++++++++++++++++++
.../{ => controller}/types/params.go | 20 ++--
.../controller/types/params_test.go | 14 +++
.../host/types/params.go | 59 ++++++++++++
.../{ => host}/types/params_test.go | 4 +-
5 files changed, 173 insertions(+), 15 deletions(-)
rename modules/apps/27-interchain-accounts/{ => controller}/types/params.go (63%)
create mode 100644 modules/apps/27-interchain-accounts/controller/types/params_test.go
create mode 100644 modules/apps/27-interchain-accounts/host/types/params.go
rename modules/apps/27-interchain-accounts/{ => host}/types/params_test.go (77%)
diff --git a/go.mod b/go.mod
index 9f96dbd3b10..274ba00ded6 100644
--- a/go.mod
+++ b/go.mod
@@ -26,3 +26,94 @@ require (
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
)
+
+require (
+ filippo.io/edwards25519 v1.0.0-beta.2 // indirect
+ github.com/99designs/keyring v1.1.6 // indirect
+ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
+ github.com/DataDog/zstd v1.4.5 // indirect
+ github.com/Workiva/go-datastructures v1.0.52 // indirect
+ github.com/beorn7/perks v1.0.1 // indirect
+ github.com/bgentry/speakeasy v0.1.0 // indirect
+ github.com/btcsuite/btcd v0.22.0-beta // indirect
+ github.com/cespare/xxhash v1.1.0 // indirect
+ github.com/cespare/xxhash/v2 v2.1.1 // indirect
+ github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect
+ github.com/cosmos/go-bip39 v1.0.0 // indirect
+ github.com/cosmos/iavl v0.17.1 // indirect
+ github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
+ github.com/cosmos/ledger-go v0.9.2 // indirect
+ github.com/danieljoos/wincred v1.0.2 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
+ github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
+ github.com/dgraph-io/ristretto v0.0.3 // indirect
+ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
+ github.com/dustin/go-humanize v1.0.0 // indirect
+ github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
+ github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 // indirect
+ github.com/felixge/httpsnoop v1.0.1 // indirect
+ github.com/fsnotify/fsnotify v1.5.1 // indirect
+ github.com/go-kit/kit v0.10.0 // indirect
+ github.com/go-logfmt/logfmt v0.5.0 // indirect
+ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
+ github.com/gogo/gateway v1.1.0 // indirect
+ github.com/golang/snappy v0.0.3 // indirect
+ github.com/google/btree v1.0.0 // indirect
+ github.com/google/orderedcode v0.0.1 // indirect
+ github.com/gorilla/handlers v1.5.1 // indirect
+ github.com/gorilla/websocket v1.4.2 // indirect
+ github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
+ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
+ github.com/gtank/merlin v0.1.1 // indirect
+ github.com/gtank/ristretto255 v0.1.2 // indirect
+ github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
+ github.com/improbable-eng/grpc-web v0.14.1 // indirect
+ github.com/inconshreveable/mousetrap v1.0.0 // indirect
+ github.com/jmhodges/levigo v1.0.0 // indirect
+ github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
+ github.com/klauspost/compress v1.11.7 // indirect
+ github.com/lib/pq v1.10.2 // indirect
+ github.com/libp2p/go-buffer-pool v0.0.2 // indirect
+ github.com/magiconair/properties v1.8.5 // indirect
+ github.com/mattn/go-isatty v0.0.14 // indirect
+ github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
+ github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
+ github.com/minio/highwayhash v1.0.1 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/mitchellh/mapstructure v1.4.2 // indirect
+ github.com/mtibben/percent v0.2.1 // indirect
+ github.com/pelletier/go-toml v1.9.4 // indirect
+ github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/prometheus/client_golang v1.11.0 // indirect
+ github.com/prometheus/client_model v0.2.0 // indirect
+ github.com/prometheus/common v0.29.0 // indirect
+ github.com/prometheus/procfs v0.6.0 // indirect
+ github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
+ github.com/rs/cors v1.7.0 // indirect
+ github.com/rs/zerolog v1.23.0 // indirect
+ github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
+ github.com/spf13/afero v1.6.0 // indirect
+ github.com/spf13/jwalterweatherman v1.1.0 // indirect
+ github.com/spf13/pflag v1.0.5 // indirect
+ github.com/subosito/gotenv v1.2.0 // indirect
+ github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect
+ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
+ github.com/tendermint/btcd v0.1.1 // indirect
+ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
+ github.com/tendermint/go-amino v0.16.0 // indirect
+ github.com/zondax/hid v0.9.0 // indirect
+ go.etcd.io/bbolt v1.3.5 // indirect
+ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
+ golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
+ golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect
+ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
+ golang.org/x/text v0.3.6 // indirect
+ gopkg.in/ini.v1 v1.63.2 // indirect
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
+ nhooyr.io/websocket v1.8.6 // indirect
+)
diff --git a/modules/apps/27-interchain-accounts/types/params.go b/modules/apps/27-interchain-accounts/controller/types/params.go
similarity index 63%
rename from modules/apps/27-interchain-accounts/types/params.go
rename to modules/apps/27-interchain-accounts/controller/types/params.go
index 2e8667fa496..aacff9dbd3b 100644
--- a/modules/apps/27-interchain-accounts/types/params.go
+++ b/modules/apps/27-interchain-accounts/controller/types/params.go
@@ -7,17 +7,13 @@ import (
)
const (
- // DefaultControllerEnabled enabled
+ // DefaultControllerEnabled is the default value for the controller param (set to true)
DefaultControllerEnabled = true
- // DefaultHostEnabled enabled
- DefaultHostEnabled = true
)
var (
// KeyControllerEnabled is store's key for ControllerEnabled Params
KeyControllerEnabled = []byte("ControllerEnabled")
- // KeyHostEnabled is store's key for HostEnabled Params
- KeyHostEnabled = []byte("HostEnabled")
)
// ParamKeyTable type declaration for parameters
@@ -25,33 +21,31 @@ func ParamKeyTable() paramtypes.KeyTable {
return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
}
-// NewParams creates a new parameter configuration for the interchain accounts module
-func NewParams(enableController, enableHost bool) Params {
+// NewParams creates a new parameter configuration for the controller submodule
+func NewParams(enableController bool) Params {
return Params{
ControllerEnabled: enableController,
- HostEnabled: enableHost,
}
}
-// DefaultParams is the default parameter configuration for the ibc-transfer module
+// DefaultParams is the default parameter configuration for the controller submodule
func DefaultParams() Params {
- return NewParams(DefaultControllerEnabled, DefaultHostEnabled)
+ return NewParams(DefaultControllerEnabled)
}
-// Validate all ibc-transfer module parameters
+// Validate validates all controller submodule parameters
func (p Params) Validate() error {
if err := validateEnabled(p.ControllerEnabled); err != nil {
return err
}
- return validateEnabled(p.HostEnabled)
+ return nil
}
// ParamSetPairs implements params.ParamSet
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
return paramtypes.ParamSetPairs{
paramtypes.NewParamSetPair(KeyControllerEnabled, p.ControllerEnabled, validateEnabled),
- paramtypes.NewParamSetPair(KeyHostEnabled, p.HostEnabled, validateEnabled),
}
}
diff --git a/modules/apps/27-interchain-accounts/controller/types/params_test.go b/modules/apps/27-interchain-accounts/controller/types/params_test.go
new file mode 100644
index 00000000000..0a25fd213a0
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/controller/types/params_test.go
@@ -0,0 +1,14 @@
+package types_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+)
+
+func TestValidateParams(t *testing.T) {
+ require.NoError(t, types.DefaultParams().Validate())
+ require.NoError(t, types.NewParams(false).Validate())
+}
diff --git a/modules/apps/27-interchain-accounts/host/types/params.go b/modules/apps/27-interchain-accounts/host/types/params.go
new file mode 100644
index 00000000000..c1f15c5ac56
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/host/types/params.go
@@ -0,0 +1,59 @@
+package types
+
+import (
+ "fmt"
+
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+)
+
+const (
+ // DefaultHostEnabled is the default value for the host param (set to true)
+ DefaultHostEnabled = true
+)
+
+var (
+ // KeyHostEnabled is store's key for HostEnabled Params
+ KeyHostEnabled = []byte("HostEnabled")
+)
+
+// ParamKeyTable type declaration for parameters
+func ParamKeyTable() paramtypes.KeyTable {
+ return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
+}
+
+// NewParams creates a new parameter configuration for the host submodule
+func NewParams(enableHost bool) Params {
+ return Params{
+ HostEnabled: enableHost,
+ }
+}
+
+// DefaultParams is the default parameter configuration for the host submodule
+func DefaultParams() Params {
+ return NewParams(DefaultHostEnabled)
+}
+
+// Validate validates all host submodule parameters
+func (p Params) Validate() error {
+ if err := validateEnabled(p.HostEnabled); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+// ParamSetPairs implements params.ParamSet
+func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
+ return paramtypes.ParamSetPairs{
+ paramtypes.NewParamSetPair(KeyHostEnabled, p.HostEnabled, validateEnabled),
+ }
+}
+
+func validateEnabled(i interface{}) error {
+ _, ok := i.(bool)
+ if !ok {
+ return fmt.Errorf("invalid parameter type: %T", i)
+ }
+
+ return nil
+}
diff --git a/modules/apps/27-interchain-accounts/types/params_test.go b/modules/apps/27-interchain-accounts/host/types/params_test.go
similarity index 77%
rename from modules/apps/27-interchain-accounts/types/params_test.go
rename to modules/apps/27-interchain-accounts/host/types/params_test.go
index ceb28f9f0f2..b8a0d418bc2 100644
--- a/modules/apps/27-interchain-accounts/types/params_test.go
+++ b/modules/apps/27-interchain-accounts/host/types/params_test.go
@@ -5,10 +5,10 @@ import (
"github.com/stretchr/testify/require"
- "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
)
func TestValidateParams(t *testing.T) {
require.NoError(t, types.DefaultParams().Validate())
- require.NoError(t, types.NewParams(true, false).Validate())
+ require.NoError(t, types.NewParams(false).Validate())
}
From d43a945cee66d2d6fde88f085c4a430264d13649 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Mon, 29 Nov 2021 12:45:25 +0100
Subject: [PATCH 4/7] add keeper params logic
---
docs/ibc/proto-docs.md | 2 +
.../controller/keeper/genesis.go | 3 +
.../controller/keeper/genesis_test.go | 17 +-
.../controller/keeper/keeper.go | 62 +++---
.../controller/keeper/params.go | 24 +++
.../controller/keeper/params_test.go | 15 ++
.../host/keeper/genesis.go | 3 +
.../host/keeper/keeper.go | 68 ++++---
.../host/keeper/params.go | 24 +++
.../host/keeper/params_test.go | 15 ++
.../27-interchain-accounts/types/genesis.go | 18 +-
.../types/genesis.pb.go | 183 ++++++++++++++----
.../interchain_accounts/v1/genesis.proto | 4 +
testing/simapp/app.go | 6 +-
14 files changed, 344 insertions(+), 100 deletions(-)
create mode 100644 modules/apps/27-interchain-accounts/controller/keeper/params.go
create mode 100644 modules/apps/27-interchain-accounts/controller/keeper/params_test.go
create mode 100644 modules/apps/27-interchain-accounts/host/keeper/params.go
create mode 100644 modules/apps/27-interchain-accounts/host/keeper/params_test.go
diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md
index da269933b46..c1eaa081667 100644
--- a/docs/ibc/proto-docs.md
+++ b/docs/ibc/proto-docs.md
@@ -336,6 +336,7 @@ ControllerGenesisState defines the interchain accounts controller genesis state
| `active_channels` | [ActiveChannel](#ibc.applications.interchain_accounts.v1.ActiveChannel) | repeated | |
| `interchain_accounts` | [RegisteredInterchainAccount](#ibc.applications.interchain_accounts.v1.RegisteredInterchainAccount) | repeated | |
| `ports` | [string](#string) | repeated | |
+| `params` | [ibc.applications.interchain_accounts.controller.v1.Params](#ibc.applications.interchain_accounts.controller.v1.Params) | | |
@@ -369,6 +370,7 @@ HostGenesisState defines the interchain accounts host genesis state
| `active_channels` | [ActiveChannel](#ibc.applications.interchain_accounts.v1.ActiveChannel) | repeated | |
| `interchain_accounts` | [RegisteredInterchainAccount](#ibc.applications.interchain_accounts.v1.RegisteredInterchainAccount) | repeated | |
| `port` | [string](#string) | | |
+| `params` | [ibc.applications.interchain_accounts.host.v1.Params](#ibc.applications.interchain_accounts.host.v1.Params) | | |
diff --git a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go
index 101acdea21e..c1e96f14658 100644
--- a/modules/apps/27-interchain-accounts/controller/keeper/genesis.go
+++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis.go
@@ -27,6 +27,8 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, state types.ControllerGenesisSt
for _, acc := range state.InterchainAccounts {
keeper.SetInterchainAccountAddress(ctx, acc.PortId, acc.AccountAddress)
}
+
+ keeper.SetParams(ctx, state.Params)
}
// ExportGenesis returns the interchain accounts controller exported genesis
@@ -35,5 +37,6 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) types.ControllerGenesisState
keeper.GetAllActiveChannels(ctx),
keeper.GetAllInterchainAccounts(ctx),
keeper.GetAllPorts(ctx),
+ keeper.GetParams(ctx),
)
}
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 5f0880eb94b..488d39d982b 100644
--- a/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go
+++ b/modules/apps/27-interchain-accounts/controller/keeper/genesis_test.go
@@ -2,21 +2,22 @@ package keeper_test
import (
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/keeper"
- "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+ icatypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v2/testing"
)
func (suite *KeeperTestSuite) TestInitGenesis() {
suite.SetupTest()
- genesisState := types.ControllerGenesisState{
- ActiveChannels: []types.ActiveChannel{
+ genesisState := icatypes.ControllerGenesisState{
+ ActiveChannels: []icatypes.ActiveChannel{
{
PortId: TestPortID,
ChannelId: ibctesting.FirstChannelID,
},
},
- InterchainAccounts: []types.RegisteredInterchainAccount{
+ InterchainAccounts: []icatypes.RegisteredInterchainAccount{
{
PortId: TestPortID,
AccountAddress: TestAccAddress.String(),
@@ -34,6 +35,11 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
accountAdrr, found := suite.chainA.GetSimApp().ICAControllerKeeper.GetInterchainAccountAddress(suite.chainA.GetContext(), TestPortID)
suite.Require().True(found)
suite.Require().Equal(TestAccAddress.String(), accountAdrr)
+
+ expParams := types.NewParams(false)
+ params := suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
+
}
func (suite *KeeperTestSuite) TestExportGenesis() {
@@ -54,4 +60,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
suite.Require().Equal(path.EndpointA.ChannelConfig.PortID, genesisState.InterchainAccounts[0].PortId)
suite.Require().Equal([]string{TestPortID}, genesisState.GetPorts())
+
+ expParams := types.DefaultParams()
+ suite.Require().Equal(expParams, genesisState.GetParams())
}
diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go
index 1fed7445a7a..91705ae89e1 100644
--- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go
+++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go
@@ -9,21 +9,24 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"
- "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+ icatypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
)
// Keeper defines the IBC interchain accounts controller keeper
type Keeper struct {
- storeKey sdk.StoreKey
- cdc codec.BinaryCodec
+ storeKey sdk.StoreKey
+ cdc codec.BinaryCodec
+ paramSpace paramtypes.Subspace
- ics4Wrapper types.ICS4Wrapper
- channelKeeper types.ChannelKeeper
- portKeeper types.PortKeeper
- accountKeeper types.AccountKeeper
+ ics4Wrapper icatypes.ICS4Wrapper
+ channelKeeper icatypes.ChannelKeeper
+ portKeeper icatypes.PortKeeper
+ accountKeeper icatypes.AccountKeeper
scopedKeeper capabilitykeeper.ScopedKeeper
@@ -32,13 +35,20 @@ type Keeper struct {
// NewKeeper creates a new interchain accounts controller Keeper instance
func NewKeeper(
- cdc codec.BinaryCodec, key sdk.StoreKey,
- ics4Wrapper types.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
- accountKeeper types.AccountKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
+ cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
+ ics4Wrapper icatypes.ICS4Wrapper, channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
+ accountKeeper icatypes.AccountKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
) Keeper {
+
+ // set KeyTable if it has not already been set
+ if !paramSpace.HasKeyTable() {
+ paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
+ }
+
return Keeper{
storeKey: key,
cdc: cdc,
+ paramSpace: paramSpace,
ics4Wrapper: ics4Wrapper,
channelKeeper: channelKeeper,
portKeeper: portKeeper,
@@ -50,13 +60,13 @@ func NewKeeper(
// Logger returns the application logger, scoped to the associated module
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
- return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, types.ModuleName))
+ return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, icatypes.ModuleName))
}
// GetAllPorts returns all ports to which the interchain accounts controller module is bound. Used in ExportGenesis
func (k Keeper) GetAllPorts(ctx sdk.Context) []string {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, []byte(types.PortKeyPrefix))
+ iterator := sdk.KVStorePrefixIterator(store, []byte(icatypes.PortKeyPrefix))
defer iterator.Close()
var ports []string
@@ -72,7 +82,7 @@ func (k Keeper) GetAllPorts(ctx sdk.Context) []string {
// BindPort stores the provided portID and binds to it, returning the associated capability
func (k Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyPort(portID), []byte{0x01})
+ store.Set(icatypes.KeyPort(portID), []byte{0x01})
return k.portKeeper.BindPort(ctx, portID)
}
@@ -96,7 +106,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability
// GetActiveChannelID retrieves the active channelID from the store keyed by the provided portID
func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) {
store := ctx.KVStore(k.storeKey)
- key := types.KeyActiveChannel(portID)
+ key := icatypes.KeyActiveChannel(portID)
if !store.Has(key) {
return "", false
@@ -106,16 +116,16 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool
}
// GetAllActiveChannels returns a list of all active interchain accounts controller channels and their associated port identifiers
-func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []types.ActiveChannel {
+func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []icatypes.ActiveChannel {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, []byte(types.ActiveChannelKeyPrefix))
+ iterator := sdk.KVStorePrefixIterator(store, []byte(icatypes.ActiveChannelKeyPrefix))
defer iterator.Close()
- var activeChannels []types.ActiveChannel
+ var activeChannels []icatypes.ActiveChannel
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")
- ch := types.ActiveChannel{
+ ch := icatypes.ActiveChannel{
PortId: keySplit[1],
ChannelId: string(iterator.Value()),
}
@@ -129,13 +139,13 @@ func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []types.ActiveChannel {
// SetActiveChannelID stores the active channelID, keyed by the provided portID
func (k Keeper) SetActiveChannelID(ctx sdk.Context, portID, channelID string) {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyActiveChannel(portID), []byte(channelID))
+ store.Set(icatypes.KeyActiveChannel(portID), []byte(channelID))
}
// DeleteActiveChannelID removes the active channel keyed by the provided portID stored in state
func (k Keeper) DeleteActiveChannelID(ctx sdk.Context, portID string) {
store := ctx.KVStore(k.storeKey)
- store.Delete(types.KeyActiveChannel(portID))
+ store.Delete(icatypes.KeyActiveChannel(portID))
}
// IsActiveChannel returns true if there exists an active channel for the provided portID, otherwise false
@@ -147,7 +157,7 @@ func (k Keeper) IsActiveChannel(ctx sdk.Context, portID string) bool {
// GetInterchainAccountAddress retrieves the InterchainAccount address from the store keyed by the provided portID
func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, portID string) (string, bool) {
store := ctx.KVStore(k.storeKey)
- key := types.KeyOwnerAccount(portID)
+ key := icatypes.KeyOwnerAccount(portID)
if !store.Has(key) {
return "", false
@@ -157,15 +167,15 @@ func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, portID string) (str
}
// GetAllInterchainAccounts returns a list of all registered interchain account addresses and their associated controller port identifiers
-func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []types.RegisteredInterchainAccount {
+func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredInterchainAccount {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, []byte(types.OwnerKeyPrefix))
+ iterator := sdk.KVStorePrefixIterator(store, []byte(icatypes.OwnerKeyPrefix))
- var interchainAccounts []types.RegisteredInterchainAccount
+ var interchainAccounts []icatypes.RegisteredInterchainAccount
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")
- acc := types.RegisteredInterchainAccount{
+ acc := icatypes.RegisteredInterchainAccount{
PortId: keySplit[1],
AccountAddress: string(iterator.Value()),
}
@@ -179,5 +189,5 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []types.RegisteredInte
// SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated portID
func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, portID string, address string) {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyOwnerAccount(portID), []byte(address))
+ store.Set(icatypes.KeyOwnerAccount(portID), []byte(address))
}
diff --git a/modules/apps/27-interchain-accounts/controller/keeper/params.go b/modules/apps/27-interchain-accounts/controller/keeper/params.go
new file mode 100644
index 00000000000..5169d51e6a9
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/controller/keeper/params.go
@@ -0,0 +1,24 @@
+package keeper
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+)
+
+// GetControllerEnabled retrieves the host enabled boolean from the paramstore
+func (k Keeper) GetControllerEnabled(ctx sdk.Context) bool {
+ var res bool
+ k.paramSpace.Get(ctx, types.KeyControllerEnabled, &res)
+ return res
+}
+
+// GetParams returns the total set of the host submodule parameters.
+func (k Keeper) GetParams(ctx sdk.Context) types.Params {
+ return types.NewParams(k.GetControllerEnabled(ctx))
+}
+
+// SetParams sets the total set of the host submodule parameters.
+func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
+ k.paramSpace.SetParamSet(ctx, ¶ms)
+}
diff --git a/modules/apps/27-interchain-accounts/controller/keeper/params_test.go b/modules/apps/27-interchain-accounts/controller/keeper/params_test.go
new file mode 100644
index 00000000000..27138d42de5
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/controller/keeper/params_test.go
@@ -0,0 +1,15 @@
+package keeper_test
+
+import "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+
+func (suite *KeeperTestSuite) TestParams() {
+ expParams := types.DefaultParams()
+
+ params := suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
+
+ expParams.ControllerEnabled = false
+ suite.chainA.GetSimApp().ICAControllerKeeper.SetParams(suite.chainA.GetContext(), expParams)
+ params = suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
+}
diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis.go b/modules/apps/27-interchain-accounts/host/keeper/genesis.go
index 4a8584102f5..bbfff4b8ebc 100644
--- a/modules/apps/27-interchain-accounts/host/keeper/genesis.go
+++ b/modules/apps/27-interchain-accounts/host/keeper/genesis.go
@@ -25,6 +25,8 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, state types.HostGenesisState) {
for _, acc := range state.InterchainAccounts {
keeper.SetInterchainAccountAddress(ctx, acc.PortId, acc.AccountAddress)
}
+
+ keeper.SetParams(ctx, state.Params)
}
// ExportGenesis returns the interchain accounts host exported genesis
@@ -33,5 +35,6 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) types.HostGenesisState {
keeper.GetAllActiveChannels(ctx),
keeper.GetAllInterchainAccounts(ctx),
types.PortID,
+ keeper.GetParams(ctx),
)
}
diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go
index 44735ae81ea..c4d9261651b 100644
--- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go
+++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go
@@ -10,21 +10,24 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/tendermint/tendermint/libs/log"
- "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
+ icatypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v2/modules/core/24-host"
)
// Keeper defines the IBC interchain accounts host keeper
type Keeper struct {
- storeKey sdk.StoreKey
- cdc codec.BinaryCodec
+ storeKey sdk.StoreKey
+ cdc codec.BinaryCodec
+ paramSpace paramtypes.Subspace
- channelKeeper types.ChannelKeeper
- portKeeper types.PortKeeper
- accountKeeper types.AccountKeeper
+ channelKeeper icatypes.ChannelKeeper
+ portKeeper icatypes.PortKeeper
+ accountKeeper icatypes.AccountKeeper
scopedKeeper capabilitykeeper.ScopedKeeper
@@ -33,18 +36,25 @@ type Keeper struct {
// NewKeeper creates a new interchain accounts host Keeper instance
func NewKeeper(
- cdc codec.BinaryCodec, key sdk.StoreKey, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
- accountKeeper types.AccountKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
+ cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
+ channelKeeper icatypes.ChannelKeeper, portKeeper icatypes.PortKeeper,
+ accountKeeper icatypes.AccountKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, msgRouter *baseapp.MsgServiceRouter,
) Keeper {
// ensure ibc interchain accounts module account is set
- if addr := accountKeeper.GetModuleAddress(types.ModuleName); addr == nil {
+ if addr := accountKeeper.GetModuleAddress(icatypes.ModuleName); addr == nil {
panic("the Interchain Accounts module account has not been set")
}
+ // set KeyTable if it has not already been set
+ if !paramSpace.HasKeyTable() {
+ paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
+ }
+
return Keeper{
storeKey: key,
cdc: cdc,
+ paramSpace: paramSpace,
channelKeeper: channelKeeper,
portKeeper: portKeeper,
accountKeeper: accountKeeper,
@@ -55,13 +65,13 @@ func NewKeeper(
// Logger returns the application logger, scoped to the associated module
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
- return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, types.ModuleName))
+ return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", host.ModuleName, icatypes.ModuleName))
}
// BindPort stores the provided portID and binds to it, returning the associated capability
func (k Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyPort(portID), []byte{0x01})
+ store.Set(icatypes.KeyPort(portID), []byte{0x01})
return k.portKeeper.BindPort(ctx, portID)
}
@@ -85,7 +95,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability
// GetActiveChannelID retrieves the active channelID from the store keyed by the provided portID
func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) {
store := ctx.KVStore(k.storeKey)
- key := types.KeyActiveChannel(portID)
+ key := icatypes.KeyActiveChannel(portID)
if !store.Has(key) {
return "", false
@@ -95,16 +105,16 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool
}
// GetAllActiveChannels returns a list of all active interchain accounts host channels and their associated port identifiers
-func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []types.ActiveChannel {
+func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []icatypes.ActiveChannel {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, []byte(types.ActiveChannelKeyPrefix))
+ iterator := sdk.KVStorePrefixIterator(store, []byte(icatypes.ActiveChannelKeyPrefix))
defer iterator.Close()
- var activeChannels []types.ActiveChannel
+ var activeChannels []icatypes.ActiveChannel
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")
- ch := types.ActiveChannel{
+ ch := icatypes.ActiveChannel{
PortId: keySplit[1],
ChannelId: string(iterator.Value()),
}
@@ -118,13 +128,13 @@ func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []types.ActiveChannel {
// SetActiveChannelID stores the active channelID, keyed by the provided portID
func (k Keeper) SetActiveChannelID(ctx sdk.Context, portID, channelID string) {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyActiveChannel(portID), []byte(channelID))
+ store.Set(icatypes.KeyActiveChannel(portID), []byte(channelID))
}
// DeleteActiveChannelID removes the active channel keyed by the provided portID stored in state
func (k Keeper) DeleteActiveChannelID(ctx sdk.Context, portID string) {
store := ctx.KVStore(k.storeKey)
- store.Delete(types.KeyActiveChannel(portID))
+ store.Delete(icatypes.KeyActiveChannel(portID))
}
// IsActiveChannel returns true if there exists an active channel for the provided portID, otherwise false
@@ -136,7 +146,7 @@ func (k Keeper) IsActiveChannel(ctx sdk.Context, portID string) bool {
// GetInterchainAccountAddress retrieves the InterchainAccount address from the store keyed by the provided portID
func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, portID string) (string, bool) {
store := ctx.KVStore(k.storeKey)
- key := types.KeyOwnerAccount(portID)
+ key := icatypes.KeyOwnerAccount(portID)
if !store.Has(key) {
return "", false
@@ -146,15 +156,15 @@ func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, portID string) (str
}
// GetAllInterchainAccounts returns a list of all registered interchain account addresses and their associated controller port identifiers
-func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []types.RegisteredInterchainAccount {
+func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredInterchainAccount {
store := ctx.KVStore(k.storeKey)
- iterator := sdk.KVStorePrefixIterator(store, []byte(types.OwnerKeyPrefix))
+ iterator := sdk.KVStorePrefixIterator(store, []byte(icatypes.OwnerKeyPrefix))
- var interchainAccounts []types.RegisteredInterchainAccount
+ var interchainAccounts []icatypes.RegisteredInterchainAccount
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")
- acc := types.RegisteredInterchainAccount{
+ acc := icatypes.RegisteredInterchainAccount{
PortId: keySplit[1],
AccountAddress: string(iterator.Value()),
}
@@ -168,7 +178,7 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []types.RegisteredInte
// SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated portID
func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, portID string, address string) {
store := ctx.KVStore(k.storeKey)
- store.Set(types.KeyOwnerAccount(portID), []byte(address))
+ store.Set(icatypes.KeyOwnerAccount(portID), []byte(address))
}
// NegotiateAppVersion handles application version negotation for the IBC interchain accounts module
@@ -180,12 +190,12 @@ func (k Keeper) NegotiateAppVersion(
counterparty channeltypes.Counterparty,
proposedVersion string,
) (string, error) {
- if proposedVersion != types.VersionPrefix {
- return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "failed to negotiate app version: expected %s, got %s", types.VersionPrefix, proposedVersion)
+ if proposedVersion != icatypes.VersionPrefix {
+ return "", sdkerrors.Wrapf(icatypes.ErrInvalidVersion, "failed to negotiate app version: expected %s, got %s", icatypes.VersionPrefix, proposedVersion)
}
- moduleAccAddr := k.accountKeeper.GetModuleAddress(types.ModuleName)
- accAddr := types.GenerateAddress(moduleAccAddr, counterparty.PortId)
+ moduleAccAddr := k.accountKeeper.GetModuleAddress(icatypes.ModuleName)
+ accAddr := icatypes.GenerateAddress(moduleAccAddr, counterparty.PortId)
- return types.NewAppVersion(types.VersionPrefix, accAddr.String()), nil
+ return icatypes.NewAppVersion(icatypes.VersionPrefix, accAddr.String()), nil
}
diff --git a/modules/apps/27-interchain-accounts/host/keeper/params.go b/modules/apps/27-interchain-accounts/host/keeper/params.go
new file mode 100644
index 00000000000..c5198283b53
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/host/keeper/params.go
@@ -0,0 +1,24 @@
+package keeper
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
+)
+
+// GetHostEnabled retrieves the host enabled boolean from the paramstore
+func (k Keeper) GetHostEnabled(ctx sdk.Context) bool {
+ var res bool
+ k.paramSpace.Get(ctx, types.KeyHostEnabled, &res)
+ return res
+}
+
+// GetParams returns the total set of the host submodule parameters.
+func (k Keeper) GetParams(ctx sdk.Context) types.Params {
+ return types.NewParams(k.GetHostEnabled(ctx))
+}
+
+// SetParams sets the total set of the host submodule parameters.
+func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
+ k.paramSpace.SetParamSet(ctx, ¶ms)
+}
diff --git a/modules/apps/27-interchain-accounts/host/keeper/params_test.go b/modules/apps/27-interchain-accounts/host/keeper/params_test.go
new file mode 100644
index 00000000000..9f8e53068ae
--- /dev/null
+++ b/modules/apps/27-interchain-accounts/host/keeper/params_test.go
@@ -0,0 +1,15 @@
+package keeper_test
+
+import "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
+
+func (suite *KeeperTestSuite) TestParams() {
+ expParams := types.DefaultParams()
+
+ params := suite.chainA.GetSimApp().ICAHostKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
+
+ expParams.HostEnabled = false
+ suite.chainA.GetSimApp().ICAHostKeeper.SetParams(suite.chainA.GetContext(), expParams)
+ params = suite.chainA.GetSimApp().ICAHostKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
+}
diff --git a/modules/apps/27-interchain-accounts/types/genesis.go b/modules/apps/27-interchain-accounts/types/genesis.go
index 9fbf9489dc1..6923e7527a7 100644
--- a/modules/apps/27-interchain-accounts/types/genesis.go
+++ b/modules/apps/27-interchain-accounts/types/genesis.go
@@ -1,5 +1,10 @@
package types
+import (
+ controllertypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+ hosttypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
+)
+
// DefaultGenesis creates and returns the interchain accounts GenesisState
func DefaultGenesis() *GenesisState {
return &GenesisState{
@@ -18,30 +23,35 @@ func NewGenesisState(controllerGenesisState ControllerGenesisState, hostGenesisS
// DefaultControllerGenesis creates and returns the default interchain accounts ControllerGenesisState
func DefaultControllerGenesis() ControllerGenesisState {
- return ControllerGenesisState{}
+ return ControllerGenesisState{
+ Params: controllertypes.DefaultParams(),
+ }
}
// NewControllerGenesisState creates a returns a new ControllerGenesisState instance
-func NewControllerGenesisState(channels []ActiveChannel, accounts []RegisteredInterchainAccount, ports []string) ControllerGenesisState {
+func NewControllerGenesisState(channels []ActiveChannel, accounts []RegisteredInterchainAccount, ports []string, controllerParams controllertypes.Params) ControllerGenesisState {
return ControllerGenesisState{
ActiveChannels: channels,
InterchainAccounts: accounts,
Ports: ports,
+ Params: controllerParams,
}
}
// DefaultHostGenesis creates and returns the default interchain accounts HostGenesisState
func DefaultHostGenesis() HostGenesisState {
return HostGenesisState{
- Port: PortID,
+ Port: PortID,
+ Params: hosttypes.DefaultParams(),
}
}
// NewHostGenesisState creates a returns a new HostGenesisState instance
-func NewHostGenesisState(channels []ActiveChannel, accounts []RegisteredInterchainAccount, port string) HostGenesisState {
+func NewHostGenesisState(channels []ActiveChannel, accounts []RegisteredInterchainAccount, port string, hostParams hosttypes.Params) HostGenesisState {
return HostGenesisState{
ActiveChannels: channels,
InterchainAccounts: accounts,
Port: port,
+ Params: hostParams,
}
}
diff --git a/modules/apps/27-interchain-accounts/types/genesis.pb.go b/modules/apps/27-interchain-accounts/types/genesis.pb.go
index 261826239bf..5a226263fb8 100644
--- a/modules/apps/27-interchain-accounts/types/genesis.pb.go
+++ b/modules/apps/27-interchain-accounts/types/genesis.pb.go
@@ -5,6 +5,8 @@ package types
import (
fmt "fmt"
+ types "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/controller/types"
+ types1 "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
@@ -81,6 +83,7 @@ type ControllerGenesisState struct {
ActiveChannels []ActiveChannel `protobuf:"bytes,1,rep,name=active_channels,json=activeChannels,proto3" json:"active_channels" yaml:"active_channels"`
InterchainAccounts []RegisteredInterchainAccount `protobuf:"bytes,2,rep,name=interchain_accounts,json=interchainAccounts,proto3" json:"interchain_accounts" yaml:"interchain_accounts"`
Ports []string `protobuf:"bytes,3,rep,name=ports,proto3" json:"ports,omitempty"`
+ Params types.Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params"`
}
func (m *ControllerGenesisState) Reset() { *m = ControllerGenesisState{} }
@@ -137,11 +140,19 @@ func (m *ControllerGenesisState) GetPorts() []string {
return nil
}
+func (m *ControllerGenesisState) GetParams() types.Params {
+ if m != nil {
+ return m.Params
+ }
+ return types.Params{}
+}
+
// HostGenesisState defines the interchain accounts host genesis state
type HostGenesisState struct {
ActiveChannels []ActiveChannel `protobuf:"bytes,1,rep,name=active_channels,json=activeChannels,proto3" json:"active_channels" yaml:"active_channels"`
InterchainAccounts []RegisteredInterchainAccount `protobuf:"bytes,2,rep,name=interchain_accounts,json=interchainAccounts,proto3" json:"interchain_accounts" yaml:"interchain_accounts"`
Port string `protobuf:"bytes,3,opt,name=port,proto3" json:"port,omitempty"`
+ Params types1.Params `protobuf:"bytes,4,opt,name=params,proto3" json:"params"`
}
func (m *HostGenesisState) Reset() { *m = HostGenesisState{} }
@@ -198,6 +209,13 @@ func (m *HostGenesisState) GetPort() string {
return ""
}
+func (m *HostGenesisState) GetParams() types1.Params {
+ if m != nil {
+ return m.Params
+ }
+ return types1.Params{}
+}
+
// ActiveChannel contains a pairing of port ID and channel ID for an active interchain accounts channel
type ActiveChannel struct {
PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"`
@@ -317,41 +335,46 @@ func init() {
}
var fileDescriptor_629b3ced0911516b = []byte{
- // 543 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x94, 0xcf, 0x8f, 0x12, 0x31,
- 0x14, 0xc7, 0xe9, 0xa0, 0x6b, 0xe8, 0xea, 0xba, 0xd6, 0x75, 0x33, 0x62, 0x32, 0x60, 0x2f, 0x4b,
- 0x62, 0x98, 0x66, 0xf1, 0x57, 0xf4, 0x62, 0x00, 0x8d, 0x72, 0x1d, 0x6f, 0x5e, 0x26, 0xa5, 0xd3,
- 0x0c, 0x4d, 0x86, 0x29, 0x99, 0x16, 0x92, 0x3d, 0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 0x66, 0x83, 0x5f, 0x9e, 0xa5, 0x54, 0xf4, 0xd7,
+ 0xf5, 0xc8, 0x7f, 0xf2, 0x27, 0x00, 0x00, 0xff, 0xff, 0x61, 0x4a, 0xb3, 0xe7, 0xe8, 0x06, 0x00,
+ 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -417,6 +440,16 @@ func (m *ControllerGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
_ = i
var l int
_ = l
+ {
+ size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x22
if len(m.Ports) > 0 {
for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Ports[iNdEx])
@@ -477,6 +510,16 @@ func (m *HostGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ {
+ size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintGenesis(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x22
if len(m.Port) > 0 {
i -= len(m.Port)
copy(dAtA[i:], m.Port)
@@ -637,6 +680,8 @@ func (m *ControllerGenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
+ l = m.Params.Size()
+ n += 1 + l + sovGenesis(uint64(l))
return n
}
@@ -662,6 +707,8 @@ func (m *HostGenesisState) Size() (n int) {
if l > 0 {
n += 1 + l + sovGenesis(uint64(l))
}
+ l = m.Params.Size()
+ n += 1 + l + sovGenesis(uint64(l))
return n
}
@@ -950,6 +997,39 @@ func (m *ControllerGenesisState) Unmarshal(dAtA []byte) error {
}
m.Ports = append(m.Ports, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
@@ -1100,6 +1180,39 @@ func (m *HostGenesisState) Unmarshal(dAtA []byte) error {
}
m.Port = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenesis
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenesis
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenesis(dAtA[iNdEx:])
diff --git a/proto/ibc/applications/interchain_accounts/v1/genesis.proto b/proto/ibc/applications/interchain_accounts/v1/genesis.proto
index 69527bd867a..7fc5cd846bd 100644
--- a/proto/ibc/applications/interchain_accounts/v1/genesis.proto
+++ b/proto/ibc/applications/interchain_accounts/v1/genesis.proto
@@ -5,6 +5,8 @@ package ibc.applications.interchain_accounts.v1;
option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types";
import "gogoproto/gogo.proto";
+import "ibc/applications/interchain_accounts/controller/v1/controller.proto";
+import "ibc/applications/interchain_accounts/host/v1/host.proto";
// GenesisState defines the interchain accounts genesis state
message GenesisState {
@@ -21,6 +23,7 @@ message ControllerGenesisState {
repeated RegisteredInterchainAccount interchain_accounts = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""];
repeated string ports = 3;
+ ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false];
}
// HostGenesisState defines the interchain accounts host genesis state
@@ -30,6 +33,7 @@ message HostGenesisState {
repeated RegisteredInterchainAccount interchain_accounts = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""];
string port = 3;
+ ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false];
}
// ActiveChannel contains a pairing of port ID and channel ID for an active interchain accounts channel
diff --git a/testing/simapp/app.go b/testing/simapp/app.go
index 1955558be31..18aba3e1ec6 100644
--- a/testing/simapp/app.go
+++ b/testing/simapp/app.go
@@ -353,14 +353,14 @@ func NewSimApp(
mockIBCModule := ibcmock.NewIBCModule(&ibcmock.MockIBCApp{}, scopedIBCMockKeeper)
app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
- appCodec, keys[icacontrollertypes.StoreKey],
+ appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.ModuleName),
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, scopedICAControllerKeeper, app.MsgServiceRouter(),
)
app.ICAHostKeeper = icahostkeeper.NewKeeper(
- appCodec, keys[icahosttypes.StoreKey],
+ appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.ModuleName),
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(),
)
@@ -708,6 +708,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
+ paramsKeeper.Subspace(icacontrollertypes.ModuleName)
+ paramsKeeper.Subspace(icahosttypes.ModuleName)
return paramsKeeper
}
From ff79bd9910495b1c5a7ddef3901a75fb0faf060a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?colin=20axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Tue, 30 Nov 2021 12:19:11 +0100
Subject: [PATCH 5/7] Apply suggestions from code review
Co-authored-by: Damian Nolan
---
modules/apps/27-interchain-accounts/controller/types/params.go | 2 +-
modules/apps/27-interchain-accounts/host/types/params.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/apps/27-interchain-accounts/controller/types/params.go b/modules/apps/27-interchain-accounts/controller/types/params.go
index aacff9dbd3b..eb9c413bec0 100644
--- a/modules/apps/27-interchain-accounts/controller/types/params.go
+++ b/modules/apps/27-interchain-accounts/controller/types/params.go
@@ -12,7 +12,7 @@ const (
)
var (
- // KeyControllerEnabled is store's key for ControllerEnabled Params
+ // KeyControllerEnabled is the store key for ControllerEnabled Params
KeyControllerEnabled = []byte("ControllerEnabled")
)
diff --git a/modules/apps/27-interchain-accounts/host/types/params.go b/modules/apps/27-interchain-accounts/host/types/params.go
index c1f15c5ac56..589de75fc23 100644
--- a/modules/apps/27-interchain-accounts/host/types/params.go
+++ b/modules/apps/27-interchain-accounts/host/types/params.go
@@ -12,7 +12,7 @@ const (
)
var (
- // KeyHostEnabled is store's key for HostEnabled Params
+ // KeyHostEnabled is the store key for HostEnabled Params
KeyHostEnabled = []byte("HostEnabled")
)
From df27451cad1de1ff4a4214c0f19ac84655801944 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Tue, 30 Nov 2021 16:48:01 +0100
Subject: [PATCH 6/7] add host genesis init/export params test case
---
.../host/keeper/genesis_test.go | 20 +++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
index 41cdcf5b671..7dba9ea121a 100644
--- a/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
+++ b/modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
@@ -2,27 +2,28 @@ package keeper_test
import (
"github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/keeper"
- "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
+ "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/host/types"
+ icatypes "github.com/cosmos/ibc-go/v2/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v2/testing"
)
func (suite *KeeperTestSuite) TestInitGenesis() {
suite.SetupTest()
- genesisState := types.HostGenesisState{
- ActiveChannels: []types.ActiveChannel{
+ genesisState := icatypes.HostGenesisState{
+ ActiveChannels: []icatypes.ActiveChannel{
{
PortId: TestPortID,
ChannelId: ibctesting.FirstChannelID,
},
},
- InterchainAccounts: []types.RegisteredInterchainAccount{
+ InterchainAccounts: []icatypes.RegisteredInterchainAccount{
{
PortId: TestPortID,
AccountAddress: TestAccAddress.String(),
},
},
- Port: types.PortID,
+ Port: icatypes.PortID,
}
keeper.InitGenesis(suite.chainA.GetContext(), suite.chainA.GetSimApp().ICAHostKeeper, genesisState)
@@ -34,6 +35,10 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
accountAdrr, found := suite.chainA.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainA.GetContext(), TestPortID)
suite.Require().True(found)
suite.Require().Equal(TestAccAddress.String(), accountAdrr)
+
+ expParams := types.NewParams(false)
+ params := suite.chainA.GetSimApp().ICAHostKeeper.GetParams(suite.chainA.GetContext())
+ suite.Require().Equal(expParams, params)
}
func (suite *KeeperTestSuite) TestExportGenesis() {
@@ -53,5 +58,8 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
suite.Require().Equal(TestAccAddress.String(), genesisState.InterchainAccounts[0].AccountAddress)
suite.Require().Equal(path.EndpointA.ChannelConfig.PortID, genesisState.InterchainAccounts[0].PortId)
- suite.Require().Equal(types.PortID, genesisState.GetPort())
+ suite.Require().Equal(icatypes.PortID, genesisState.GetPort())
+
+ expParams := types.DefaultParams()
+ suite.Require().Equal(expParams, genesisState.GetParams())
}
From b807529e3593909120493e6e76e6e2e5fb1eb99e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Colin=20Axn=C3=A9r?=
<25233464+colin-axner@users.noreply.github.com>
Date: Wed, 1 Dec 2021 10:39:19 +0100
Subject: [PATCH 7/7] add genesis validation for controller and host params
---
modules/apps/27-interchain-accounts/types/genesis.go | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules/apps/27-interchain-accounts/types/genesis.go b/modules/apps/27-interchain-accounts/types/genesis.go
index 3832681577e..97a906cf5f5 100644
--- a/modules/apps/27-interchain-accounts/types/genesis.go
+++ b/modules/apps/27-interchain-accounts/types/genesis.go
@@ -80,6 +80,10 @@ func (gs ControllerGenesisState) Validate() error {
}
}
+ if err := gs.Params.Validate(); err != nil {
+ return err
+ }
+
return nil
}
@@ -127,5 +131,9 @@ func (gs HostGenesisState) Validate() error {
return err
}
+ if err := gs.Params.Validate(); err != nil {
+ return err
+ }
+
return nil
}