Skip to content

Commit

Permalink
asset: delete cargo-culted fields in DenomMetadata
Browse files Browse the repository at this point in the history
These were copied over from the bank.Metadata proto but:

- they're never used by any of our tooling
- searching the cosmos/chain-registry reveals they're never used in the rest of the ecosystem
- we can't parse the cosmos sdk data anyways, because it does bespoke field renaming

So no reason to keep it and definite reasons to remove it.
  • Loading branch information
hdevalence committed Jan 30, 2024
1 parent 391a8a8 commit 7a4ccef
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 145 deletions.
8 changes: 0 additions & 8 deletions crates/core/asset/src/asset/denom_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub(super) struct Inner {
display_index: usize,
name: String,
symbol: String,
uri: String,
uri_hash: String,
}

impl DomainType for DenomMetadata {
Expand All @@ -59,8 +57,6 @@ impl From<&Inner> for pb::DenomMetadata {
display: inner.units[inner.display_index].denom.clone(),
name: inner.name.clone(),
symbol: inner.symbol.clone(),
uri: inner.uri.clone(),
uri_hash: inner.uri_hash.clone(),
penumbra_asset_id: Some(inner.id.into()),
denom_units: inner.units.clone().into_iter().map(|x| x.into()).collect(),
}
Expand Down Expand Up @@ -127,8 +123,6 @@ impl TryFrom<pb::DenomMetadata> for Inner {
description: value.description,
name: value.name,
symbol: value.symbol,
uri: value.uri,
uri_hash: value.uri_hash,
})
}
}
Expand Down Expand Up @@ -249,8 +243,6 @@ impl Inner {
description: String::new(),
name: String::new(),
symbol: String::new(),
uri: String::new(),
uri_hash: String::new(),
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions crates/proto/src/gen/penumbra.core.asset.v1alpha1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ pub struct DenomMetadata {
/// be the same as the display.
#[prost(string, tag = "6")]
pub symbol: ::prost::alloc::string::String,
/// URI to a document (on or off-chain) that contains additional information. Optional.
#[prost(string, tag = "7")]
pub uri: ::prost::alloc::string::String,
/// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
/// the document didn't change. Optional.
#[prost(string, tag = "8")]
pub uri_hash: ::prost::alloc::string::String,
/// the asset ID on Penumbra for this denomination.
#[prost(message, optional, tag = "1984")]
pub penumbra_asset_id: ::core::option::Option<AssetId>,
Expand Down
35 changes: 0 additions & 35 deletions crates/proto/src/gen/penumbra.core.asset.v1alpha1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,6 @@ impl serde::Serialize for DenomMetadata {
if !self.symbol.is_empty() {
len += 1;
}
if !self.uri.is_empty() {
len += 1;
}
if !self.uri_hash.is_empty() {
len += 1;
}
if self.penumbra_asset_id.is_some() {
len += 1;
}
Expand All @@ -367,12 +361,6 @@ impl serde::Serialize for DenomMetadata {
if !self.symbol.is_empty() {
struct_ser.serialize_field("symbol", &self.symbol)?;
}
if !self.uri.is_empty() {
struct_ser.serialize_field("uri", &self.uri)?;
}
if !self.uri_hash.is_empty() {
struct_ser.serialize_field("uriHash", &self.uri_hash)?;
}
if let Some(v) = self.penumbra_asset_id.as_ref() {
struct_ser.serialize_field("penumbraAssetId", v)?;
}
Expand All @@ -393,9 +381,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
"display",
"name",
"symbol",
"uri",
"uri_hash",
"uriHash",
"penumbra_asset_id",
"penumbraAssetId",
];
Expand All @@ -408,8 +393,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
Display,
Name,
Symbol,
Uri,
UriHash,
PenumbraAssetId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
Expand Down Expand Up @@ -438,8 +421,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
"display" => Ok(GeneratedField::Display),
"name" => Ok(GeneratedField::Name),
"symbol" => Ok(GeneratedField::Symbol),
"uri" => Ok(GeneratedField::Uri),
"uriHash" | "uri_hash" => Ok(GeneratedField::UriHash),
"penumbraAssetId" | "penumbra_asset_id" => Ok(GeneratedField::PenumbraAssetId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
Expand All @@ -466,8 +447,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
let mut display__ = None;
let mut name__ = None;
let mut symbol__ = None;
let mut uri__ = None;
let mut uri_hash__ = None;
let mut penumbra_asset_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
Expand Down Expand Up @@ -507,18 +486,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
}
symbol__ = Some(map_.next_value()?);
}
GeneratedField::Uri => {
if uri__.is_some() {
return Err(serde::de::Error::duplicate_field("uri"));
}
uri__ = Some(map_.next_value()?);
}
GeneratedField::UriHash => {
if uri_hash__.is_some() {
return Err(serde::de::Error::duplicate_field("uriHash"));
}
uri_hash__ = Some(map_.next_value()?);
}
GeneratedField::PenumbraAssetId => {
if penumbra_asset_id__.is_some() {
return Err(serde::de::Error::duplicate_field("penumbraAssetId"));
Expand All @@ -534,8 +501,6 @@ impl<'de> serde::Deserialize<'de> for DenomMetadata {
display: display__.unwrap_or_default(),
name: name__.unwrap_or_default(),
symbol: symbol__.unwrap_or_default(),
uri: uri__.unwrap_or_default(),
uri_hash: uri_hash__.unwrap_or_default(),
penumbra_asset_id: penumbra_asset_id__,
})
}
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
Loading

0 comments on commit 7a4ccef

Please sign in to comment.