Ackee-Blockchain / trident

Rust-based framework to Fuzz and Integration test Solana programs to help you ship secure code.

Home Page:https://ackee.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An issue with error 'Attempt to load a program that does not exist'

DXist opened this issue · comments

I have an issue when I try to test my pet project.

It looks like I'm loading some unexisting program.

Here is test output of trdelnik test

running 1 test
test test_id ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/program_client-897c2221637b8873)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test.rs (target/debug/deps/test-d8bf1173be91f7e0)

running 1 test
-------------- TEST START --------------
Waiting for fees to stabilize 1...
Waiting for fees to stabilize 2...
Error: RPC response error -32002: Transaction simulation failed: Attempt to load a program that does not exist

Caused by:
    0: RPC response error -32002: Transaction simulation failed: Attempt to load a program that does not exist
    1: RPC response error -32002: Transaction simulation failed: Attempt to load a program that does not exist
thread 'test_happy_path' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/test/src/lib.rs:185:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test test_happy_path ... FAILED

failures:

failures:
    test_happy_path

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 7.38s

error: test failed, to rerun pass '-p trdelnik-tests --test test'
Error: testing failed

I built trdelnik from current master

type trdelnik
trdelnik is hashed (/Users/rinatshigapov/workspace/evita/../trdelnik/target/debug/trdelnik)

I tried to add extra log messages to runtime/src/accounts.rs in solana checkout at v1.10.29 tag. I want to output which program_id is not found.

But I don't know how to see test-validator log messages.

solana --version
solana-cli 1.10.29 (src:devbuild; feat:1425680972)

Hi!
The problem might be that you're declaring a different program ID (6syjPkpJf6gT6JCaXvWVDfKk4vv29s16F7FTWB2t4XP5) than you're actually using in your test.
Changing your program ID to the public key of program_keypair(1) (Po1RaS8BEDbNcn5oXsFryAeQ6Wn8fvmE111DJaKCgPC) you're using in your test should hopefully solve this issue.

@antoninkriz , thank you for pointing this!

Indeed it fixes the problem.

I find it strange that I have to synchronise the declared id.

If I decide to test my program in another environment using another keypair do I have to change it again?

I think the default template for trdelnik test should look for the program keypair the same way as solana does - in the same directory as build artifacts.

Now it uses constant keypairs that do not work out of the box.

I noticed that a new key-pair subcommand and updated README.md have landed in master. Now it's more clear how to use test program keypairs.

Thank you!