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