Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM: fix EIP1559 bug to include tx value in balance check, fix nonce check #1372

Merged
merged 5 commits into from
Jul 22, 2021

Conversation

jochem-brouwer
Copy link
Member

This PR fixes an EIP1559 bug, where we checked:

			# the signer must be able to afford the transaction
			assert signer.balance >= transaction.gas_limit * transaction.max_fee_per_gas

However, in the EIP, the call value is first deducted from the accounts' balance, and we should thus add this to the transaction.gas_limit * transaction.max_fee_per_gas.

This PR also fixes a bug where nonce values are not checked at runtime.

@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #1372 (a2044f0) into master (4f23469) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

Flag Coverage Δ
block 86.06% <ø> (ø)
blockchain 83.43% <ø> (-0.07%) ⬇️
client 83.79% <100.00%> (+0.32%) ⬆️
common 92.70% <ø> (-0.32%) ⬇️
devp2p 83.56% <ø> (+0.14%) ⬆️
ethash 82.83% <ø> (ø)
tx 88.24% <ø> (-0.12%) ⬇️
vm 79.34% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

packages/vm/src/runTx.ts Outdated Show resolved Hide resolved
@ryanio ryanio changed the title Fix EIP1559 consensus bug, fix not checking nonce in VM VM: fix EIP1559 bug to include tx value in balance check, fix nonce check Jul 21, 2021
Copy link
Contributor

@ryanio ryanio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ryanio ryanio merged commit 7a2301c into master Jul 22, 2021
@ryanio ryanio deleted the eip1559-hotfix branch July 22, 2021 03:08
@ryanio ryanio mentioned this pull request Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants