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

view service: Implement LQT rpcs (follow-up) #5064

Merged
merged 1 commit into from
Feb 6, 2025
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
7 changes: 6 additions & 1 deletion crates/proto/src/gen/penumbra.view.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ impl ::prost::Name for LqtVotingNotesResponse {
/// Note: implementations must not accept messages with both `epoch_index`
/// and `block_height` set. This is a convenience API, to allow consumers
/// to defer epoch tracking to a view service.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TournamentVotesRequest {
/// Retrieves votes for the specified epoch.
#[prost(uint64, tag = "1")]
pub epoch_index: u64,
/// Retrieves votes as of the specified block height.
#[prost(uint64, tag = "2")]
pub block_height: u64,
/// If present, filter balances to only include the account specified by the `AddressIndex`.
#[prost(message, optional, tag = "3")]
pub account_filter: ::core::option::Option<
super::super::core::keys::v1::AddressIndex,
>,
}
impl ::prost::Name for TournamentVotesRequest {
const NAME: &'static str = "TournamentVotesRequest";
Expand Down
18 changes: 18 additions & 0 deletions crates/proto/src/gen/penumbra.view.v1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6075,6 +6075,9 @@ impl serde::Serialize for TournamentVotesRequest {
if self.block_height != 0 {
len += 1;
}
if self.account_filter.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("penumbra.view.v1.TournamentVotesRequest", len)?;
if self.epoch_index != 0 {
#[allow(clippy::needless_borrow)]
Expand All @@ -6086,6 +6089,9 @@ impl serde::Serialize for TournamentVotesRequest {
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("blockHeight", ToString::to_string(&self.block_height).as_str())?;
}
if let Some(v) = self.account_filter.as_ref() {
struct_ser.serialize_field("accountFilter", v)?;
}
struct_ser.end()
}
}
Expand All @@ -6100,12 +6106,15 @@ impl<'de> serde::Deserialize<'de> for TournamentVotesRequest {
"epochIndex",
"block_height",
"blockHeight",
"account_filter",
"accountFilter",
];

#[allow(clippy::enum_variant_names)]
enum GeneratedField {
EpochIndex,
BlockHeight,
AccountFilter,
__SkipField__,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
Expand All @@ -6130,6 +6139,7 @@ impl<'de> serde::Deserialize<'de> for TournamentVotesRequest {
match value {
"epochIndex" | "epoch_index" => Ok(GeneratedField::EpochIndex),
"blockHeight" | "block_height" => Ok(GeneratedField::BlockHeight),
"accountFilter" | "account_filter" => Ok(GeneratedField::AccountFilter),
_ => Ok(GeneratedField::__SkipField__),
}
}
Expand All @@ -6151,6 +6161,7 @@ impl<'de> serde::Deserialize<'de> for TournamentVotesRequest {
{
let mut epoch_index__ = None;
let mut block_height__ = None;
let mut account_filter__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::EpochIndex => {
Expand All @@ -6169,6 +6180,12 @@ impl<'de> serde::Deserialize<'de> for TournamentVotesRequest {
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::AccountFilter => {
if account_filter__.is_some() {
return Err(serde::de::Error::duplicate_field("accountFilter"));
}
account_filter__ = map_.next_value()?;
}
GeneratedField::__SkipField__ => {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Expand All @@ -6177,6 +6194,7 @@ impl<'de> serde::Deserialize<'de> for TournamentVotesRequest {
Ok(TournamentVotesRequest {
epoch_index: epoch_index__.unwrap_or_default(),
block_height: block_height__.unwrap_or_default(),
account_filter: account_filter__,
})
}
}
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
2 changes: 2 additions & 0 deletions proto/penumbra/penumbra/view/v1/view.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ message TournamentVotesRequest {
uint64 epoch_index = 1;
// Retrieves votes as of the specified block height.
uint64 block_height = 2;
// If present, filter balances to only include the account specified by the `AddressIndex`.
core.keys.v1.AddressIndex account_filter = 3;
}

message TournamentVotesResponse {
Expand Down
Loading