trident_client::fuzzing

Macro convert_entry

Source
macro_rules! convert_entry {
    ($entry:expr) => { ... };
}
Expand description

trident macros Converts Anchor 0.29.0 and higher entrypoint into the runtime’s entrypoint style

Starting Anchor 0.29.0 the accounts are passed by reference https://github.com/coral-xyz/anchor/pull/2656 and the lifetime requirements are accounts: &'a [AccountInfo<'a>] instead of accounts: &'a [AccountInfo<'b>]. The new requirements require the slice of AccountInfos and the contained Accounts to have the same lifetime but the previous version is more general. The compiler implies that 'b must live at least as long as 'a or longer.

The transaction data is serialized and again deserialized to the &[AccountInfo<_>] slice just before invoking the entry point and the modified account data is copied to the original accounts just after the the entry point. After that the &[AccountInfo<_>] slice goes out of scope entirely and therefore 'a == 'b. So it SHOULD be safe to do this conversion in this testing scenario.

Do not use this conversion in any on-chain programs!