Add get_processed_sibling_instruction syscall#22859
Add get_processed_sibling_instruction syscall#22859jackcmay merged 4 commits intosolana-labs:masterfrom
Conversation
f214d94 to
3b48112
Compare
| instruction_context_stack: Vec<InstructionContext>, | ||
| number_of_instructions_at_transaction_level: usize, | ||
| instruction_trace: Vec<Vec<CompiledInstruction>>, | ||
| top_level_instruction_trace: Vec<InstructionContext>, |
There was a problem hiding this comment.
This is close to what I had in mind. Why not include top_level_instruction_trace as the first entry in each inner_instruction_trace? deconstruct() in bank.rs would then need to skip the first entry, but it might be a bit more compact and easier to understand.
(I can also refactor that later myself)
There was a problem hiding this comment.
Updated, check it out
3b48112 to
7f055f6
Compare
Codecov Report
@@ Coverage Diff @@
## master #22859 +/- ##
=========================================
- Coverage 81.3% 81.2% -0.1%
=========================================
Files 560 560
Lines 152043 152268 +225
=========================================
+ Hits 123623 123725 +102
- Misses 28420 28543 +123 |
| } | ||
|
|
||
| /// Get the instruction's accounts | ||
| pub fn get_instruction_accounts(&self) -> &[InstructionAccount] { |
There was a problem hiding this comment.
I think I missed this the last time I reviewed it, but InstructionAccount should not be exposed. It is only meant to be a constructor for the tests. Otherwise access the fields of the InstructionContext separately, because the encoding is still suspect to heavy changes.
There was a problem hiding this comment.
You thinking we replace it with a trace-specific instruction struct?
There was a problem hiding this comment.
I'm exposing it in the instruction trace
There was a problem hiding this comment.
We could expose an iterator of a trait that exposes the AccountMeta infos
There was a problem hiding this comment.
It just occurred to me that you can't know what I refer to as I haven't merged that branch yet.
I meant exposing the individual fields in InstructionAccount separately like this:
Lichtso@c34020d
There was a problem hiding this comment.
Yeah, thats what I thought you meant, but we need a way to discover the account indicies from the InstructiionContext. So instead of get_instruction_accounts() we need a get_instruction_account_indicies_in_transaction()
There was a problem hiding this comment.
And make InstructionAccount private
There was a problem hiding this comment.
We already have a get_instruction_account_indicies_in_transaction()
it is called InstructionContext::get_index_in_transaction()
There was a problem hiding this comment.
Yup, way past that :-)
385d085 to
6bdf7b0
Compare
|
@CriesofCarrots Try this out and let us know, I'll work on porting it to v1.9 |
Awesome, will do! |
|
@jackcmay , this is working great. Here's the branch where I have it in use: https://github.com/CriesofCarrots/solana-program-library/tree/finish-memo-extension I'll keep my eyes out for your v1.9 backport, and patch to it for testing when it's ready. |
Problem
There are scenarios where instructions (top-level or via CPI) would like to know what the last instruction processed was. Some examples are verification of assert instructions or to check for memo instructions. Programs can already check tx level instructions via the
Sysvar1nstructions1111111111111111111111111but there is no way to get information about what inner instructions have been processed.Summary of Changes
Add a syscall that allows a program to query what sibling instructions have been successfully processed.
This PR supersedes #22515
Fixes #22437