Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Fix return data too large test #20340

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions programs/bpf/rust/invoke/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub const TEST_NESTED_INVOKE_TOO_DEEP: u8 = 15;
pub const TEST_EXECUTABLE_LAMPORTS: u8 = 16;
pub const TEST_CALL_PRECOMPILE: u8 = 17;
pub const ADD_LAMPORTS: u8 = 18;
pub const TEST_RETURN_DATA_TOO_LARGE: u8 = 19;

pub const MINT_INDEX: usize = 0;
pub const ARGUMENT_INDEX: usize = 1;
Expand Down
3 changes: 3 additions & 0 deletions programs/bpf/rust/invoke/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,9 @@ fn process_instruction(
// make sure the total balance is fine
**accounts[0].lamports.borrow_mut() += 1;
}
TEST_RETURN_DATA_TOO_LARGE => {
set_return_data(&[1u8; 1028]);
}
_ => panic!(),
}

Expand Down
6 changes: 6 additions & 0 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,12 @@ fn test_program_bpf_invoke_sanity() {
&[],
);

do_invoke_failure_test_local(
TEST_RETURN_DATA_TOO_LARGE,
TransactionError::InstructionError(0, InstructionError::ProgramFailedToComplete),
&[],
);

// Check resulting state

assert_eq!(43, bank.get_balance(&derived_key1));
Expand Down