Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(v0.4.x): remove deprecated endpoints #289

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ localnet-build-env: localnet-alliance-rmi
localnet-build-nodes:
$(DOCKER) run --rm -v $(CURDIR)/.testnets:/alliance terra-money/localnet-alliance \
testnet init-files --v 3 -o /alliance --starting-ip-address 192.168.5.20 --keyring-backend=test --chain-id=alliance-testnet-1
docker-compose up -d
$(DOCKER) compose up -d

localnet-stop:
docker-compose down
$(DOCKER) compose down

localnet-start: localnet-stop localnet-build-env localnet-build-nodes

Expand Down
57 changes: 0 additions & 57 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@
- [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse)
- [QueryAlliancesRequest](#alliance.alliance.QueryAlliancesRequest)
- [QueryAlliancesResponse](#alliance.alliance.QueryAlliancesResponse)
- [QueryIBCAllianceDelegationRequest](#alliance.alliance.QueryIBCAllianceDelegationRequest)
- [QueryIBCAllianceDelegationRewardsRequest](#alliance.alliance.QueryIBCAllianceDelegationRewardsRequest)
- [QueryIBCAllianceRequest](#alliance.alliance.QueryIBCAllianceRequest)
- [QueryParamsRequest](#alliance.alliance.QueryParamsRequest)
- [QueryParamsResponse](#alliance.alliance.QueryParamsResponse)

Expand Down Expand Up @@ -1072,57 +1069,6 @@ Alliances



<a name="alliance.alliance.QueryIBCAllianceDelegationRequest"></a>

### QueryIBCAllianceDelegationRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_addr` | [string](#string) | | |
| `validator_addr` | [string](#string) | | |
| `hash` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.alliance.QueryIBCAllianceDelegationRewardsRequest"></a>

### QueryIBCAllianceDelegationRewardsRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_addr` | [string](#string) | | |
| `validator_addr` | [string](#string) | | |
| `hash` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.alliance.QueryIBCAllianceRequest"></a>

### QueryIBCAllianceRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `hash` | [string](#string) | | |






<a name="alliance.alliance.QueryParamsRequest"></a>

### QueryParamsRequest
Expand Down Expand Up @@ -1163,16 +1109,13 @@ Params
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#alliance.alliance.QueryParamsRequest) | [QueryParamsResponse](#alliance.alliance.QueryParamsResponse) | | GET|/terra/alliances/params|
| `Alliances` | [QueryAlliancesRequest](#alliance.alliance.QueryAlliancesRequest) | [QueryAlliancesResponse](#alliance.alliance.QueryAlliancesResponse) | Query paginated alliances | GET|/terra/alliances|
| `IBCAlliance` | [QueryIBCAllianceRequest](#alliance.alliance.QueryIBCAllianceRequest) | [QueryAllianceResponse](#alliance.alliance.QueryAllianceResponse) | Query a specific alliance by ibc hash @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/ibc%2Falliance | GET|/terra/alliances/ibc/{hash}|
| `AllAlliancesDelegations` | [QueryAllAlliancesDelegationsRequest](#alliance.alliance.QueryAllAlliancesDelegationsRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations | GET|/terra/alliances/delegations|
| `AllianceValidator` | [QueryAllianceValidatorRequest](#alliance.alliance.QueryAllianceValidatorRequest) | [QueryAllianceValidatorResponse](#alliance.alliance.QueryAllianceValidatorResponse) | Query alliance validator | GET|/terra/alliances/validators/{validator_addr}|
| `AllAllianceValidators` | [QueryAllAllianceValidatorsRequest](#alliance.alliance.QueryAllAllianceValidatorsRequest) | [QueryAllianceValidatorsResponse](#alliance.alliance.QueryAllianceValidatorsResponse) | Query all paginated alliance validators | GET|/terra/alliances/validators|
| `AlliancesDelegation` | [QueryAlliancesDelegationsRequest](#alliance.alliance.QueryAlliancesDelegationsRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations for a delegator addr | GET|/terra/alliances/delegations/{delegator_addr}|
| `AlliancesDelegationByValidator` | [QueryAlliancesDelegationByValidatorRequest](#alliance.alliance.QueryAlliancesDelegationByValidatorRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations for a delegator addr and validator_addr | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}|
| `AllianceDelegation` | [QueryAllianceDelegationRequest](#alliance.alliance.QueryAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse) | Query a delegation to an alliance by delegator addr, validator_addr and denom | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/{denom}|
| `IBCAllianceDelegation` | [QueryIBCAllianceDelegationRequest](#alliance.alliance.QueryIBCAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse) | Query a delegation to an alliance by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceDelegationRewards` | [QueryAllianceDelegationRewardsRequest](#alliance.alliance.QueryAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}|
| `IBCAllianceDelegationRewards` | [QueryIBCAllianceDelegationRewardsRequest](#alliance.alliance.QueryIBCAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceUnbondingsByDenomAndDelegator` | [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest) | [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}|
| `AllianceUnbondings` | [QueryAllianceUnbondingsRequest](#alliance.alliance.QueryAllianceUnbondingsRequest) | [QueryAllianceUnbondingsResponse](#alliance.alliance.QueryAllianceUnbondingsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}/{validator_addr}|
| `AllianceRedelegations` | [QueryAllianceRedelegationsRequest](#alliance.alliance.QueryAllianceRedelegationsRequest) | [QueryAllianceRedelegationsResponse](#alliance.alliance.QueryAllianceRedelegationsResponse) | Query redelegations by denom and delegator address | GET|/terra/alliances/redelegations/{denom}/{delegator_addr}|
Expand Down
62 changes: 0 additions & 62 deletions proto/alliance/alliance/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ service Query {
option (google.api.http).get = "/terra/alliances";
}

// Query a specific alliance by ibc hash
// @deprecated: this endpoint will be replaced for by the encoded version
// of the denom e.g.: GET:/terra/alliances/ibc%2Falliance
rpc IBCAlliance(QueryIBCAllianceRequest) returns (QueryAllianceResponse) {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from ibc/alliance to ibc%2Falliance
option deprecated = true;
option (google.api.http).get = "/terra/alliances/ibc/{hash}";
}

// Query all paginated alliance delegations
rpc AllAlliancesDelegations(QueryAllAlliancesDelegationsRequest) returns (QueryAlliancesDelegationsResponse) {
option (google.api.http).get = "/terra/alliances/delegations";
Expand Down Expand Up @@ -63,29 +53,10 @@ service Query {
option (google.api.http).get = "/terra/alliances/delegations/{delegator_addr}/{validator_addr}/{denom}";
}

// Query a delegation to an alliance by delegator addr, validator_addr and denom
// @deprecated: this endpoint will be replaced for by the encoded version
// of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
rpc IBCAllianceDelegation(QueryIBCAllianceDelegationRequest) returns (QueryAllianceDelegationResponse) {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from ibc/alliance to ibc%2Falliance
option deprecated = true;
option (google.api.http).get = "/terra/alliances/delegations/{delegator_addr}/{validator_addr}/ibc/{hash}";
}

// Query for rewards by delegator addr, validator_addr and denom
rpc AllianceDelegationRewards(QueryAllianceDelegationRewardsRequest) returns (QueryAllianceDelegationRewardsResponse) {
option (google.api.http).get = "/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}";
}
// Query for rewards by delegator addr, validator_addr and denom
// @deprecated: this endpoint will be replaced for by the encoded version
// of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
rpc IBCAllianceDelegationRewards(QueryIBCAllianceDelegationRewardsRequest) returns (QueryAllianceDelegationRewardsResponse) {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from ibc/alliance to ibc%2Falliance
option deprecated = true;
option (google.api.http).get = "/terra/alliances/rewards/{delegator_addr}/{validator_addr}/ibc/{hash}";
}

// Query for rewards by delegator addr, validator_addr and denom
rpc AllianceUnbondingsByDenomAndDelegator(QueryAllianceUnbondingsByDenomAndDelegatorRequest) returns (QueryAllianceUnbondingsByDenomAndDelegatorResponse) {
Expand Down Expand Up @@ -134,13 +105,6 @@ message QueryAllianceResponse {
AllianceAsset alliance = 1;
}

message QueryIBCAllianceRequest {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from
option deprecated = true;
string hash = 1;
}

message QueryAllianceValidatorRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand Down Expand Up @@ -207,19 +171,6 @@ message QueryAllianceDelegationRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

message QueryIBCAllianceDelegationRequest {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from
option deprecated = true;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string delegator_addr = 1;
string validator_addr = 2;
string hash = 3;
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

message QueryAllianceDelegationResponse {
DelegationResponse delegation = 1 [(gogoproto.nullable) = false];
}
Expand All @@ -235,19 +186,6 @@ message QueryAllianceDelegationRewardsRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

message QueryIBCAllianceDelegationRewardsRequest {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from
option deprecated = true;
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string delegator_addr = 1;
string validator_addr = 2;
string hash = 3;
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

message QueryAllianceDelegationRewardsResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
Expand Down
28 changes: 0 additions & 28 deletions x/alliance/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,6 @@ func (k QueryServer) Alliance(c context.Context, req *types.QueryAllianceRequest
}, nil
}

func (k QueryServer) IBCAlliance(c context.Context, request *types.QueryIBCAllianceRequest) (*types.QueryAllianceResponse, error) { //nolint:staticcheck // SA1019: types.QueryIBCAllianceRequest is deprecated
req := types.QueryAllianceRequest{
Denom: "ibc/" + request.Hash,
}
return k.Alliance(c, &req)
}

func (k QueryServer) AllianceDelegationRewards(context context.Context, req *types.QueryAllianceDelegationRewardsRequest) (*types.QueryAllianceDelegationRewardsResponse, error) {
ctx := sdk.UnwrapSDKContext(context)
decodedDenom, err := url.QueryUnescape(req.Denom)
Expand Down Expand Up @@ -266,17 +259,6 @@ func (k QueryServer) AllianceDelegationRewards(context context.Context, req *typ
}, nil
}

func (k QueryServer) IBCAllianceDelegationRewards(context context.Context, request *types.QueryIBCAllianceDelegationRewardsRequest) (*types.QueryAllianceDelegationRewardsResponse, error) { //nolint:staticcheck // SA1019: types.QueryIBCAllianceDelegationRewardsRequest is deprecated
req := types.QueryAllianceDelegationRewardsRequest{
DelegatorAddr: request.DelegatorAddr,
ValidatorAddr: request.ValidatorAddr,
Denom: "ibc/" + request.Hash,
Pagination: request.Pagination,
}

return k.AllianceDelegationRewards(context, &req)
}

func (k QueryServer) AlliancesDelegation(c context.Context, req *types.QueryAlliancesDelegationsRequest) (*types.QueryAlliancesDelegationsResponse, error) {
var delegationsRes []types.DelegationResponse

Expand Down Expand Up @@ -542,16 +524,6 @@ func (k QueryServer) AllianceRedelegations(c context.Context, req *types.QueryAl
}, err
}

func (k QueryServer) IBCAllianceDelegation(c context.Context, request *types.QueryIBCAllianceDelegationRequest) (*types.QueryAllianceDelegationResponse, error) { //nolint:staticcheck // SA1019: types.QueryIBCAllianceDelegationRequest is deprecated
req := types.QueryAllianceDelegationRequest{
DelegatorAddr: request.DelegatorAddr,
ValidatorAddr: request.ValidatorAddr,
Denom: "ibc/" + request.Hash,
Pagination: request.Pagination,
}
return k.AllianceDelegation(c, &req)
}

func NewQueryServerImpl(keeper Keeper) types.QueryServer {
return &QueryServer{
Keeper: keeper,
Expand Down
17 changes: 0 additions & 17 deletions x/alliance/keeper/tests/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ func TestQueryAnUniqueIBCAlliance(t *testing.T) {
alliances, err := queryServer.Alliance(ctx, &types.QueryAllianceRequest{
Denom: "ibc%2Falliance2",
})
alliancesIbcEndpoint, err2 := queryServer.IBCAlliance(ctx, &types.QueryIBCAllianceRequest{ //nolint:staticcheck // SA1019: types.types.QueryIBCAllianceRequest is deprecated
Hash: "alliance2",
})

// THEN: VALIDATE THAT BOTH ALLIANCES HAVE THE CORRECT MODEL WHEN QUERYING
require.Nil(t, err)
Expand All @@ -178,20 +175,6 @@ func TestQueryAnUniqueIBCAlliance(t *testing.T) {
RewardChangeInterval: 0,
},
}, alliances)

require.Nil(t, err2)
require.Equal(t, &types.QueryAllianceResponse{
Alliance: &types.AllianceAsset{
Denom: "ibc/alliance2",
RewardWeight: math.LegacyNewDec(10),
RewardWeightRange: types.RewardWeightRange{Min: math.LegacyNewDec(2), Max: math.LegacyNewDec(12)},
TakeRate: math.LegacyMustNewDecFromStr("0.14159265359"),
TotalTokens: math.ZeroInt(),
TotalValidatorShares: math.LegacyNewDec(0),
RewardChangeRate: math.LegacyNewDec(0),
RewardChangeInterval: 0,
},
}, alliancesIbcEndpoint)
}

func TestQueryAllianceNotFound(t *testing.T) {
Expand Down
Loading
Loading