1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Do not count gas on special accounts in block gas limits (enabled by config) (#856)

* Set higher gas limit for special accounts, don't add gas from special accounts to block total

* Make removing special accounts from block gas limits enabled by config

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
EmelyanenkoK 2024-01-12 12:34:28 +03:00 committed by GitHub
parent 3a5f3fcadd
commit ff40c1f2a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 21 deletions

View file

@ -4904,13 +4904,6 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
int trans_type = block::transaction::Transaction::tr_none;
switch (tag) {
case block::gen::TransactionDescr::trans_ord: {
if (!block_limit_status_->fits(block::ParamLimits::cl_medium)) {
return reject_query(PSTRING() << "cannod add ordinary transaction because hard block limits are exceeded: "
<< "gas_used=" << block_limit_status_->gas_used
<< "(limit=" << block_limits_->gas.hard() << "), "
<< "lt_delta=" << block_limit_status_->cur_lt - block_limits_->start_lt
<< "(limit=" << block_limits_->lt_delta.hard() << ")");
}
trans_type = block::transaction::Transaction::tr_ord;
if (in_msg_root.is_null()) {
return reject_query(PSTRING() << "ordinary transaction " << lt << " of account " << addr.to_hex()
@ -5058,10 +5051,19 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
return reject_query(PSTRING() << "cannot re-create the serialization of transaction " << lt
<< " for smart contract " << addr.to_hex());
}
if (!trs->update_limits(*block_limit_status_, false)) {
if (!trs->update_limits(*block_limit_status_,
/* with_gas = */ !account.is_special,
/* with_size = */ false)) {
return fatal_error(PSTRING() << "cannot update block limit status to include transaction " << lt << " of account "
<< addr.to_hex());
}
if (block_limit_status_->gas_used > block_limits_->gas.hard() + compute_phase_cfg_.gas_limit) {
// Note that block_limit_status_->gas_used does not include transactions in special accounts
return reject_query(PSTRING() << "gas block limits are exceeded: total_gas_used > gas_limit_hard + trx_gas_limit ("
<< "total_gas_used=" << block_limit_status_->gas_used
<< ", gas_limit_hard=" << block_limits_->gas.hard()
<< ", trx_gas_limit=" << compute_phase_cfg_.gas_limit << ")");
}
auto trans_root2 = trs->commit(account);
if (trans_root2.is_null()) {
return reject_query(PSTRING() << "the re-created transaction " << lt << " for smart contract " << addr.to_hex()