Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit 2a7d578

Browse files
authored
Puneet/removelscosmos (#516)
* remove msg service. * deprecate all queries and msgs * add deprecation warnings * add deprecation warnings
1 parent ce5fdfd commit 2a7d578

File tree

14 files changed

+760
-1079
lines changed

14 files changed

+760
-1079
lines changed

proto/pstake/lscosmos/v1beta1/governance_proposal.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ option (gogoproto.goproto_getters_all) = false;
1515
message MinDepositAndFeeChangeProposal {
1616
option (gogoproto.equal) = false;
1717
option (gogoproto.goproto_stringer) = false;
18+
option deprecated = true;
1819

1920
string title = 1;
2021
string description = 2;
@@ -48,6 +49,7 @@ message MinDepositAndFeeChangeProposal {
4849
message PstakeFeeAddressChangeProposal {
4950
option (gogoproto.equal) = false;
5051
option (gogoproto.goproto_stringer) = false;
52+
option deprecated = true;
5153

5254
string title = 1;
5355
string description = 2;
@@ -58,6 +60,7 @@ message PstakeFeeAddressChangeProposal {
5860
message AllowListedValidatorSetChangeProposal {
5961
option (gogoproto.equal) = false;
6062
option (gogoproto.goproto_stringer) = false;
63+
option deprecated = true;
6164

6265
string title = 1;
6366
string description = 2;

proto/pstake/lscosmos/v1beta1/msgs.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ option go_package = "github.com/persistenceOne/pstake-native/v2/x/lscosmos/types
1313

1414
// Msg defines the lsCosmos services.
1515
service Msg {
16+
option deprecated = true;
17+
1618
rpc LiquidStake(MsgLiquidStake) returns (MsgLiquidStakeResponse) {
1719
option (google.api.http).post = "/pstake/lscosmos/v1beta1/LiquidStake";
1820
}

proto/pstake/lscosmos/v1beta1/query.proto

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "gogoproto/gogo.proto";
55
import "google/api/annotations.proto";
66
import "cosmos/base/query/v1beta1/pagination.proto";
77
import "pstake/lscosmos/v1beta1/params.proto";
8+
import "pstake/lscosmos/v1beta1/genesis.proto";
89
import "pstake/lscosmos/v1beta1/governance_proposal.proto";
910
import "pstake/lscosmos/v1beta1/lscosmos.proto";
1011
import "cosmos/base/v1beta1/coin.proto";
@@ -15,10 +16,15 @@ option go_package = "github.com/persistenceOne/pstake-native/v2/x/lscosmos/types
1516

1617
// Query defines the gRPC querier service.
1718
service Query {
19+
option deprecated = true;
1820
// Parameters queries the parameters of the module.
1921
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
2022
option (google.api.http).get = "/pstake/lscosmos/v1beta1/params";
2123
}
24+
// AllState returns all state of module, aka, genesis export.
25+
rpc AllState(QueryAllStateRequest) returns (QueryAllStateResponse) {
26+
option (google.api.http).get = "/pstake/lscosmos/v1beta1/all_state";
27+
}
2228

2329
rpc HostChainParams(QueryHostChainParamsRequest)
2430
returns (QueryHostChainParamsResponse) {
@@ -82,7 +88,7 @@ service Query {
8288
rpc DelegatorUnbondingEpochEntry(QueryDelegatorUnbondingEpochEntryRequest)
8389
returns (QueryDelegatorUnbondingEpochEntryResponse) {
8490
option (google.api.http).get =
85-
"/pstake/lscosmos/v1beta1/delegator_unbonding_epoch_entry/"
91+
"/pstake/lscosmos/v1beta1/delegator_unbonding_epoch_entry/"
8692
"{delegator_address}/{epoch_number}";
8793
}
8894

@@ -101,7 +107,7 @@ service Query {
101107
QueryAllDelegatorUnbondingEpochEntriesRequest)
102108
returns (QueryAllDelegatorUnbondingEpochEntriesResponse) {
103109
option (google.api.http).get =
104-
"/pstake/lscosmos/v1beta1/delegator_unbonding_epoch_entries/"
110+
"/pstake/lscosmos/v1beta1/delegator_unbonding_epoch_entries/"
105111
"{delegator_address}";
106112
}
107113
}
@@ -112,7 +118,17 @@ message QueryParamsRequest {}
112118
// QueryParamsResponse is response type for the Query/Params RPC method.
113119
message QueryParamsResponse {
114120
// params holds all the parameters of this module.
115-
Params params = 1 [ (gogoproto.nullable) = false ];
121+
Params params = 1 [(gogoproto.nullable) = false];
122+
}
123+
124+
125+
// QueryAllStateRequest is request type for the Query/AllState RPC method.
126+
message QueryAllStateRequest {}
127+
128+
// QueryAllStateResponse is response type for the Query/AllState RPC method.
129+
message QueryAllStateResponse {
130+
// params holds all the parameters of this module.
131+
GenesisState genesis = 1 [(gogoproto.nullable) = false];
116132
}
117133

118134
// QueryHostChainParamsRequest is request for the Ouery/HostChainParams methods.
@@ -121,7 +137,7 @@ message QueryHostChainParamsRequest {}
121137
// QueryHostChainParamsResponse is response for the Ouery/HostChainParams
122138
// methods.
123139
message QueryHostChainParamsResponse {
124-
HostChainParams host_chain_params = 1 [ (gogoproto.nullable) = false ];
140+
HostChainParams host_chain_params = 1 [(gogoproto.nullable) = false];
125141
}
126142

127143
// QueryDelegationStateRequest is request for the Ouery/DelegationState methods.
@@ -130,7 +146,7 @@ message QueryDelegationStateRequest {}
130146
// QueryDelegationStateResponse is response for the Ouery/DelegationState
131147
// methods.
132148
message QueryDelegationStateResponse {
133-
DelegationState delegation_state = 1 [ (gogoproto.nullable) = false ];
149+
DelegationState delegation_state = 1 [(gogoproto.nullable) = false];
134150
}
135151

136152
// QueryListedValidatorsRequest is a request for the Query/AllowListedValidators
@@ -141,7 +157,7 @@ message QueryAllowListedValidatorsRequest {}
141157
// Query/AllowListedValidators methods.
142158
message QueryAllowListedValidatorsResponse {
143159
AllowListedValidators allow_listed_validators = 1
144-
[ (gogoproto.nullable) = false ];
160+
[(gogoproto.nullable) = false];
145161
}
146162

147163
// QueryCValueRequest is a request for the Query/CValue methods.
@@ -159,7 +175,7 @@ message QueryCValueResponse {
159175
message QueryModuleStateRequest {}
160176

161177
// QueryModuleStateRequest is a response for the Query/ModuleState methods.
162-
message QueryModuleStateResponse { bool module_state = 1; }
178+
message QueryModuleStateResponse {bool module_state = 1;}
163179

164180
// QueryIBCTransientStoreRequest is a request for the Query/IBCTransientStore
165181
// methods.
@@ -169,58 +185,58 @@ message QueryIBCTransientStoreRequest {}
169185
// methods.
170186
message QueryIBCTransientStoreResponse {
171187
IBCAmountTransientStore i_b_c_transient_store = 1
172-
[ (gogoproto.nullable) = false ];
188+
[(gogoproto.nullable) = false];
173189
}
174190

175191
// QueryUnclaimedRequest is a request for the Query/Unclaimed methods.
176-
message QueryUnclaimedRequest { string delegator_address = 1; }
192+
message QueryUnclaimedRequest {string delegator_address = 1;}
177193
// QueryUnclaimedResponse is a response for the Query/Unclaimed methods.
178194
message QueryUnclaimedResponse {
179-
repeated UnbondingEpochCValue unclaimed = 1 [ (gogoproto.nullable) = false ];
195+
repeated UnbondingEpochCValue unclaimed = 1 [(gogoproto.nullable) = false];
180196
}
181197

182198
// QueryFailedUnbondingsRequest is a request for the Query/FailedUnbondings
183199
// methods.
184-
message QueryFailedUnbondingsRequest { string delegator_address = 1; }
200+
message QueryFailedUnbondingsRequest {string delegator_address = 1;}
185201

186202
// QueryFailedUnbondingsResponse a response for the Query/FailedUnbondings
187203
// methods.
188204
message QueryFailedUnbondingsResponse {
189205
repeated UnbondingEpochCValue failed_unbondings = 1
190-
[ (gogoproto.nullable) = false ];
206+
[(gogoproto.nullable) = false];
191207
}
192208

193209
// QueryPendingUnbondingsRequest is a request for the Query/PendingUnbondings
194210
// methods.
195-
message QueryPendingUnbondingsRequest { string delegator_address = 1; }
211+
message QueryPendingUnbondingsRequest {string delegator_address = 1;}
196212

197213
// QueryPendingUnbondingsResponse is a response for the Query/PendingUnbondings
198214
// methods.
199215
message QueryPendingUnbondingsResponse {
200216
repeated UnbondingEpochCValue pending_unbondings = 1
201-
[ (gogoproto.nullable) = false ];
217+
[(gogoproto.nullable) = false];
202218
}
203219

204220
// QueryUnbondingEpochCValueRequest is a request for the
205221
// Query/UnbondingEpochCValue methods.
206-
message QueryUnbondingEpochCValueRequest { int64 epoch_number = 1; }
222+
message QueryUnbondingEpochCValueRequest {int64 epoch_number = 1;}
207223

208224
// QueryUnbondingEpochCValueResponse is a response for the
209225
// Query/UnbondingEpochCValue methods.
210226
message QueryUnbondingEpochCValueResponse {
211227
UnbondingEpochCValue unbonding_epoch_c_value = 1
212-
[ (gogoproto.nullable) = false ];
228+
[(gogoproto.nullable) = false];
213229
}
214230

215231
// QueryHostAccountUndelegationRequest is a request for the
216232
// Query/HostAccountUndelegation methods.
217-
message QueryHostAccountUndelegationRequest { int64 epoch_number = 1; }
233+
message QueryHostAccountUndelegationRequest {int64 epoch_number = 1;}
218234

219235
// QueryHostAccountUndelegationResponse is a response for the
220236
// Query/HostAccountUndelegation methods.
221237
message QueryHostAccountUndelegationResponse {
222238
HostAccountUndelegation host_account_undelegation = 1
223-
[ (gogoproto.nullable) = false ];
239+
[(gogoproto.nullable) = false];
224240
}
225241

226242
// QueryDelegatorUnbondingEpochEntryRequest is a request for the
@@ -234,15 +250,15 @@ message QueryDelegatorUnbondingEpochEntryRequest {
234250
// Query/DelegatorUnbondingEpochEntry methods.
235251
message QueryDelegatorUnbondingEpochEntryResponse {
236252
DelegatorUnbondingEpochEntry delegator_unboding_epoch_entry = 1
237-
[ (gogoproto.nullable) = false ];
253+
[(gogoproto.nullable) = false];
238254
}
239255

240256
// QueryHostAccountsRequest is a request for the Query/HostAccounts methods.
241257
message QueryHostAccountsRequest {}
242258

243259
// QueryHostAccountsResponse is a response for the Query/HostAccounts methods.
244260
message QueryHostAccountsResponse {
245-
HostAccounts host_accounts = 1 [ (gogoproto.nullable) = false ];
261+
HostAccounts host_accounts = 1 [(gogoproto.nullable) = false];
246262
}
247263

248264
// QueryDepositModuleAccountRequest is a request for the
@@ -252,7 +268,7 @@ message QueryDepositModuleAccountRequest {}
252268
// QueryDepositModuleAccountResponse is a response for the
253269
// Query/DepositModuleAccount methods.
254270
message QueryDepositModuleAccountResponse {
255-
cosmos.base.v1beta1.Coin balance = 1 [ (gogoproto.nullable) = false ];
271+
cosmos.base.v1beta1.Coin balance = 1 [(gogoproto.nullable) = false];
256272
}
257273

258274
// QueryAllDelegatorUnbondingEpochEntriesRequest is a request for the
@@ -265,5 +281,5 @@ message QueryAllDelegatorUnbondingEpochEntriesRequest {
265281
// Query/DelegatorUnbondingEpochEntries methods.
266282
message QueryAllDelegatorUnbondingEpochEntriesResponse {
267283
repeated DelegatorUnbondingEpochEntry delegator_unbonding_epoch_entries = 1
268-
[ (gogoproto.nullable) = false ];
284+
[(gogoproto.nullable) = false];
269285
}

x/lscosmos/genesis.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
4242

4343
// ExportGenesis returns the capability module's exported genesis.
4444
func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
45-
genesis := types.DefaultGenesis()
46-
genesis.Params = k.GetParams(ctx)
47-
48-
genesis.ModuleEnabled = k.GetModuleState(ctx)
49-
genesis.HostChainParams = k.GetHostChainParams(ctx)
50-
genesis.AllowListedValidators = k.GetAllowListedValidators(ctx)
51-
genesis.DelegationState = k.GetDelegationState(ctx)
52-
genesis.HostChainRewardAddress = k.GetHostChainRewardAddress(ctx)
53-
genesis.IBCAmountTransientStore = k.GetIBCTransientStore(ctx)
54-
genesis.UnbondingEpochCValues = k.IterateAllUnbondingEpochCValues(ctx)
55-
genesis.DelegatorUnbondingEpochEntries = k.IterateAllDelegatorUnbondingEpochEntry(ctx)
56-
genesis.HostAccounts = k.GetHostAccounts(ctx)
57-
5845
// this line is used by starport scaffolding # genesis/module/export
59-
60-
return genesis
46+
return k.GetGenesisState(ctx)
6147
}

x/lscosmos/keeper/genesis.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package keeper
2+
3+
import (
4+
sdk "github.com/cosmos/cosmos-sdk/types"
5+
"github.com/persistenceOne/pstake-native/v2/x/lscosmos/types"
6+
)
7+
8+
func (k Keeper) GetGenesisState(ctx sdk.Context) *types.GenesisState {
9+
genesis := types.DefaultGenesis()
10+
genesis.Params = k.GetParams(ctx)
11+
12+
genesis.ModuleEnabled = k.GetModuleState(ctx)
13+
genesis.HostChainParams = k.GetHostChainParams(ctx)
14+
genesis.AllowListedValidators = k.GetAllowListedValidators(ctx)
15+
genesis.DelegationState = k.GetDelegationState(ctx)
16+
genesis.HostChainRewardAddress = k.GetHostChainRewardAddress(ctx)
17+
genesis.IBCAmountTransientStore = k.GetIBCTransientStore(ctx)
18+
genesis.UnbondingEpochCValues = k.IterateAllUnbondingEpochCValues(ctx)
19+
genesis.DelegatorUnbondingEpochEntries = k.IterateAllDelegatorUnbondingEpochEntry(ctx)
20+
genesis.HostAccounts = k.GetHostAccounts(ctx)
21+
return genesis
22+
}
Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,21 @@
11
package keeper
22

33
import (
4-
errorsmod "cosmossdk.io/errors"
54
sdk "github.com/cosmos/cosmos-sdk/types"
6-
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
75
"github.com/persistenceOne/pstake-native/v2/x/lscosmos/types"
86
)
97

108
// HandleMinDepositAndFeeChangeProposal changes host chain params for desired min-deposit and protocol fee
119
func HandleMinDepositAndFeeChangeProposal(ctx sdk.Context, k Keeper, content types.MinDepositAndFeeChangeProposal) error {
12-
if !k.GetModuleState(ctx) {
13-
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Module not enabled")
14-
}
15-
16-
hostChainParams := k.GetHostChainParams(ctx)
17-
if hostChainParams.IsEmpty() {
18-
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "host chain not registered")
19-
}
20-
21-
// modify oldData with the new proposal content
22-
hostChainParams.MinDeposit = content.MinDeposit
23-
hostChainParams.PstakeParams.PstakeDepositFee = content.PstakeDepositFee
24-
hostChainParams.PstakeParams.PstakeRestakeFee = content.PstakeRestakeFee
25-
hostChainParams.PstakeParams.PstakeUnstakeFee = content.PstakeUnstakeFee
26-
hostChainParams.PstakeParams.PstakeRedemptionFee = content.PstakeRedemptionFee
27-
28-
k.SetHostChainParams(ctx, hostChainParams)
29-
30-
return nil
10+
return types.ErrDeprecated
3111
}
3212

3313
// HandlePstakeFeeAddressChangeProposal changes fee collector address
3414
func HandlePstakeFeeAddressChangeProposal(ctx sdk.Context, k Keeper, content types.PstakeFeeAddressChangeProposal) error {
35-
//Do not check ModuleEnabled state or host chain params here because non-critical proposal and will help not hardcode address inside default genesis
36-
37-
hostChainParams := k.GetHostChainParams(ctx)
38-
39-
// modify oldData with the new proposal content
40-
hostChainParams.PstakeParams.PstakeFeeAddress = content.PstakeFeeAddress
41-
42-
k.SetHostChainParams(ctx, hostChainParams)
43-
44-
return nil
15+
return types.ErrDeprecated
4516
}
4617

4718
// HandleAllowListedValidatorSetChangeProposal changes the allowList validator set
4819
func HandleAllowListedValidatorSetChangeProposal(ctx sdk.Context, k Keeper, content types.AllowListedValidatorSetChangeProposal) error {
49-
if !k.GetModuleState(ctx) {
50-
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Module not enabled")
51-
}
52-
53-
hostChainParams := k.GetHostChainParams(ctx)
54-
if hostChainParams.IsEmpty() {
55-
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "host chain not registered")
56-
}
57-
58-
if !content.AllowListedValidators.Valid() {
59-
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "Allow listed validators is invalid")
60-
}
61-
62-
k.SetAllowListedValidators(ctx, content.AllowListedValidators)
63-
return nil
20+
return types.ErrDeprecated
6421
}

0 commit comments

Comments
 (0)