@@ -4547,12 +4547,14 @@ pub mod tests {
4547
4547
commitment:: { BlockCommitment , CommitmentSlots } ,
4548
4548
non_circulating_supply:: non_circulating_accounts,
4549
4549
} ,
4550
+ solana_sdk_ids:: bpf_loader_upgradeable,
4550
4551
solana_send_transaction_service:: {
4551
4552
tpu_info:: NullTpuInfo ,
4552
4553
transaction_client:: { ConnectionCacheClient , TpuClientNextClient } ,
4553
4554
} ,
4554
4555
solana_sha256_hasher:: hash,
4555
4556
solana_signer:: Signer ,
4557
+ solana_svm:: account_loader:: TRANSACTION_ACCOUNT_BASE_SIZE ,
4556
4558
solana_system_interface:: { instruction as system_instruction, program as system_program} ,
4557
4559
solana_system_transaction as system_transaction,
4558
4560
solana_sysvar:: slot_hashes:: SlotHashes ,
@@ -4629,6 +4631,22 @@ pub mod tests {
4629
4631
}
4630
4632
}
4631
4633
4634
+ fn expected_loaded_accounts_data_size ( bank : & Bank , tx : & Transaction ) -> u32 {
4635
+ let mut loaded_accounts_data_size = 0 ;
4636
+ for key in tx. message . account_keys . iter ( ) {
4637
+ if let Some ( account) = bank. get_account ( key) {
4638
+ assert ! (
4639
+ * account. owner( ) != bpf_loader_upgradeable:: id( ) ,
4640
+ "LoaderV3 is not supported; to add it, parse the program account and add its programdata size." ,
4641
+ ) ;
4642
+ loaded_accounts_data_size +=
4643
+ ( account. data ( ) . len ( ) + TRANSACTION_ACCOUNT_BASE_SIZE ) as u32 ;
4644
+ }
4645
+ }
4646
+
4647
+ loaded_accounts_data_size
4648
+ }
4649
+
4632
4650
fn test_builtin_processor (
4633
4651
invoke_context : & mut InvokeContext ,
4634
4652
) -> std:: result:: Result < u64 , Box < dyn std:: error:: Error > > {
@@ -5975,11 +5993,7 @@ pub mod tests {
5975
5993
// Simulation bank must be frozen
5976
5994
bank. freeze ( ) ;
5977
5995
5978
- let loaded_account_data_size = bank
5979
- . get_account ( & system_program:: id ( ) )
5980
- . unwrap ( )
5981
- . data ( )
5982
- . len ( ) as u32 ;
5996
+ let loaded_accounts_data_size = expected_loaded_accounts_data_size ( & bank, & tx) ;
5983
5997
5984
5998
// Good signature with sigVerify=true
5985
5999
let req = format ! (
@@ -6020,7 +6034,7 @@ pub mod tests {
6020
6034
] ,
6021
6035
"err" : null,
6022
6036
"innerInstructions" : null,
6023
- "loadedAccountsDataSize" : loaded_account_data_size ,
6037
+ "loadedAccountsDataSize" : loaded_accounts_data_size ,
6024
6038
"logs" : [
6025
6039
"Program 11111111111111111111111111111111 invoke [1]" ,
6026
6040
"Program 11111111111111111111111111111111 success"
@@ -6107,7 +6121,7 @@ pub mod tests {
6107
6121
"accounts" : null,
6108
6122
"err" : null,
6109
6123
"innerInstructions" : null,
6110
- "loadedAccountsDataSize" : loaded_account_data_size ,
6124
+ "loadedAccountsDataSize" : loaded_accounts_data_size ,
6111
6125
"logs" : [
6112
6126
"Program 11111111111111111111111111111111 invoke [1]" ,
6113
6127
"Program 11111111111111111111111111111111 success"
@@ -6138,7 +6152,7 @@ pub mod tests {
6138
6152
"accounts" : null,
6139
6153
"err" : null,
6140
6154
"innerInstructions" : null,
6141
- "loadedAccountsDataSize" : loaded_account_data_size ,
6155
+ "loadedAccountsDataSize" : loaded_accounts_data_size ,
6142
6156
"logs" : [
6143
6157
"Program 11111111111111111111111111111111 invoke [1]" ,
6144
6158
"Program 11111111111111111111111111111111 success"
@@ -6227,7 +6241,7 @@ pub mod tests {
6227
6241
"accounts" : null,
6228
6242
"err" : null,
6229
6243
"innerInstructions" : null,
6230
- "loadedAccountsDataSize" : loaded_account_data_size ,
6244
+ "loadedAccountsDataSize" : loaded_accounts_data_size ,
6231
6245
"logs" : [
6232
6246
"Program 11111111111111111111111111111111 invoke [1]" ,
6233
6247
"Program 11111111111111111111111111111111 success"
@@ -6320,16 +6334,7 @@ pub mod tests {
6320
6334
// Simulation bank must be frozen
6321
6335
bank. freeze ( ) ;
6322
6336
6323
- let loaded_accounts_data_size = bank
6324
- . get_account ( & token_account_pubkey)
6325
- . unwrap ( )
6326
- . data ( )
6327
- . len ( ) as u32
6328
- + bank
6329
- . get_account ( & system_program:: id ( ) )
6330
- . unwrap ( )
6331
- . data ( )
6332
- . len ( ) as u32 ;
6337
+ let loaded_accounts_data_size = expected_loaded_accounts_data_size ( & bank, & tx) ;
6333
6338
6334
6339
let req = format ! (
6335
6340
r#"{{"jsonrpc":"2.0",
@@ -6444,16 +6449,7 @@ pub mod tests {
6444
6449
// Simulation bank must be frozen
6445
6450
bank. freeze ( ) ;
6446
6451
6447
- let loaded_accounts_data_size = bank
6448
- . get_account ( & TestBuiltinEntrypoint :: PROGRAM_ID )
6449
- . unwrap ( )
6450
- . data ( )
6451
- . len ( ) as u32
6452
- + bank
6453
- . get_account ( & system_program:: id ( ) )
6454
- . unwrap ( )
6455
- . data ( )
6456
- . len ( ) as u32 ;
6452
+ let loaded_accounts_data_size = expected_loaded_accounts_data_size ( & bank, & tx) ;
6457
6453
6458
6454
// `innerInstructions` not provided, should not be in response
6459
6455
let req = format ! (
0 commit comments