3

Tested with:

  • Solana 18 (checked with 0.18.2, 0.18.10, and 0.18.14)

  • Anchor 0.29.0

Loading programs with Anchor.toml with an address like this:


## Wormhole Core Bridge

[[test.validator.clone]]

address = "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"

Attempting to call any instruction in the test on it will result in the following error after running tests with anchor test:

Transaction simulation failed: This program may not be used for executing instructions.

--

It used to work fine; I have an older program built with 0.16.19 (and Anchor 0.29.0) which correctly loaded the programs.

A workaround for this is to manually download and load the program. Anchor.toml must be changed to:


[[test.genesis]]

address = "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"

program = "mainnet_core_bridge.so"

Notes:

worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth is the Wormhole core bridge. It is owned by BPF Upgradeable Loader (Solscan link). According to Anchor docs, it should load properly.

This could be related to: Changes to runtime's LoadedPrograms between 1.17.6 and versions after in the ProgramTest context

The workaround is not a long-term solution has anybody been able to make it work with simple cloning [[test.validator.clone]] ?

--

Edit1:

Same issue with other programs like mpl token metadata (metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s)

1

1 Answer 1

2

This isn't perfect, but a solution I've used when running into this has been running test-validator separately, and using --clone-upgradeable-program (need to be using 1.18.10) with IDs like Metaplex.

Additionally, if you want to automate this with anchor test, you can grab the program binary with solana program dump like you have been, and use [[test.genesis]] with the programId and binary to load the program at genesis rather than cloning from mainnet.

Example:

# Wormhole, like your example
[[test.genesis]]
address = "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"
program = "wormhole.so"

For more information about why this may be the case, this answer from Jon C details it: Transaction confirmation expires on test-validator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.