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

0stake after undelegating from validator #2137

Open
cgilbe27 opened this issue Jan 2, 2025 · 6 comments
Open

0stake after undelegating from validator #2137

cgilbe27 opened this issue Jan 2, 2025 · 6 comments
Labels
P: Nice to have / Low prio Lower priority item

Comments

@cgilbe27
Copy link
Contributor

cgilbe27 commented Jan 2, 2025

This is kind of 2 bugs

The first bug is that validators are still displayed as staked to even though they don't have any stake assigned
image

As a result of not having anything staked..

When you withdrawal rewards from all current validators you see:
image
image

@Unique-Divine
Copy link
Member

Unique-Divine commented Jan 6, 2025

Seems solvable client-side with a simple .filter statement where we ignore delegations of amount 0

@cgilbe27
Copy link
Contributor Author

cgilbe27 commented Jan 6, 2025

This will only solve this issue for our first party client, any other client (explorers will also see this issue, See here: https://nibiru.explorers.guru/account/nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5#:~:text=Time-,Delegations,-Delegations)


image

Rewards have a non-zero amount from the built-in cosmos tx, and it's impossible to make this zero even after claiming

import { setupDistributionExtension, } from "@cosmjs/stargate"

`this.nibiruExtensions = StargateQueryClient.withExtensions(
  tmClient,
  setupDistributionExtension,
  setupGovExtension,
  setupStakingExtension,
  setupIbcExtension,
  setupWasmExtension,
  setupAuthExtension,
  setupNibiruExtension
)`

const resp = await signingClient.nibiruExtensions.distribution.delegationTotalRewards(address)

For my account it's the Nodes.Guru validator
"nibivaloper1hvt68he6uvadnk73rjy6hg7a4u2myud5yhj3ae"

Client-side fix here: https://github.com/NibiruChain/web-app/pull/1251

@cgilbe27
Copy link
Contributor Author

cgilbe27 commented Jan 6, 2025

Also related, calling reward withdrawal when most are minimal non-zero numbers
image

Raw log: (Note, all validators are returning 0stake here, not 0unibi)

"[{\"msg_index\":0,\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\"},{\"key\":\"sender\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"},{\"key\":\"module\",\"value\":\"distribution\"}]},{\"type\":\"withdraw_rewards\",\"attributes\":[{\"key\":\"amount\",\"value\":\"0stake\"},{\"key\":\"validator\",\"value\":\"nibivaloper1xwh38k5kulrfglt34qqmnsrrjg788d4azq6e5u\"},{\"key\":\"delegator\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"}]}]},{\"msg_index\":1,\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\"},{\"key\":\"sender\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"},{\"key\":\"module\",\"value\":\"distribution\"}]},{\"type\":\"withdraw_rewards\",\"attributes\":[{\"key\":\"amount\",\"value\":\"0stake\"},{\"key\":\"validator\",\"value\":\"nibivaloper140l6y2gp3gxvay6qtn70re7z2s0gn57zj8exm0\"},{\"key\":\"delegator\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"}]}]},{\"msg_index\":2,\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\"},{\"key\":\"sender\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"},{\"key\":\"module\",\"value\":\"distribution\"}]},{\"type\":\"withdraw_rewards\",\"attributes\":[{\"key\":\"amount\",\"value\":\"0stake\"},{\"key\":\"validator\",\"value\":\"nibivaloper1hvt68he6uvadnk73rjy6hg7a4u2myud5yhj3ae\"},{\"key\":\"delegator\",\"value\":\"nibi1ytf8uvxjx0guxcj7mxs9x8xw5suters539dxp5\"}]}]}]"

@cgilbe27
Copy link
Contributor Author

cgilbe27 commented Jan 6, 2025

Investigate import { setupDistributionExtension, } from "@cosmjs/stargate"

@cgilbe27
Copy link
Contributor Author

cgilbe27 commented Jan 6, 2025

"/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest"

@cgilbe27
Copy link
Contributor Author

Initial review by Kevin found partial share amount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P: Nice to have / Low prio Lower priority item
Projects
Status: ⚡ Building 🧱
Development

No branches or pull requests

3 participants
@cgilbe27 @Unique-Divine and others