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
17package core
18
19import (
20	"errors"
21
22	"github.com/ethereum/go-ethereum/core/types"
23)
24
25var (
26	// ErrKnownBlock is returned when a block to import is already known locally.
27	ErrKnownBlock = errors.New("block already known")
28
29	// ErrBannedHash is returned if a block to import is on the banned list.
30	ErrBannedHash = errors.New("banned hash")
31
32	// ErrNoGenesis is returned when there is no Genesis Block.
33	ErrNoGenesis = errors.New("genesis not found in chain")
34
35	errSideChainReceipts = errors.New("side blocks can't be accepted as ancient chain data")
36)
37
38// List of evm-call-message pre-checking errors. All state transition messages will
39// be pre-checked before execution. If any invalidation detected, the corresponding
40// error should be returned which is defined here.
41//
42// - If the pre-checking happens in the miner, then the transaction won't be packed.
43// - If the pre-checking happens in the block processing procedure, then a "BAD BLOCk"
44// error should be emitted.
45var (
46	// ErrNonceTooLow is returned if the nonce of a transaction is lower than the
47	// one present in the local chain.
48	ErrNonceTooLow = errors.New("nonce too low")
49
50	// ErrNonceTooHigh is returned if the nonce of a transaction is higher than the
51	// next one expected based on the local chain.
52	ErrNonceTooHigh = errors.New("nonce too high")
53
54	// ErrNonceMax is returned if the nonce of a transaction sender account has
55	// maximum allowed value and would become invalid if incremented.
56	ErrNonceMax = errors.New("nonce has max value")
57
58	// ErrGasLimitReached is returned by the gas pool if the amount of gas required
59	// by a transaction is higher than what's left in the block.
60	ErrGasLimitReached = errors.New("gas limit reached")
61
62	// ErrInsufficientFundsForTransfer is returned if the transaction sender doesn't
63	// have enough funds for transfer(topmost call only).
64	ErrInsufficientFundsForTransfer = errors.New("insufficient funds for transfer")
65
66	// ErrInsufficientFunds is returned if the total cost of executing a transaction
67	// is higher than the balance of the user's account.
68	ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")
69
70	// ErrGasUintOverflow is returned when calculating gas usage.
71	ErrGasUintOverflow = errors.New("gas uint64 overflow")
72
73	// ErrIntrinsicGas is returned if the transaction is specified to use less gas
74	// than required to start the invocation.
75	ErrIntrinsicGas = errors.New("intrinsic gas too low")
76
77	// ErrTxTypeNotSupported is returned if a transaction is not supported in the
78	// current network configuration.
79	ErrTxTypeNotSupported = types.ErrTxTypeNotSupported
80
81	// ErrTipAboveFeeCap is a sanity error to ensure no one is able to specify a
82	// transaction with a tip higher than the total fee cap.
83	ErrTipAboveFeeCap = errors.New("max priority fee per gas higher than max fee per gas")
84
85	// ErrTipVeryHigh is a sanity error to avoid extremely big numbers specified
86	// in the tip field.
87	ErrTipVeryHigh = errors.New("max priority fee per gas higher than 2^256-1")
88
89	// ErrFeeCapVeryHigh is a sanity error to avoid extremely big numbers specified
90	// in the fee cap field.
91	ErrFeeCapVeryHigh = errors.New("max fee per gas higher than 2^256-1")
92
93	// ErrFeeCapTooLow is returned if the transaction fee cap is less than the
94	// the base fee of the block.
95	ErrFeeCapTooLow = errors.New("max fee per gas less than block base fee")
96
97	// ErrSenderNoEOA is returned if the sender of a transaction is a contract.
98	ErrSenderNoEOA = errors.New("sender not an eoa")
99)
100