Skip to content

Commit

Permalink
Add missing address_index field to `UnbondingTokensByAddressIndexRe…
Browse files Browse the repository at this point in the history
…quest` (#4140)

## Describe your changes
While working on PR #4138, I forgot to include the `address_index` field
in the request for unbonding tokens by address index. This PR fixes
that.

Relevant changes are to the proto file
[here](https://github.com/penumbra-zone/penumbra/pull/4140/files#diff-03b7341d5bf81ab9c8d8542d220d5ba4ae122bd3837531309742b685d7ec1619).

## Issue ticket number and link
#4006 

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

  > Does not affect consensus
  • Loading branch information
jessepinho authored Mar 31, 2024
1 parent 74a0b46 commit 6428659
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/proto/src/gen/penumbra.view.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,11 @@ pub struct UnbondingTokensByAddressIndexRequest {
tag = "1"
)]
pub filter: i32,
/// The address index to fetch unbonding tokens for.
#[prost(message, optional, tag = "2")]
pub address_index: ::core::option::Option<
super::super::core::keys::v1::AddressIndex,
>,
}
/// Nested message and enum types in `UnbondingTokensByAddressIndexRequest`.
pub mod unbonding_tokens_by_address_index_request {
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 @@ -7297,12 +7297,18 @@ impl serde::Serialize for UnbondingTokensByAddressIndexRequest {
if self.filter != 0 {
len += 1;
}
if self.address_index.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("penumbra.view.v1.UnbondingTokensByAddressIndexRequest", len)?;
if self.filter != 0 {
let v = unbonding_tokens_by_address_index_request::Filter::try_from(self.filter)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.filter)))?;
struct_ser.serialize_field("filter", &v)?;
}
if let Some(v) = self.address_index.as_ref() {
struct_ser.serialize_field("addressIndex", v)?;
}
struct_ser.end()
}
}
Expand All @@ -7314,11 +7320,14 @@ impl<'de> serde::Deserialize<'de> for UnbondingTokensByAddressIndexRequest {
{
const FIELDS: &[&str] = &[
"filter",
"address_index",
"addressIndex",
];

#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Filter,
AddressIndex,
__SkipField__,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
Expand All @@ -7342,6 +7351,7 @@ impl<'de> serde::Deserialize<'de> for UnbondingTokensByAddressIndexRequest {
{
match value {
"filter" => Ok(GeneratedField::Filter),
"addressIndex" | "address_index" => Ok(GeneratedField::AddressIndex),
_ => Ok(GeneratedField::__SkipField__),
}
}
Expand All @@ -7362,6 +7372,7 @@ impl<'de> serde::Deserialize<'de> for UnbondingTokensByAddressIndexRequest {
V: serde::de::MapAccess<'de>,
{
let mut filter__ = None;
let mut address_index__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Filter => {
Expand All @@ -7370,13 +7381,20 @@ impl<'de> serde::Deserialize<'de> for UnbondingTokensByAddressIndexRequest {
}
filter__ = Some(map_.next_value::<unbonding_tokens_by_address_index_request::Filter>()? as i32);
}
GeneratedField::AddressIndex => {
if address_index__.is_some() {
return Err(serde::de::Error::duplicate_field("addressIndex"));
}
address_index__ = map_.next_value()?;
}
GeneratedField::__SkipField__ => {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
}
}
Ok(UnbondingTokensByAddressIndexRequest {
filter: filter__.unwrap_or_default(),
address_index: address_index__,
})
}
}
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
3 changes: 3 additions & 0 deletions proto/penumbra/penumbra/view/v1/view.proto
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ message UnbondingTokensByAddressIndexRequest {
}

Filter filter = 1;

// The address index to fetch unbonding tokens for.
core.keys.v1.AddressIndex address_index = 2;
}

// Returns unbonding tokens for the given address index, optionally filtered by
Expand Down

0 comments on commit 6428659

Please sign in to comment.