Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct derivation of Penumbra asset ID #4

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/tools/compiler/target
.DS_Store
/.idea
62 changes: 25 additions & 37 deletions registry/penumbra-testnet-deimos-6.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@
"exponent": 6
}
],
"base": "uosmo",
"display": "osmo",
"base": "transfer/channel-0/uosmo",
"display": "transfer/channel-0/osmo",
"name": "Osmosis",
"symbol": "OSMO",
"penumbraAssetId": {
"inner": "pjiYlm5+VallEe+wo+t8QNFsNKUyPtRB3AFvi0Cb6AI="
"inner": "jIowYEpoMr+LQYqjDVEnQO6hyzb9raVxbO1GLyDxlhI="
},
"images": [
{
Expand All @@ -221,12 +221,12 @@
"exponent": 6
}
],
"base": "uion",
"display": "ion",
"base": "transfer/channel-0/uion",
"display": "transfer/channel-0/ion",
"name": "Ion",
"symbol": "ION",
"penumbraAssetId": {
"inner": "KCzsvepTyhh+1zBj5xaBf2+mLoFV1n/YD55xRDN3kAw="
"inner": "KX8cjRGFpZUkZCwCtUX8Pi2lEyO5g0oPVr8WhsLgkwg="
},
"images": [
{
Expand All @@ -245,12 +245,12 @@
"exponent": 6
}
],
"base": "factory/osmo1zlkzu72774ynac53necz46u4ycqtp36wedrar0/willyz",
"display": "willyz",
"base": "transfer/channel-0/factory/osmo1zlkzu72774ynac53necz46u4ycqtp36wedrar0/willyz",
"display": "transfer/channel-0/willyz",
"name": "Willyz",
"symbol": "WILLYZ",
"penumbraAssetId": {
"inner": "nhVpxXo2RTn91ldkmDlPWogWZPH7PfLDq813YUo2TRE="
"inner": "ra98J77CX10Us2s6+d7bebfpm1Q3+UOycPfaaEeeuAY="
},
"images": [
{
Expand All @@ -263,66 +263,57 @@
"description": "The controlled staking asset for Noble Chain",
"denomUnits": [
{
"denom": "transfer/channel-3/ustake",
"aliases": [
"microstake"
]
"denom": "transfer/channel-3/ustake"
},
{
"denom": "transfer/channel-3/stake",
"exponent": 6
}
],
"base": "ustake",
"display": "stake",
"base": "transfer/channel-3/ustake",
"display": "transfer/channel-3/stake",
"name": "Stake",
"symbol": "STAKE",
"penumbraAssetId": {
"inner": "W+FJMVYhwDLC0dOa5OkDTpxyHUfjO6f6BhsrwHltjgk="
"inner": "hGwO3SuE1/D05ooLMUVVe7XvYbAFnxAUbIRIZdG3TwI="
}
},
{
"description": "Love is a test tokenfactory asset controlled by the Strangelove Team",
"denomUnits": [
{
"denom": "transfer/channel-3/ulove",
"aliases": [
"microlove"
]
"denom": "transfer/channel-3/ulove"
},
{
"denom": "transfer/channel-3/love",
"exponent": 6
}
],
"base": "ulove",
"display": "love",
"base": "transfer/channel-3/ulove",
"display": "transfer/channel-3/love",
"name": "Love",
"symbol": "LOVE",
"penumbraAssetId": {
"inner": "IeuQ1Y5T62mLaez/2WaDLm6e8CbDw9E4WJpe6Q9++AE="
"inner": "Hqn6gTCqE7mCBsVa4agsTFmrO0Rip5xmLcipnGKH9AI="
}
},
{
"description": "USD Coin",
"denomUnits": [
{
"denom": "transfer/channel-3/uusdc",
"aliases": [
"microusdc"
]
"denom": "transfer/channel-3/uusdc"
},
{
"denom": "transfer/channel-3/usdc",
"exponent": 6
}
],
"base": "uusdc",
"display": "usdc",
"base": "transfer/channel-3/uusdc",
"display": "transfer/channel-3/usdc",
"name": "USD Coin",
"symbol": "USDC",
"penumbraAssetId": {
"inner": "ziENb4v2dxNHmbUzRAVK/tuDL7gtVaJpA8ZdEIkh0Qk="
"inner": "CKBQapu+DkQpsKyTfKESLTV19/NPWR5sNZtvQsd3Hw8="
},
"images": [
{
Expand All @@ -334,22 +325,19 @@
"description": "USDLR is a fiat-backed stablecoin issued by Stable. Stable pays DeFi protocols who distribute USDLR.",
"denomUnits": [
{
"denom": "transfer/channel-3/uusdlr",
"aliases": [
"microusdlr"
]
"denom": "transfer/channel-3/uusdlr"
},
{
"denom": "transfer/channel-3/usdlr",
"exponent": 6
}
],
"base": "uusdlr",
"display": "usdlr",
"base": "transfer/channel-3/uusdlr",
"display": "transfer/channel-3/usdlr",
"name": "USDLR by Stable",
"symbol": "USDLR",
"penumbraAssetId": {
"inner": "nd4l/VXn/XaePOgpqr9V/JN010HaGi1svkjMLrgFOAA="
"inner": "+jDercxZxs90BjC91PrWyA53/p7uN3ZcSJj3N0mHjhI="
},
"images": [
{
Expand Down
51 changes: 47 additions & 4 deletions tools/compiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tools/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ regress = "0.9.1"
reqwest = { version = "0.12.3", features = ["json"] }
thiserror = "1.0.58"
tokio = { version = "1.37.0", features = ["full"] }
tracing-subscriber = "0.3"
tracing = "0.1"
1 change: 0 additions & 1 deletion tools/compiler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod error;
pub mod github;
pub mod metadata;
pub mod parser;
pub mod processor;
pub mod querier;
1 change: 1 addition & 0 deletions tools/compiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ use penumbra_registry::processor::generate_registry;

#[tokio::main]
async fn main() -> AppResult<()> {
tracing_subscriber::fmt::init();
generate_registry().await
}
59 changes: 0 additions & 59 deletions tools/compiler/src/metadata.rs

This file was deleted.

9 changes: 5 additions & 4 deletions tools/compiler/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fs;
use std::path::Path;

use anyhow::anyhow;
use penumbra_proto::penumbra::core::asset::v1 as pb;
use penumbra_asset::asset::Metadata;
use serde::{Deserialize, Serialize};

use crate::error::AppResult;
Expand All @@ -12,7 +12,7 @@ use crate::error::AppResult;
pub struct ChainConfig {
pub chain_id: String,
pub ibc_assets: Vec<IbcConfig>,
pub native_assets: Vec<pb::Metadata>,
pub native_assets: Vec<Metadata>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
Expand Down Expand Up @@ -48,7 +48,7 @@ pub fn get_chain_configs() -> AppResult<Vec<ChainConfig>> {
fs::create_dir_all(registry_dir)?;
let chain_dirs = fs::read_dir(LOCAL_INPUT_DIR)?;

chain_dirs
Ok(chain_dirs
.into_iter()
.map(|dir_entry| -> AppResult<ChainConfig> {
let chain_path = dir_entry?.path();
Expand All @@ -74,5 +74,6 @@ pub fn get_chain_configs() -> AppResult<Vec<ChainConfig>> {
};
Ok(chain_config)
})
.collect()
.filter_map(|result| result.ok())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to throw if the user did not set up the file structure correctly? Wouldn't this mean it kinda would silently fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I did this along the way to starting towards having it consume a git submodule and change the input directory structure, which I abandoned and then wrote up as a follow on issue. Getting output of some kind felt (feels) more important

.collect())
}
Loading
Loading