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

cmd/evm: Fix blob-gas-used on invalid transactions #28734

Merged

Conversation

marioevz
Copy link
Member

Moves the block's blob-gas-used increment to the same place as the normal gas so that, in the case of failed transactions, neither gas type usage is incremented.

Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

Is there an issue here where if the tx is applied successfully, but we later find out that it is technically invalid due to exceeding the blob gas limit, that the state is not reset?

I think you will need to add statedb.RevertToSnapshot(snapshot) above the err assignment to correct this.

@MariusVanDerWijden
Copy link
Member

MariusVanDerWijden commented Jan 2, 2024

Yep I think it's like @lightclient said. Previously we filtered out the blob transactions before applying them. Now we apply them and potentially leave the statedb in a weird state. We should make sure to explicitly reset the statedb in order to prevent any unwanted modification of the state by failed transactions.

The fix itself looks good to me, you're right previously we incremented the blob gas used even if the transaction failed while applying the message.

@marioevz
Copy link
Member Author

marioevz commented Jan 2, 2024

Thanks for the review @lightclient, I've simplified the PR and fixed the issue, let me know if this looks ok.

@MariusVanDerWijden MariusVanDerWijden merged commit 0b471c3 into ethereum:master Jan 3, 2024
2 of 3 checks passed
@marioevz marioevz deleted the evm-t8n-fix-blob-gas-used branch January 3, 2024 15:12
@MariusVanDerWijden MariusVanDerWijden modified the milestones: 1.13.8, 1.13.9 Jan 10, 2024
Dergarcon pushed a commit to specialmechanisms/mev-geth-0x2mev that referenced this pull request Jan 31, 2024
…8734)

cmd/evm: fixes the blob gas calculation if a transaction is invalid
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Apr 29, 2024
…8734)

cmd/evm: fixes the blob gas calculation if a transaction is invalid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants