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

Experiment with symbols for delegation tokens #558

Merged
merged 3 commits into from
Feb 22, 2024
Merged

Conversation

hdevalence
Copy link
Member

This PR experiments with symbols for delegation tokens. Two possible approaches are illustrated:

  1. The extension's asset registry can be augmented with the validator-specific token info, as I did for the two main testnet validators.
  2. The extension could auto-create a symbol for the delegation token, but we must be very very careful about this, because the symbol field is shown to users and it is potentially attacker-controlled. For instance, if we just read the label off the chain, someone could spoof another validator's identity without consequence.

However, this seems like a good place to start.

@hdevalence hdevalence requested a review from grod220 February 16, 2024 08:04
Copy link
Collaborator

@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.

I think it makes sense to do both of these methods. Either:

A) They are a known/trusted validator. We add them to our local registry list with their company logo in images array. This gets pre-loaded into our db.
B) They are an unknown validator. If a user has a delegation token from them, we don't find it in our db, so we assemble the metadata w/ the symbol in the block processor. If we can trust the id in metadata.display then we are safe.

You're taking off for holiday soon, happy to take this PR over on Monday if you'd like

packages/query/src/block-processor.ts Outdated Show resolved Hide resolved
packages/query/src/block-processor.ts Outdated Show resolved Hide resolved
packages/query/src/block-processor.ts Outdated Show resolved Hide resolved
@grod220 grod220 self-assigned this Feb 19, 2024
@grod220 grod220 force-pushed the delegation-token-symbol branch from 08b2860 to ef98a2d Compare February 22, 2024 15:17
hdevalence and others added 3 commits February 22, 2024 21:30
This PR experiments with symbols for delegation tokens. Two possible approaches are illustrated:

1. The extension's asset registry can be augmented with the validator-specific token info, as I did for the two main testnet validators.
2. The extension could auto-create a symbol for the delegation token, but we must be very very careful about this, because the `symbol` field is shown to users and it is potentially attacker-controlled. For instance, if we just read the label off the chain, someone could spoof another validator's identity without consequence.

However, this seems like a good place to start.
This is better because it doesn't mislead the user into thinking that the number of tokens for the asset is the value of UM they represent.
@grod220 grod220 force-pushed the delegation-token-symbol branch from ef98a2d to 5551ec5 Compare February 22, 2024 20:30
@grod220 grod220 merged commit 209f264 into main Feb 22, 2024
7 checks passed
@grod220 grod220 deleted the delegation-token-symbol branch February 22, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants