Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Refactor: CPI Instruction Recording#22111

Merged
Lichtso merged 4 commits intosolana-labs:masterfrom
Lichtso:refactor/instruction_recording
Dec 25, 2021
Merged

Refactor: CPI Instruction Recording#22111
Lichtso merged 4 commits intosolana-labs:masterfrom
Lichtso:refactor/instruction_recording

Conversation

@Lichtso
Copy link
Copy Markdown
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
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant