Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: CPI Instruction Recording #22111

Merged
merged 4 commits into from
Dec 25, 2021

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Dec 25, 2021

Problem

Another followup of #22102, because CPI instruction recording is currently the responsibility of the caller of InvokeContext::process_instruction(), clones Instructions and compiles them, but neither of that is necessary.

Summary of Changes

  • Turns Vec<Option<Rc<RefCell<Vec<Instruction>>>>> into Option<Rc<RefCell<Vec<Vec<Instruction>>>>> by unifying all InstructionRecorders of a transaction into one.
  • Assembles the CompiledInstruction by recycling the account indices gathered for instruction_accounts.
  • Removes the cloning of Instructions from instruction_recorder.record_instruction(instruction.clone());
  • Moves the recording of CPI instructions into InvokeContext::process_instruction()

Fixes #

@codecov
Copy link

codecov bot commented Dec 25, 2021

Codecov Report

Merging #22111 (e9d27e6) into master (60ddd93) will decrease coverage by 0.0%.
The diff coverage is 64.2%.

@@            Coverage Diff            @@
##           master   #22111     +/-   ##
=========================================
- Coverage    81.3%    81.2%   -0.1%     
=========================================
  Files         519      519             
  Lines      145721   145734     +13     
=========================================
- Hits       118475   118447     -28     
- Misses      27246    27287     +41     

@Lichtso Lichtso merged commit cc947ca into solana-labs:master Dec 25, 2021
@Lichtso Lichtso deleted the refactor/instruction_recording branch December 25, 2021 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant