use cost model to limit new account creation (#21369)

* use cost model to limit new account creation

* handle every system instruction

* remove &

* simplify match

* simplify match

* add datapoint for account data size

* add postgres error handling

* handle accounts:unlock_accounts
This commit is contained in:
Jeff Washington (jwash)
2021-12-12 14:57:18 -06:00
committed by GitHub
parent 025a5a3b9c
commit 90f41fd9b7
11 changed files with 223 additions and 33 deletions

View File

@ -949,8 +949,8 @@ impl BankingStage {
bank.prepare_sanitized_batch_with_results(txs, transactions_qos_results.into_iter());
lock_time.stop();
// retryable_txs includes AccountInUse, WouldExceedMaxBlockCostLimit and
// WouldExceedMaxAccountCostLimit
// retryable_txs includes AccountInUse, WouldExceedMaxBlockCostLimit
// WouldExceedMaxAccountCostLimit, and WouldExceedMaxAccountDataCostLimit
let (result, mut retryable_txs) = Self::process_and_record_transactions_locked(
bank,
poh,

View File

@ -133,6 +133,10 @@ impl QosService {
self.metrics.retried_txs_per_account_limit_count.fetch_add(1, Ordering::Relaxed);
Err(TransactionError::WouldExceedMaxAccountCostLimit)
}
CostTrackerError::WouldExceedAccountDataMaxLimit => {
self.metrics.retried_txs_per_account_data_limit_count.fetch_add(1, Ordering::Relaxed);
Err(TransactionError::WouldExceedMaxAccountDataCostLimit)
}
}
}
})
@ -165,6 +169,7 @@ struct QosServiceMetrics {
selected_txs_count: AtomicU64,
retried_txs_per_block_limit_count: AtomicU64,
retried_txs_per_account_limit_count: AtomicU64,
retried_txs_per_account_data_limit_count: AtomicU64,
}
impl QosServiceMetrics {
@ -204,6 +209,12 @@ impl QosServiceMetrics {
.swap(0, Ordering::Relaxed) as i64,
i64
),
(
"retried_txs_per_account_data_limit_count",
self.retried_txs_per_account_data_limit_count
.swap(0, Ordering::Relaxed) as i64,
i64
),
);
}
}