Skip to content

Commit

Permalink
avoid conflicting field numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
hdevalence committed Feb 2, 2024
1 parent a67f17d commit d6af7f4
Show file tree
Hide file tree
Showing 6 changed files with 878 additions and 871 deletions.
Binary file modified crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
24 changes: 13 additions & 11 deletions crates/proto/src/gen/penumbra.view.v1alpha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ pub struct TransactionPlannerRequest {
pub expiry_height: u64,
/// The memo for the requested TransactionPlan.
/// The memo must be unspecified unless `outputs` is nonempty.
#[prost(message, optional, tag = "4")]
#[prost(message, optional, tag = "3")]
pub memo: ::core::option::Option<
super::super::core::transaction::v1alpha1::MemoPlaintext,
>,
/// If present, only spends funds from the given account.
#[prost(message, optional, tag = "5")]
#[prost(message, optional, tag = "4")]
pub source: ::core::option::Option<super::super::core::keys::v1alpha1::AddressIndex>,
/// Request contents
#[prost(message, repeated, tag = "20")]
Expand Down Expand Up @@ -206,8 +206,9 @@ pub struct TransactionPlannerRequest {
pub position_withdraws: ::prost::alloc::vec::Vec<
transaction_planner_request::PositionWithdraw,
>,
#[prost(oneof = "transaction_planner_request::FeeOption", tags = "2, 3")]
pub fee_option: ::core::option::Option<transaction_planner_request::FeeOption>,
/// Specifies either that the planner should compute fees automatically or that it should use a fixed fee amount.
#[prost(oneof = "transaction_planner_request::FeeMode", tags = "100, 101")]
pub fee_mode: ::core::option::Option<transaction_planner_request::FeeMode>,
}
/// Nested message and enum types in `TransactionPlannerRequest`.
pub mod transaction_planner_request {
Expand Down Expand Up @@ -397,15 +398,16 @@ pub mod transaction_planner_request {
)
}
}
/// Specifies either that the planner should compute fees automatically or that it should use a fixed fee amount.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum FeeOption {
/// The fee for the requested TransactionPlan, if any.
#[prost(message, tag = "2")]
Fee(super::super::super::core::component::fee::v1alpha1::Fee),
/// The fee tier for the requested TransactionPlan, if any.
#[prost(message, tag = "3")]
FeeTier(super::super::super::core::component::fee::v1alpha1::FeeTier),
pub enum FeeMode {
/// Automatically compute a fee based on gas use.
#[prost(message, tag = "100")]
AutoFee(super::super::super::core::component::fee::v1alpha1::FeeTier),
/// A manually set fee, rather than automatically computing a fee based on gas use.
#[prost(message, tag = "101")]
ManualFee(super::super::super::core::component::fee::v1alpha1::Fee),
}
}
impl ::prost::Name for TransactionPlannerRequest {
Expand Down
47 changes: 24 additions & 23 deletions crates/proto/src/gen/penumbra.view.v1alpha1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5438,7 +5438,7 @@ impl serde::Serialize for TransactionPlannerRequest {
if !self.position_withdraws.is_empty() {
len += 1;
}
if self.fee_option.is_some() {
if self.fee_mode.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("penumbra.view.v1alpha1.TransactionPlannerRequest", len)?;
Expand Down Expand Up @@ -5482,13 +5482,13 @@ impl serde::Serialize for TransactionPlannerRequest {
if !self.position_withdraws.is_empty() {
struct_ser.serialize_field("positionWithdraws", &self.position_withdraws)?;
}
if let Some(v) = self.fee_option.as_ref() {
if let Some(v) = self.fee_mode.as_ref() {
match v {
transaction_planner_request::FeeOption::Fee(v) => {
struct_ser.serialize_field("fee", v)?;
transaction_planner_request::FeeMode::AutoFee(v) => {
struct_ser.serialize_field("autoFee", v)?;
}
transaction_planner_request::FeeOption::FeeTier(v) => {
struct_ser.serialize_field("feeTier", v)?;
transaction_planner_request::FeeMode::ManualFee(v) => {
struct_ser.serialize_field("manualFee", v)?;
}
}
}
Expand Down Expand Up @@ -5522,9 +5522,10 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
"positionCloses",
"position_withdraws",
"positionWithdraws",
"fee",
"fee_tier",
"feeTier",
"auto_fee",
"autoFee",
"manual_fee",
"manualFee",
];

#[allow(clippy::enum_variant_names)]
Expand All @@ -5542,8 +5543,8 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
PositionOpens,
PositionCloses,
PositionWithdraws,
Fee,
FeeTier,
AutoFee,
ManualFee,
__SkipField__,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
Expand Down Expand Up @@ -5579,8 +5580,8 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
"positionOpens" | "position_opens" => Ok(GeneratedField::PositionOpens),
"positionCloses" | "position_closes" => Ok(GeneratedField::PositionCloses),
"positionWithdraws" | "position_withdraws" => Ok(GeneratedField::PositionWithdraws),
"fee" => Ok(GeneratedField::Fee),
"feeTier" | "fee_tier" => Ok(GeneratedField::FeeTier),
"autoFee" | "auto_fee" => Ok(GeneratedField::AutoFee),
"manualFee" | "manual_fee" => Ok(GeneratedField::ManualFee),
_ => Ok(GeneratedField::__SkipField__),
}
}
Expand Down Expand Up @@ -5613,7 +5614,7 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
let mut position_opens__ = None;
let mut position_closes__ = None;
let mut position_withdraws__ = None;
let mut fee_option__ = None;
let mut fee_mode__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::ExpiryHeight => {
Expand Down Expand Up @@ -5696,18 +5697,18 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
}
position_withdraws__ = Some(map_.next_value()?);
}
GeneratedField::Fee => {
if fee_option__.is_some() {
return Err(serde::de::Error::duplicate_field("fee"));
GeneratedField::AutoFee => {
if fee_mode__.is_some() {
return Err(serde::de::Error::duplicate_field("autoFee"));
}
fee_option__ = map_.next_value::<::std::option::Option<_>>()?.map(transaction_planner_request::FeeOption::Fee)
fee_mode__ = map_.next_value::<::std::option::Option<_>>()?.map(transaction_planner_request::FeeMode::AutoFee)
;
}
GeneratedField::FeeTier => {
if fee_option__.is_some() {
return Err(serde::de::Error::duplicate_field("feeTier"));
GeneratedField::ManualFee => {
if fee_mode__.is_some() {
return Err(serde::de::Error::duplicate_field("manualFee"));
}
fee_option__ = map_.next_value::<::std::option::Option<_>>()?.map(transaction_planner_request::FeeOption::FeeTier)
fee_mode__ = map_.next_value::<::std::option::Option<_>>()?.map(transaction_planner_request::FeeMode::ManualFee)
;
}
GeneratedField::__SkipField__ => {
Expand All @@ -5729,7 +5730,7 @@ impl<'de> serde::Deserialize<'de> for TransactionPlannerRequest {
position_opens: position_opens__.unwrap_or_default(),
position_closes: position_closes__.unwrap_or_default(),
position_withdraws: position_withdraws__.unwrap_or_default(),
fee_option: fee_option__,
fee_mode: fee_mode__,
})
}
}
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
Loading

0 comments on commit d6af7f4

Please sign in to comment.