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

Question: Is points the same as bonded amount? #1746

Closed
frankli-dev opened this issue Dec 15, 2023 · 9 comments
Closed

Question: Is points the same as bonded amount? #1746

frankli-dev opened this issue Dec 15, 2023 · 9 comments

Comments

@frankli-dev
Copy link
Contributor

frankli-dev commented Dec 15, 2023

Screenshot 2023-12-15 at 8 10 52 AM Screenshot_2023-12-15_at_8_52_59_AM

Here I can see the points label. I'm not sure what that means.

Is it the same as bonded amount?

@rossbulat
Copy link
Collaborator

Points are proportional to the balance of the pool unless there is a slash to the pool, in which case the same points will convert to less balance. We use points_to_balance runtime api to convert points to balances on staking dashboard.

@rossbulat
Copy link
Collaborator

@frankli-dev is this okay to close?

@frankli-dev
Copy link
Contributor Author

@rossbulat Thanks for your answer. Really appreciated.

One question. I setup substrate network & polkadot-staking-dashboard on my local and tried to bond 100k tokens but the bond amount shows 0.0028341238... that really doesn't make sense.

I checked the codebase and membership.points contains 100_000 but the balance with pointsToBalance function returns very small value.

If this is by a slash, I am not sure what slash there is. Because I just created a new network and new pool and then bonded. So not sure what kind of slashes there can be.

Can you explain further about this, please?

@rossbulat
Copy link
Collaborator

rossbulat commented Dec 18, 2023

Wow, that certainly is not a 1:1 ratio! It would be hard to tell what the issue is without looking at the setup, are you able to determine whether there indeed were slashes?

The initial ratio is defined by POINTS_TO_BALANCE_INIT_RATIO, which is set to 1. And the balance to points conversion logic can be found here.

@Ank4n @gpestana do you think it is worth investigating this further? If we can determine the issue @frankli-dev is facing then we could prevent this from occurring in the future by mentioning it in the docs.

@frankli-dev is your node setup public?

@frankli-dev
Copy link
Contributor Author

@rossbulat Thanks for sharing me the reference to points to balance logic.
But looks like the use of the function doesn't match on polkadot-staking-dashboard
https://github.com/paritytech/polkadot-staking-dashboard/blob/main/src/contexts/Pools/PoolMemberships/index.tsx#L105

const balance =
          (
            await api.call.nominationPoolsApi.pointsToBalance(
              membership.poolId,
              membership.points
            )
          )?.toString() || '0';

The first parameter is poolId but the sdk requires it as current_balance

fn balance_to_point(
		current_balance: BalanceOf<T>,
		current_points: BalanceOf<T>,
		new_funds: BalanceOf<T>,
	) -> BalanceOf<T> {

@frankli-dev
Copy link
Contributor Author

@rossbulat My node setup is not public. Sorry, I am not sure if I can do it

@frankli-dev
Copy link
Contributor Author

Maybe is this related to this one?
paritytech/polkadot-sdk#416
paritytech/polkadot-sdk#2706

@gpestana
Copy link

gpestana commented Dec 18, 2023

@frankli-dev the issue paritytech/polkadot-sdk#416 could be the problem in your setup, yes. Depending on the Balance type that is setup in your runtime. You can double-check in your runtime if the issue is solved by applying the fix paritytech/polkadot-sdk#2706 -- which is pretty simple -- and check if that fixes the issue.

@frankli-dev
Copy link
Contributor Author

@frankli-dev the issue paritytech/polkadot-sdk#416 could be the problem in your setup, yes. Depending on the Balance type that is setup in your runtime. You can double-check in your runtime if the issue is solved by applying the fix paritytech/polkadot-sdk#2706 -- which is pretty simple -- and check if that fixes the issue.

I also found that fix and it solved my issue. Hope it can be merged soon.

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

No branches or pull requests

3 participants