Skip to content

Commit

Permalink
eip-1559: add more constraints to the tx validation (#3594)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed May 28, 2021
1 parent a697e66 commit ee7053e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions EIPS/eip-1559.md
Expand Up @@ -209,6 +209,13 @@ class World(ABC):

# ensure that the user was willing to at least pay the base fee
assert transaction.max_fee_per_gas >= block.base_fee_per_gas

# The first two of these four rules are implicit due to the next two rules
assert transaction.max_fee_per_gas < 2**256 # Prevent impossibly large numbers
assert transaction.max_priority_fee_per_gas < 2**256 # Prevent impossibly large numbers
assert transaction.max_fee_per_gas >= transaction.max_priority_fee_per_gas # The total must be the larger of the two
assert sender.balance >= gasLimit * transaction.max_fee_per_gas

# priority fee is capped because the base fee is filled first
priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)
# signer pays both the priority fee and the base fee
Expand Down

0 comments on commit ee7053e

Please sign in to comment.