Error: Custom: Invalid blockhash when solana program deploy - blockchain

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

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)"

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/

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.

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

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.

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

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;

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.

Related

Cannot deploy the program to devnet with anchor

First, I tried with deploying on localhost with anchor deploy it works fine. But then I changed the cluster to devnet, changed Anchor.toml and lib.rs file with the address I got after anchor build. Then tried with anchor deploy --provider.cluster devnet
Changed the solana cluster also solana config set --url https://api.devnet.solana.com, then solana program deploy /target/deploy/voter.so. Still getting the error for both of the methods.
Deploying workspace: https://api.devnet.solana.com
Upgrade authority: /home/XXXXXX/.config/solana/id.json
Deploying program "voter"...
Program path: /home/<user>/workspace/voter/target/deploy/voter.so...
Error: Account xxxx is not an upgradeable program or already in use
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.
First check if devnet is up and running with: https://status.solana.com
Then check if you have SOL: solana balance
^Usually it's one of those two!
I hope this helps!
The error gives the info: Error: Account xxxx is not an upgradeable program or already in use
Check the address you're trying to deploy to. You may need to change the program address to a new one if it's already being used by another program or user.

How to fix build error because Install pods using EAS build EXPO?

I'm trying to build an IOS app using EAS service expo, but when I try to build, there is an error while install pods on build details expo. And this is the error.
Unable to find a specification for `UMTaskManagerInterface` depended upon by `EXLocation`
I try to install pod by npm i pod-install but still get error. Is this because I build on Windows, or what should I do to fix this error? I also try to find the error in GitHub forum, and it's say adding path pod in ios/Podfile which I can't find it in my expo project. Where is ios/Podfile file located in expo project?
This is the full error
Installing pods
Using Expo modules
Auto-linking React Native modules for target `MMS`: RNCAsyncStorage, RNCCheckbox, RNDateTimePicker, RNGestureHandler, RNPermissions, RNReanimated, RNScreens, react-native-safe-area-context, and react-native-viewpager
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
CocoaPods 1.11.2 is available.
To update use: `sudo gem install cocoapods`
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.2
[!] Unable to find a specification for `UMTaskManagerInterface` depended upon by `EXLocation`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
[stderr] [!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `2EE81B3C866A4A13B6460929` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
pod exited with non-zero code: 1
Edit*
i try using expo build:ios-> archive is working perfectly. why using eas build -p ios i got that error?

npx mrm lint-staged erroring out with 'Preset "default" not found."

Example of the issue:
❯ npx mrm lint-staged
npx: installed 298 in 9.141s
Preset “default” not found.
We’ve tried to load “mrm-preset-default” and “default” npm packages.
Can't run this command and I don't know why!
The problem is within mrm which is currently in version 3 that seems to be incompatible with lint-staged, to fix this you got to specify mrm version 2 by running npx mrm#2 lint-staged

appcfg.py request_logs certificate verify failed (_ssl.c:661)

We've been using appcfg.py request_logs to download GAE logs, every once in a while it throws the error:
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
But after a few times trying it works out, sometimes also it works after updating gcloud using gcloud components update. We thought it might be some network throttling issue of some kind and didn't give it enough thought. Lately though, we're trying to figure out what is causing this.
The full command we use is:
appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0 all_logs.log --append --no_cookies
It seems the error is related to httplib2 library, but since it is part of the appcfg.py calls we're not sure we should tamper with something within its calls
Versions:
Python 2.7.13
Google Cloud SDK 196.0.0
app-engine-python 1.9.67
This has become more persistent now and I couldn't download logs for a few days now no matter how many times I try.
Looking at the download logs command I tried the same command again but without the --no_cookies flag to see what would happen.
appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0 all_logs.log --append
I got the error:
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u'e~testapp').
--- end server output ---
Which lead me to the answer provided here https://stackoverflow.com/a/34694577/1394228 by #ninjahoahong. This worked for me and logs where downloaded from first trial in case someone faces the same issue
There's also this Google Group post which I didn't try but seems like it does the same thing.
Not sure if removing the file ~/.appcfg_oauth2_tokens would have other effects, yet to find out.
Update:
I also found out that my httplib2 located at /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2 was version = "0.7.5", I upgraded it to version = '0.11.3' using target location(directory) upgrade command:
sudo pip2 install --upgrade httplib2 -t /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2/

I am deploying with 'eb deploy' in aws but getting the following error

I am using 'eb deploy' for deploying my commits but getting this error
WARNING: You have uncommitted changes.
Creating application version archive "6fea".
Uploading: [##################################################] 100% Done...
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-10d1f9ec] Command failed on instance. Return code: 126
Output: /bin/sh: ./scripts/update-ftp-dns.sh: /bin/sh^M: bad interpreter: No such file or directory.
container_command 07-update_ftp_dns in .ebextensions/03-vsftpd.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
INFO: New application version was deployed to running EC2 instances.
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.
Please help me to solve this.
The error message is a bit hidden, but it's in there:
Output: /bin/sh: ./scripts/update-ftp-dns.sh: /bin/sh^M: bad interpreter: No such file or directory.
If I had to guess, you have a line break with both a line feed and a carriage return in it. It's treating the carriage return character as if it's part of the name of the executable.
Make sure that you've converted the /scripts/update-ftp-dns.sh script so that it uses Unix line endings only.
See ./configure : /bin/sh^M : bad interpreter
I had something similar, and the cause was having Git's autocrlf value set to true. What this means is that Git will convert the file to a Windows-formatted one when git checkout is run - which unfortunately means that the Elastic Beanstalk tool tries to upload Windows-formatted files to your Linux server, which will manifest in errors like this.
I fixed it by switching autoclrf to false, and committing the relevant file again. Do be aware of the repercussions of this however.