github.com/Blockdaemon/celo-blockchain@v0.0.0-20200129231733-e667f6b08419/consensus/istanbul/core/errors.go (about) 1 // Copyright 2017 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 "errors" 20 21 var ( 22 // errInconsistentSubject is returned when received subject is different from 23 // current subject. 24 errInconsistentSubject = errors.New("inconsistent subjects") 25 // errNotFromProposer is returned when received message is supposed to be from 26 // proposer. 27 errNotFromProposer = errors.New("message does not come from proposer") 28 // errFutureMessage is returned when current view is earlier than the 29 // view of the received message. 30 errFutureMessage = errors.New("future message") 31 // errOldMessage is returned when the received message's view is earlier 32 // than current view. 33 errOldMessage = errors.New("old message") 34 // errInvalidMessage is returned when the message is malformed. 35 errInvalidMessage = errors.New("invalid message") 36 // errFailedDecodePreprepare is returned when the PREPREPARE message is malformed. 37 errFailedDecodePreprepare = errors.New("failed to decode PREPREPARE") 38 // errFailedDecodePrepare is returned when the PREPARE message is malformed. 39 errFailedDecodePrepare = errors.New("failed to decode PREPARE") 40 // errFailedDecodeCommit is returned when the COMMIT message is malformed. 41 errFailedDecodeCommit = errors.New("failed to decode COMMIT") 42 // errInvalidPreparedCertificateProposal is returned when the PREPARED certificate has an invalid proposal. 43 errInvalidPreparedCertificateProposal = errors.New("invalid proposal in PREPARED certificate") 44 // errInvalidPreparedCertificateNumMsgs is returned when the PREPARED certificate has an incorrect number of messages. 45 errInvalidPreparedCertificateNumMsgs = errors.New("invalid number of PREPARE messages in certificate") 46 // errInvalidPreparedCertificateMsgSignature is returned when the PREPARED certificate has a message with an invalid signature. 47 errInvalidPreparedCertificateMsgSignature = errors.New("invalid signature in PREPARED certificate") 48 // errInvalidPreparedCertificateDuplicate is returned when the PREPARED certificate has multiple messages from the same validator. 49 errInvalidPreparedCertificateDuplicate = errors.New("duplicate message in PREPARED certificate") 50 // errInvalidPreparedCertificateMsgCode is returned when the PREPARED certificate contains a non-PREPARE/COMMIT message. 51 errInvalidPreparedCertificateMsgCode = errors.New("non-PREPARE message in PREPARED certificate") 52 // errInvalidPreparedCertificateMsgView is returned when the PREPARED certificate contains a message for the wrong view 53 errInvalidPreparedCertificateMsgView = errors.New("message in PREPARED certificate for wrong view") 54 // errInvalidPreparedCertificateDigestMismatch is returned when the PREPARED certificate proposal doesn't match one of the messages. 55 errInvalidPreparedCertificateDigestMismatch = errors.New("message in PREPARED certificate for different digest than proposal") 56 // errInvalidRoundChangeViewMismatch is returned when the PREPARED certificate view is greater than the round change view 57 errInvalidRoundChangeViewMismatch = errors.New("View for PREPARED certificate is greater than the view in the round change message") 58 // errInvalidPreparedCertificateInconsistentViews is returned when the PREPARED certificate view is inconsistent among it's messages 59 errInvalidPreparedCertificateInconsistentViews = errors.New("View is inconsistent among the PREPARED certificate messages") 60 61 // errInvalidRoundChangeCertificateNumMsgs is returned when the ROUND CHANGE certificate has an incorrect number of ROUND CHANGE messages. 62 errInvalidRoundChangeCertificateNumMsgs = errors.New("invalid number of ROUND CHANGE messages in certificate") 63 // errInvalidRoundChangeCertificateMsgSignature is returned when the ROUND CHANGE certificate has a ROUND CHANGE message with an invalid signature. 64 errInvalidRoundChangeCertificateMsgSignature = errors.New("invalid signature in ROUND CHANGE certificate") 65 // errInvalidRoundChangeCertificateDuplicate is returned when the ROUND CHANGE certificate has multiple ROUND CHANGE messages from the same validator. 66 errInvalidRoundChangeCertificateDuplicate = errors.New("duplicate message in ROUND CHANGE certificate") 67 // errInvalidRoundChangeCertificateMsgCode is returned when the ROUND CHANGE certificate contains a message with the wrong code. 68 errInvalidRoundChangeCertificateMsgCode = errors.New("non-ROUND CHANGE message in ROUND CHANGE certificate") 69 // errInvalidRoundChangeCertificateMsgView is returned when the ROUND CHANGE certificate contains a message for the wrong view 70 errInvalidRoundChangeCertificateMsgView = errors.New("message in ROUND CHANGE certificate for wrong view") 71 72 // errInvalidCommittedSeal is returned when a COMMIT message has an invalid committed seal. 73 errInvalidCommittedSeal = errors.New("invalid committed seal in COMMIT message") 74 // errInvalidEpochValidatorSetSeal is returned when a COMMIT message has an invalid epoch validator seal. 75 errInvalidEpochValidatorSetSeal = errors.New("invalid epoch validator set seal in COMMIT message") 76 // errNotLastBlockInEpoch is returned when the block number was not the last block in the epoch 77 errNotLastBlockInEpoch = errors.New("not last block in epoch") 78 // errMissingRoundChangeCertificate is returned when ROUND CHANGE certificate is missing from a PREPREPARE for round > 0. 79 errMissingRoundChangeCertificate = errors.New("missing ROUND CHANGE certificate in PREPREPARE") 80 // errFailedCreateRoundChangeCertificate is returned when there aren't enough ROUND CHANGE messages to create a ROUND CHANGE certificate. 81 errFailedCreateRoundChangeCertificate = errors.New("failed to create ROUND CHANGE certficate") 82 // errInvalidProposal is returned when a PREPARED certificate exists for proposal A in the ROUND CHANGE certificate for a PREPREPARE with proposal B. 83 errInvalidProposal = errors.New("invalid proposal in PREPREPARE") 84 // errInvalidValidatorAddress is returned when the COMMIT message address doesn't 85 // correspond to a validator in the current set. 86 errInvalidValidatorAddress = errors.New("failed to find an existing validator by address") 87 )