solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
13.21k stars 4.29k forks source link

Run a local validator fail: Failed to get validator identity over RPC #34932

Closed chen4903 closed 8 months ago

chen4903 commented 9 months ago

To set a local validator, I follow the solana dev doc and use this command: solana-test-validator. But it fails:

levi@LEVI-104-PC:/opt/solana/solana-local-validator$ solana-test-validator
--faucet-sol argument ignored, ledger already exists
Ledger location: test-ledger
Log: test-ledger/validator.log
⠓ Initializing...
Waiting for fees to stabilize 1...
Identity: 8tyfD7vG2shknYLoXWo9SQA3eNf8v8NMH5WvZnQTugnL
Genesis Hash: BaLEwHBR8Qhz7MW6xZnEffW5MT4XyrPDN2NVezyBC1nj
Version: 1.16.28
Shred Version: 52617
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
WebSocket PubSub URL: ws://127.0.0.1:8900
  RPC connection failure: error sending request for url (http://127.0.0.1:8899/): error trying to connect: tcp connect error: Canno
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)

I am sure there is no other process using the 8899 port. Perhaps reducing the version of solana-cli is effective, but it is not a long-term solution as Solana is constantly advancing. My specification:

Windows11, wsl2: ubuntu 20.04
solana-cli 1.16.28 (src:8a9f5026; feat:2294205250, client:SolanaLabs)

btw, I have set a proxy in ~/.bashrc:

export https_proxy="http://127.0.0.1:7890"
export http_proxy="http://127.0.0.1:7890"

When I delete the proxy configuration in ~/.bashrc and don't use vpn in windows, it can work. What should I do to work with the proxy configuration?

jakerumbles commented 8 months ago

This is also happening to me right now

jake@Jakes-MacBook-Pro vault % solana-test-validator --clone-upgradeable-program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s --url https://api.devnet.solana.com --reset
Ledger location: test-ledger
Log: test-ledger/validator.log
⠠ Initializing...                                                                                                                                                                                                                                                                                                                                                         Waiting for fees to stabilize 1...
⠒ Initializing...                                                                                                                                                                                                                                                                                                                                                         Waiting for fees to stabilize 2...
Identity: 3uLSdTzfGHaXwfzrd2mKA5CiWwreBrXoBCpNhR1TU6v4
Genesis Hash: 7B2vzms6FwnimuCQPfarFCUtJMRJGF9L26txbyTN8EXi
Version: 1.18.1
Shred Version: 52991
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
WebSocket PubSub URL: ws://127.0.0.1:8900
  RPC connection failure: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
t validator identity over RPC: error sending requestFailed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out

Works just fine if don't try to load in the Token Metadata Program. I've tried loading from mainnet beta, testnet, and devnet and none of them

jake@Jakes-MacBook-Pro vault % solana-test-validator --clone-upgradeable-program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s --url https://api.mainnet-beta.solana.com --reset
Ledger location: test-ledger
Log: test-ledger/validator.log
⠐ Initializing...                                                                                                                                                                                                                                                                                                                                                         Waiting for fees to stabilize 1...
Identity: EcbtGvT58MZYN9YWgCUDmGBssEaV4SKZQMELfxySmr2W
Genesis Hash: GfBipJDGqNUnrvBrZQ8ZZLrb3axfSg41eANcxCRKtpNo
Version: 1.18.1
Shred Version: 24575
Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899
WebSocket PubSub URL: ws://127.0.0.1:8900
  RPC connection failure: error sending request for url (http://127.0.0.1:8899/): operation timed out
Failed to get validator identity over RPC: error sending request for url (http://127.0.0.1:8899/): operation timed out

Also here's my test I'm trying to run on this test validator

describe("vault", () => {
  // Configure the client to use the local cluster.
  anchor.setProvider(anchor.AnchorProvider.env());
  const provider = anchor.AnchorProvider.env();

  const program = anchor.workspace.Vault as Program<Vault>;

  const [vaultInfoPDA, vaultInfoBump] = PublicKey.findProgramAddressSync(
    [anchor.utils.bytes.utf8.encode("SOLvault")],
    program.programId
  );

  const [mintPDA] = PublicKey.findProgramAddressSync(
    [Buffer.from("mint")],
    program.programId
  );

  const metadata = {
    name: "GEM Vault Receipt",
    symbol: "vGEM",
    uri: "https://raw.githubusercontent.com/solana-developers/program-examples/new-examples/tokens/tokens/.assets/spl-token.json",
    decimals: 9,
  };

  const tokenProgram = new PublicKey(
    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
  );

  const [tokenAccountPDA, tokenAccountBump] = PublicKey.findProgramAddressSync(
    [anchor.utils.bytes.utf8.encode("SOLmint")],
    program.programId
  );

  it("Is initialized!", async () => {
    // Derive the metadata account address.
    const [metadataAddress] = PublicKey.findProgramAddressSync(
      [
        Buffer.from("metadata"),
        TOKEN_METADATA_PROGRAM_ID.toBuffer(),
        mintPDA.toBuffer(),
      ],
      TOKEN_METADATA_PROGRAM_ID
    );

    const maxBalance = new BN(10 * LAMPORTS_PER_SOL);

    let signature = await program.methods
      .initialize(maxBalance, metadata)
      .accounts({
        metadata: metadataAddress,
        vaultInfo: vaultInfoPDA,
        payer: provider.publicKey,
        mint: mintPDA,
        rent: anchor.web3.SYSVAR_RENT_PUBKEY,
        systemProgram: anchor.web3.SystemProgram.programId,
        tokenProgram: tokenProgram,
        tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
      })
      .rpc();

    console.log(
      `View transaction: https://explorer.solana.com/tx/${signature}?cluster=custom`
    );
  });

No idea what's happening. I've just spent all day just trying to get a local node to have a metaplex program so I can continue on with my program development.

jakerumbles commented 8 months ago

Ok I just noticed on my phone that some AT&T malware network software was blocking something. I put it on the allow list and I think it may be working now?

github-actions[bot] commented 8 months ago

Hi @chen4903,

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of Solana itself.

Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with Solana itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask


This automated message is a result of having added the ‘question’ tag.

70mg commented 8 months ago

I'm getting the same issue. MacOS, following Solana's guide.

Screenshot 2024-03-07 at 15 53 34

Pretty sure no malware protection is getting in the way like for jakerumbles. I had to grant the terminal network access from a pop-up, but that's not showing up now. Lsof shows nothing running on port 8899.

70mg commented 8 months ago

I'm getting the same issue. MacOS, following Solana's guide.

Screenshot 2024-03-07 at 15 53 34

Pretty sure no malware protection is getting in the way like for jakerumbles. I had to grant the terminal network access from a pop-up, but that's not showing up now. Lsof shows nothing running on port 8899.

Nevermind, I worked it out. It was because I had a VPN running. My VPN has an option to allow access to devices on LAN, which I had turned off. Turning this on solved the issue.

happysammy commented 4 months ago

I'm encountering the same issue on MacOS, and it appears to be primarily a network problem. When I turn off my VPN, the issue is resolved.