diff --git a/CHANGELOG.md b/CHANGELOG.md index efb56d7cab..5b5cb1f54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#1462](https://github.com/regen-network/regen-ledger/pull/1462) Bridge operations must now specify a target/source that exists in the `AllowedBridgeChain` table. - [#1476](https://github.com/regen-network/regen-ledger/pull/1476) `DefaultParams` function has been removed. - [#1476](https://github.com/regen-network/regen-ledger/pull/1476) Remove `params` argument from `ValidateGenesis`. +- [#1543](https://github.com/regen-network/regen-ledger/pull/1543) Remove `paramsKeeper` argument from `base/Keeper`, `basket/Keeper` and `marketplace/Keeper`. #### Added diff --git a/api/regen/ecocredit/v1/tx_grpc.pb.go b/api/regen/ecocredit/v1/tx_grpc.pb.go index 255bde6f29..dea12c9beb 100644 --- a/api/regen/ecocredit/v1/tx_grpc.pb.go +++ b/api/regen/ecocredit/v1/tx_grpc.pb.go @@ -119,7 +119,7 @@ type MsgClient interface { // Since Revision 1 AddClassCreator(ctx context.Context, in *MsgAddClassCreator, opts ...grpc.CallOption) (*MsgAddClassCreatorResponse, error) // RemoveClassCreator is a governance method that removes - // address from the creation allowlist. + // address from the class creation allowlist. // // Since Revision 1 RemoveClassCreator(ctx context.Context, in *MsgRemoveClassCreator, opts ...grpc.CallOption) (*MsgRemoveClassCreatorResponse, error) @@ -448,7 +448,7 @@ type MsgServer interface { // Since Revision 1 AddClassCreator(context.Context, *MsgAddClassCreator) (*MsgAddClassCreatorResponse, error) // RemoveClassCreator is a governance method that removes - // address from the creation allowlist. + // address from the class creation allowlist. // // Since Revision 1 RemoveClassCreator(context.Context, *MsgRemoveClassCreator) (*MsgRemoveClassCreatorResponse, error) diff --git a/proto/regen/ecocredit/v1/tx.proto b/proto/regen/ecocredit/v1/tx.proto index 458a764e22..bc4d41af18 100644 --- a/proto/regen/ecocredit/v1/tx.proto +++ b/proto/regen/ecocredit/v1/tx.proto @@ -136,7 +136,7 @@ service Msg { rpc AddClassCreator(MsgAddClassCreator) returns (MsgAddClassCreatorResponse); // RemoveClassCreator is a governance method that removes - // address from the creation allowlist. + // address from the class creation allowlist. // // Since Revision 1 rpc RemoveClassCreator(MsgRemoveClassCreator) diff --git a/x/ecocredit/base/types/v1/tx.pb.go b/x/ecocredit/base/types/v1/tx.pb.go index adc901790b..09662387d6 100644 --- a/x/ecocredit/base/types/v1/tx.pb.go +++ b/x/ecocredit/base/types/v1/tx.pb.go @@ -2968,7 +2968,7 @@ type MsgClient interface { // Since Revision 1 AddClassCreator(ctx context.Context, in *MsgAddClassCreator, opts ...grpc.CallOption) (*MsgAddClassCreatorResponse, error) // RemoveClassCreator is a governance method that removes - // address from the creation allowlist. + // address from the class creation allowlist. // // Since Revision 1 RemoveClassCreator(ctx context.Context, in *MsgRemoveClassCreator, opts ...grpc.CallOption) (*MsgRemoveClassCreatorResponse, error) @@ -3295,7 +3295,7 @@ type MsgServer interface { // Since Revision 1 AddClassCreator(context.Context, *MsgAddClassCreator) (*MsgAddClassCreatorResponse, error) // RemoveClassCreator is a governance method that removes - // address from the creation allowlist. + // address from the class creation allowlist. // // Since Revision 1 RemoveClassCreator(context.Context, *MsgRemoveClassCreator) (*MsgRemoveClassCreatorResponse, error) diff --git a/x/ecocredit/basket/keeper/keeper.go b/x/ecocredit/basket/keeper/keeper.go index c0d5e1a124..dfe3f58162 100644 --- a/x/ecocredit/basket/keeper/keeper.go +++ b/x/ecocredit/basket/keeper/keeper.go @@ -19,7 +19,6 @@ type Keeper struct { stateStore api.StateStore baseStore baseapi.StateStore bankKeeper ecocredit.BankKeeper - paramsKeeper ecocredit.ParamKeeper moduleAddress sdk.AccAddress authority sdk.AccAddress } @@ -29,7 +28,6 @@ func NewKeeper( ss api.StateStore, cs baseapi.StateStore, bk ecocredit.BankKeeper, - pk ecocredit.ParamKeeper, ma sdk.AccAddress, authority sdk.AccAddress, ) Keeper { @@ -37,7 +35,6 @@ func NewKeeper( stateStore: ss, baseStore: cs, bankKeeper: bk, - paramsKeeper: pk, moduleAddress: ma, authority: authority, } diff --git a/x/ecocredit/basket/keeper/keeper_test.go b/x/ecocredit/basket/keeper/keeper_test.go index 8962749e62..936d22fccb 100644 --- a/x/ecocredit/basket/keeper/keeper_test.go +++ b/x/ecocredit/basket/keeper/keeper_test.go @@ -32,18 +32,17 @@ const ( ) type baseSuite struct { - t gocuke.TestingT - db ormdb.ModuleDB - ctx context.Context - k Keeper - ctrl *gomock.Controller - addrs []sdk.AccAddress - stateStore api.StateStore - baseStore baseapi.StateStore - bankKeeper *mocks.MockBankKeeper - paramsKeeper *mocks.MockParamKeeper - storeKey *storetypes.KVStoreKey - sdkCtx sdk.Context + t gocuke.TestingT + db ormdb.ModuleDB + ctx context.Context + k Keeper + ctrl *gomock.Controller + addrs []sdk.AccAddress + stateStore api.StateStore + baseStore baseapi.StateStore + bankKeeper *mocks.MockBankKeeper + storeKey *storetypes.KVStoreKey + sdkCtx sdk.Context } func setupBase(t gocuke.TestingT) *baseSuite { @@ -70,13 +69,12 @@ func setupBase(t gocuke.TestingT) *baseSuite { s.ctrl = gomock.NewController(t) assert.NilError(t, err) s.bankKeeper = mocks.NewMockBankKeeper(s.ctrl) - s.paramsKeeper = mocks.NewMockParamKeeper(s.ctrl) _, _, moduleAddress := testdata.KeyTestPubAddr() authority, err := sdk.AccAddressFromBech32("regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68") assert.NilError(t, err) - s.k = NewKeeper(s.stateStore, s.baseStore, s.bankKeeper, s.paramsKeeper, moduleAddress, authority) + s.k = NewKeeper(s.stateStore, s.baseStore, s.bankKeeper, moduleAddress, authority) s.baseStore, err = baseapi.NewStateStore(s.db) assert.NilError(t, err) diff --git a/x/ecocredit/expected_keepers.go b/x/ecocredit/expected_keepers.go index fd19b4a9f5..3c6c48bdc0 100644 --- a/x/ecocredit/expected_keepers.go +++ b/x/ecocredit/expected_keepers.go @@ -5,7 +5,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/cosmos-sdk/x/params/types" ) //go:generate mockgen -source=expected_keepers.go -package mocks -destination mocks/expected_keepers.go @@ -43,13 +42,3 @@ type GovKeeper interface { // GetDepositParams queries governance module deposit params GetDepositParams(ctx sdk.Context) govv1.DepositParams } - -type ParamKeeper interface { - - // Get fetches a parameter by key from the Subspace's KVStore and sets the provided pointer to the fetched value. - // If the value does not exist, this method will panic. - Get(ctx sdk.Context, key []byte, ptr interface{}) - - // GetParamSet fetches each parameter in the ParamSet. - GetParamSet(ctx sdk.Context, ps types.ParamSet) -} diff --git a/x/ecocredit/marketplace/keeper/keeper.go b/x/ecocredit/marketplace/keeper/keeper.go index bcbf89a260..67742ce667 100644 --- a/x/ecocredit/marketplace/keeper/keeper.go +++ b/x/ecocredit/marketplace/keeper/keeper.go @@ -15,20 +15,18 @@ var ( ) type Keeper struct { - stateStore marketapi.StateStore - baseStore baseapi.StateStore - bankKeeper ecocredit.BankKeeper - paramsKeeper ecocredit.ParamKeeper - authority sdk.AccAddress + stateStore marketapi.StateStore + baseStore baseapi.StateStore + bankKeeper ecocredit.BankKeeper + authority sdk.AccAddress } func NewKeeper(ss marketapi.StateStore, cs baseapi.StateStore, bk ecocredit.BankKeeper, - params ecocredit.ParamKeeper, authority sdk.AccAddress) Keeper { + authority sdk.AccAddress) Keeper { return Keeper{ - baseStore: cs, - stateStore: ss, - bankKeeper: bk, - paramsKeeper: params, - authority: authority, + baseStore: cs, + stateStore: ss, + bankKeeper: bk, + authority: authority, } } diff --git a/x/ecocredit/marketplace/keeper/keeper_test.go b/x/ecocredit/marketplace/keeper/keeper_test.go index 9e756fab1f..d772a159bc 100644 --- a/x/ecocredit/marketplace/keeper/keeper_test.go +++ b/x/ecocredit/marketplace/keeper/keeper_test.go @@ -36,18 +36,17 @@ const ( ) type baseSuite struct { - t gocuke.TestingT - db ormdb.ModuleDB - baseStore baseapi.StateStore - marketStore api.StateStore - ctx context.Context - k Keeper - ctrl *gomock.Controller - addrs []sdk.AccAddress - bankKeeper *mocks.MockBankKeeper - paramsKeeper *mocks.MockParamKeeper - storeKey *storetypes.KVStoreKey - sdkCtx sdk.Context + t gocuke.TestingT + db ormdb.ModuleDB + baseStore baseapi.StateStore + marketStore api.StateStore + ctx context.Context + k Keeper + ctrl *gomock.Controller + addrs []sdk.AccAddress + bankKeeper *mocks.MockBankKeeper + storeKey *storetypes.KVStoreKey + sdkCtx sdk.Context } func setupBase(t gocuke.TestingT, numAddresses int) *baseSuite { @@ -74,11 +73,10 @@ func setupBase(t gocuke.TestingT, numAddresses int) *baseSuite { s.ctrl = gomock.NewController(t) assert.NilError(t, err) s.bankKeeper = mocks.NewMockBankKeeper(s.ctrl) - s.paramsKeeper = mocks.NewMockParamKeeper(s.ctrl) authority, err := sdk.AccAddressFromBech32("regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68") assert.NilError(s.t, err) - s.k = NewKeeper(s.marketStore, s.baseStore, s.bankKeeper, s.paramsKeeper, authority) + s.k = NewKeeper(s.marketStore, s.baseStore, s.bankKeeper, authority) // set test accounts for i := 0; i < numAddresses; i++ { diff --git a/x/ecocredit/mocks/expected_keepers.go b/x/ecocredit/mocks/expected_keepers.go index f3996bbd02..e46f6eecc8 100644 --- a/x/ecocredit/mocks/expected_keepers.go +++ b/x/ecocredit/mocks/expected_keepers.go @@ -7,12 +7,11 @@ package mocks import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" - types "github.com/cosmos/cosmos-sdk/types" types0 "github.com/cosmos/cosmos-sdk/x/auth/types" types1 "github.com/cosmos/cosmos-sdk/x/bank/types" - types2 "github.com/cosmos/cosmos-sdk/x/params/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + gomock "github.com/golang/mock/gomock" ) // MockAccountKeeper is a mock of AccountKeeper interface. @@ -239,49 +238,39 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } -// MockParamKeeper is a mock of ParamKeeper interface. -type MockParamKeeper struct { +// MockGovKeeper is a mock of GovKeeper interface. +type MockGovKeeper struct { ctrl *gomock.Controller - recorder *MockParamKeeperMockRecorder + recorder *MockGovKeeperMockRecorder } -// MockParamKeeperMockRecorder is the mock recorder for MockParamKeeper. -type MockParamKeeperMockRecorder struct { - mock *MockParamKeeper +// MockGovKeeperMockRecorder is the mock recorder for MockGovKeeper. +type MockGovKeeperMockRecorder struct { + mock *MockGovKeeper } -// NewMockParamKeeper creates a new mock instance. -func NewMockParamKeeper(ctrl *gomock.Controller) *MockParamKeeper { - mock := &MockParamKeeper{ctrl: ctrl} - mock.recorder = &MockParamKeeperMockRecorder{mock} +// NewMockGovKeeper creates a new mock instance. +func NewMockGovKeeper(ctrl *gomock.Controller) *MockGovKeeper { + mock := &MockGovKeeper{ctrl: ctrl} + mock.recorder = &MockGovKeeperMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockParamKeeper) EXPECT() *MockParamKeeperMockRecorder { +func (m *MockGovKeeper) EXPECT() *MockGovKeeperMockRecorder { return m.recorder } -// Get mocks base method. -func (m *MockParamKeeper) Get(ctx types.Context, key []byte, ptr interface{}) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Get", ctx, key, ptr) -} - -// Get indicates an expected call of Get. -func (mr *MockParamKeeperMockRecorder) Get(ctx, key, ptr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockParamKeeper)(nil).Get), ctx, key, ptr) -} - -// GetParamSet mocks base method. -func (m *MockParamKeeper) GetParamSet(ctx types.Context, ps types2.ParamSet) { +// GetDepositParams mocks base method. +func (m *MockGovKeeper) GetDepositParams(ctx types.Context) v1.DepositParams { m.ctrl.T.Helper() - m.ctrl.Call(m, "GetParamSet", ctx, ps) + ret := m.ctrl.Call(m, "GetDepositParams", ctx) + ret0, _ := ret[0].(v1.DepositParams) + return ret0 } -// GetParamSet indicates an expected call of GetParamSet. -func (mr *MockParamKeeperMockRecorder) GetParamSet(ctx, ps interface{}) *gomock.Call { +// GetDepositParams indicates an expected call of GetDepositParams. +func (mr *MockGovKeeperMockRecorder) GetDepositParams(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetParamSet", reflect.TypeOf((*MockParamKeeper)(nil).GetParamSet), ctx, ps) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDepositParams", reflect.TypeOf((*MockGovKeeper)(nil).GetDepositParams), ctx) } diff --git a/x/ecocredit/module/module.go b/x/ecocredit/module/module.go index b217b8389f..6a878cde88 100644 --- a/x/ecocredit/module/module.go +++ b/x/ecocredit/module/module.go @@ -120,7 +120,7 @@ func (m Module) RegisterInterfaces(registry types.InterfaceRegistry) { // RegisterServices implements AppModule/RegisterServices. func (m *Module) RegisterServices(cfg module.Configurator) { - svr := server.NewServer(m.key, m.legacySubspace, m.accountKeeper, m.bankKeeper, m.authority) + svr := server.NewServer(m.key, m.accountKeeper, m.bankKeeper, m.authority) basetypes.RegisterMsgServer(cfg.MsgServer(), svr.BaseKeeper) basetypes.RegisterQueryServer(cfg.QueryServer(), svr.BaseKeeper) diff --git a/x/ecocredit/server/server.go b/x/ecocredit/server/server.go index 40855c0f8d..48376e6f47 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/orm/model/ormdb" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" basketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1" marketapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" @@ -23,9 +22,8 @@ import ( ) type serverImpl struct { - legacySubspace paramtypes.Subspace - bankKeeper ecocredit.BankKeeper - accountKeeper ecocredit.AccountKeeper + bankKeeper ecocredit.BankKeeper + accountKeeper ecocredit.AccountKeeper BaseKeeper basekeeper.Keeper BasketKeeper basketkeeper.Keeper @@ -38,12 +36,11 @@ type serverImpl struct { } //nolint:revive -func NewServer(storeKey storetypes.StoreKey, legacySubspace paramtypes.Subspace, +func NewServer(storeKey storetypes.StoreKey, accountKeeper ecocredit.AccountKeeper, bankKeeper ecocredit.BankKeeper, authority sdk.AccAddress) serverImpl { s := serverImpl{ - legacySubspace: legacySubspace, - bankKeeper: bankKeeper, - accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + accountKeeper: accountKeeper, } // ensure ecocredit module account is set @@ -69,8 +66,8 @@ func NewServer(storeKey storetypes.StoreKey, legacySubspace paramtypes.Subspace, s.basketStore = basketStore s.marketplaceStore = marketStore s.BaseKeeper = basekeeper.NewKeeper(baseStore, bankKeeper, baseAddr, basketStore, marketStore, authority) - s.BasketKeeper = basketkeeper.NewKeeper(basketStore, baseStore, bankKeeper, s.legacySubspace, basketAddr, authority) - s.MarketplaceKeeper = marketkeeper.NewKeeper(marketStore, baseStore, bankKeeper, s.legacySubspace, authority) + s.BasketKeeper = basketkeeper.NewKeeper(basketStore, baseStore, bankKeeper, basketAddr, authority) + s.MarketplaceKeeper = marketkeeper.NewKeeper(marketStore, baseStore, bankKeeper, authority) return s }