Don't use stale executor cache (#13966)
This commit is contained in:
18
programs/bpf/rust/invoke_and_error/Cargo.toml
Normal file
18
programs/bpf/rust/invoke_and_error/Cargo.toml
Normal file
@ -0,0 +1,18 @@
|
||||
[package]
|
||||
name = "solana-bpf-rust-invoke-and-error"
|
||||
version = "1.5.0"
|
||||
description = "Solana BPF test program written in Rust"
|
||||
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
solana-program = { path = "../../../../sdk/program", version = "1.5.0" }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
2
programs/bpf/rust/invoke_and_error/Xargo.toml
Normal file
2
programs/bpf/rust/invoke_and_error/Xargo.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[target.bpfel-unknown-unknown.dependencies.std]
|
||||
features = []
|
32
programs/bpf/rust/invoke_and_error/src/lib.rs
Normal file
32
programs/bpf/rust/invoke_and_error/src/lib.rs
Normal file
@ -0,0 +1,32 @@
|
||||
//! @brief Invokes an instruction and returns an error, the instruction invoked
|
||||
//! uses the instruction data provided and all the accounts
|
||||
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, instruction::AccountMeta,
|
||||
instruction::Instruction, program::invoke, pubkey::Pubkey,
|
||||
};
|
||||
|
||||
entrypoint!(process_instruction);
|
||||
fn process_instruction(
|
||||
_program_id: &Pubkey,
|
||||
accounts: &[AccountInfo],
|
||||
instruction_data: &[u8],
|
||||
) -> ProgramResult {
|
||||
let to_call = accounts[0].key;
|
||||
let infos = accounts;
|
||||
let instruction = Instruction {
|
||||
accounts: accounts[1..]
|
||||
.iter()
|
||||
.map(|acc| AccountMeta {
|
||||
pubkey: *acc.key,
|
||||
is_signer: acc.is_signer,
|
||||
is_writable: acc.is_writable,
|
||||
})
|
||||
.collect(),
|
||||
data: instruction_data.to_owned(),
|
||||
program_id: *to_call,
|
||||
};
|
||||
let _ = invoke(&instruction, &infos);
|
||||
|
||||
Err(42.into())
|
||||
}
|
Reference in New Issue
Block a user