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

Refactor InvokeContext::process_instruction()#21671

Merged
Lichtso merged 1 commit intosolana-labs:masterfrom
Lichtso:refactor/InvokeContext_process_instruction
Dec 7, 2021
Merged

Refactor InvokeContext::process_instruction()#21671
Lichtso merged 1 commit intosolana-labs:masterfrom
Lichtso:refactor/InvokeContext_process_instruction

Conversation

@Lichtso
Copy link
Copy Markdown
Contributor

@Lichtso Lichtso commented Dec 7, 2021

Problem

The first level of program invocation is handled at process_message() while the higher levels (CPI and native_invoke) are handled in InvokeContext. The code duplication is prone to errors (such as the handling of return_data being left out) and should be unified.

Summary of Changes

  • Implicitly fixes invoke_context.return_data not being reset between instructions in process_message().
  • Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
  • Renames InvokeContext::process_instruction() to InvokeContext::process_executable_chain().
  • Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
  • Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
  • Removes InvokeContext::new_mock_with_sysvars().

Fixes #

@Lichtso Lichtso force-pushed the refactor/InvokeContext_process_instruction branch 2 times, most recently from 998bf80 to e8e9c7c Compare December 7, 2021 18:16
… instructions in process_message.

- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().
@Lichtso Lichtso force-pushed the refactor/InvokeContext_process_instruction branch from e8e9c7c to 2489b09 Compare December 7, 2021 19:30
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 7, 2021

Codecov Report

Merging #21671 (2489b09) into master (92a1fc0) will decrease coverage by 0.0%.
The diff coverage is 97.1%.

@@            Coverage Diff            @@
##           master   #21671     +/-   ##
=========================================
- Coverage    81.6%    81.6%   -0.1%     
=========================================
  Files         511      511             
  Lines      143128   143127      -1     
=========================================
- Hits       116897   116866     -31     
- Misses      26231    26261     +30     

@Lichtso Lichtso merged commit 1df8883 into solana-labs:master Dec 7, 2021
@Lichtso Lichtso deleted the refactor/InvokeContext_process_instruction branch December 7, 2021 22:00
@Lichtso Lichtso added the v1.9 label Dec 8, 2021
mergify Bot pushed a commit that referenced this pull request Dec 8, 2021
… instructions in process_message. (#21671)

- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().

(cherry picked from commit 1df8883)
mergify Bot added a commit that referenced this pull request Dec 8, 2021
… instructions in process_message. (#21671) (#21684)

- Lets InvokeContext::process_cross_program_instruction() handle the first invocation depth too.
- Marks InvokeContext::verify(), InvokeContext::verify_and_update() and InvokeContext::process_executable_chain() private.
- Renames InvokeContext::process_cross_program_instruction() to InvokeContext::process_instruction().
- Removes InvokeContext::new_mock_with_sysvars().

(cherry picked from commit 1df8883)

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
@brooksprumo brooksprumo mentioned this pull request Jan 5, 2022
@Lichtso Lichtso mentioned this pull request Jan 9, 2022
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