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

getStakeActivation rpc method incorrect inactive balance #35111

Closed
xdzurman opened this issue Feb 6, 2024 · 2 comments · Fixed by anza-xyz/agave#69
Closed

getStakeActivation rpc method incorrect inactive balance #35111

xdzurman opened this issue Feb 6, 2024 · 2 comments · Fixed by anza-xyz/agave#69
Labels
community Community contribution

Comments

@xdzurman
Copy link

xdzurman commented Feb 6, 2024

Problem

When funds are sent to an active stake account (by mistake or by e.g. JITO pools), the result of getStakeActivation remains unchanged. While active stake balance remains correct, I'd expect the inactive stake balance to not be 0, but be equal to the sent amount. Example:

before:

    "result": {
        "active": 100000000,
        "inactive": 0,
        "state": "active"
    },

-- send 0.1 SOL to the stake account
after:

    "result": {
        "active": 100000000,
        "inactive": 0,
        "state": "active"
    },

However, this state would be expected:

    "result": {
        "active": 100000000,
        "inactive": 100000000,
        "state": "active"
    },

Proposed Solution

Do not hardcode "0" inactiveBalance if the stake account is in an 'active' state, but calculate the inactiveBalance correctly (e.g. balance - activeStake - rentAmount)

@CriesofCarrots
Copy link
Contributor

Good point. It looks like the deactivating and inactive cases already take the total lamports into account.
I have a PR up to make inactive_stake consistent across all states: #35116

The one case where my patch might be a little unintuitive is activating:

before:

"result": {
    "active": 0,
    "inactive": 1000000000,
    "state": "activating"
  }

Send 1 SOL to the stake account.
after:

"result": {
    "active": 0,
    "inactive": 2000000000,
    "state": "activating"
  }

Epoch boundary passes.
then:

"result": {
    "active": 1000000000,
    "inactive": 1000000000,
    "state": "active"
  }

ie. just because an account is "activating" does not been the total "inactive" amount is what will activate. I think this is actually more correct.

@xdzurman
Copy link
Author

xdzurman commented Feb 7, 2024

Thanks for the speedy response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment