github.com/ethereum/go-ethereum@v1.16.1/core/error.go (about)

     1  // Copyright 2014 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package core
    18  
    19  import (
    20  	"errors"
    21  
    22  	"github.com/ethereum/go-ethereum/core/types"
    23  )
    24  
    25  var (
    26  	// ErrKnownBlock is returned when a block to import is already known locally.
    27  	ErrKnownBlock = errors.New("block already known")
    28  
    29  	// ErrNoGenesis is returned when there is no Genesis Block.
    30  	ErrNoGenesis = errors.New("genesis not found in chain")
    31  )
    32  
    33  // List of evm-call-message pre-checking errors. All state transition messages will
    34  // be pre-checked before execution. If any invalidation detected, the corresponding
    35  // error should be returned which is defined here.
    36  //
    37  // - If the pre-checking happens in the miner, then the transaction won't be packed.
    38  // - If the pre-checking happens in the block processing procedure, then a "BAD BLOCk"
    39  // error should be emitted.
    40  var (
    41  	// ErrNonceTooLow is returned if the nonce of a transaction is lower than the
    42  	// one present in the local chain.
    43  	ErrNonceTooLow = errors.New("nonce too low")
    44  
    45  	// ErrNonceTooHigh is returned if the nonce of a transaction is higher than the
    46  	// next one expected based on the local chain.
    47  	ErrNonceTooHigh = errors.New("nonce too high")
    48  
    49  	// ErrNonceMax is returned if the nonce of a transaction sender account has
    50  	// maximum allowed value and would become invalid if incremented.
    51  	ErrNonceMax = errors.New("nonce has max value")
    52  
    53  	// ErrGasLimitReached is returned by the gas pool if the amount of gas required
    54  	// by a transaction is higher than what's left in the block.
    55  	ErrGasLimitReached = errors.New("gas limit reached")
    56  
    57  	// ErrInsufficientFundsForTransfer is returned if the transaction sender doesn't
    58  	// have enough funds for transfer(topmost call only).
    59  	ErrInsufficientFundsForTransfer = errors.New("insufficient funds for transfer")
    60  
    61  	// ErrMaxInitCodeSizeExceeded is returned if creation transaction provides the init code bigger
    62  	// than init code size limit.
    63  	ErrMaxInitCodeSizeExceeded = errors.New("max initcode size exceeded")
    64  
    65  	// ErrInsufficientBalanceWitness is returned if the transaction sender has enough
    66  	// funds to cover the transfer, but not enough to pay for witness access/modification
    67  	// costs for the transaction
    68  	ErrInsufficientBalanceWitness = errors.New("insufficient funds to cover witness access costs for transaction")
    69  
    70  	// ErrInsufficientFunds is returned if the total cost of executing a transaction
    71  	// is higher than the balance of the user's account.
    72  	ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")
    73  
    74  	// ErrGasUintOverflow is returned when calculating gas usage.
    75  	ErrGasUintOverflow = errors.New("gas uint64 overflow")
    76  
    77  	// ErrIntrinsicGas is returned if the transaction is specified to use less gas
    78  	// than required to start the invocation.
    79  	ErrIntrinsicGas = errors.New("intrinsic gas too low")
    80  
    81  	// ErrFloorDataGas is returned if the transaction is specified to use less gas
    82  	// than required for the data floor cost.
    83  	ErrFloorDataGas = errors.New("insufficient gas for floor data gas cost")
    84  
    85  	// ErrTxTypeNotSupported is returned if a transaction is not supported in the
    86  	// current network configuration.
    87  	ErrTxTypeNotSupported = types.ErrTxTypeNotSupported
    88  
    89  	// ErrTipAboveFeeCap is a sanity error to ensure no one is able to specify a
    90  	// transaction with a tip higher than the total fee cap.
    91  	ErrTipAboveFeeCap = errors.New("max priority fee per gas higher than max fee per gas")
    92  
    93  	// ErrTipVeryHigh is a sanity error to avoid extremely big numbers specified
    94  	// in the tip field.
    95  	ErrTipVeryHigh = errors.New("max priority fee per gas higher than 2^256-1")
    96  
    97  	// ErrFeeCapVeryHigh is a sanity error to avoid extremely big numbers specified
    98  	// in the fee cap field.
    99  	ErrFeeCapVeryHigh = errors.New("max fee per gas higher than 2^256-1")
   100  
   101  	// ErrFeeCapTooLow is returned if the transaction fee cap is less than the
   102  	// base fee of the block.
   103  	ErrFeeCapTooLow = errors.New("max fee per gas less than block base fee")
   104  
   105  	// ErrSenderNoEOA is returned if the sender of a transaction is a contract.
   106  	ErrSenderNoEOA = errors.New("sender not an eoa")
   107  
   108  	// -- EIP-4844 errors --
   109  
   110  	// ErrBlobFeeCapTooLow is returned if the transaction fee cap is less than the
   111  	// blob gas fee of the block.
   112  	ErrBlobFeeCapTooLow = errors.New("max fee per blob gas less than block blob gas fee")
   113  
   114  	// ErrMissingBlobHashes is returned if a blob transaction has no blob hashes.
   115  	ErrMissingBlobHashes = errors.New("blob transaction missing blob hashes")
   116  
   117  	// ErrBlobTxCreate is returned if a blob transaction has no explicit to field.
   118  	ErrBlobTxCreate = errors.New("blob transaction of type create")
   119  
   120  	// -- EIP-7702 errors --
   121  
   122  	// Message validation errors:
   123  	ErrEmptyAuthList   = errors.New("EIP-7702 transaction with empty auth list")
   124  	ErrSetCodeTxCreate = errors.New("EIP-7702 transaction cannot be used to create contract")
   125  )
   126  
   127  // EIP-7702 state transition errors.
   128  // Note these are just informational, and do not cause tx execution abort.
   129  var (
   130  	ErrAuthorizationWrongChainID       = errors.New("EIP-7702 authorization chain ID mismatch")
   131  	ErrAuthorizationNonceOverflow      = errors.New("EIP-7702 authorization nonce > 64 bit")
   132  	ErrAuthorizationInvalidSignature   = errors.New("EIP-7702 authorization has invalid signature")
   133  	ErrAuthorizationDestinationHasCode = errors.New("EIP-7702 authorization destination is a contract")
   134  	ErrAuthorizationNonceMismatch      = errors.New("EIP-7702 authorization nonce does not match current account nonce")
   135  )