Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
solana-runtime-transaction = { workspace = true, features = [
"dev-context-only-utils",
] }
solana-sdk-ids = { workspace = true }
solana-send-transaction-service = { workspace = true, features = ["dev-context-only-utils"] }
solana-sha256-hasher = { workspace = true }
solana-stake-interface = { workspace = true }
Expand Down
54 changes: 25 additions & 29 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4547,12 +4547,14 @@ pub mod tests {
commitment::{BlockCommitment, CommitmentSlots},
non_circulating_supply::non_circulating_accounts,
},
solana_sdk_ids::bpf_loader_upgradeable,
solana_send_transaction_service::{
tpu_info::NullTpuInfo,
transaction_client::{ConnectionCacheClient, TpuClientNextClient},
},
solana_sha256_hasher::hash,
solana_signer::Signer,
solana_svm::account_loader::TRANSACTION_ACCOUNT_BASE_SIZE,
solana_system_interface::{instruction as system_instruction, program as system_program},
solana_system_transaction as system_transaction,
solana_sysvar::slot_hashes::SlotHashes,
Expand Down Expand Up @@ -4629,6 +4631,22 @@ pub mod tests {
}
}

fn expected_loaded_accounts_data_size(bank: &Bank, tx: &Transaction) -> u32 {
let mut loaded_accounts_data_size = 0;
for key in tx.message.account_keys.iter() {
if let Some(account) = bank.get_account(key) {
assert!(
*account.owner() != bpf_loader_upgradeable::id(),
"LoaderV3 is not supported; to add it, parse the program account and add its programdata size.",
);
loaded_accounts_data_size +=
(account.data().len() + TRANSACTION_ACCOUNT_BASE_SIZE) as u32;
}
}

loaded_accounts_data_size
}

fn test_builtin_processor(
invoke_context: &mut InvokeContext,
) -> std::result::Result<u64, Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -5975,11 +5993,7 @@ pub mod tests {
// Simulation bank must be frozen
bank.freeze();

let loaded_account_data_size = bank
.get_account(&system_program::id())
.unwrap()
.data()
.len() as u32;
let loaded_accounts_data_size = expected_loaded_accounts_data_size(&bank, &tx);

// Good signature with sigVerify=true
let req = format!(
Expand Down Expand Up @@ -6020,7 +6034,7 @@ pub mod tests {
],
"err":null,
"innerInstructions": null,
"loadedAccountsDataSize": loaded_account_data_size,
"loadedAccountsDataSize": loaded_accounts_data_size,
"logs":[
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
Expand Down Expand Up @@ -6107,7 +6121,7 @@ pub mod tests {
"accounts":null,
"err":null,
"innerInstructions":null,
"loadedAccountsDataSize": loaded_account_data_size,
"loadedAccountsDataSize": loaded_accounts_data_size,
"logs":[
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
Expand Down Expand Up @@ -6138,7 +6152,7 @@ pub mod tests {
"accounts":null,
"err":null,
"innerInstructions":null,
"loadedAccountsDataSize": loaded_account_data_size,
"loadedAccountsDataSize": loaded_accounts_data_size,
"logs":[
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
Expand Down Expand Up @@ -6227,7 +6241,7 @@ pub mod tests {
"accounts":null,
"err":null,
"innerInstructions":null,
"loadedAccountsDataSize": loaded_account_data_size,
"loadedAccountsDataSize": loaded_accounts_data_size,
"logs":[
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
Expand Down Expand Up @@ -6320,16 +6334,7 @@ pub mod tests {
// Simulation bank must be frozen
bank.freeze();

let loaded_accounts_data_size = bank
.get_account(&token_account_pubkey)
.unwrap()
.data()
.len() as u32
+ bank
.get_account(&system_program::id())
.unwrap()
.data()
.len() as u32;
let loaded_accounts_data_size = expected_loaded_accounts_data_size(&bank, &tx);

let req = format!(
r#"{{"jsonrpc":"2.0",
Expand Down Expand Up @@ -6444,16 +6449,7 @@ pub mod tests {
// Simulation bank must be frozen
bank.freeze();

let loaded_accounts_data_size = bank
.get_account(&TestBuiltinEntrypoint::PROGRAM_ID)
.unwrap()
.data()
.len() as u32
+ bank
.get_account(&system_program::id())
.unwrap()
.data()
.len() as u32;
let loaded_accounts_data_size = expected_loaded_accounts_data_size(&bank, &tx);

// `innerInstructions` not provided, should not be in response
let req = format!(
Expand Down
3 changes: 2 additions & 1 deletion svm/src/account_loader.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "dev-context-only-utils")]
use qualifier_attr::field_qualifiers;
use qualifier_attr::{field_qualifiers, qualifiers};
use {
crate::{
account_overrides::AccountOverrides, nonce_info::NonceInfo,
Expand Down Expand Up @@ -39,6 +39,7 @@ use {

// Per SIMD-0186, all accounts are assigned a base size of 64 bytes to cover
// the storage cost of metadata.
#[cfg_attr(feature = "dev-context-only-utils", qualifiers(pub))]
pub(crate) const TRANSACTION_ACCOUNT_BASE_SIZE: usize = 64;

// Per SIMD-0186, resolved address lookup tables are assigned a base size of 8248
Expand Down