Skip to content

Commit

Permalink
add retdata to effects; no idea if this will pass
Browse files Browse the repository at this point in the history
  • Loading branch information
2501babe committed Dec 10, 2024
1 parent 746b362 commit dd8dacc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fuzz/fixture/src/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
use {
super::proto::{AcctState as ProtoAccount, InstrEffects as ProtoEffects},
solana_sdk::{account::AccountSharedData, keccak::Hasher, pubkey::Pubkey},
solana_sdk::{
account::AccountSharedData, keccak::Hasher, pubkey::Pubkey,
transaction_context::TransactionReturnData,
},
};

/// Represents the effects of a single instruction.
Expand All @@ -14,6 +17,7 @@ pub struct Effects {
pub execution_time: u64,
// Program return code. Zero is success, errors are non-zero.
pub program_result: u32,
pub return_data: Option<TransactionReturnData>,
/// Resulting accounts with state, to be checked post-simulation.
pub resulting_accounts: Vec<(Pubkey, AccountSharedData)>,
}
Expand All @@ -34,6 +38,7 @@ impl From<ProtoEffects> for Effects {
compute_units_consumed,
execution_time,
program_result,
return_data: None, // TODO
resulting_accounts,
}
}
Expand All @@ -45,6 +50,7 @@ impl From<Effects> for ProtoEffects {
compute_units_consumed,
execution_time,
program_result,
return_data: _, // TODO
resulting_accounts,
} = value;

Expand Down
2 changes: 2 additions & 0 deletions harness/src/fuzz/mollusk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl From<&InstructionResult> for FuzzEffects {
fn from(input: &InstructionResult) -> Self {
let compute_units_consumed = input.compute_units_consumed;
let execution_time = input.execution_time;
let return_data = input.return_data.clone();

let program_result = match &input.program_result {
ProgramResult::Success => 0,
Expand All @@ -69,6 +70,7 @@ impl From<&InstructionResult> for FuzzEffects {
compute_units_consumed,
execution_time,
program_result,
return_data,
resulting_accounts,
}
}
Expand Down

0 comments on commit dd8dacc

Please sign in to comment.