Skip to content

Commit

Permalink
stub using feature flags
Browse files Browse the repository at this point in the history
set cu consumed
  • Loading branch information
ravyu-jump committed Jul 24, 2024
1 parent e8750ba commit 6e2e6f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions program-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ frozen-abi = [
"solana-sdk/frozen-abi",
]
shuttle-test = ["solana-type-overrides/shuttle-test"]
stub-proc-instr = []

8 changes: 8 additions & 0 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,18 @@ impl<'a> InvokeContext<'a> {
timings: &mut ExecuteTimings,
) -> Result<(), InstructionError> {
*compute_units_consumed = 0;

// Stub out the processing of the instruction
if cfg!(feature = "stub-proc-instr"){
eprintln!("Stubbing out processing of instruction");
return Ok(());
}

self.transaction_context
.get_next_instruction_context()?
.configure(program_indices, instruction_accounts, instruction_data);
self.push()?;

self.process_executable_chain(compute_units_consumed, timings)
// MUST pop if and only if `push` succeeded, independent of `result`.
// Thus, the `.and()` instead of an `.and_then()`.
Expand Down

0 comments on commit 6e2e6f4

Please sign in to comment.