Skip to content

Commit

Permalink
Set minimum cost of ACL entry to 32 gas; apply also to the Priority Fee
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Nov 7, 2023
1 parent 8933e1a commit ac9a73a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions EIPS/eip-000.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ divided evenly among all transactions containing such access and the rest of the
If a large number of transactions all access the same addresses or slots, the cost of each cold access may get
way too low which may represent a potential DoS attack vector.

In order to prevent that, the base fee gas component of access cost cannot be lower than `MIN_ACCESS_LIST_ENTRY_COST`
which is set at equivalent to `WARM_STORAGE_READ_COST` or `100 gas`.
In order to prevent that, the gas cost of including an entity in the access list cannot be lower
than `MIN_ACCESS_LIST_ENTRY_COST`, which is set to `32 gas`.

Minimal cost of the priority gas fees are not limited by this rule.
This value is equivalent to the calldata cost of including two bytes long identifier of entries in `block_access_list`.

### Calculating a refund of the charged priority fee

Expand Down Expand Up @@ -274,7 +274,10 @@ export function calculatePriorityFeeRefunds (sortedAccesses: AccessDetails[], ac
const refunds = [Math.floor(totalRefund * topTransactionContribution / totalContributions)]
for (let i = 1; i < sortedAccesses.length; i++) {
const charge = parseInt(sortedAccesses[i].priorityFeePerGas) * parseInt(accessGasCost)
refunds.push(Math.floor(totalRefund * charge / totalContributions))
const calldataCharge = parseInt(sortedAccesses[i].priorityFeePerGas) * MIN_ACCESS_LIST_ENTRY_COST
const refundToCalldata = charge - calldataCharge
const refundToContribution = Math.floor(totalRefund * charge / totalContributions)
refunds.push(Math.min(refundToCalldata, refundToContribution))
}
return refunds
}
Expand Down

0 comments on commit ac9a73a

Please sign in to comment.