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 - Simplify program accounts in transaction loading #29728

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Jan 17, 2023

Problem

Currently we skip the loading of program accounts (of top level instructions) by filling them with an empty entry and later loading them separately in load_executable_accounts(). This not only causes redundant loading logic for the upgradeable loaders programdata special case, but also duplication of all program accounts, even multiple times if a program is used more than once.

Summary of Changes

  • Adds the deduplicated built-in programs at the very end (behind the account deps).
  • Removes load_executable_accounts() and uses the normal account loading instead.
  • Removes test_accounts_account_not_found() as the ProgramAccountNotFound case is now covered by test_program_sbf_invoke_in_same_tx_as_deployment() (see Adds symmetric tests for all cases of un-/re-/deployment inside the same transaction #29725).
  • Adjusts number of total loaded accounts in test_load_accounts_multiple_loaders().

@Lichtso Lichtso force-pushed the refactor/simplify_program_accounts_in_transaction_loading branch from e48aedd to 57283cd Compare January 17, 2023 12:29
@Lichtso Lichtso added this to To do in Account Data Direct Mapping via automation Jan 17, 2023
@Lichtso Lichtso moved this from To do to In Review in Account Data Direct Mapping Jan 17, 2023
@Lichtso Lichtso moved this from In Review to Prototyping (WIP) in Account Data Direct Mapping Jan 17, 2023
@Lichtso Lichtso force-pushed the refactor/simplify_program_accounts_in_transaction_loading branch from 57283cd to 95f3a2e Compare January 17, 2023 14:15
@tao-stones
Copy link
Contributor

tao-stones commented Jan 17, 2023

Can this PR be backported to 1.14? The function on top of this (to limit loaded data to a fixed size) will be backported, that'd bring it to 1.14, would you think so?

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to avoid redundant accounts loading by tracking with account_found_and_dep_index. Just few questions that I am not sure about.

runtime/src/accounts.rs Show resolved Hide resolved
runtime/src/accounts.rs Outdated Show resolved Hide resolved
runtime/src/accounts.rs Outdated Show resolved Hide resolved
@Lichtso Lichtso force-pushed the refactor/simplify_program_accounts_in_transaction_loading branch 2 times, most recently from 0c6c32e to cc6df59 Compare January 24, 2023 07:57
@Lichtso Lichtso removed this from Prototyping (WIP) in Account Data Direct Mapping Jan 24, 2023
tao-stones
tao-stones previously approved these changes Jan 24, 2023
Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for discussing the decision of removing chained-loader.

@Lichtso Lichtso force-pushed the refactor/simplify_program_accounts_in_transaction_loading branch from cc6df59 to 6e67274 Compare January 27, 2023 18:37
@mergify mergify bot dismissed tao-stones’s stale review January 27, 2023 18:38

Pull request has been modified.

@Lichtso Lichtso merged commit aa2e348 into solana-labs:master Jan 27, 2023
@Lichtso Lichtso deleted the refactor/simplify_program_accounts_in_transaction_loading branch January 27, 2023 20:24
@tao-stones tao-stones added v1.14 v1.15 (abandoned) The v1.15 branch has been abandoned labels Feb 1, 2023
mergify bot pushed a commit that referenced this pull request Feb 1, 2023
* Refactors the "!validated_fee_payer" case from an "else" branch to an early "return".

* Moves the early return upward.

* Removes empty entries.

* Adds account_found_and_dep_index.

* cargo fmt.

* Replaces call site of load_executable_accounts().

* Adjusts number of total loaded accounts in test_load_accounts_multiple_loaders().

* Removes test_accounts_account_not_found().

* Removes load_executable_accounts().

* Refactor back to built-in loader ownership chain loop.

(cherry picked from commit aa2e348)

# Conflicts:
#	runtime/src/accounts.rs
mergify bot pushed a commit that referenced this pull request Feb 1, 2023
* Refactors the "!validated_fee_payer" case from an "else" branch to an early "return".

* Moves the early return upward.

* Removes empty entries.

* Adds account_found_and_dep_index.

* cargo fmt.

* Replaces call site of load_executable_accounts().

* Adjusts number of total loaded accounts in test_load_accounts_multiple_loaders().

* Removes test_accounts_account_not_found().

* Removes load_executable_accounts().

* Refactor back to built-in loader ownership chain loop.

(cherry picked from commit aa2e348)

# Conflicts:
#	runtime/src/accounts.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.15 (abandoned) The v1.15 branch has been abandoned
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants