github.com/klaytn/klaytn@v1.12.1/blockchain/error.go (about) 1 // Modifications Copyright 2018 The klaytn Authors 2 // Copyright 2014 The go-ethereum Authors 3 // This file is part of the go-ethereum library. 4 // 5 // The go-ethereum library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // The go-ethereum library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public License 16 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // This file is derived from core/error.go (2018/06/04). 19 // Modified and improved for the klaytn development. 20 21 package blockchain 22 23 import ( 24 "errors" 25 26 "github.com/klaytn/klaytn/blockchain/types" 27 ) 28 29 var ( 30 // ErrKnownBlock is returned when a block to import is already known locally. 31 ErrKnownBlock = errors.New("block already known") 32 33 // ErrGasLimitReached is returned by the gas pool if the amount of gas required 34 // by a transaction is higher than what's left in the block. 35 ErrGasLimitReached = errors.New("gas limit reached") 36 37 // ErrBlacklistedHash is returned if a block to import is on the blacklist. 38 ErrBlacklistedHash = errors.New("blacklisted hash") 39 40 // ErrNonceTooHigh is returned if the nonce of a transaction is higher than the 41 // next one expected based on the local chain. 42 ErrNonceTooHigh = errors.New("nonce too high") 43 44 // tx_pool 45 46 // ErrInvalidSender is returned if the transaction contains an invalid signature. 47 ErrInvalidSender = errors.New("invalid sender") 48 49 // ErrInvalidFeePayer is returned if the transaction contains an invalid signature of the fee payer. 50 ErrInvalidFeePayer = errors.New("invalid fee payer") 51 52 // ErrNonceTooLow is returned if the nonce of a transaction is lower than the 53 // one present in the local chain. 54 ErrNonceTooLow = errors.New("nonce too low") 55 56 // ErrUnderpriced is returned if a transaction's gas price is below the minimum 57 // configured for the transaction pool. 58 ErrUnderpriced = errors.New("transaction underpriced") 59 60 // ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced 61 // with a different one without the required price bump. 62 ErrReplaceUnderpriced = errors.New("replacement transaction underpriced") 63 64 // ErrAlreadyNonceExistInPool is returned if there is another tx with the same nonce in the tx pool. 65 ErrAlreadyNonceExistInPool = errors.New("there is another tx which has the same nonce in the tx pool") 66 67 // ErrMaxInitCodeSizeExceeded is returned if creation transaction provides the init code bigger 68 // than init code size limit. 69 ErrMaxInitCodeSizeExceeded = errors.New("max initcode size exceeded") 70 71 // ErrInsufficientFunds is returned if the total cost of executing a transaction 72 // is higher than the balance of the user's account. 73 ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") 74 75 // ErrInsufficientFundsFrom is returned if the value of a transaction is higher than 76 // the balance of the user's account. 77 ErrInsufficientFundsFrom = errors.New("insufficient funds of the sender for value ") 78 79 // ErrInsufficientFundsFeePayer is returned if the fee of a transaction is higher than 80 // the balance of the fee payer's account. 81 ErrInsufficientFundsFeePayer = errors.New("insufficient funds of the fee payer for gas * price") 82 83 // ErrIntrinsicGas is returned if the transaction is specified to use less gas 84 // than required to start the invocation. 85 ErrIntrinsicGas = errors.New("intrinsic gas too low") 86 87 // ErrGasLimit is returned if a transaction's requested gas limit exceeds the 88 // maximum allowance of the current block. 89 ErrGasLimit = errors.New("exceeds block gas limit") 90 91 // ErrNegativeValue is a sanity error to ensure noone is able to specify a 92 // transaction with a negative value. 93 ErrNegativeValue = errors.New("negative value") 94 95 // ErrOversizedData is returned if the input data of a transaction is greater 96 // than some meaningful limit a user might use. This is not a consensus error 97 // making the transaction invalid, rather a DOS protection. 98 ErrOversizedData = errors.New("oversized data") 99 100 // ErrInvlidUnitPrice is returned if gas price of transaction is not equal to UnitPrice 101 ErrInvalidUnitPrice = errors.New("invalid unit price") 102 103 // ErrInvalidChainId is returned if the chain id of transaction is not equal to the chain id of the chain config. 104 ErrInvalidChainId = errors.New("invalid chain id") 105 106 // ErrNotYetImplementedAPI is returned if API is not yet implemented 107 ErrNotYetImplementedAPI = errors.New("not yet implemented API") 108 109 // Errors returned from GetVMerrFromReceiptStatus 110 111 // ErrInvalidReceiptStatus is returned if status of receipt is invalid from GetVMerrFromReceiptStatus 112 ErrInvalidReceiptStatus = errors.New("unknown receipt status") 113 114 // ErrTxTypeNotSupported is returned if a transaction is not supported in the 115 // current network configuration. 116 ErrTxTypeNotSupported = types.ErrTxTypeNotSupported 117 118 // ErrVMDefault is returned if status of receipt is ReceiptStatusErrDefault from GetVMerrFromReceiptStatus 119 ErrVMDefault = errors.New("VM error occurs while running smart contract") 120 121 // ErrAccountCreationPrevented is returned if account creation is inserted in the service chain's txpool. 122 ErrAccountCreationPrevented = errors.New("account creation is prevented for the service chain") 123 124 // ErrInvalidTracer is returned if the tracer type is not vm.InternalTxTracer 125 ErrInvalidTracer = errors.New("tracer type is invalid for internal transaction tracing") 126 127 // ErrTipVeryHigh is a sanity error to avoid extremely big numbers specified in the tip field. 128 ErrTipVeryHigh = errors.New("max priority fee per gas higher than 2^256-1") 129 130 // ErrFeeCapVeryHigh is a sanity error to avoid extremely big numbers specified in the fee cap field. 131 ErrFeeCapVeryHigh = errors.New("max fee per gas higher than 2^256-1") 132 133 // ErrTipAboveFeeCap is a sanity error to ensure no one is able to specify a 134 // transaction with a tip higher than the total fee cap. 135 ErrTipAboveFeeCap = errors.New("max fee per gas higher than max priority fee per gas") 136 137 // ErrInvalidGasFeeCap is returned if gas fee cap of transaction is not equal to UnitPrice 138 ErrInvalidGasFeeCap = errors.New("invalid gas fee cap. It must be set to the same value as gas unit price") 139 140 // ErrInvalidGasTipCap is returned if gas tip cap of transaction is not equal to UnitPrice 141 ErrInvalidGasTipCap = errors.New("invalid gas tip cap. It must be set to the same value as gas unit price") 142 143 // ErrFeeCapBelowBaseFee is returned if gas fee cap of transaction is lower than gas unit price. 144 ErrFeeCapBelowBaseFee = errors.New("invalid gas fee cap. It must be set to value greater than or equal to baseFee") 145 146 // ErrGasPriceBelowBaseFee is returned if gas price of transaction is lower than gas unit price. 147 ErrGasPriceBelowBaseFee = errors.New("invalid gas price. It must be set to value greater than or equal to baseFee") 148 )