@@ -11,7 +11,7 @@ use near_chain_configs::{GenesisConfig, MIN_GC_NUM_EPOCHS_TO_KEEP, ProtocolConfi
11
11
use near_crypto:: PublicKey ;
12
12
use near_epoch_manager:: shard_assignment:: account_id_to_shard_id;
13
13
use near_epoch_manager:: { EpochManagerAdapter , EpochManagerHandle } ;
14
- use near_parameters:: { ActionCosts , ExtCosts , RuntimeConfig , RuntimeConfigStore } ;
14
+ use near_parameters:: { ExtCosts , RuntimeConfig , RuntimeConfigStore } ;
15
15
use near_pool:: types:: TransactionGroupIterator ;
16
16
use near_primitives:: account:: { AccessKey , Account } ;
17
17
use near_primitives:: apply:: ApplyChunkReason ;
@@ -20,13 +20,12 @@ use near_primitives::congestion_info::{
20
20
} ;
21
21
use near_primitives:: errors:: { InvalidTxError , RuntimeError , StorageError } ;
22
22
use near_primitives:: hash:: { CryptoHash , hash} ;
23
- use near_primitives:: receipt:: { DelayedReceiptIndices , Receipt } ;
23
+ use near_primitives:: receipt:: Receipt ;
24
24
use near_primitives:: runtime:: migration_data:: { MigrationData , MigrationFlags } ;
25
25
use near_primitives:: sandbox:: state_patch:: SandboxStatePatch ;
26
26
use near_primitives:: shard_layout:: { ShardLayout , ShardUId } ;
27
27
use near_primitives:: state_part:: PartId ;
28
28
use near_primitives:: transaction:: { SignedTransaction , ValidatedTransaction } ;
29
- use near_primitives:: trie_key:: TrieKey ;
30
29
use near_primitives:: types:: {
31
30
AccountId , Balance , BlockHeight , EpochHeight , EpochId , EpochInfoProvider , Gas , MerkleHash ,
32
31
ShardId , StateChangeCause , StateRoot , StateRootNode ,
@@ -662,18 +661,6 @@ impl RuntimeAdapter for NightshadeRuntime {
662
661
} ;
663
662
let mut num_checked_transactions = 0 ;
664
663
665
- // To avoid limiting the throughput of the network, we want to include enough receipts to
666
- // saturate the capacity of the chunk even in case when all of these receipts end up using
667
- // the smallest possible amount of gas, which is at least the cost of execution of action
668
- // receipt.
669
- // Currently, the min execution cost is ~100 GGas and the chunk capacity is 1 PGas, giving
670
- // a bound of at most 10000 receipts processed in a chunk.
671
- let delayed_receipts_indices: DelayedReceiptIndices =
672
- near_store:: get ( & state_update, & TrieKey :: DelayedReceiptIndices ) ?. unwrap_or_default ( ) ;
673
- let min_fee = runtime_config. fees . fee ( ActionCosts :: new_action_receipt) . exec_fee ( ) ;
674
- let new_receipt_count_limit =
675
- get_new_receipt_count_limit ( min_fee, gas_limit, delayed_receipts_indices) ;
676
-
677
664
let size_limit: u64 = calculate_transactions_size_limit (
678
665
protocol_version,
679
666
& runtime_config,
@@ -695,17 +682,6 @@ impl RuntimeAdapter for NightshadeRuntime {
695
682
result. limited_by = Some ( PrepareTransactionsLimit :: Size ) ;
696
683
break ;
697
684
}
698
- if !ProtocolFeature :: CongestionControl . enabled ( protocol_version) {
699
- // Local Congestion Control.
700
- // Keep this for the upgrade phase, afterwards it can be
701
- // removed. It does not need to be kept because it does not
702
- // affect replayability.
703
- // TODO(congestion_control): remove at release CongestionControl + 1 or later
704
- if result. transactions . len ( ) >= new_receipt_count_limit {
705
- result. limited_by = Some ( PrepareTransactionsLimit :: ReceiptCount ) ;
706
- break ;
707
- }
708
- }
709
685
710
686
if let Some ( time_limit) = & time_limit {
711
687
if start_time. elapsed ( ) >= * time_limit {
@@ -1285,27 +1261,6 @@ impl RuntimeAdapter for NightshadeRuntime {
1285
1261
}
1286
1262
}
1287
1263
1288
- /// Get the limit on the number of new receipts imposed by the local congestion control.
1289
- fn get_new_receipt_count_limit (
1290
- min_fee : u64 ,
1291
- gas_limit : u64 ,
1292
- delayed_receipts_indices : DelayedReceiptIndices ,
1293
- ) -> usize {
1294
- if min_fee == 0 {
1295
- return usize:: MAX ;
1296
- }
1297
- // Round up to include at least one receipt.
1298
- let max_processed_receipts_in_chunk = ( gas_limit + min_fee - 1 ) / min_fee;
1299
- // Allow at most 2 chunks worth of delayed receipts. This way under congestion,
1300
- // after processing a single chunk, we will still have at least 1 chunk worth of
1301
- // delayed receipts, ensuring the high throughput even if the next chunk producer
1302
- // does not include any receipts.
1303
- // This buffer size is a trade-off between the max queue size and system efficiency
1304
- // under congestion.
1305
- let delayed_receipt_count_limit = max_processed_receipts_in_chunk * 2 ;
1306
- delayed_receipt_count_limit. saturating_sub ( delayed_receipts_indices. len ( ) ) as usize
1307
- }
1308
-
1309
1264
/// How much gas of the next chunk we want to spend on converting new
1310
1265
/// transactions to receipts.
1311
1266
fn chunk_tx_gas_limit (
0 commit comments