Impl get_/set_return_data syscalls for ProgramTest (#22647)
* Remove &mut self from set_return_data * Impl get_/set_return_data for program-test SyscallStubs * Add return_data program-test
This commit is contained in:
@@ -355,6 +355,23 @@ impl solana_sdk::program_stubs::SyscallStubs for SyscallStubs {
|
||||
fn sol_get_rent_sysvar(&self, var_addr: *mut u8) -> u64 {
|
||||
get_sysvar(get_invoke_context().get_sysvar_cache().get_rent(), var_addr)
|
||||
}
|
||||
|
||||
fn sol_get_return_data(&self) -> Option<(Pubkey, Vec<u8>)> {
|
||||
let (program_id, data) = get_invoke_context().transaction_context.get_return_data();
|
||||
Some((*program_id, data.to_vec()))
|
||||
}
|
||||
|
||||
fn sol_set_return_data(&self, data: &[u8]) {
|
||||
let invoke_context = get_invoke_context();
|
||||
let caller = *invoke_context
|
||||
.transaction_context
|
||||
.get_program_key()
|
||||
.unwrap();
|
||||
invoke_context
|
||||
.transaction_context
|
||||
.set_return_data(caller, data.to_vec())
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_file(filename: &str) -> Option<PathBuf> {
|
||||
|
Reference in New Issue
Block a user