2023-06-16 07:29:40 -05:00
|
|
|
// Copyright 2014 The go-ethereum Authors
|
|
|
|
// This file is part of the go-ethereum library.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package txpool
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrAlreadyKnown is returned if the transactions is already contained
|
|
|
|
// within the pool.
|
|
|
|
ErrAlreadyKnown = errors.New("already known")
|
|
|
|
|
|
|
|
// ErrInvalidSender is returned if the transaction contains an invalid signature.
|
|
|
|
ErrInvalidSender = errors.New("invalid sender")
|
|
|
|
|
|
|
|
// ErrUnderpriced is returned if a transaction's gas price is below the minimum
|
|
|
|
// configured for the transaction pool.
|
|
|
|
ErrUnderpriced = errors.New("transaction underpriced")
|
|
|
|
|
|
|
|
// ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced
|
|
|
|
// with a different one without the required price bump.
|
|
|
|
ErrReplaceUnderpriced = errors.New("replacement transaction underpriced")
|
|
|
|
|
2023-07-27 05:45:35 -05:00
|
|
|
// ErrAccountLimitExceeded is returned if a transaction would exceed the number
|
|
|
|
// allowed by a pool for a single account.
|
|
|
|
ErrAccountLimitExceeded = errors.New("account limit exceeded")
|
|
|
|
|
2023-06-16 07:29:40 -05:00
|
|
|
// ErrGasLimit is returned if a transaction's requested gas limit exceeds the
|
|
|
|
// maximum allowance of the current block.
|
|
|
|
ErrGasLimit = errors.New("exceeds block gas limit")
|
|
|
|
|
|
|
|
// ErrNegativeValue is a sanity error to ensure no one is able to specify a
|
|
|
|
// transaction with a negative value.
|
|
|
|
ErrNegativeValue = errors.New("negative value")
|
|
|
|
|
|
|
|
// ErrOversizedData is returned if the input data of a transaction is greater
|
|
|
|
// than some meaningful limit a user might use. This is not a consensus error
|
|
|
|
// making the transaction invalid, rather a DOS protection.
|
|
|
|
ErrOversizedData = errors.New("oversized data")
|
|
|
|
|
|
|
|
// ErrFutureReplacePending is returned if a future transaction replaces a pending
|
2023-09-27 20:48:14 -05:00
|
|
|
// one. Future transactions should only be able to replace other future transactions.
|
2023-06-16 07:29:40 -05:00
|
|
|
ErrFutureReplacePending = errors.New("future transaction tries to replace pending")
|
2024-02-27 05:27:50 -06:00
|
|
|
|
|
|
|
// ErrAlreadyReserved is returned if the sender address has a pending transaction
|
|
|
|
// in a different subpool. For example, this error is returned in response to any
|
|
|
|
// input transaction of non-blob type when a blob transaction from this sender
|
|
|
|
// remains pending (and vice-versa).
|
|
|
|
ErrAlreadyReserved = errors.New("address already reserved")
|
core/txpool/legacypool: add support for SetCode transactions (#31073)
The new SetCode transaction type introduces some additional complexity
when handling the transaction pool.
This complexity stems from two new account behaviors:
1. The balance and nonce of an account can change during regular
transaction execution *when they have a deployed delegation*.
2. The nonce and code of an account can change without any EVM execution
at all. This is the "set code" mechanism introduced by EIP-7702.
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.
Since authorizations are not bound to a specific transaction, we
cannot drop 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.
---------
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-02-11 07:15:04 -06:00
|
|
|
|
|
|
|
// ErrAuthorityReserved is returned if a transaction has an authorization
|
|
|
|
// signed by an address which already has in-flight transactions known to the
|
|
|
|
// pool.
|
|
|
|
ErrAuthorityReserved = errors.New("authority already reserved")
|
|
|
|
|
|
|
|
// ErrAuthorityNonce is returned if a transaction has an authorization with
|
|
|
|
// a nonce that is not currently valid for the authority.
|
|
|
|
ErrAuthorityNonceTooLow = errors.New("authority nonce too low")
|
2023-06-16 07:29:40 -05:00
|
|
|
)
|