-
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
Replace hardcoded loaded accounts size limit with compute budget instruction #30506
Replace hardcoded loaded accounts size limit with compute budget instruction #30506
Conversation
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.
seems like its good to go not sure about the tests
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.
Code looks good. Are there tests that combine the new instruction to set a load limit and then using/checking that limit via get_requested_loaded_accounts_data_size_limit
?
Thanks @brooksprumo, add a test to check |
runtime/src/accounts.rs
Outdated
macro_rules! test { | ||
( $instructions: expr, $feature_set: expr, $expected_result: expr ) => { | ||
let payer_keypair = Keypair::new(); | ||
let tx = SanitizedTransaction::from_transaction_for_tests(Transaction::new( | ||
&[&payer_keypair], | ||
Message::new($instructions, Some(&payer_keypair.pubkey())), | ||
Hash::default(), | ||
)); | ||
assert_eq!( | ||
$expected_result, | ||
Accounts::get_requested_loaded_accounts_data_size_limit(&tx, $feature_set) | ||
); | ||
}; | ||
} |
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 a function instead of a macro? (It can still stay within this test too!)
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.
not sure if macro is worse than function-in-function here, in term of styling. Assume prefer functions because macro is not type checked?
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.
And macros take longer to compile :)
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.
but quicker to run 💨 😅
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.
Really? Why?
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.
For the extra time it spent during compile, macros are expanded and inlined. So for the extra compile time and larger size, macros would shave few execution time. Worth it or not perhaps is another debate 😸
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.
Is it different than #[inline(always)]
?
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!
…get instruction; 2. new transaction error for invalid account data size limit
a5a4de4
to
3e2eb86
Compare
…ruction (solana-labs#30506) 1. replace hardcoded loaded accounts data size limit with compute budget instruction; 2. new transaction error for invalid account data size limit 3. test requested limit with combination of features and transactions
Problem
#30366 added compute budget instruction to request transaction's loaded accounts size limit. Should replace hardcoded limit with this instruction.
Summary of Changes
Fix: #30366