From 4f99f3a44670f5baa1a8b6cb6c7214d632ae4c98 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Tue, 30 Apr 2024 13:20:38 -0400 Subject: [PATCH] dex: augment `liquidity_positions_by_price` stream with position ids (#4234) ## Describe your changes This adds a `PositionId` field to `penumbra.core.component.dex.v1.LiquidityPositionsByPriceResponse`. ## 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: > RPC change. --- .../core/component/dex/src/component/rpc.rs | 8 ++++++-- .../src/gen/penumbra.core.component.dex.v1.rs | 2 ++ .../penumbra.core.component.dex.v1.serde.rs | 17 +++++++++++++++++ .../proto/src/gen/proto_descriptor.bin.no_lfs | Bin 401653 -> 401773 bytes .../penumbra/core/component/dex/v1/dex.proto | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/crates/core/component/dex/src/component/rpc.rs b/crates/core/component/dex/src/component/rpc.rs index ed3e6914d0..545e4e48cb 100644 --- a/crates/core/component/dex/src/component/rpc.rs +++ b/crates/core/component/dex/src/component/rpc.rs @@ -362,8 +362,12 @@ impl QueryService for Server { anyhow::Ok(position) } }) - .map_ok(|position| LiquidityPositionsByPriceResponse { - data: Some(position.into()), + .map_ok(|position| { + let id = position.id(); + LiquidityPositionsByPriceResponse { + data: Some(position.into()), + id: Some(id.into()), + } }) .map_err(|e: anyhow::Error| { tonic::Status::internal(format!("error retrieving positions: {:#}", e)) diff --git a/crates/proto/src/gen/penumbra.core.component.dex.v1.rs b/crates/proto/src/gen/penumbra.core.component.dex.v1.rs index 6d36074247..27b5b16480 100644 --- a/crates/proto/src/gen/penumbra.core.component.dex.v1.rs +++ b/crates/proto/src/gen/penumbra.core.component.dex.v1.rs @@ -1172,6 +1172,8 @@ impl ::prost::Name for LiquidityPositionsByPriceRequest { pub struct LiquidityPositionsByPriceResponse { #[prost(message, optional, tag = "1")] pub data: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub id: ::core::option::Option, } impl ::prost::Name for LiquidityPositionsByPriceResponse { const NAME: &'static str = "LiquidityPositionsByPriceResponse"; diff --git a/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs b/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs index 448ce2e13a..9a6d02eee0 100644 --- a/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs +++ b/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs @@ -3473,10 +3473,16 @@ impl serde::Serialize for LiquidityPositionsByPriceResponse { if self.data.is_some() { len += 1; } + if self.id.is_some() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("penumbra.core.component.dex.v1.LiquidityPositionsByPriceResponse", len)?; if let Some(v) = self.data.as_ref() { struct_ser.serialize_field("data", v)?; } + if let Some(v) = self.id.as_ref() { + struct_ser.serialize_field("id", v)?; + } struct_ser.end() } } @@ -3488,11 +3494,13 @@ impl<'de> serde::Deserialize<'de> for LiquidityPositionsByPriceResponse { { const FIELDS: &[&str] = &[ "data", + "id", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Data, + Id, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3516,6 +3524,7 @@ impl<'de> serde::Deserialize<'de> for LiquidityPositionsByPriceResponse { { match value { "data" => Ok(GeneratedField::Data), + "id" => Ok(GeneratedField::Id), _ => Ok(GeneratedField::__SkipField__), } } @@ -3536,6 +3545,7 @@ impl<'de> serde::Deserialize<'de> for LiquidityPositionsByPriceResponse { V: serde::de::MapAccess<'de>, { let mut data__ = None; + let mut id__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::Data => { @@ -3544,6 +3554,12 @@ impl<'de> serde::Deserialize<'de> for LiquidityPositionsByPriceResponse { } data__ = map_.next_value()?; } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -3551,6 +3567,7 @@ impl<'de> serde::Deserialize<'de> for LiquidityPositionsByPriceResponse { } Ok(LiquidityPositionsByPriceResponse { data: data__, + id: id__, }) } } diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index fb096d7e68f8796b14f863baebe80c5bbe052378..4057b3c8428cc9392575c71081b478834ff49e67 100644 GIT binary patch delta 3834 zcmYLMYit$A8ND<9X1QJrHVYWPeT~7bqh8zhVf$XcNRyD5@+i+h2}PlTDyS_@R4TQ< zEJSIkQd5eRj4WgkMJPfpMXnG+R4E06T*pNQ9FxQ$CIwL*qKGIW2vH$=zS$k`4@*AZ zoO9-T%#7FHoGrRPSTyiaKb^lLU48agPVMnW{XeOpKH*mNyme_#&;HvpdcGO$Ag{%h zJ+EJE%#qu-9zS>a^TO$W{;zPSc`6dQt+d!D=JdSx>h$CPyt8AIIHQ{ui{)KJby9fr z50cNhGhD^UF>t{ug*m+X?OHd_l~nIJgA_SW!kzBsP(7G~6rGDDqIwze=p4yL zqXU8~V6}zdo}&c~Q_HYDN2#>2ZSb5Sid+nA8$cbRXrbE#+Xl8B)>~c{3w71YVs?C( zWXyPC1;k;h@+|>jIZT;spu^$_>oW0?P$D=QN(3Y$ELmo@k{(^q-+e{2YViuTx+_c7r)mnrgPP;dgw%M>khXCjM4 zPQ-J@NPbQ^W;0+ckC8jeEpQ!Pj)L$p(I=$be0Q230p(**x?o{A+_iCXN-V>S1A!S~ z0FrT)~;Q$}6k~YN5}Fimb%c@)_mL zog%p- zwA|PxIqMrF6GjLGTR{Ip0fKvjYQAGv;d+DW8{Cx`ev;4GO_CKQFT@uAV(0dsZP~eP zYi#?DH-EV^wnaZ%B3hSVwIGmkZ8vFFv4wEDNoAabq?G5}rpQ-8ekm|-Q*@SFi%n9T z-(Bjd_$t=Sr2!+uyCi2ABS5h4(##SI;d_^d`Yj{I;yvB4RFt+R>fC_BN8=vJd<&UF z1%6^F$+zqtC*~WV>G#>7Hhw>paN+kuiG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