Skip to content

solana-staking: update deposit-to-specific-validator example for mandatory ephemeral_seed (staker breaking change) #25

Description

@cpascoli

Context

The SOL staker program has a breaking change from TruFin-io/smart-contracts-solana#147 (ephemeral-seed poisoning DoS fix). deposit_to_specific_validator now takes a required ephemeral_seed: u64 argument, and the ephemeral stake account must be the PDA derived from that seed.

Devnet was upgraded on 2026-07-24 (program 6EZAJVrNQdnBJU6ULxXSDaEoK6fN7C3iXTCkZKRWDdGM), so the published example no longer works as written.

What to change

In packages/solana-staking:

  1. src/scripts/anchor/deposit-to-specific-validator.ts — generate a fresh random u64 seed per call, derive the ephemeral stake account PDA under the SPL Stake Pool program (seeds = ["ephemeral", stake_pool_pubkey, seed as u64 LE (8 bytes)]), pass the seed as the second instruction argument and the PDA as ephemeralStakeAccount.
  2. src/idl/staker.json — refresh to the new IDL.
  3. src/docs/deposit-to-specific-validator.md — update the walkthrough to explain the seed: it must be random/fresh on every call so the pool-global ephemeral address is never fixed (that is the point of the DoS fix — a poisoned address is simply abandoned by choosing a different seed).

Reference

Working version: scripts/deposit-to-specific-validator.ts in TruFin-io/smart-contracts-solana.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions