7

Trying to deploy a program to solana devnet.

I was using solana program deploy ./path/xxxx.so -u devnet

And I got multiple lines of

msg 21AbKBwMcsDR4DciR6Z69X6vrqVj7uHKg2Wf1ap8FB1J
msg 21AbKBwMcsDR4DciR6Z69X6vrqVj7uHKg2Wf1ap8FB1J
msg 21AbKBwMcsDR4DciR6Z69X6vrqVj7uHKg2Wf1ap8FB1J
msg 21AbKBwMcsDR4DciR6Z69X6vrqVj7uHKg2Wf1ap8FB1J
msg 21AbKBwMcsDR4DciR6Z69X6vrqVj7uHKg2Wf1ap8FB1J

It gave me this error in the end

Error: Custom: Invalid blockhash

Tried search online but didn't get any useful informations

Sveargith
  • 409
  • 1
  • 4
  • 8

8 Answers8

6

I was able to resolve this error by reverting to earlier versions of solana-cli and anchor-cli

solana-cli 1.8.0 (src:4a8ff62a; feat:1813598585)
anchor-cli 0.18.2
rustc 1.57.0 (f1edd0429 2021-11-29)

I also shared the above solution in this related github issue

One guess I have is that ExitStatus(unix_wait_status(256)) (which was in my error logs) could be a "time out error" from waiting too long due to slower deployment validation.

I did notice my deployments using later versions (solana-cli 1.9.1, anchor-cli 0.20.1) being significantly slower, especially for larger programs (my small program deployments were still working fine). These were the versions that showed similar "msg" logging as OP.

UPDATE:

Nowadays, my most fool proof solution is to run the snippet below before deployments

sh -c "$(curl -sSfL https://release.solana.com/v1.8.13/install)"
3

For deploying to devnet via Anchor, the error I got:

Error: Custom: Invalid blockhash
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

I have solved this:

Local npm package: @project-serum/anchor 0.20.1
Solana program dependencies: anchor-lang 0.20.1, anchor-spl 0.20.1, solana-program 1.9.4
deploy to devnet: failed

Local npm package: @project-serum/anchor 0.19.0
Solana program dependencies: anchor-lang 0.19.0, anchor-spl 0.19.0, solana-program 1.9.4
deploy to devnet: successful or failed

Local npm package: @project-serum/anchor 0.18.2
Solana program dependencies: anchor-lang 0.18.2, anchor-spl 0.18.2, solana-program 1.9.4
deploy to devnet: successful or failed

in all cases, the global environment is the same:

Rust 1.57.0
solana-cli 1.9.4
@project-serum/anchor-cli 0.20.1

it seems sometimes the transaction may fail and those transactions include program deployment. see reference: https://www.brianfriel.xyz/resending-dropped-transactions-on-solana/

Russo
  • 2,186
  • 2
  • 26
  • 42
1

This seems to be only because of anchor's version, I had the following versions installed:

Rust 1.59.0
solana-cli 1.9.6
anchor-lang 0.22.1

I couldn't deploy to devnet because of

Error: Custom: Invalid blockhash
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

So I just changed anchor-lang to 0.22.0 and all worked well.

Hadi Saleh
  • 21
  • 1
0

That's very strange, and not the normal output that you should get while deploying a program. Have you tried updating to the latest Solana SDK, which is 1.9.2 at the time of writing? More docs at https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool

I just tried this on devnet, and got the following output:

$ solana program deploy path/to/program.so -u devnet
Finding leader nodes...
[x/y] Transactions sent...
[x/y] Transactions confirmed. Retrying in z blocks.
Program Id: 6sxk3XpYapcRnpSwRKFS1nGK9MJpm8Jkb9aofnBcG1p8
Jon C
  • 7,019
  • 10
  • 17
  • Interesting, yes I think I'm using the latest solana sdk, I'm just following the testing sections of metaplex https://github.com/metaplex-foundation/metaplex#testing , there is a step to deploy the program to devnet – Sveargith Dec 27 '21 at 10:08
0

For Mac M1,

Rust 1.57.0
solana-cli 1.8.0
@project-serum/anchor-cli 0.20.1

these tools' versions work. I tried myself.

abhi3700
  • 156
  • 1
  • 8
0

https://github.com/project-serum/anchor/issues/1157#issuecomment-1065828414 try solana cli 1.8.12 as 1.9.* seems to have issues deploying on devnet

noooooooob
  • 1,872
  • 3
  • 21
  • 27
0

I had similar error in chainlink contract github example. I changed this line in Execute Struct

pub system_program:Program<'info,System>,

to this:

#[account(address=system_program::ID)]
/// CHECK:
pub system_program:AccountInfo<'info>,

I had to import system_program

use anchor_lang::solana_program::system_program;
Yilmaz
  • 35,338
  • 10
  • 157
  • 202
0

for me, to solve it my solana-cli version was 1.9.4 and I just updated with

solana-install update

and it's downgraded to 1.8.16 and deployed my program without any problem. before this I can't deploy using anchor test(process) or solana program deploy.

Also, If you upgrade to one of the 1.10.X versions the issue will fix.

Setmax
  • 946
  • 6
  • 10