solana
solana copied to clipboard
Add richer Instruction details to RPC/geyser output
Problem
RPC getTransaction
and geyser transaction-info streaming report some details about transactions, including the fields inner_instructions
and return_data
. However, inner_instructions
is flattened, so it is only possible to know which top-level instruction an inner-ix was invoked within, not the actual order of CPIs. Meanwhile, return_data
only reports the last return data written, regardless of how many times it was used in the transactions.
Proposed Solution
Deprecate inner_instructions
and return_data
from relevant TransactionStatusMeta structs.
Add a new field, perhaps rich_instruction_details
, that would report inner_instructions
as a multidimensional array to reflect actual CPI order/depth. A new instruction struct could also report return_data written, compute units consumed, and syscalls made. Perhaps this struct should include top-level instructions as well in order to provide the rich details consistently.
Sounds great! Though I think we could expand on the existing inner_instructions
field in RPC responses rather than replace it with a new field. I'm in favor of deprecating return_data
though
I would love to see this,
Perhaps its a as simple as adding the stack height in each inner instruction, then you can keep the same setup excep the innner instruction struct would change from
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct InnerInstructions {
/// Transaction instruction index
pub index: u8,
/// List of inner instructions
pub instructions: Vec<CompiledInstruction>,
}
to
pub struct CompiledInnerInstruction {
pub stack_height: u8,
pub instruction: CompiledInstruction
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct InnerInstructions {
/// Transaction instruction index
pub index: u8,
/// List of inner instructions
pub instructions: Vec<CompiledInnerInstruction>,
}
Or something similar.
https://github.com/solana-labs/solana/pull/28430 adds the stack_height
for inner instructions. It would still be nice to record return data and compute units used for each instruction
#28430 adds stack height true, but it does not expose this to the geyser in any way.
looks like this is included in 1.15