Skip to content

Commit

Permalink
penumbra: regenerate protos with shielded pool params
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jan 30, 2024
1 parent de25be6 commit c911e9e
Show file tree
Hide file tree
Showing 7 changed files with 1,053 additions and 833 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,11 @@ pub struct ChangedAppParameters {
pub funding_params: ::core::option::Option<
super::super::funding::v1alpha1::FundingParameters,
>,
/// Shielded pool module parameters
#[prost(message, optional, tag = "9")]
pub shielded_pool_params: ::core::option::Option<
super::super::shielded_pool::v1alpha1::ShieldedPoolParameters,
>,
}
impl ::prost::Name for ChangedAppParameters {
const NAME: &'static str = "ChangedAppParameters";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ impl serde::Serialize for ChangedAppParameters {
if self.funding_params.is_some() {
len += 1;
}
if self.shielded_pool_params.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("penumbra.core.component.governance.v1alpha1.ChangedAppParameters", len)?;
if let Some(v) = self.sct_params.as_ref() {
struct_ser.serialize_field("sctParams", v)?;
Expand All @@ -277,6 +280,9 @@ impl serde::Serialize for ChangedAppParameters {
if let Some(v) = self.funding_params.as_ref() {
struct_ser.serialize_field("fundingParams", v)?;
}
if let Some(v) = self.shielded_pool_params.as_ref() {
struct_ser.serialize_field("shieldedPoolParams", v)?;
}
struct_ser.end()
}
}
Expand All @@ -303,6 +309,8 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
"distributionsParams",
"funding_params",
"fundingParams",
"shielded_pool_params",
"shieldedPoolParams",
];

#[allow(clippy::enum_variant_names)]
Expand All @@ -315,6 +323,7 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
FeeParams,
DistributionsParams,
FundingParams,
ShieldedPoolParams,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
Expand Down Expand Up @@ -344,6 +353,7 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
"feeParams" | "fee_params" => Ok(GeneratedField::FeeParams),
"distributionsParams" | "distributions_params" => Ok(GeneratedField::DistributionsParams),
"fundingParams" | "funding_params" => Ok(GeneratedField::FundingParams),
"shieldedPoolParams" | "shielded_pool_params" => Ok(GeneratedField::ShieldedPoolParams),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
Expand Down Expand Up @@ -371,6 +381,7 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
let mut fee_params__ = None;
let mut distributions_params__ = None;
let mut funding_params__ = None;
let mut shielded_pool_params__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SctParams => {
Expand Down Expand Up @@ -421,6 +432,12 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
}
funding_params__ = map_.next_value()?;
}
GeneratedField::ShieldedPoolParams => {
if shielded_pool_params__.is_some() {
return Err(serde::de::Error::duplicate_field("shieldedPoolParams"));
}
shielded_pool_params__ = map_.next_value()?;
}
}
}
Ok(ChangedAppParameters {
Expand All @@ -432,6 +449,7 @@ impl<'de> serde::Deserialize<'de> for ChangedAppParameters {
fee_params: fee_params__,
distributions_params: distributions_params__,
funding_params: funding_params__,
shielded_pool_params: shielded_pool_params__,
})
}
}
Expand Down
140 changes: 78 additions & 62 deletions crates/proto/src/gen/penumbra.core.component.shielded_pool.v1alpha1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,81 @@
/// Configuration data for the shielded pool component.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ShieldedPoolParameters {
#[prost(message, optional, tag = "1")]
pub fmd_params: ::core::option::Option<FmdParameters>,
}
impl ::prost::Name for ShieldedPoolParameters {
const NAME: &'static str = "ShieldedPoolParameters";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.{}", Self::NAME
)
}
}
/// Genesis data for the shielded pool component.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisContent {
/// The allocations present at genesis
#[prost(message, repeated, tag = "2")]
pub allocations: ::prost::alloc::vec::Vec<genesis_content::Allocation>,
}
/// Nested message and enum types in `GenesisContent`.
pub mod genesis_content {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Allocation {
#[prost(message, optional, tag = "1")]
pub amount: ::core::option::Option<
super::super::super::super::num::v1alpha1::Amount,
>,
#[prost(string, tag = "2")]
pub denom: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub address: ::core::option::Option<
super::super::super::super::keys::v1alpha1::Address,
>,
}
impl ::prost::Name for Allocation {
const NAME: &'static str = "Allocation";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.GenesisContent.{}",
Self::NAME
)
}
}
}
impl ::prost::Name for GenesisContent {
const NAME: &'static str = "GenesisContent";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.{}", Self::NAME
)
}
}
/// Parameters for Fuzzy Message Detection
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FmdParameters {
#[prost(uint32, tag = "1")]
pub precision_bits: u32,
#[prost(uint64, tag = "2")]
pub as_of_block_height: u64,
}
impl ::prost::Name for FmdParameters {
const NAME: &'static str = "FmdParameters";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.{}", Self::NAME
)
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Note {
Expand Down Expand Up @@ -495,68 +573,6 @@ impl ::prost::Name for DenomMetadataByIdResponse {
)
}
}
/// Genesis data for the shielded pool component.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GenesisContent {
/// The allocations present at genesis
#[prost(message, repeated, tag = "2")]
pub allocations: ::prost::alloc::vec::Vec<genesis_content::Allocation>,
}
/// Nested message and enum types in `GenesisContent`.
pub mod genesis_content {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Allocation {
#[prost(message, optional, tag = "1")]
pub amount: ::core::option::Option<
super::super::super::super::num::v1alpha1::Amount,
>,
#[prost(string, tag = "2")]
pub denom: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub address: ::core::option::Option<
super::super::super::super::keys::v1alpha1::Address,
>,
}
impl ::prost::Name for Allocation {
const NAME: &'static str = "Allocation";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.GenesisContent.{}",
Self::NAME
)
}
}
}
impl ::prost::Name for GenesisContent {
const NAME: &'static str = "GenesisContent";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.{}", Self::NAME
)
}
}
/// Parameters for Fuzzy Message Detection
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FmdParameters {
#[prost(uint32, tag = "1")]
pub precision_bits: u32,
#[prost(uint64, tag = "2")]
pub as_of_block_height: u64,
}
impl ::prost::Name for FmdParameters {
const NAME: &'static str = "FmdParameters";
const PACKAGE: &'static str = "penumbra.core.component.shielded_pool.v1alpha1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!(
"penumbra.core.component.shielded_pool.v1alpha1.{}", Self::NAME
)
}
}
/// Generated client implementations.
#[cfg(feature = "rpc")]
pub mod query_service_client {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,98 @@ impl<'de> serde::Deserialize<'de> for output_view::Visible {
deserializer.deserialize_struct("penumbra.core.component.shielded_pool.v1alpha1.OutputView.Visible", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ShieldedPoolParameters {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.fmd_params.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("penumbra.core.component.shielded_pool.v1alpha1.ShieldedPoolParameters", len)?;
if let Some(v) = self.fmd_params.as_ref() {
struct_ser.serialize_field("fmdParams", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ShieldedPoolParameters {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"fmd_params",
"fmdParams",
];

#[allow(clippy::enum_variant_names)]
enum GeneratedField {
FmdParams,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;

impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;

fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}

#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"fmdParams" | "fmd_params" => Ok(GeneratedField::FmdParams),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ShieldedPoolParameters;

fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct penumbra.core.component.shielded_pool.v1alpha1.ShieldedPoolParameters")
}

fn visit_map<V>(self, mut map_: V) -> std::result::Result<ShieldedPoolParameters, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut fmd_params__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::FmdParams => {
if fmd_params__.is_some() {
return Err(serde::de::Error::duplicate_field("fmdParams"));
}
fmd_params__ = map_.next_value()?;
}
}
}
Ok(ShieldedPoolParameters {
fmd_params: fmd_params__,
})
}
}
deserializer.deserialize_struct("penumbra.core.component.shielded_pool.v1alpha1.ShieldedPoolParameters", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for Spend {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
Loading

0 comments on commit c911e9e

Please sign in to comment.