Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soroban-cli: unhandled error panick in invoke code #1067

Closed
leighmcculloch opened this issue Nov 6, 2023 · 0 comments · Fixed by #1068
Closed

soroban-cli: unhandled error panick in invoke code #1067

leighmcculloch opened this issue Nov 6, 2023 · 0 comments · Fixed by #1068
Labels
bug Something isn't working

Comments

@leighmcculloch
Copy link
Member

leighmcculloch commented Nov 6, 2023

This issue is lifting a report shared and experienced by someone else in Discord.

What version are you using?

I think it's v20.0.0-rc4, but can't be certain.

What did you do?

Hi folks, I'm working on the Soroban Quest, the first one "Hello World" compiles fine and deploys fine but I am unable to invoke. Here are the steps I took:

  1. Logged into the SQ Gitpod (via Discord)
  2. Generated a keypair (public key GBPC7EJR7A7FEVXLSADKJJ4PKNL2ABSVYMXAHOO736F25C5HHGONOCAW)
  3. Funded it
  4. Built it - soroban contract build (seems like hello world compiles fine but quest 5 throws errors)
  5. Create an alice identity as per - https://soroban.stellar.org/docs/getting-started/deploy-to-testnet and setup testnet
  6. Deployed and stored returned contract address to ./soroban/hello-id
    soroban contract deploy
    --wasm target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm
    --source alice
    --network testnet
  7. When invoking

soroban contract invoke --id $(cat ../../.soroban/hello-id) --source alice --network testnet

Ref: https://discord.com/channels/897514728459468821/966788672164855829/1170881122213822495

What did you expect to see?

Successful invoke or help messages or helpful error message.

What did you see instead?

thread 'main' panicked at 'called Option::unwrap() on a None value', src/commands/contract/invoke.rs:188:66
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Ref: https://discord.com/channels/897514728459468821/966788672164855829/1170881122213822495

Discussion

Looking at the command being executed it appears like the invoke contract function is missing. However, even if it's missing or the command isn't formed correctly we shouldn't be panicking.

This is the line of code that I think panicked:

https://github.com/stellar/soroban-tools/blob/bce5e56ba16ba977200b022c91f3eaf6282f47eb/cmd/soroban-cli/src/commands/contract/invoke.rs#L188

Seems like this is an error case we should be handling instead of using unwrap.

@leighmcculloch leighmcculloch added the bug Something isn't working label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant