-
Notifications
You must be signed in to change notification settings - Fork 321
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
view(rpc): add DelegationsByAddressIndex
query
#3984
Conversation
5c6251a
to
aa568ef
Compare
82cd410
to
097dd6d
Compare
097dd6d
to
83339b6
Compare
DelegationsByAddressIndex
to query service
DelegationsByAddressIndex
to query serviceDelegationsByAddressIndex
query
&self, | ||
_request: tonic::Request<pb::DelegationsByAddressIndexRequest>, | ||
) -> Result<tonic::Response<Self::DelegationsByAddressIndexStream>, tonic::Status> { | ||
unimplemented!("delegations_by_address_index") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this PR isn't ready yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the idea is that it could be implemented by other implementations of ViewService
, such as in the web app. (Note that fn authorize_and_build
above is also unimplemented.) I had to add this method here or else the Rust compiler would complain that this method was missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I also thought this was a WIP. This makes sense and I don't think we need to spend time chasing feature parity across view service impls (in this case this seem onerous even).
@erwanor I'd accidentally left this as a draft PR — that's prob why! :D |
## Describe your changes Right now, the `StakingService` has a method, `validatorInfo`, that returns a series of `ValidatorInfo`s. As of penumbra-zone/web#604, we've refactored the minifront staking page to treat validators as tokens that an address may have a balance of. To achieve that, [we're fetching validator infos, then generating `ValueView`s from those validators](https://github.com/penumbra-zone/web/pull/604/files#diff-9bd971ea2f5dadcc555a9a848d1cea2a0d6df1a0069b9e5e490218058ac5adbc) that include the address's balance of those tokens. This logic should be moved into a new RPC method on the `ViewService` called `DelegationsByAddressIndex`, since it's a common enough use case that clients shouldn't all have to do it themselves. Relevant changes are to [`view.proto`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-03b7341d5bf81ab9c8d8542d220d5ba4ae122bd3837531309742b685d7ec1619) and [`ViewService`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-36188e6ab5083e8be9d29039370cc523cfcfede683b223327b2d90e3f75d40c7); the rest is just codegen changes. ## Issue ticket number and link Closes penumbra-zone/web#612 ## Checklist before requesting a review - [x] (n/a) If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. (cherry picked from commit eb4f5e4)
Right now, the `StakingService` has a method, `validatorInfo`, that returns a series of `ValidatorInfo`s. As of penumbra-zone/web#604, we've refactored the minifront staking page to treat validators as tokens that an address may have a balance of. To achieve that, [we're fetching validator infos, then generating `ValueView`s from those validators](https://github.com/penumbra-zone/web/pull/604/files#diff-9bd971ea2f5dadcc555a9a848d1cea2a0d6df1a0069b9e5e490218058ac5adbc) that include the address's balance of those tokens. This logic should be moved into a new RPC method on the `ViewService` called `DelegationsByAddressIndex`, since it's a common enough use case that clients shouldn't all have to do it themselves. Relevant changes are to [`view.proto`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-03b7341d5bf81ab9c8d8542d220d5ba4ae122bd3837531309742b685d7ec1619) and [`ViewService`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-36188e6ab5083e8be9d29039370cc523cfcfede683b223327b2d90e3f75d40c7); the rest is just codegen changes. Closes penumbra-zone/web#612 - [x] (n/a) If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. (cherry picked from commit eb4f5e4) Also includes a manual regen of the proto files, post-cherry-pick onto the release branch.
Right now, the `StakingService` has a method, `validatorInfo`, that returns a series of `ValidatorInfo`s. As of penumbra-zone/web#604, we've refactored the minifront staking page to treat validators as tokens that an address may have a balance of. To achieve that, [we're fetching validator infos, then generating `ValueView`s from those validators](https://github.com/penumbra-zone/web/pull/604/files#diff-9bd971ea2f5dadcc555a9a848d1cea2a0d6df1a0069b9e5e490218058ac5adbc) that include the address's balance of those tokens. This logic should be moved into a new RPC method on the `ViewService` called `DelegationsByAddressIndex`, since it's a common enough use case that clients shouldn't all have to do it themselves. Relevant changes are to [`view.proto`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-03b7341d5bf81ab9c8d8542d220d5ba4ae122bd3837531309742b685d7ec1619) and [`ViewService`](https://github.com/penumbra-zone/penumbra/pull/3984/files#diff-36188e6ab5083e8be9d29039370cc523cfcfede683b223327b2d90e3f75d40c7); the rest is just codegen changes. Closes penumbra-zone/web#612 - [x] (n/a) If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. (cherry picked from commit eb4f5e4) Also includes a manual regen of the proto files, post-cherry-pick onto the release branch.
Describe your changes
Right now, the
StakingService
has a method,validatorInfo
, that returns a series ofValidatorInfo
s.As of penumbra-zone/web#604, we've refactored the minifront staking page to treat validators as tokens that an address may have a balance of. To achieve that, we're fetching validator infos, then generating
ValueView
s from those validators that include the address's balance of those tokens.This logic should be moved into a new RPC method on the
ViewService
calledDelegationsByAddressIndex
, since it's a common enough use case that clients shouldn't all have to do it themselves.Relevant changes are to
view.proto
andViewService
; the rest is just codegen changes.Issue ticket number and link
Closes penumbra-zone/web#612
Checklist before requesting a review