Ackee-Blockchain / trident

Rust-based framework to Fuzz and Integration test Solana programs to help you ship secure code.
https://ackee.xyz/trident/docs/latest/
MIT License
205 stars 18 forks source link

Feat/anchor 0.30.0 support #148

Closed Ikrk closed 5 months ago

Ikrk commented 5 months ago

Now Anchor 0.29 and higher is supported. In order to support multiple versions of Anchor and solana-program, it was necessary to get rid of the solana-program-test-anchor-fix crate. I created new convert_entry macro that converts the new entry point of programs based on Anchor 0.29 and higher to the previous version of entry closure. See convert_entry description for more information.

Anchor 0.29.0 works only with solana-program 1.17 due to issues with pinned dependencies. It is possible that Anchor 0.30.0 will work also with 1.16 but I did not test if trident works in this setup.

Ikrk commented 5 months ago

I tested the PR and it looks nice! One thing, that Im not sure about is if we do not want to include in the documentation the steps required to make it work with 0.30.0. It will work (it can be initialized without changes, but to run fuzz test) with 30, however as Trident uses 29 the accounts_snapshots.rs shows

the trait bound test30::Escrow: trident_client::anchor_lang::AccountSerialize is not satisfied

the above is a result of the example: "arbitrary-limit-inputs-5" used with 0.30.0

this error can be resolved if we temporarily switch in the Cargo.toml of the program to 0.29.0, but I don't know if this is desirable.

I have done some modifications and now when you want to use Trident with Anchor 0.29.0, you can run

cargo update anchor-client@0.30.0 --precise 0.29.0
cargo update anchor-spl@0.30.0 --precise 0.29.0

after Trident initialization and it should set the correct versions in Cargo.lock file without having to do any other adjustments in Cargo.toml. I did not find a way how it could be done automatically without user intervention.

It could be done also the other way around, when you want to use v0.30.0, than you would need to override the versions, but I think we want to support primarily new versions without friction.