@@ -139,6 +139,7 @@ struct TransactionChunkGenerator<'a, 'b, T: ?Sized> {
139
139
reclaim_lamports_back_to_source_account : bool ,
140
140
compute_unit_price : Option < ComputeUnitPrice > ,
141
141
instruction_padding_config : Option < InstructionPaddingConfig > ,
142
+ skip_tx_account_data_size : bool ,
142
143
}
143
144
144
145
impl < ' a , ' b , T > TransactionChunkGenerator < ' a , ' b , T >
@@ -153,6 +154,7 @@ where
153
154
compute_unit_price : Option < ComputeUnitPrice > ,
154
155
instruction_padding_config : Option < InstructionPaddingConfig > ,
155
156
num_conflict_groups : Option < usize > ,
157
+ skip_tx_account_data_size : bool ,
156
158
) -> Self {
157
159
let account_chunks = if let Some ( num_conflict_groups) = num_conflict_groups {
158
160
KeypairChunks :: new_with_conflict_groups ( gen_keypairs, chunk_size, num_conflict_groups)
@@ -170,6 +172,7 @@ where
170
172
reclaim_lamports_back_to_source_account : false ,
171
173
compute_unit_price,
172
174
instruction_padding_config,
175
+ skip_tx_account_data_size,
173
176
}
174
177
}
175
178
@@ -195,6 +198,7 @@ where
195
198
source_nonce_chunk,
196
199
dest_nonce_chunk,
197
200
self . reclaim_lamports_back_to_source_account ,
201
+ self . skip_tx_account_data_size ,
198
202
& self . instruction_padding_config ,
199
203
)
200
204
} else {
@@ -206,6 +210,7 @@ where
206
210
blockhash. unwrap ( ) ,
207
211
& self . instruction_padding_config ,
208
212
& self . compute_unit_price ,
213
+ self . skip_tx_account_data_size ,
209
214
)
210
215
} ;
211
216
@@ -397,6 +402,7 @@ where
397
402
sustained,
398
403
target_slots_per_epoch,
399
404
compute_unit_price,
405
+ skip_tx_account_data_size,
400
406
use_durable_nonce,
401
407
instruction_padding_config,
402
408
num_conflict_groups,
@@ -412,6 +418,7 @@ where
412
418
compute_unit_price,
413
419
instruction_padding_config,
414
420
num_conflict_groups,
421
+ skip_tx_account_data_size,
415
422
) ;
416
423
417
424
let first_tx_count = loop {
@@ -538,6 +545,7 @@ fn generate_system_txs(
538
545
blockhash : & Hash ,
539
546
instruction_padding_config : & Option < InstructionPaddingConfig > ,
540
547
compute_unit_price : & Option < ComputeUnitPrice > ,
548
+ skip_tx_account_data_size : bool ,
541
549
) -> Vec < TimestampedTransaction > {
542
550
let pairs: Vec < _ > = if !reclaim {
543
551
source. iter ( ) . zip ( dest. iter ( ) ) . collect ( )
@@ -575,6 +583,7 @@ fn generate_system_txs(
575
583
* blockhash,
576
584
instruction_padding_config,
577
585
Some ( * * compute_unit_price) ,
586
+ skip_tx_account_data_size,
578
587
) ,
579
588
Some ( timestamp ( ) ) ,
580
589
)
@@ -592,6 +601,7 @@ fn generate_system_txs(
592
601
* blockhash,
593
602
instruction_padding_config,
594
603
None ,
604
+ skip_tx_account_data_size,
595
605
) ,
596
606
Some ( timestamp ( ) ) ,
597
607
)
@@ -607,6 +617,7 @@ fn transfer_with_compute_unit_price_and_padding(
607
617
recent_blockhash : Hash ,
608
618
instruction_padding_config : & Option < InstructionPaddingConfig > ,
609
619
compute_unit_price : Option < u64 > ,
620
+ skip_tx_account_data_size : bool ,
610
621
) -> Transaction {
611
622
let from_pubkey = from_keypair. pubkey ( ) ;
612
623
let transfer_instruction = system_instruction:: transfer ( & from_pubkey, to, lamports) ;
@@ -621,12 +632,15 @@ fn transfer_with_compute_unit_price_and_padding(
621
632
} else {
622
633
transfer_instruction
623
634
} ;
624
- let mut instructions = vec ! [
625
- ComputeBudgetInstruction :: set_loaded_accounts_data_size_limit(
626
- get_transaction_loaded_accounts_data_size( instruction_padding_config. is_some( ) ) ,
627
- ) ,
628
- instruction,
629
- ] ;
635
+ let mut instructions = vec ! [ ] ;
636
+ if !skip_tx_account_data_size {
637
+ instructions. push (
638
+ ComputeBudgetInstruction :: set_loaded_accounts_data_size_limit (
639
+ get_transaction_loaded_accounts_data_size ( instruction_padding_config. is_some ( ) ) ,
640
+ ) ,
641
+ )
642
+ }
643
+ instructions. push ( instruction) ;
630
644
if instruction_padding_config. is_some ( ) {
631
645
// By default, CU budget is DEFAULT_INSTRUCTION_COMPUTE_UNIT_LIMIT which is much larger than needed
632
646
instructions. push ( ComputeBudgetInstruction :: set_compute_unit_limit (
@@ -711,6 +725,7 @@ fn nonced_transfer_with_padding(
711
725
nonce_account : & Pubkey ,
712
726
nonce_authority : & Keypair ,
713
727
nonce_hash : Hash ,
728
+ skip_tx_account_data_size : bool ,
714
729
instruction_padding_config : & Option < InstructionPaddingConfig > ,
715
730
) -> Transaction {
716
731
let from_pubkey = from_keypair. pubkey ( ) ;
@@ -726,12 +741,15 @@ fn nonced_transfer_with_padding(
726
741
} else {
727
742
transfer_instruction
728
743
} ;
729
- let instructions = vec ! [
730
- ComputeBudgetInstruction :: set_loaded_accounts_data_size_limit(
731
- get_transaction_loaded_accounts_data_size( instruction_padding_config. is_some( ) ) ,
732
- ) ,
733
- instruction,
734
- ] ;
744
+ let mut instructions = vec ! [ ] ;
745
+ if !skip_tx_account_data_size {
746
+ instructions. push (
747
+ ComputeBudgetInstruction :: set_loaded_accounts_data_size_limit (
748
+ get_transaction_loaded_accounts_data_size ( instruction_padding_config. is_some ( ) ) ,
749
+ ) ,
750
+ )
751
+ }
752
+ instructions. push ( instruction) ;
735
753
let message = Message :: new_with_nonce (
736
754
instructions,
737
755
Some ( & from_pubkey) ,
@@ -748,6 +766,7 @@ fn generate_nonced_system_txs<T: 'static + BenchTpsClient + Send + Sync + ?Sized
748
766
source_nonce : & [ & Keypair ] ,
749
767
dest_nonce : & VecDeque < & Keypair > ,
750
768
reclaim : bool ,
769
+ skip_tx_account_data_size : bool ,
751
770
instruction_padding_config : & Option < InstructionPaddingConfig > ,
752
771
) -> Vec < TimestampedTransaction > {
753
772
let length = source. len ( ) ;
@@ -768,6 +787,7 @@ fn generate_nonced_system_txs<T: 'static + BenchTpsClient + Send + Sync + ?Sized
768
787
& source_nonce[ i] . pubkey ( ) ,
769
788
source[ i] ,
770
789
blockhashes[ i] ,
790
+ skip_tx_account_data_size,
771
791
instruction_padding_config,
772
792
) ,
773
793
None ,
@@ -786,6 +806,7 @@ fn generate_nonced_system_txs<T: 'static + BenchTpsClient + Send + Sync + ?Sized
786
806
& dest_nonce[ i] . pubkey ( ) ,
787
807
dest[ i] ,
788
808
blockhashes[ i] ,
809
+ skip_tx_account_data_size,
789
810
instruction_padding_config,
790
811
) ,
791
812
None ,
@@ -1046,6 +1067,7 @@ pub fn generate_and_fund_keypairs<T: 'static + BenchTpsClient + Send + Sync + ?S
1046
1067
funding_key : & Keypair ,
1047
1068
keypair_count : usize ,
1048
1069
lamports_per_account : u64 ,
1070
+ skip_tx_account_data_size : bool ,
1049
1071
enable_padding : bool ,
1050
1072
) -> Result < Vec < Keypair > > {
1051
1073
let rent = client. get_minimum_balance_for_rent_exemption ( 0 ) ?;
@@ -1059,6 +1081,7 @@ pub fn generate_and_fund_keypairs<T: 'static + BenchTpsClient + Send + Sync + ?S
1059
1081
& keypairs,
1060
1082
extra,
1061
1083
lamports_per_account,
1084
+ skip_tx_account_data_size,
1062
1085
enable_padding,
1063
1086
) ?;
1064
1087
@@ -1074,6 +1097,7 @@ pub fn fund_keypairs<T: 'static + BenchTpsClient + Send + Sync + ?Sized>(
1074
1097
keypairs : & [ Keypair ] ,
1075
1098
extra : u64 ,
1076
1099
lamports_per_account : u64 ,
1100
+ skip_tx_account_data_size : bool ,
1077
1101
enable_padding : bool ,
1078
1102
) -> Result < ( ) > {
1079
1103
let rent = client. get_minimum_balance_for_rent_exemption ( 0 ) ?;
@@ -1131,6 +1155,8 @@ pub fn fund_keypairs<T: 'static + BenchTpsClient + Send + Sync + ?Sized>(
1131
1155
return Err ( BenchTpsError :: AirdropFailure ) ;
1132
1156
}
1133
1157
}
1158
+ let data_size_limit = ( !skip_tx_account_data_size)
1159
+ . then ( || get_transaction_loaded_accounts_data_size ( enable_padding) ) ;
1134
1160
1135
1161
fund_keys (
1136
1162
client,
@@ -1139,7 +1165,7 @@ pub fn fund_keypairs<T: 'static + BenchTpsClient + Send + Sync + ?Sized>(
1139
1165
total,
1140
1166
max_fee,
1141
1167
lamports_per_account,
1142
- get_transaction_loaded_accounts_data_size ( enable_padding ) ,
1168
+ data_size_limit ,
1143
1169
) ;
1144
1170
}
1145
1171
Ok ( ( ) )
@@ -1181,7 +1207,7 @@ mod tests {
1181
1207
1182
1208
let keypair_count = config. tx_count * config. keypair_multiplier ;
1183
1209
let keypairs =
1184
- generate_and_fund_keypairs ( client. clone ( ) , & config. id , keypair_count, 20 , false )
1210
+ generate_and_fund_keypairs ( client. clone ( ) , & config. id , keypair_count, 20 , false , false )
1185
1211
. unwrap ( ) ;
1186
1212
1187
1213
do_bench_tps ( client, config, keypairs, None ) ;
@@ -1197,7 +1223,7 @@ mod tests {
1197
1223
let rent = client. get_minimum_balance_for_rent_exemption ( 0 ) . unwrap ( ) ;
1198
1224
1199
1225
let keypairs =
1200
- generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false )
1226
+ generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false , false )
1201
1227
. unwrap ( ) ;
1202
1228
1203
1229
for kp in & keypairs {
@@ -1222,7 +1248,7 @@ mod tests {
1222
1248
let rent = client. get_minimum_balance_for_rent_exemption ( 0 ) . unwrap ( ) ;
1223
1249
1224
1250
let keypairs =
1225
- generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false )
1251
+ generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false , false )
1226
1252
. unwrap ( ) ;
1227
1253
1228
1254
for kp in & keypairs {
@@ -1239,7 +1265,7 @@ mod tests {
1239
1265
let lamports = 10_000_000 ;
1240
1266
1241
1267
let authority_keypairs =
1242
- generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false )
1268
+ generate_and_fund_keypairs ( client. clone ( ) , & id, keypair_count, lamports, false , false )
1243
1269
. unwrap ( ) ;
1244
1270
1245
1271
let nonce_keypairs = generate_durable_nonce_accounts ( client. clone ( ) , & authority_keypairs) ;
0 commit comments