Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gas Limit Penalty

Why Penalties Exist

Telcoin Network uses a consensus-first architecture: transactions are ordered by consensus before they are executed. This means the actual gas a transaction consumes is unknown at the time it enters a batch. The network must rely on the gas limit declared by the sender to reserve space in each batch.

This creates a denial-of-service vector. A malicious or careless user can set an extremely high gas limit on a cheap transaction, consuming most of a batch’s capacity while using almost none of it. The batch ends up nearly empty in terms of useful work, but no other transactions could fit.

To counter this, TN applies a quadratic penalty on transactions whose gas limit is grossly inflated relative to their actual usage. The penalty deducts a portion of the unused gas refund and redirects it to the chain’s base-fee address for governance processing. This economically disincentivizes gas limit inflation without affecting well-estimated transactions.

How It Works

The 10% Rule

The penalty only activates when a transaction uses less than 10% of its declared gas limit. Any transaction that uses 10% or more of its gas limit pays zero penalty.

Additionally, transactions with a gas limit at or below 210,000 are always exempt, regardless of usage ratio. This protects simple transfers and low-cost interactions from unintended penalties.

Quadratic Scaling

When the penalty does activate, it scales quadratically based on how far below the 10% threshold the usage falls. The further below 10% usage a transaction is, the more aggressively the penalty grows.

In plain terms:

  • At 9.9% usage, the penalty is negligible
  • At 5% usage, roughly 25% of unused gas is penalized
  • At 2% usage, roughly 64% of unused gas is penalized
  • At 0.1% usage, over 95% of unused gas is penalized

The quadratic curve means the penalty ramps up gently near the threshold and steeply for extreme over-estimation, targeting the worst offenders while leaving borderline cases mostly unaffected.

The Formula

For transactions above the minimum gas limit threshold and below 10% usage:

usage_ratio = gas_used / gas_limit
inefficiency = 0.10 - usage_ratio
penalty_gas = (inefficiency^2 / 0.10^2) * unused_gas

Where:

  • gas_used is the actual gas consumed (before EVM refunds like SSTORE clearing)
  • gas_limit is the gas limit declared by the sender
  • unused_gas = gas_limit - gas_used (computed from the same pre-refund gas_used)
  • The result is clamped so the penalty never exceeds unused_gas

Note on EVM refunds: The penalty calculation uses pre-refund gas (actual execution cost) to determine the usage ratio, so SSTORE refunds do not artificially inflate the penalty. The standard EVM refund is still applied when computing the user’s gas reimbursement.

Where the Fees Go

When a transaction executes on TN, fees are distributed as follows:

Fee ComponentRecipientDescription
Priority fee (tip)Batch producer (validator)(effective_gas_price - base_fee) * gas_used
Base feeBase-fee addressbase_fee * gas_used
Gas limit penaltyBase-fee addressQuadratic penalty on unused gas (if applicable)
RemainderRefunded to senderUnused gas minus any penalty

The penalty is deducted from what would otherwise be refunded to the transaction sender. It does not increase the total fee paid beyond the sender’s declared gas_limit * effective_gas_price – it only reduces the refund.

Example Penalty Table

Gas LimitGas UsedUsage %Unused GasPenalty GasPenalty % of Unused
21,00021,000100%000%
210,00021,00010%189,00000%
420,00021,0005%399,00099,75025%
1,000,00021,0002.1%979,000610,99362.4%
5,000,00021,0000.42%4,979,0004,569,54691.8%
10,000,00021,0000.21%9,979,0009,564,28295.8%
30,000,00021,0000.07%29,979,00029,560,76298.6%

How to Avoid Penalties

  1. Use accurate gas estimation. Call eth_estimateGas before submitting transactions and set the gas limit based on the estimate. A reasonable buffer (e.g., 1.5x-2x the estimate) will not trigger penalties as long as the final usage stays above 10% of the gas limit.
  2. Understand the 10x safe zone. As a rule of thumb, if your gas limit is no more than 10x your actual gas consumption, you will never pay a penalty. A simple transfer using ~21,000 gas can safely use a gas limit up to 210,000 with zero penalty.
  3. Small transactions are exempt. Any transaction with a gas limit of 210,000 or less is exempt from penalties entirely, regardless of usage ratio.
  4. Do not hardcode inflated gas limits. Setting a gas limit to the maximum batch gas without estimating actual usage is the primary behavior this penalty targets. Bridge contracts and relayers should always estimate gas for each message rather than using a static high value.

Summary

PropertyValue
Penalty thresholdUsage below 10% of gas limit
ScalingQuadratic (gentle near threshold, steep at extremes)
Minimum gas limit for penalty> 210,000
Penalty destinationBase-fee address (for governance processing)
Maximum penaltyCannot exceed unused gas
Safe multiplierUp to 10x estimated gas = zero penalty

For the exact formula, worked examples, and guidance for wallets and integrators on detecting the charge, see Gas Over-Reservation Penalty.