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

Add Priority Scores #96

Merged
merged 13 commits into from
Oct 18, 2024
Merged

Add Priority Scores #96

merged 13 commits into from
Oct 18, 2024

Conversation

JasonMHasperhoven
Copy link
Contributor

Copy link

changeset-bot bot commented Oct 17, 2024

⚠️ No Changeset found

Latest commit: 01e9c88

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JasonMHasperhoven JasonMHasperhoven marked this pull request as ready for review October 17, 2024 15:33
@JasonMHasperhoven JasonMHasperhoven requested review from grod220 and conorsch and removed request for grod220 October 17, 2024 15:33
Copy link
Contributor

@grod220 grod220 left a comment

Choose a reason for hiding this comment

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

Great job on your first Rust PR! 🎊

@@ -0,0 +1,5 @@
---
'@penumbra-labs/registry': patch
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: this should be a minor bump given it is a forward-compatible new feature

pb_metadata.priority_score = priority_scores_by_base
.get(&pb_metadata.base)
.copied()
.unwrap_or(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: if it is not in the HashMap, don't think we should add any score to the metadata object. Aka:

    // Add priority score if available
    if let Some(score) = priority_scores_by_base.get(&pb_metadata.base) {
        pb_metadata.priority_score = *score;
    }

@@ -27,6 +28,7 @@ pub struct ChainConfig {
pub ibc_connections: Vec<IbcInput>,
pub native_assets: Vec<Metadata>,
pub canonical_numeraires: Vec<String>,
pub priority_scores_by_base: HashMap<String, u64>,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Can you alias the string? Aka:

type BaseDenom = String

pub priority_scores_by_base: HashMap<BaseDenom, u64>,

"transfer/channel-4/factory/osmo1q77cw0mmlluxu0wr29fcdd0tdnh78gzhkvhe4n6ulal9qvrtu43qtd0nh8/crazyhorse": 1,
"transfer/channel-4/uosmo": 14,
"transfer/channel-4/factory/osmo10n8rv8npx870l69248hnp6djy6pll2yuzzn9x8/BADKID": 1,
"upenumbra": 99,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: can you move this to the top? Actually, can we rank these be priority scores descending?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, I'd make this 999999999999

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I think a good approach is:

  • only specify overrides (if unspecified, will use a default score of 0)
  • specify assets top to bottom
  • leave spaces in the numbering (can put UM as 1000000, other stuff at 100000)

"transfer/channel-4/factory/osmo1pfyxruwvtwk00y8z06dh2lqjdj82ldvy74wzm3/WOSMO": 14,
"transfer/channel-4/factory/osmo19hdqma2mj0vnmgcxag6ytswjnr8a3y07q7e70p/wLIBRA": 1,
"transfer/channel-4/factory/osmo14mafhhp337yjj2aujplawz0tks6jd2lel4hkwz4agyzhvvztzaqsqzjq8x/alloyed/allTRX": 18,
"transfer/channel-4/factory/osmo1q77cw0mmlluxu0wr29fcdd0tdnh78gzhkvhe4n6ulal9qvrtu43qtd0nh8/cac": 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Is there a reason why we would add a priority score of 1 to any? Feels like we can drop it entirely if it's that low

@JasonMHasperhoven JasonMHasperhoven merged commit 4a563c9 into main Oct 18, 2024
7 checks passed
@JasonMHasperhoven JasonMHasperhoven deleted the priorityscores branch October 18, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants