-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
fix account resize test by requesting max tx data size #28826
Conversation
This fixes issues described in #28814 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you prefer explicitly setting the accounts data size load limit vs the current solution of just using smaller account sizes?
runtime/src/bank.rs
Outdated
@@ -19479,6 +19479,7 @@ pub(crate) mod tests { | |||
new_balance: u64, | |||
mock_program_id: Pubkey, | |||
recent_blockhash: Hash, | |||
tx_data_size_limit: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this fn is only used in tests, and those tests are not meant to exercise the ComputeBudget's load-account-data-size cap, I think it'd be nicer to not take this parameter here, and instead just call ComputeBudgetInstruction::set_accounts_data_size_limit()
with u32::MAX
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially added the exact tx data size limit as a way to demonstrate the usage of set_accounts_data_size_limit()
. But agree this may pollute this test. Replaced it with u32::MAX
runtime/src/bank.rs
Outdated
@@ -19780,6 +19790,7 @@ pub(crate) mod tests { | |||
/// Ensure that accounts data size is updated correctly on resize transactions | |||
#[test] | |||
fn test_accounts_data_size_and_resize_transactions() { | |||
solana_logger::setup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
perhaps the easiest fix is to redefine const DEFAULT_LOADED_ACCOUNTS_DATA_LIMIT: u32 = |
Ahhh, that could the be issue! Also, does loading the system program count against the account data load limit (even though it lives in the runtime vs on-chain)? |
Yea, transaction's account data size is the sum of all accounts being loaded into memory. |
027596e
to
77dc305
Compare
Calling |
@taozhu-chicago So does that mean a transaction that creates a single max-sized account would still fail? (Assuming it does not call |
Yea, it needs to call to set limit, otherwise it'd fail -- |
I guess I was under the impression that the 10 MB default load-limit was calculated so that a single max-sized account could be created without needing to call But that was my assumption. So, if that's not the intent by the default 10 MB limit, that is also OK; and then the default limit does not need to be changed here. It may be useful to know what the load-limit must be set to in order to create a max-sized account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the changes look good. But, if the the system program counts against the load budget, won't the test still fail if the account data size ends up being the 10 MiB max?
Edit: Nevermind, forgot that the load limit was bumped up to u32::MAX
Yeah, in early commit (before change to BTW, the need to loading builtin is discussed separately. Hopefully soon to be able to not loading builtin programs, then the default limit of 10MiB can perfectly load a max sized account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
…8826) * fix account resize test by requesting max tx data size * define data size limit in incremental of 1024
This reverts commit ae48ac9.
…8826) * fix account resize test by requesting max tx data size * define data size limit in incremental of 1024
This reverts commit ae48ac9.
This reverts commit ae48ac9.
Problem
test_accounts_data_size_and_resize_transactions():
generate random account data size without compute_budget instruction to set tx's max data size. When the randomly generated account size exceeds default 10M limit, transaction will fail due toMaxLoadedAccountsDataSizeExceeded
Summary of Changes
Fixes #