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

deactivating stake address detected as inactive #15

Closed
roccomuso opened this issue Oct 24, 2024 · 5 comments
Closed

deactivating stake address detected as inactive #15

roccomuso opened this issue Oct 24, 2024 · 5 comments

Comments

@roccomuso
Copy link
Contributor

Using this lib at the moment this deactivating stake address 3pcXwjYupqdowaYLJtYxF4SRCxAwCtwVR4VXg22fg5gp is detected as inactive.

I think this is a bug.

@joncinque
Copy link
Collaborator

Do you have a test showing this? I just tried this with the v1 lib:

  const connection = new Connection('https://api.mainnet-beta.solana.com');
  let stake = new PublicKey('3pcXwjYupqdowaYLJtYxF4SRCxAwCtwVR4VXg22fg5gp');
  let status = await getStakeActivation(connection, stake);
  console.log(status);

And this with the v2 lib:

    const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
    let stake = '3pcXwjYupqdowaYLJtYxF4SRCxAwCtwVR4VXg22fg5gp';
    let status = await getStakeActivation(rpc, stake as Address);
    console.log(status);

And they both give:

{ status: 'deactivating', active: 7717120n, inactive: 0n }

@steveluscher
Copy link
Contributor

Just a hunch (without actually having tried) but I bet sometimes deactivationEpoch is a string

https://github.com/anza-xyz/agave/blob/c14034ed289fcae9ca9e5f05abde329a21c1a65a/account-decoder/src/parse_stake.rs#L121

And sometimes it's a number

https://github.com/anza-xyz/agave/blob/c14034ed289fcae9ca9e5f05abde329a21c1a65a/sdk/program/src/stake/state.rs#L614-L615

…depending on where you got it from.

@steveluscher
Copy link
Contributor

@roccomuso, are you perhaps skipping the step that passes parsed stake account data through this code?

stake: BigInt(
parsedData.value.data.parsed.info.stake.delegation.stake
),
activationEpoch: BigInt(
parsedData.value.data.parsed.info.stake.delegation.activationEpoch
),
deactivationEpoch: BigInt(
parsedData.value.data.parsed.info.stake.delegation
.deactivationEpoch
),

@roccomuso
Copy link
Contributor Author

It was a type check error my side.
I saw you're already casting it to bigint, so should be ok

@joncinque
Copy link
Collaborator

Ok great! Closing

@joncinque joncinque closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2024
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 a pull request may close this issue.

3 participants