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

Include loaded accounts data size in TransactionResults #1525

Conversation

tao-stones
Copy link

@tao-stones tao-stones commented May 29, 2024

Problem

Total loaded-accounts-data-size for successfully loaded transaction is accumulated during load_transaction_accounts(). It is useful information, could be included in TransactionResults that is returned from load_execute_and_commit_transactions(), so call sites can access stats of loaded accounts of sanitized transactions.

For now, such stats includes the actual loaded-accounts-data-size, count of loaded accounts.

The use of this information is planned for:

  1. cost_tracker uses it to adjust reserved block space for transaction, in the same fashion as it adjust for estimated/actual execution cost. (note: loaded accounts data size contributes to transaction cost in term of CU, charging CU for loaded accounts data size #1356 )
  2. replay_stage uses it to report histogram of loaded accounts data size per transaction.

Summary of Changes

  • add pub struct TransactionLoadedAccountsStats
  • include it into TransactionResults

Fixes #

@tao-stones tao-stones requested review from jstarry and apfitzge May 29, 2024 16:23
…ess stats of loaded accounts for sanitized transactions

Such stats include the actual loaded-accounts-data-size, count of loaded accounts.
@tao-stones tao-stones force-pushed the imp-include-loaded-accounts-size-to-transaction-results branch from 756df57 to 36aecbf Compare May 29, 2024 17:10
@jstarry
Copy link

jstarry commented May 30, 2024

Main question is why not put this info in TransactionExecutionDetails instead of TransactionResults? For the most part, any transaction which is loaded will also be executed. It's not a big deal either way but putting this info in execution details could be easier to work with depending on what you're doing.

@tao-stones
Copy link
Author

Main question is why not put this info in TransactionExecutionDetails instead of TransactionResults? For the most part, any transaction which is loaded will also be executed. It's not a big deal either way but putting this info in execution details could be easier to work with depending on what you're doing.

Good question. It'd be easier to ride on TransactionExecutionDetails, however there are few errors can happen after accounts loaded but NotExecuted, for example:

  • When program cache full -> NotExecuted(TransactionError::ProgramCacheHitMaxLimit)
  • Any error from ComputeBudget::try_from_instructions() -> NotExecuted(...)

In these cases, we would lost information about loaded accounts, that'd skew histogram data report to metrics, and make banking_stage adjusting block reserve by actual loaded-accounts-data-size-cost inaccurate (potentially?). Thought it's better to separate loaded and executed anyway.

@jstarry
Copy link

jstarry commented May 30, 2024

Ok sounds good, makes sense.

@tao-stones tao-stones merged commit faa4fa6 into anza-xyz:master May 30, 2024
42 checks passed
@tao-stones tao-stones deleted the imp-include-loaded-accounts-size-to-transaction-results branch May 30, 2024 19: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.

2 participants