txpool: add support for set code transactions #31073
Draft
+364
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new SetCode transaction type introduces some additional complexity when handling the transaction pool.
This complexity stems from two new account behaviors:
The first issue has already been considered extensively during the design of ERC-4337, and we're relatively confident in the solution of simply limiting the number of in-flight pending transactions an account can have to one. This puts a reasonable bound on transaction cancellation. Normally to cancel, you would need to spend 21,000 gas. Now it's possible to cancel for around the cost of warming the account and sending value (
2,600+9,000=11,600
). So 50% cheaper.The second issue is more novel and needs further consideration.
There are a few issues we must carefully design around:
transactions with conflicting authorizations. Otherwise, it might be possible to cherry-pick authorizations from txs and front run them with different txs at much lower fee amounts, effectively DoSing the authority. Fortunately, conflicting
authorizations do not affect the underlying validity of the transaction so we can just accept both.
A few situations to test:
the tx are removed.
5.1. This should also work when a self-sponsored setcode tx attempts
to replace itself.
the pool, otherwise someone might submit old validations to deny
service to unsuspecting users.
maybe try to write out each possible scenario for all types of txs entering the
pool +different 7702 situations and consider outcomes?