Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Setup script fails due to id balance 0 #6

Open
0xNilsOlav opened this issue Oct 6, 2021 · 6 comments · Fixed by #7
Open

Setup script fails due to id balance 0 #6

0xNilsOlav opened this issue Oct 6, 2021 · 6 comments · Fixed by #7

Comments

@0xNilsOlav
Copy link
Contributor

Currently the setup script is failing with the following log output:

Requesting SOL for Alice...
Requesting SOL for Bob...
Creating Mint X...
Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.

Script runs successfully after airdropping sol to the id public key address, so think the fix is to add another requestAirdrop to that address before creating the mint.

0xNilsOlav added a commit to 0xNilsOlav/solana-escrow that referenced this issue Oct 6, 2021
To avoid error detailed in [this issue](paul-schaaf#6)
@paul-schaaf
Copy link
Owner

hi @0xNilsOlav, thank you for the issue and PR!

However, I'm not able to reproduce this. What system are you on? Have you run npm run start-validator <PROGRAM_LOCATION> before running npm run setup? The custom start-validator command should airdrop SOL to the ID public key. (It does so with the --mint arg on the Solana start-validator command).

@0xNilsOlav
Copy link
Contributor Author

Ah, that makes sense - I started the validator manually and then ran npm run all as instructed in the scripts README.

I'm on an M1 mac and needed to build from source with the 1.7 branch because of that, so needed to run solana-test-validator from that directory rather than the system one installed to .local/share/solana/install. That's a me problem, but IMO it would be cleaner to have the start-validator script just start the validator rather than also doing some initialization.

@0xNilsOlav
Copy link
Contributor Author

Some background on how I got to this point:

I started by trying to use the UI in the guide (which is why I had started the test validator manually) and thought I had everything set up correctly, but got the error below and didn't know what to do with that so thought I'd try the script instead.

failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x4

(the guide is awesome, btw - really great introduction to programming on Solana!)

@paul-schaaf
Copy link
Owner

paul-schaaf commented Oct 10, 2021

@0xNilsOlav I merged your PR but I'm still gonna keep the initialization in the script as well. If you dont want initialization, you can just use the solana-test-validator command after all. That said, I'll rename it to setup-validator to hint at the fact there's more happening than just starting the validator

Have you managed to find the cause of the error with the help of the scripts?

@weihwork
Copy link

I have the same problem with my mac m1, because there is something wrong with solana-test-validator, so i use devnet.

I use 'solana airdrop instruction' get sol for id, alice and bob first, and use 'solana program deploy' instruction load solana_escrow.so program. Because of escrow program id changed, so replace keys/program_pub.json with the pubkey of deploy/solana_escrow-keypair.json.

Finally, change setup.ts,alice.ts,bob.ts connection with https://api.devnet.solana.com, delete setup.ts requestAirdrop instruction.

npm run setup --> npm run alice --> npm run bob.

@paul-schaaf
Copy link
Owner

Thanks for the feedback @weihwork , I'm adjusting the code so it can be used on different clusters along with some other changes to make you do less work

laion01 pushed a commit to laion01/solana-escrow that referenced this issue Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants