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: Remove Rc from PreAccount and InvokeContext::get_account() #21882

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Dec 14, 2021

Problem

Rc<RefCell<AccountSharedData>> in the program-runtime is overkill and AccountSharedData would suffice for the PreAccounts. Also InvokeContext::get_account() does not need to clone the Rc.

This PR is a spinoff / preparation for #21706.

Summary of Changes

  • Moves the .clone() of the AccountSharedData from PreAccount into InvokeContext.
  • Replaces Rc<RefCell<AccountSharedData>> by AccountSharedData in the PreAccounts.
  • Splits get_account() into find_index_of_account() and get_account_at_index() in order to remove Rc from return type.

Fixes #

@Lichtso Lichtso force-pushed the refactor/remove_rc_from_pre_account_and_get_account branch from daea395 to ab3476b Compare December 14, 2021 12:41
@codecov
Copy link

codecov bot commented Dec 14, 2021

Codecov Report

Merging #21882 (ab3476b) into master (033106e) will decrease coverage by 0.0%.
The diff coverage is 54.2%.

@@            Coverage Diff            @@
##           master   #21882     +/-   ##
=========================================
- Coverage    81.3%    81.3%   -0.1%     
=========================================
  Files         516      516             
  Lines      144217   144216      -1     
=========================================
- Hits       117268   117257     -11     
- Misses      26949    26959     +10     

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