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

Validate transaction cost #465

Merged
merged 1 commit into from
Sep 3, 2021

Conversation

tgmichel
Copy link
Contributor

@tgmichel tgmichel commented Sep 3, 2021

This PR fixes an issue where invalid transactions are stored on pallet-ethereum storage for free.

Description

  • User A sends transaction with input data which's cost is greater than the gas limit.
  • The EVM will early exit if that transaction cost cannot be paid, and the account nonce is not increased in that case.
  • Currently the pallet_evm::runner does not Error in that case, so pallet-ethereum inserts the transaction metadata in it's storage. At this point, once the block is sealed, that transaction is mapped to the block, even if it didn't increase the nonce for user A, thus bloating the runtime storage for free (as the used gas still 0 and the fees are refunded in the runner after).

Transactions that cannot pay for the transaction cost itself should be discarded, its source account nonce not increased and not stored in the ethereum block (and they shouldn't be included in the substrate block neither). They cannot occupy blockchain space.

@tgmichel tgmichel requested a review from sorpaas as a code owner September 3, 2021 13:58
@sorpaas
Copy link
Member

sorpaas commented Sep 3, 2021

Can you also add this check to transact dispatch?

@sorpaas sorpaas merged commit 0b962f2 into polkadot-evm:master Sep 3, 2021
tgmichel added a commit to moonbeam-foundation/frontier that referenced this pull request Sep 6, 2021
raykyri pushed a commit to tangle-network/frontier that referenced this pull request Sep 24, 2021
@tgmichel tgmichel deleted the tgm-tx-cost-fix branch April 1, 2022 09:54
abhijeetbhagat pushed a commit to web3labs/frontier that referenced this pull request Jan 11, 2023
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.

2 participants