github.com/vipernet-xyz/tm@v0.34.24/state/errors.go (about)

     1  package state
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  type (
     9  	ErrInvalidBlock error
    10  	ErrProxyAppConn error
    11  
    12  	ErrUnknownBlock struct {
    13  		Height int64
    14  	}
    15  
    16  	ErrBlockHashMismatch struct {
    17  		CoreHash []byte
    18  		AppHash  []byte
    19  		Height   int64
    20  	}
    21  
    22  	ErrAppBlockHeightTooHigh struct {
    23  		CoreHeight int64
    24  		AppHeight  int64
    25  	}
    26  
    27  	ErrAppBlockHeightTooLow struct {
    28  		AppHeight int64
    29  		StoreBase int64
    30  	}
    31  
    32  	ErrLastStateMismatch struct {
    33  		Height int64
    34  		Core   []byte
    35  		App    []byte
    36  	}
    37  
    38  	ErrStateMismatch struct {
    39  		Got      *State
    40  		Expected *State
    41  	}
    42  
    43  	ErrNoValSetForHeight struct {
    44  		Height int64
    45  	}
    46  
    47  	ErrNoConsensusParamsForHeight struct {
    48  		Height int64
    49  	}
    50  
    51  	ErrNoABCIResponsesForHeight struct {
    52  		Height int64
    53  	}
    54  )
    55  
    56  func (e ErrUnknownBlock) Error() string {
    57  	return fmt.Sprintf("could not find block #%d", e.Height)
    58  }
    59  
    60  func (e ErrBlockHashMismatch) Error() string {
    61  	return fmt.Sprintf(
    62  		"app block hash (%X) does not match core block hash (%X) for height %d",
    63  		e.AppHash,
    64  		e.CoreHash,
    65  		e.Height,
    66  	)
    67  }
    68  
    69  func (e ErrAppBlockHeightTooHigh) Error() string {
    70  	return fmt.Sprintf("app block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
    71  }
    72  
    73  func (e ErrAppBlockHeightTooLow) Error() string {
    74  	return fmt.Sprintf("app block height (%d) is too far below block store base (%d)", e.AppHeight, e.StoreBase)
    75  }
    76  
    77  func (e ErrLastStateMismatch) Error() string {
    78  	return fmt.Sprintf(
    79  		"latest tendermint block (%d) LastAppHash (%X) does not match app's AppHash (%X)",
    80  		e.Height,
    81  		e.Core,
    82  		e.App,
    83  	)
    84  }
    85  
    86  func (e ErrStateMismatch) Error() string {
    87  	return fmt.Sprintf(
    88  		"state after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n",
    89  		e.Got,
    90  		e.Expected,
    91  	)
    92  }
    93  
    94  func (e ErrNoValSetForHeight) Error() string {
    95  	return fmt.Sprintf("could not find validator set for height #%d", e.Height)
    96  }
    97  
    98  func (e ErrNoConsensusParamsForHeight) Error() string {
    99  	return fmt.Sprintf("could not find consensus params for height #%d", e.Height)
   100  }
   101  
   102  func (e ErrNoABCIResponsesForHeight) Error() string {
   103  	return fmt.Sprintf("could not find results for height #%d", e.Height)
   104  }
   105  
   106  var ErrABCIResponsesNotPersisted = errors.New("node is not persisting abci responses")