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

Refactor: Cleanup InvokeContext#20785

Merged
Lichtso merged 10 commits intosolana-labs:masterfrom
Lichtso:refactor/cleanup_InvokeContext
Oct 21, 2021
Merged

Refactor: Cleanup InvokeContext#20785
Lichtso merged 10 commits intosolana-labs:masterfrom
Lichtso:refactor/cleanup_InvokeContext

Conversation

@Lichtso
Copy link
Copy Markdown
Contributor

@Lichtso Lichtso commented Oct 19, 2021

This PR collects various small adjustments around the InvokeContext,
which are required for the upcoming removal of MockInvokeContext.

Changes

  • Makes sysvar interface consistent between ThisInvokeContext and MockInvokeContext, in order to add InvokeContext::get_sysvars().
  • Move blockhash and fee_calculator in ThisInvokeContext instead of using a reference.
  • Makes ancestors optional in ThisInvokeContext.
  • Adds ThisInvokeContext::new_mock() and ThisInvokeContext::new_mock_with_features() constructor.
  • Adds prepare_mock_invoke_context() and mock_process_instruction().
  • Adds InvokeContext::set_blockhash() and InvokeContext ::set_fee_calculator().
  • Adds missing loader account in uses of MockInvokeContext.
  • Moves tx_wide_compute_cap into InvokeContext::push().
  • Use keyed_account_at_index() when accessing keyed_accounts.

@Lichtso Lichtso force-pushed the refactor/cleanup_InvokeContext branch 3 times, most recently from 6cbfc66 to 20cc79b Compare October 19, 2021 17:16
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 19, 2021

Codecov Report

Merging #20785 (336b7a4) into master (95e91a4) will decrease coverage by 0.0%.
The diff coverage is 53.6%.

@@            Coverage Diff            @@
##           master   #20785     +/-   ##
=========================================
- Coverage    81.9%    81.8%   -0.1%     
=========================================
  Files         496      496             
  Lines      138515   138552     +37     
=========================================
- Hits       113462   113447     -15     
- Misses      25053    25105     +52     

@Lichtso Lichtso force-pushed the refactor/cleanup_InvokeContext branch from 20cc79b to b6633ab Compare October 20, 2021 18:48
@Lichtso Lichtso force-pushed the refactor/cleanup_InvokeContext branch from b6633ab to 336b7a4 Compare October 20, 2021 19:11
@Lichtso Lichtso merged commit 97c2732 into solana-labs:master Oct 21, 2021
@Lichtso Lichtso deleted the refactor/cleanup_InvokeContext branch October 21, 2021 18:57
@Lichtso Lichtso mentioned this pull request Nov 9, 2021
dankelleher pushed a commit to identity-com/solana that referenced this pull request Nov 24, 2021
* Move blockhash and fee_calculator in ThisInvokeContext instead of using a reference.

* Moves tx_wide_compute_cap into InvokeContext::push().

* Adds ThisInvokeContext::new_mock() constructor.

* Adds missing loader account in uses of MockInvokeContext.

* Use keyed_account_at_index() when accessing keyed_accounts.

* Makes sysvar interface consistent between ThisInvokeContext and MockInvokeContext,
in order to add InvokeContext::get_sysvars().

* Adds InvokeContext::set_blockhash() and InvokeContext ::set_fee_calculator().

* Adds new_mock_with_features.

* Makes ancestors optional in ThisInvokeContext.

* Adds prepare_mock_invoke_context() and mock_process_instruction().
frits-metalogix added a commit to identity-com/solana that referenced this pull request Nov 24, 2021
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